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 url_params params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses) 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 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.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.5992201
53
+li+ tag with the 'active' class added if the url is the current one with a link inside it pointing to that url.
def activable_li_tag_with_link(title, *url) activable_li_tag *url do link_to(title, url.first) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nav_active(url)\n active_nav_class = \"current\"\n\n if (url.instance_of? String)\n current_resource.url == url_for(url) ? {class: active_nav_class} : {}\n elsif (url.instance_of? Array)\n url.map { |url| url_for(url) }.include?(current_resource.url) ? {class: active_nav_class} : {}\n else\n {}\n end\n end", "def css_class\n (page.link_to.split('/')[1] == @href.split('/')[1] || page.link_to?(@href)) && \"active\"\n end", "def link_class(url)\n return 'nav-item' unless current_page?(url)\n\n 'nav-item current'\n end", "def active_class(link_path)\n current_page?(link_path) ? 'active' : ''\n end", "def active_class(link_path)\n current_page?(link_path) ? \"active\" : \"\"\n end", "def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end", "def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end", "def link_to_if_current(text, page, active_class: \"active\")\n if page == current_page\n link_to text, page.request_path, class: active_class\n else\n link_to text, page.request_path\n end\n end", "def active_link_to(*args, &block)\n if block_given?\n active_link_to(capture(&block), args.first || {}, args.second)\n else\n active = false\n html_options = args.third || {}\n active_paths = html_options.delete(:active_paths)\n active_controllers = html_options.delete(:active_controllers)\n if active_paths.nil? && active_controllers.nil?\n active = true if request.fullpath == args.second\n else\n active_paths.to_a.each do |url_object|\n next if url_object.nil?\n next if url_object.respond_to?(:second) && !url_object.try(:second).try(:persisted?)\n active = request.path == url_for(url_object)\n break if active\n end\n active_controllers.to_a.each do |controller|\n active = params[:controller] == controller.to_s\n break if active\n end\n end\n content_tag :li, active ? { class: 'active' } : nil do\n link_to(*args)\n end\n end\n end", "def is_active?(link_path)\n current_page?(link_path) ? \"active\" : \"\"\n end", "def active_link_to_class(url, options = {})\n if is_active_link?(url, options[:active])\n options[:class_active] || 'active'\n else\n options[:class_inactive] || ''\n end\n end", "def active_class(url, options = {})\n if is_active_link?(url, options)\n options[:active_class] || 'active'\n else\n options[:inactive_class] || ''\n end\n end", "def active_link(text,link)\n content_tag(:li) do\n link_to text, link, :class => 'active', remote: true\n end\n end", "def link_with_active(text, url)\n if url == \"/\" then\n if request.fullpath == \"/\" then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n else\n if request.fullpath.include? url then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n end\n end", "def is_active?(link_path)\n if current_page?(link_path)\n 'active'\n else\n ''\n end\n end", "def is_active?(link_path)\n link_path.include?(request.path) ? \"active\" : \"\"\n end", "def is_active?(link_path)\n link_path.include?(request.path) ? \"active\" : \"\"\n end", "def is_active?(link_path)\n\t if current_page?(link_path)\n\t \"active\"\n\t else\n\t \"\"\n\t end\n end", "def link_actived?(link_path)\n \"active\" if current_page?(link_path)\n end", "def bsh_navbar_item(display, url, active: true)\n is_active = active && request.path == url\n\n raw <<-HTML.chomp!\n <li class='#{is_active ? 'active' : ''}'><a href='#{url}'>#{display}</a></li>\n HTML\n end", "def admin_nav_link(controller, url = false, selected_url = false)\n controller_name = controller.gsub(/ /, \"_\").downcase.pluralize\n url = \"/admin/#{controller_name}\" unless url\n\n css = nil\n if selected_url && request.env['REQUEST_URI'] =~ /#{selected_url}/\n css = \"active\"\n elsif request.env['REQUEST_URI'] =~ /#{url}/\n css = \"active\"\n end\n content_tag(:li, link_to(controller, url), class: css, id: \"admin-nav-#{controller_name.dasherize}\")\n end", "def nav_active(path)\n (current_page.path.start_with? path) ? \"active\" : \"\"\n end", "def active? path\n \"active\" if current_page? path\n end", "def active? path\n \"active\" if current_page? path\n end", "def nav_link_to(link, url, opts={})\n if current_resource.url == url_for(url)\n opts[:class] << \" active\"\n end\n link_to(link, url, opts)\n end", "def active_navigation(link_path)\n\t current_page?(link_path) ? 'active' : ''\n\tend", "def active? path \n \"active\" if current_page? path\n end", "def active_navbar_class(page_path)\n current_page?(page_path) ? \"active\" : \"\"\n end", "def active_link_class(item)\n active_class = 'active_menu_link'\n found = false\n case item.class.to_s\n when 'Project'\n found = true if (@project && @project == item) && (@stage.blank?)\n when 'Host'\n found = true if @host && @host == item\n when 'Recipe'\n found = true if @recipe && @recipe == item\n when 'User'\n found = true if @user && @user == item\n when 'Stage'\n found = true if @stage && @stage == item\n end\n \n if found\n active_class\n else\n ''\n end\n end", "def active_class(link_path)\n if request_path_active?(link_path)\n \"active\"\n else\n \"\"\n end\n rescue ActionController::UrlGenerationError\n \"\"\n end", "def active_in_page(path)\n \"active\" if current_page?(path)\n end", "def item title, link\n unless current_page? link\n content_tag :li, link_to(title, link)\n else\n content_tag(:li, :class => :active){\n content_tag :strong, title\n }\n end\n end", "def active_path?(href, current_path = \"\")\n href == get_path(current_path)\n end", "def nav_link(text, link)\n recognized = Rails.application.routes.recognize_path(link)\n if recognized[:controller] == params[:controller] && recognized[:action] == params[:action]\n content_tag(:li, :class => \"active\") { link_to( text, link ) }\n else\n content_tag(:li) { link_to( text, link ) }\n end\n end", "def list_item_with_link_if_not_active (text, link, active)\n html = \"<li>\"\n if active\n html += \"<a href='#{link}'>#{text}</a>\"\n else\n html += \"<span>#{text}</span>\"\n end\n html += \"</li>\"\nend", "def navigation_item(content = false, &block)\n cls = 'navigation-item'\n cls << ' active' if content\n\n tag('li', content, class: cls, &block)\n end", "def nav_link(text, route)\n content_tag(:li, class: current_page?(route) ? \"active\" : \"\") do\n link_to text, route\n end\n end", "def nav_link_to(text, url, options = {})\n is_active = url_for(url.split(\"#\")[0], relative: false) ==\n url_for(current_page.url, relative: false)\n options[:class] ||= \"\"\n options[:class] << \" active\" if is_active\n link_to(text, url, options)\n end", "def site_page_navigation_item(text, path, link_html_opts={}, li_html_opts={})\n li_class = current_page?(path) ? \"active\" : \"\"\n content_tag :li, li_html_opts.merge(:class=>li_class) do\n link_to text.html_safe, path, link_html_opts\n end\n end", "def menu_link_to(text, url, options={}, current=nil)\n content_tag :li, link_to(text, url, options), :class => (current.nil? ? part_of_current_url?(url) : current) ? 'current' : nil\n end", "def active_tab_class(*paths)\n active = false\n # originally used current_page? but it did not work when update button was called.\n paths.each { |path| active ||= path == request.path }\n active ? 'active' : ''\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def nav_link_class(controller_name)\n controller?(controller_name) ? 'active' : 'passive'\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def active_tab?\n url.path.split('/')[1] == attrs.href.split('/')[1]\n end", "def is_active?(current_page)\n return \"is-active\" if params[:controller] == current_page.to_s\n end", "def activepage?(path)\n \t\t\"active\" if current_page?(path)\n \tend", "def active_tab?\n url.path.split('/')[2] == attrs.href.split('/')[2]\n end", "def active?(controller_name)\n if params[:controller] == controller_name\n ' class=\"active\" '\n end\n end", "def is_active_nav_link?(url, condition = nil)\n @is_active_link ||= {}\n @is_active_link[[url, condition]] ||= begin\n original_url = url\n url = Addressable::URI::parse(url).path\n path = request.original_fullpath\n case condition\n when :inclusive, nil\n !path.match(/^#{Regexp.escape(url).chomp('/')}(\\/.*|\\?.*)?$/).blank?\n when :exclusive\n !path.match(/^#{Regexp.escape(url)}\\/?(\\?.*)?$/).blank?\n when :exact\n path == original_url\n when Proc\n condition.call(original_url)\n when Regexp\n !path.match(condition).blank?\n when Array\n controllers = Array.wrap(condition[0])\n actions = Array.wrap(condition[1])\n (controllers.blank? || controllers.member?(params[:controller])) &&\n (actions.blank? || actions.member?(params[:action])) ||\n controllers.any? do |controller, action|\n params[:controller] == controller.to_s && params[:action] == action.to_s\n end\n when TrueClass\n true\n when FalseClass\n false\n when Hash\n condition.all? do |key, value|\n params[key].to_s == value.to_s\n end\n end\n end\n end", "def is_page_active(page)\n current_page.url == page\n end", "def active_url?(request)\n\t\t\t\t\treturn false if !request || !self.url\n\t\t\t\t\tcurrent_locale, current_path = RicWebsite::Helpers::LocaleHelper.disassemble(request.fullpath)\n\t\t\t\t\tif self.url == \"/\"\n\t\t\t\t\t\treturn current_path == \"/\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn current_path.start_with?(self.url)\n\t\t\t\t\tend\n\t\t\t\tend", "def nav(name, url, pages = nil, active = false)\n content_tag :li, link_to(name, url), :class => (active || (pages && active_page?(pages)) ? 'act' : nil)\n end", "def tab(body, url_options, html_options = {})\n if current_page?(url_options)\n html_options[:class] ||= ''\n html_options[:class] << ' active'\n end\n link_to body, url_options, html_options\n end", "def link_to_nav(name, url)\n path = request.path\n current = false\n\n # path - url\n # docs/index.html - /docs/index.html\n # docs/index.html - /docs\n # docs/quickstart/dashboard - /docs\n\n # Strip leading / from the url\n testUrl = url[1..-1]\n\n\n if testUrl == path\n # Exact match\n current = true\n elsif path.start_with? testUrl\n # starts with match\n current = true\n end\n\n if current\n link_to name, url, :class => \"active\"\n else\n link_to name, url\n end\n end", "def is_active?(current_page)\n return \"is-active is-primary\" if params[:controller] == current_page.to_s\n end", "def has_active_child?(content)\n content =~ /<li class=\".*\\b#{@config.highlighted_class}\\b.*\">/\n end", "def is_current_uri?(string)\n\t string == request.env['PATH_INFO'] ? \"'active'\" : \"'inactive'\"\n end", "def top_nav_item(link_text, link_opts, html_opts={})\n css_class = html_opts[:class] || \"\"\n css_class = (css_class.split(/\\s+/)+[\"active\"]).join(\" \") if current_page?(link_opts)\n html_opts[:class] = css_class\n content_tag :li, html_opts do\n link_to(link_text, link_opts)\n end\n end", "def nav_link(text, *paths)\n attrs = paths.any? { |p| current_page?(p) } ? { :class => \"active\" } : {}\n content_tag(:li, attrs) { link_to text, paths.first }\n end", "def active_tag(name, url, content = nil, options = nil, &block)\n if block_given?\n options = content if content.is_a?(Hash)\n content = capture_html(&block)\n end\n\n if is_active_page?(url)\n options ||= {}\n active_class = 'active'\n\n if options[:class].nil?\n options[:class] = active_class\n else\n options[:class] += \" #{active_class}\"\n end\n end\n\n content_tag(name, content, options, &block)\n end", "def nav_link(*args)\n class_names = \"button\"\n class_names = \"#{class_names} #{args[2][:class]}\" if args.length >= 3\n content_tag(:li, active_link_to(args[0] , args[1] , :title => args[0]), :class => class_names)\n end", "def aboutusActive?(page_title)\n 'class=\"active\"' if page_title == \"About Us\"\n end", "def draw_link(href, label, current_path = \"\")\n active = active_path?(href, current_path)\n\n l = \"<li\"\n l += active ? ' class=\"active\">' : \">\"\n l += %Q(<a href=\"#{href}\">#{label})\n l += active ? ' <span class=\"sr-only\">(current)</span>' : \"\"\n l += \"</a></li>\"\n end", "def is_active(*links)\n links.each { |link| return 'active' if params[:active_tab] == link }\n end", "def nav_link(text, path)\n if current_page? path\n content_tag :li, class: 'active' do\n\n # <span class=\"sr-only\">(current)</span> required for Screen Readers\n link_to path do\n concat text\n concat content_tag :span, '(current)', class: 'sr-only'\n end\n end\n else\n content_tag :li do\n link_to text, path\n end\n end\n end", "def active_nav\n @active = \"user\"\n end", "def active_class(path)\n cc = request.path.split('/')\n if path == 'dashboard' && request.path.length <= 1\n 'active'\n else\n cc[1] =~ /#{path}/ ? 'active' : nil\n end\n end", "def active(basename)\n basename == Pathname.new(current_page.destination_path).basename.to_s.sub(/\\..*/, '') ? {'class' => 'ui-btn-active'} : {}\n end", "def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'current' : ''\n\n # Playlists and Tags routes should also trigger highlighting of the Watch Ignite Videos menu item\n current_uri = request.env['PATH_INFO']\n if ['/tags','/playlists'].include? current_uri and link_path == '/videos'\n class_name = 'current'\n end\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end", "def navigation_link_to(txt, url)\n\t\tpage_index = request[\"path\"].gsub(\"index.html\",\"\")\n\t\t\n\t\tif url == \"/#{page_index}\"\n\t\t\treturn link_to(txt, url, :class => \"active\")\n\t\tend\n\t\tlink_to(txt,url)\n\tend", "def current_page?(url); end", "def is_active?(path)\n \tpaths = []\n \tif not path.is_a?(Array)\n \t\tpaths << path\n \telse\n \t\tpaths = path\n \tend\n \tpaths.each { |p| return \"active\" if current_page?(p) }\n end", "def selected_by_condition?\n is_active_nav_link?(url, highlights_on)\n end", "def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'active' : ''\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end", "def breadcrumb_item(text, path)\n if path == request.env['PATH_INFO']\n content = text\n css_classes = 'breadcrumb-item active'\n else\n content = link_to text, path\n css_classes = 'breadcrumb-item'\n end\n content_tag(:li, content, class: css_classes)\n end", "def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end", "def is_active_link?(url, options = {})\n case options[:when]\n when :self, nil\n !request.fullpath.match(/^#{Regexp.escape(url)}(\\/.*|\\?.*)?$/).blank?\n when :self_only\n !request.fullpath.match(/^#{Regexp.escape(url)}\\/?(\\?.*)?$/).blank?\n when Regexp\n !request.fullpath.match(options[:when]).blank?\n when Array\n controllers = options[:when][0]\n actions = options[:when][1]\n (controllers.blank? || controllers.member?(params[:controller])) &&\n (actions.blank? || actions.member?(params[:action]))\n when TrueClass\n true\n when FalseClass\n false\n end\n end", "def active_link_to(name = nil, options = nil, html_options = nil, &block)\n # this is from Rails source - ignore rubocop\n # rubocop:disable Style/ParallelAssignment\n html_options, options, name = options, name, block if block_given?\n options ||= {}\n # rubocop:enable Style/ParallelAssignment\n\n html_options = convert_options_to_data_attributes(options, html_options)\n\n url = url_for(options)\n html_options[\"href\".freeze] ||= url\n\n # Begin custom\n active_children = html_options.delete('active_children')\n active_children = true if active_children.nil?\n current_url = request.env['PATH_INFO']\n if current_page?(url) || (active_children && current_url.include?(url))\n active_class = html_options.delete('active_class') || 'active'\n existing_class = html_options['class'] || ''\n html_options['class'] = existing_class + ' ' + active_class\n end\n # End custom\n\n content_tag(\"a\".freeze, name || url, html_options, &block)\n end", "def active?(route)\n match_href? && attributes[:href] == route ||\n active_expressions.any? do |exp|\n if exp.is_a?(Regexp)\n route =~ exp\n else\n route == exp\n end\n end\n end", "def url_active?\n begin\n response = Net::HTTP.get_response URI.parse(self.url)\n active_status = %w(200 301 302)\n active_status.include? response.code\n rescue\n false\n end \n end", "def is_active?(slug)\n slug.gsub!(/\\//, '')\n \"active\" if params[:page] == slug || params[:category] == slug\n end", "def current_class?(test_path)\n if request.path == test_path\n return \"nav-button-active\"\n else \n return \"nav-button\"\n end\n end", "def admin_active_class(key)\n request.original_url.include?('/' + key) ? 'active' : ''\n end", "def currentMenuItem(expected, controller, action) \t\t\n \t\treturn \"class=active\" if expected == (controller + \"#\" + action)\n\tend", "def active_class(rendered_page, current_page)\n if rendered_page[:shortname] == current_page[:shortname]\n return 'active'\n elsif (current_page.page_type == \"country\" && !current_page.parent.nil? && rendered_page[:shortname] == current_page.parent[:shortname])\n return 'active'\n end\n return '' \n end", "def navigation_menu(i18n_path, controller_paths, link_to_path, options={})\n code = '<li class=\"'\n code += 'active ' if is_menu_active? controller_paths\n code += 'first ' if options[:first]\n code += \"\\\">\\n\"\n code += link_to(I18n::t(i18n_path), link_to_path) + \"\\n\"\n code += \"</li>\\n\"\n\n code\n end", "def current? link\n request.env['PATH_INFO'] == link\n end", "def is_active_link?(condition = nil)\n case condition\n when Regexp\n !request.fullpath.match(condition).blank?\n when Array\n controllers = [*condition[0]]\n actions = [*condition[1]]\n (controllers.blank? || controllers.member?(controller_name)) &&\n (actions.blank? || actions.member?(action_name))\n when TrueClass\n true\n when FalseClass, nil\n false\n end\n end", "def highlight_if_clicked(url)\n current_page?(url) ? \"hilite\" : \"\"\n end", "def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end" ]
[ "0.74003303", "0.73618233", "0.7360548", "0.7267344", "0.72488534", "0.7169484", "0.7169484", "0.7159959", "0.70005214", "0.69910365", "0.6962675", "0.691394", "0.69114465", "0.6879398", "0.68735826", "0.68157303", "0.68157303", "0.6813813", "0.6810136", "0.67405295", "0.67095196", "0.6706306", "0.66884124", "0.66884124", "0.66656184", "0.6663903", "0.6628549", "0.65974593", "0.6581338", "0.65599114", "0.6514904", "0.6513987", "0.6498812", "0.6472545", "0.64315534", "0.6428089", "0.63989246", "0.6381405", "0.6378862", "0.63439673", "0.6309126", "0.63038135", "0.63038135", "0.63038135", "0.63038135", "0.63038135", "0.63038135", "0.63038135", "0.63038135", "0.63038135", "0.6291803", "0.6287305", "0.6287305", "0.6287305", "0.6287305", "0.62792146", "0.62735844", "0.6259529", "0.622207", "0.61996245", "0.6199602", "0.6160128", "0.6156029", "0.6152486", "0.6144061", "0.61229205", "0.6120541", "0.612031", "0.6118466", "0.61170053", "0.6099041", "0.6097114", "0.6085584", "0.60847795", "0.60694546", "0.6067388", "0.60450625", "0.6036962", "0.6000041", "0.5994283", "0.5980302", "0.5976075", "0.5964855", "0.5953825", "0.5910171", "0.5909476", "0.59061277", "0.5905428", "0.58960557", "0.58920974", "0.5887434", "0.583911", "0.5839084", "0.5837793", "0.5817967", "0.58130383", "0.5811298", "0.5805539", "0.5805199", "0.5799048", "0.57965887" ]
0.0
-1
def list_tasks_task_action controller.list_tasks_task_action end def create_tasks_task_action controller.create_tasks_task_action end def edit_tasks_task_action controller.edit_tasks_task_action end def complete_tasks_task_action controller.complete_task_task_action end def run_task_menu(project_name) view.print_task_menu(project_name) task_menu = true while task_menu task_input = view.get_input if task_input == 'list' list_tasks_task_action elsif task_input == 'create' create_tasks_task_action elsif task_input == 'edit' edit_tasks_task_action elsif task_input == 'complete' complete_task_task_action elsif task_input == 'back' view.print_project_menu task_menu = false end end end
def real_puts message = "" $stdout.puts message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_task_management_menu\n loop do\n system \"clear\"\n self.view_tasks\n puts \"\"\n choice = PROMPT.select(\"What would you like to do for your goal?\".light_white) do |menu|\n menu.choice 'Create New Tasks'.light_white, '1'\n menu.choice 'Delete Task'.light_white, '2'\n menu.choice 'Mark Tasks Complete'.light_white, '3'\n menu.choice 'Back'.light_white, '4'\n end\n\n case choice\n when '1'\n create_tasks\n when '2'\n delete_task\n when '3'\n mark_task_complete\n when '4'\n break\n end\n end\n end", "def menu_edit_task(task)\n loop do\n system 'clear'\n puts \"--> Task Details <--\".colorize(:cyan)\n puts @headline\n puts @pipe + \"Description: \".colorize(:cyan) + \"#{task[\"description\"]}\"\n puts @pipe + \"Status: \".colorize(:cyan) + \"#{task[\"status\"] ? @emoji[:white_heavy_check_mark] : @emoji[:cross_mark]}\"\n puts \"-\" * 20\n\n menu = [\n {name: 'Edit task', value: \"EDIT\"},\n {name: 'Delete task', value: \"DELETE\"}\n ]\n menu = menu + @navigation\n input = @prompt.select(\"Menu: \", menu)\n\n # specific menu options added \n case input\n when \"EDIT\"\n task = task_edit(task)\n when \"DELETE\"\n task_delete(task)\n menu_edit_job(task[\"job_id\"])\n when \"BACK\"\n menu_edit_job(task[\"job_id\"])\n end\n go_to(input)\n end\n end", "def project_menu(project, options = {})\n redirect_uri = options[:redirect_uri] || root_path\n\n text = \"\"\n unless without_action?(options, :project_icon)\n text += content_tag :div, class: \"item grey-text text-lighten-2\" do\n project_icon\n end\n end\n\n # TOGGLE HIDDEN\n unless without_action?(options, :toggle_hidden)\n text += content_tag :a,\n href: admin_toggle_in_pause_path(id: project.id, url: redirect_uri),\n class: \"item\",\n data: { method: :post, confirm: t('words.sure?')} do\n if current_user.has_project_in_pause?(project.id)\n toggle_visible_icon(true)\n else\n toggle_visible_icon(false)\n end\n end\n end\n\n # EDIT PROJECT\n unless without_action?(options, :edit)\n text += content_tag :a,\n href: edit_admin_project_path(project),\n title: t('actions.edit'),\n class: \"item\" do\n edit_icon\n end\n end\n\n # PROJECT KANBAN\n unless without_action?(options, :kanban)\n text += content_tag :a,\n href: kanban_admin_project_path(project),\n title: t('actions.show_kanban'),\n class: \"item\" do\n kanban_icon\n end\n end\n\n # ADD TASK\n unless without_action?(options, :add_task)\n text += content_tag :a,\n title: t('actions.add_task'),\n class: \"item add_task modal-trigger\",\n data: {\n project_id: project.id,\n target: \"add_task_for_project_#{project.id}\"\n } do\n add_icon('task')\n end\n # MODAL TO CREATE NEW TASK\n text += content_tag :div,\n id: \"add_task_for_project_#{project.id}\",\n class: \"ui modal\" do\n #render partial: \"admin/tasks/form\", locals: { task: Task.new, project_id: project.id }#, url: kanban_admin_project_path(@project)}\n end\n end\n\n # SHOW TIME ENTRIES\n unless without_action?(options, :show_time_entries)\n text += content_tag :a,\n href: admin_project_path(project),\n title: t('actions.show_time_entries'),\n class: \"item\" do\n time_entries_icon\n end\n end\n # DELETE PROJECT\n unless without_action?(options, :delete_project)\n text += content_tag :a,\n href: admin_project_path(project),\n title: t('actions.delete'),\n method: :delete, data: { confirm: t('words.sure?') },\n class: \"item\" do\n delete_icon\n end\n end\n\n div_list = \"\"\n div_list += content_tag :div, class: \"ui horizontal list\" do\n text.html_safe\n end\n\n div_list.html_safe\n end", "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "def task_for_project_leaders\n return @_action_name == \"index\" || @_action_name == \"edit\" || @_action_name == \"new\" || @_action_name == \"create\"\n end", "def forum_actions \n h = { :r => :reload, \n :n => :new_forum, \n :b => :display_forum, \n 'C-b' => :change_subforum, \n :N => :new_articles , \n :k => :delete_current_forum,\n :RIGHT => :next_forum,\n :LEFT => :previous_forum,\n :l => :view_log,\n :C => :config_menu,\n 'C-c' => :quit_app}\n\n ch, menu_text = menu \"Forum Menu \", h\n menu_text = :quit if ch == \"q\"\n return unless menu_text\n case menu_text.to_sym\n when :quit\n when :reload\n fetch_data_from_net $subforum\n when :pages\n $num_pages += 1\n when :new_articles\n new_articles\n when :new_forum\n fetch_data_from_net\n when :change_subforum\n change_file\n when :quit_app\n quit_command\n when :view_log\n view_log\n when :open_command\n print \"Enter open command: \"\n str = Readline::readline('>', true)\n if str && str != \"\"\n $open_command = str\n end\n end\nend", "def task_case(task, todo)\n system \"clear\"\n case task\n when '-c'\n toggle_complete(todo, true)\n when '-u'\n toggle_complete(todo, false)\n when '-d'\n system \"clear\"\n puts \"Deleted Todo: #{todo.content}\"\n todo.delete\n edit_menu\n when '-e'\n system \"clear\"\n puts \"Please submit your changes: \"\n todo.content = check_for_exit(gets.chomp)\n todo.save\n\n system \"clear\"\n puts \"Updated todo to #{todo.content}\"\n edit_menu\n\n when '-da'\n system \"clear\"\n puts \"Deleted all todos\".red\n Todo.delete_all\n main_menu\n when '-m'\n system \"clear\"\n main_menu\n when 'q'\n system \"clear\"\n exit\n end\nend", "def actions; end", "def determine_action(input)\n case (input.to_i)\n when 1 then TimeMenu::WeektimeMenu.new.print_menu\n when 2 then TimeMenu::MonthtimeMenu.new.print_menu\n when 3 then TimeMenu::CustomtimeMenu.new.print_menu\n when 4 then return false\n else\n handle_wrong_option\n end\n return true\n end", "def add_task_submenu\n\t\tputs \"Enter task to add to list:\"\n\t\tchoice = get_choice\n\t\t@todo_list.add_item choice\n\t\tprint_menu\n\tend", "def editTask(taskArray)\n\n num = 9\n\n #Clear previous screen\n system \"clear\" or system \"cls\"\n\n #display error message and clear\n #screen on empty tasklist\n if taskArray.length() <= 0\n puts \"No tasks to retrieve...\"\n print \"\\nPress enter to continue... \"\n gets\n return\n end\n\n while (num.to_i > 5)\n\n displayTasks(taskArray)\n\n print \"Select a task to edit (id): \"\n choice = gets.chomp\n\n if !choice.to_i.kind_of?(Integer)\n return\n end\n\n #Clear previous screen\n system \"clear\" or system \"cls\"\n\n print \"Select one of the following:\\n\",\n \"-----------ACTIONS----------\\n\",\n \"1. Edit name\\n\",\n \"2. Edit description\\n\",\n \"3. Edit priority\\n\",\n \"4. Edit due date\\n\",\n \"------------Exit------------\\n\",\n \"5. Exit Program\\n\",\n \"----------------------------\\n\",\n \">> \"\n\n num = gets.chomp\n\n if !num.to_i.kind_of?(Integer)\n print \"choice was not of type integer...\\n\",\n \"Press enter to continue...\"\n gets\n return\n end\n\n #Clear previous screen\n system \"clear\" or system \"cls\"\n\n if num.to_i == 1\n\n print \"Enter the task name (10 characters max): \"\n taskName = gets.chomp\n while (taskName.length > 10)\n print \"Error: Task name cannot exceed 10 characters, re-enter: \"\n taskName = gets.chomp\n end\n\n taskArray[choice.to_i].setName(taskName)\n\n elsif num.to_i == 2\n\n print \"Enter the description: \"\n taskDesc = gets.chomp\n while (taskDesc.length > 40)\n print \"Error: Task name cannot exceed 40 characters, re-enter: \"\n taskDesc = gets.chomp\n end\n\n taskArray[choice.to_i].setDescription(taskDesc)\n\n elsif num.to_i == 3\n\n print \"Enter the priority level (1-10): \"\n taskPriority = gets.chomp\n taskPriority = taskPriority.to_i\n while (taskPriority < 1 || taskPriority > 10)\n print \"Error: The task priority level must be between 1 and 10,\",\n \" re-enter: \"\n taskPriority = gets.chomp\n taskPriority = taskPriority.to_i\n end\n\n taskArray[choice.to_i].setPriority(taskPriority)\n\n elsif num.to_i == 4\n\n print \"Enter the due date in the format of mm/dd/yyyy: \"\n taskDueDate = gets.chomp\n while (taskDueDate.length > 10)\n print \"Error: Task due date cannot exceed 10 characters make sure it's\",\n \"in the proper format, re-enter: \"\n taskDueDate = gets.chomp\n end\n\n taskArray[choice.to_i].setDue(taskDueDate)\n\n end #end if-elseif\n\n end #end while\n\n end", "def actions\n html_str = ''\n html_str << context.link_to(\n \"Edit\",\n edit_company_admin_task_path(object, network: object.company.domain),\n class: \"button button-chromeless\"\n )\n disable_or_delete = object.has_completed_tasks? ? 'Disable' : 'Delete'\n html_str << context.link_to(\n object.enabled? ? disable_or_delete : 'Activate',\n company_admin_task_path(object, network: object.company.domain),\n method: :delete,\n remote: true,\n data: { confirm: \"Are you sure?\", taskId: object.id },\n class: \"task-status-toggle button button-chromeless danger\"\n )\n html_str\n end", "def help\n puts \"To add a task, type 'add task'.\"\n puts \"To update a task, type 'update'.\"\n puts \"To delete a task, type 'complete'.\"\n puts \"To view the To Do List, type 'view'.\"\n puts \"To quit, type 'done'.\"\nend", "def get_task(todo)\n system \"clear\"\n puts \"Selected #{todo.content}\"\n \n make_options(edit_menu_options)\n puts \"\\n\"\n gets.chomp\nend", "def tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see tasks for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find datas\n @tasks = Task.where(project_id: @project.id).order('end_date ASC')\n @deadline_tasks = @tasks.where('end_date <= ?', Date.today + 1).where.not(status: 'completed')\n @wait_tasks = @tasks.where(status: 'wait')\n @develop_tasks = @tasks.where(status: 'develop')\n @test_tasks = @tasks.where(status: 'test')\n @completed_tasks = @tasks.where(status: 'completed')\n # prepare datas for timeline\n if params[:init_date]\n @init_date = params[:init_date].to_date\n @end_date = @init_date + 6\n # update page without refresh\n respond_to do |format|\n format.js { render action: 'functions/update_timeline'}\n end\n else\n @init_date = Date.yesterday\n @end_date = @init_date + 6\n end\n end", "def menu\nend", "def handle_main_menu(response)\n prompt = TTY::Prompt.new\n\n if (['n', 'q', 'o', 'c', \"exit\"].include?(response))\n # Features that won't require an extra input argument.\n case response\n when \"n\"\n @tm.new_task\n when \"q\"\n sign_out\n when \"exit\"\n exit\n when \"o\"\n @tm.calendar.options\n when \"c\"\n @tm.create_calendar\n @tm.print_calendar\n else\n puts \"Error: Argument not accounted for!\"\n raise \n end\n else\n # Features that require an input argument.\n arg = prompt.select(\"Enter a valid Task ID: \", \n @tm.available_tasks\n .map {|task| {name: \"#{task.id.to_s} - #{task.title}\",\n value: task.id}})\n\n case response\n when \"s\"\n t = @tm.get_task(arg)\n t.print_task unless t==-1\n when \"e\"\n @tm.edit_task(arg)\n when \"d\"\n ans = prompt.yes?(\"Are you sure you want to delete task #{arg}?\") do |q|\n q.suffix \"Yes/No\"\n end\n\n if ans\n @tm.destroy_task(arg)\n end\n when \"c\"\n @tm.create_calendar(arg)\n @tm.print_calendar\n else\n puts \"Error: Argument not accounted for!\"\n raise \n end\n end\n end", "def menu\n \nend", "def student_main_menu(student_user) \n self.line_break\n puts \"Please select a command:\".colorize(:light_blue), \"1: Return to Main Menu\".colorize(:cyan), \"2: Exit\".colorize(:cyan)\n self.line_break\n input = gets.chomp\n until input == \"1\" || input == \"2\"\n puts \"Invalid response. Please select a command:\".colorize(:yellow), \"1: Return to Main Menu\".colorize(:cyan), \"2: Exit\".colorize(:cyan) \n input = gets.chomp\n end\n if input == \"1\"\n self.student_tasks(student_user)\n elsif input == \"2\"\n puts \"Have a great day!\".colorize(:light_green)\n end\n end", "def index\n @tasks = eval(get_query)\n @task = @project.tasks.build\r\n @archieved = @project.is_archieved?\n @learnmore = \"Tasks help you keep track of all the little things that need to get done. You can add them for yourself or assign them to someone else.\"\n render :layout => 'onebox_layout'\n end", "def determine_action(input)\n case (input.to_i)\n when 1 then print_all_tasks\n when 2 then retrieve_and_print_worktime\n when 3 then print_tasks_in_interval\n when 4 then output_to_csv\n when 5\n @values = nil\n return false\n else\n handle_wrong_option\n end\n return true\n end", "def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end", "def execute_tasks(tasks,template_path)\n \n if File.exists?(File.expand_path(File.join(template_path,'tasks.rb')))\n load File.expand_path(File.join(template_path,'tasks.rb'))\n end\n \n tasks.each{\n |task|\n \n puts 'Running Task: ' + task\n \n task = replace_tags(task);\n \n options = task.split(', ')\n action = options.slice!(0)\n \n if(Tasks.respond_to?(action))\n Tasks.send action, options.join(', ')\n else\n send action, options.join(', ')\n end\n \n }\n \n end", "def main_menu\n choice = self.prompt.select(\"Hi there, #{self.user.name}! What would you like to do today?\", [\"Create a new post\", \"Find a book\", \"View or edit my posts\", \"Delete my account\", \"Logout\"])\n\n case choice\n when \"Create a new post\"\n self.new_post\n when \"Find a book\"\n self.find_book\n when \"View or edit my posts\"\n self.view_edit_posts\n when \"Delete my account\"\n self.delete_account\n when \"Logout\"\n self.spinner(\" ✌️✌️✌️ \")\n self.greet\n end\n end", "def mark_done\n choose do |menu|\n menu.prompt = \"What have you completed?\"\n Toodoo::Item.where{:todo_id => todo.id, finished => false}.each do |x|\n menu.choice(x.item, \"Choose this task\"){x.update(finished => true)}\n x.save\n end\n menu.choice(:back)\n end\n\n def change_due_date\n # TODO: This should display the todos on the current list in a menu\n # similarly to pick_todo_list. Once they select a todo, the menu choice block\n # should update the due date for the todo. You probably want to use\n # `ask(\"foo\", Date)` here.\n end\n\n def edit_task\n choose do |menu|\n menu.prompt = \"What item would you like to edit?\"\n Toodoo::Item.wehere{:list_id => list_id, finished => false}.each do |x|\n menu.choice(x.item, \"Edit this task\") {x.update(item: get_new_item)}\n x.save\n end\n end\n end\n\n def show_overdue\n # TODO: This should print a sorted list of todos with a due date *older*\n # than `Date.now`. They should be formatted as follows:\n # \"Date -- Eat a Cookie\"\n # \"Older Date -- Play with Puppies\"\n end\n\n def run\n puts \"Welcome to your personal TooDoo app.\"\n loop do\n choose do |menu|\n menu.layout = :menu_only\n menu.shell = true\n\n # Are we logged in yet?\n unless @user\n menu.choice(:new_user, \"Create a new user.\") { new_user }\n menu.choice(:login, \"Login with an existing account.\") { login }\n end\n\n # We're logged in. Do we have a todo list to work on?\n if @user && !@todos\n menu.choice(:delete_account, \"Delete the current user account.\") { delete_user }\n menu.choice(:new_list, \"Create a new todo list.\") { new_todo_list }\n menu.choice(:pick_list, \"Work on an existing list.\") { pick_todo_list }\n menu.choice(:remove_list, \"Delete a todo list.\") { delete_todo_list }\n end\n\n # Let's work on some todos!\n if @todos\n menu.choice(:new_task, \"Add a new task.\") { new_task }\n menu.choice(:mark_done, \"Mark a task finished.\") { mark_done }\n menu.choice(:move_date, \"Change a task's due date.\") { change_due_date }\n menu.choice(:edit_task, \"Update a task's description.\") { edit_task }\n menu.choice(:show_done, \"Toggle display of tasks you've finished.\") { @show_done = !!@show_done }\n menu.choice(:show_overdue, \"Show a list of task's that are overdue, oldest first.\") { show_overdue }\n menu.choice(:back, \"Go work on another Toodoo list!\") do\n say \"You got it!\"\n @todos = nil\n end\n end\n\n menu.choice(:quit, \"Quit!\") { exit }\n end\n end\n end\nend", "def display_tasks\n # get the array from the repo\n tasks = @repo.all\n # display all the tasks\n @view.display_tasks(tasks)\n end", "def run(input)\n task = input\n task_name = \"#{task[1..-1].join(\" \")}\"\n case task[0] \n when \"add\" then add_task(task_name)\n when \"index\" then read_index\n when \"delete\" then delete_task(task_name)\n when \"complete\" then update_complete(task_name)\n end\n end", "def run_actions; end", "def teacher_main_menu(teacher_user) \n self.line_break\n puts \"Please select a command:\".colorize(:light_blue), \"1: Return to Main Menu\".colorize(:cyan), \"2: Exit\".colorize(:cyan)\n self.line_break\n input = gets.chomp\n until input == \"1\" || input == \"2\"\n puts \"Invalid response. Please select a command:\".colorize(:yellow), \"1: Return to Main Menu\".colorize(:cyan), \"2: Exit\".colorize(:cyan)\n input = gets.chomp\n end\n if input == \"1\"\n self.teacher_tasks(teacher_user)\n elsif input == \"2\"\n puts \"Have a great day!\".colorize(:light_green)\n end\n end", "def display_tasks(tasks) # we need the tasks\n # CONTRACT:\n # [x] buy croissants\n # [ ] buy coffee\n tasks.each_with_index do |task, index|\n # if task.done?\n # puts \"[x] #{task.name}\"\n # else\n # puts \"[ ] #{task.name}\"\n # end\n\n status = task.done? ? 'x' : ' '\n puts \"[#{status}] #{index + 1}. #{task.name}\"\n end\n end", "def action_for_task(task)\n task\n end", "def index\n if Task::TASK_STATES.include?(params[:state]) then\n @tasks = @tasklist.tasks.where(:tstate => params[:state])\n else\n @tasks = @tasklist.tasks\n render action: \"index\", :notice => \"Wrong state. All tasks are listed.\"\n end\n end", "def display_tasks\n puts \"What do you want to do? \\n\"\n puts TASKS.values\n end", "def tasks\n @use_case = UseCase.find(params[:id])\n @project = @use_case.project\n respond_to do |format|\n format.html \n end\n end", "def print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # datas\n @status = (params[:status] ? params[:status] : ['wait', 'develop', 'test', 'completed'])\n @collaborators = (params[:collaborators] ? params[:collaborators] : @project.collaborators.ids)\n @start_date = params[:start_date]\n @end_date = params[:end_date]\n @show_expected_time = (params[:show_expected_time] === '1')\n # find tasks\n @tasks = @project.tasks.where(status: @status, collaborator_id: @collaborators)\n unless @start_date.blank?\n @tasks = @tasks.where('start_date >= ?', @start_date.to_date)\n end\n unless @end_date.blank?\n @tasks = @tasks.where('end_date <= ?', @end_date.to_date)\n end\n # disable layout\n render layout: false\n end", "def display_menu\n puts \"\\nEnter option: \"\n puts '1. List Existing Threads'\n puts '2. List Single Thread'\n puts '3. Create new Thread'\n puts 'Q. Quit'\n end", "def menu # can do custom methods within a method/class\n end", "def action_run\n end", "def run\n while @running\n display_tasks\n action = gets.chomp.to_i\n print `clear`\n route_action(action)\n end\n end", "def display_and_run\n\n # prints the menu name and waits briefly\n @dp.d_print(@menu_name + \":^^\")\n i = 1\n\n # displays the options\n @options.each do |option|\n print(i.to_s + ' ')\n puts(option.get_name)\n i += 1\n end\n\n # prompt and get valid input from the player\n print(@prompt_string)\n action = get_action\n\n # runs the selected action\n action.call :menu_select\n\n # some test code\n print(\"here\")\n end", "def menu\n \n \n\nend", "def define_menu_items\n check_attributes\n @menu_description.concat(\"\\n #{set_boundaries}\")\n add_menu_item(\"All tasks to a person in the given #{time_string}.\", 1)\n add_menu_item(\"Worktime of a person in that #{time_string}.\", 2)\n add_menu_item(\"All tasks running during the interval.\", 3)\n add_menu_item(\"Write Query result to csv-file.\", 4)\n add_menu_item(\"Cancel and return to previous menu.\", 5)\n end", "def action_A_menu\n case @intern_mode\n when :choose_move_pokemon\n action_move_current_pokemon\n when :choose_move_item\n return $game_system.se_play($data_system.buzzer_se) if @team_buttons[@index].data.item_holding == 0\n @team_buttons[@move = @index].selected = true\n @intern_mode = :move_item\n @base_ui.show_win_text(text_get(23, 22))\n when :move_pokemon\n process_switch\n when :move_item\n process_item_switch\n else\n $game_system.se_play($data_system.decision_se)\n return show_choice\n end\n $game_system.se_play($data_system.decision_se)\n end", "def main_menu\n choice = true\n while choice\n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, or (E)xit \"\n options = gets.chomp.downcase\n\n case options\n when \"c\"\n # runs method create line 101\n create\n when \"l\"\n #runs method list line 144\n list\n when \"u\"\n #runs method update line 161\n update\n when \"d\"\n #runs method delete line 229\n delete\n when \"e\"\n choice = false #exits world\n else\n puts \"Wrong Input. Please input C, L, U, D or E\"\n end\n end\n end", "def create\n authorize! :create_task_list, @active_project\n \n @task_list = @active_project.task_lists.build(params[:task_list])\n @task_list.created_by = @logged_user\n\n respond_to do |format|\n if @task_list.save\n flash[:notice] = 'List was successfully created.'\n format.html {\n error_status(false, :success_added_task_list)\n redirect_back_or_default(@task_list)\n }\n format.js { return index }\n format.xml { render :xml => @task_list.to_xml(:root => 'task-list'), :status => :created, :location => @task_list }\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n form_tag task_lists_path \n error_messages_for :task_list \n t('name') \n text_field 'task_list', 'name', :id => 'taskListFormName', :class => 'long' \n t('priority') \n text_field 'task_list', 'priority', :id => 'taskListPriority', :class => 'long' \n t('description') \n text_area 'task_list', 'description', :id => 'taskListFormDescription', :class => 'short', :rows => 10, :cols => 40 \n t('milestone') \n select 'task_list', 'milestone_id', select_milestone_options(@active_project), {}, {:class => 'select_milestone', :id => 'taskListFormMilestone'} \n if @logged_user.member_of_owner? \n t('is_private_list') \n t('is_private_list_info') \n yesno_toggle 'task_list', 'is_private', :id => 'taskListFormIsPrivate', :class => 'yes_no' \n end \n t('tags') \n text_field 'task_list', 'tags', :id => 'taskListFormTags', :class => 'long' \nt('tags_info') \n \n t('add_task_list') \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n }\n \n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def menu\n system('clear')\n selection = @prompt.select('》 PLAYLIST 《', ['Display', 'Add', 'Remove', 'Export To File', 'Back'])\n case selection\n when 'Display'\n list\n else\n case_menu(selection)\n end\n end", "def execute(command_line)\n #the first part of command_line is stored in command and the second is is rest\n command, rest = command_line.split(/ /, 2)\n case command\n when 'show' #display tasks by projects and all the properties of each task\n show\n when 'add' #add a new task or project, btw..A project can contain many tasks\n add rest\n when 'check' #mark the task entered as checked\n check rest\n when 'uncheck' #mark the task entered as unchecked\n uncheck rest\n when 'help' #check the existing commands and there format\n help\n when 'deadline' # adding the ability to precise a deadline for a task already existing, syntax: deadline id_task date_deadline\n deadline rest\n when 'today' # adding the ability to display all tasks which deadline is today\n today\n when 'delete' #adding the ability to delete a task, syntax: delete id_task\n delete rest\n when 'view' #displays tasks by date or deadline or project depending on input, syntax: view by date||view by deadline||view by project\n view rest\n else\n error command\n end\n end", "def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove due date\"\n\t\tputs \"9) Delete task | 0) Exit\"\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"Enter choice: \"\n\t\tchoice = get_choice.to_i\n\t\toptions choice\n\tend", "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "def start_tasklister\n\ttasklist = []\n\n\tquit = false\n\n\twhile !quit\n\n\t\tputs \"Welcome to Tasklist! \\n Choose one of the following to get started:\"\n\t\tputs \"(1) add a task\"\n\t\tputs \"(2) show a specific task\"\n\t\tputs \"(3) remove completed task\"\n\t\tputs \"(4) get total number of tasks\"\n\t\tputs \"(5) show all tasks\"\n\t\tputs \"(6) quit\"\n\n\t\toption_select = gets.chomp.to_i\n\n\t\tif (option_select == 1)\n\t\t\tadd_task(tasklist)\n\t\telsif (option_select ==2)\n\t\t\tget_task(tasklist)\n\t\telsif (option_select ==3)\n\t\t\tcompleted(tasklist)\n\t\telsif (option_select ==4)\n\t\t\tget_count\n\t\telsif (option_select == 5)\n\t\t\tprint_all(tasklist)\n\t\telsif (option_select ==6)\n\t\t\tputs \"goodbye!\"\n\n\t\t\tquit = true\n\t\telse\n\t\t\tputs \"invalid input\"\n\t\tend\n\tend \nend", "def show\n if current_user.admin == 1\n @project = Project.find(params[:id] || params[:project_id])\n else\n @project = current_user.projects.find(params[:id] || params[:project_id])\n end\n\n if params[:status] == \"closed\"\n @tasks = @project.tasks.order('id DESC').where(:closed => 1)\n else\n @tasks = @project.tasks.order('id DESC').where(\"closed IS NULL OR closed = 0\")\n end\n @open = @project.tasks.order('id DESC').where(\"closed IS NULL OR closed = 0\")\n @closed = @project.tasks.where(:closed => 1)\n \n if params[:status] == \"activas\"\n @tasks = @project.tasks.order('id DESC').where(:state => 1 ) # Estado Activo aqui agregar para que ordene por secuence\n end\n if params[:status] == \"cerradas\"\n @tasks = @project.tasks.order('id DESC').where(:state => 2) # Estado Cerrada aqui agregar para que ordene por secuence\n end\n if params[:status] == \"obsoleta\"\n @tasks = @project.tasks.order('id DESC').where(:state => 3) # Estado Obsoleta aqui agregar para que ordene por secuence\n end\n if params[:status] == \"cortada\"\n @tasks = @project.tasks.order('id DESC').where(:state => 4) # Estado Cortada aqui agregar para que ordene por secuence\n end\n if params[:status] == \"enprogreso\"\n @tasks = @project.tasks.order('id DESC').where(:state => 5, :assigned_to_id => current_user.id) # Estado En progreso aqui agregar para que ordene por secuence\n end\n \n if params[:status] == \"alta\"\n @tasks = @project.tasks.order('id DESC').where(:complexity => 1, :assigned_to_id => current_user.id) \n end\n \n if params[:status] == \"media\"\n @tasks = @project.tasks.order('id DESC').where(:complexity => 2, :assigned_to_id => current_user.id) \n end\n \n if params[:status] == \"baja\"\n @tasks = @project.tasks.order('id DESC').where(:complexity => 3, :assigned_to_id => current_user.id) \n end\n @todas = @project.tasks.where( :assigned_to_id => current_user.id)\n @activas = @project.tasks.where(:state=> 1)\n @cerradas = @project.tasks.where(:state => 2)\n @obsoleta = @project.tasks.where(:state => 3)\n @cortada = @project.tasks.where(:state => 4)\n @enprogreso = @project.tasks.where(:state => 5)\n \n @alta = @project.tasks.where(:complexity => 1)\n @media = @project.tasks.where(:complexity => 2)\n @baja = @project.tasks.where(:complexity => 3)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end", "def show\n begin\n @task_list = @active_project.task_lists.find(params[:id])\n rescue\n return error_status(true, :invalid_task_list)\n end\n \n authorize! :show, @task_list\n\n respond_to do |format|\n format.html {\n index_lists(@logged_user.member_of_owner?)\n }\n \n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n render :partial => 'show', :object => @task_list, :locals => {:on_list_page => true} \n \n \n \n \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n }\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n render :partial => 'show', :object => @task_list, :locals => {:on_list_page => true} \n \n \n \n \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n\n end", "def main_menu\n puts\n puts \"What would you like to do? Please enter a number:\".colorize(:green)\n puts \"---------------------\"\n puts \"1. Search Developer Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"2. See Saved Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"3. Apply From Saved Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"4. Have You Moved? Update Location Here\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"5. Sign Out\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"6. Exit Program\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n main_menu_response = gets.chomp.downcase\n if main_menu_response == \"1\"\n search_jobs\n elsif main_menu_response == \"2\"\n saved_jobs\n elsif main_menu_response == \"3\"\n apply_job\n elsif main_menu_response == \"4\"\n update_location\n elsif main_menu_response == \"5\"\n @@user_id = nil\n puts \"Signing out\".colorize(:color => :blue, :background => :white)\n sleep(1)\n welcome\n elsif main_menu_response == \"6\"\n exit\n else\n invalid_response\n main_menu\n end\n end", "def interpret_task\n\n command = params[:process].to_sym\n respond_to do |format|\n case command\n when :setup\n setup_project() if @project.may_setup?\n @project.setup! # TODO refactor setup_project as a :before callback to event\n\n format.html { redirect_to project_path(@project, :submit_action => 'setup'), notice: 'Request for project set-up has been submitted.' }\n format.json {render :json => {'data' => 'Request for project set-up has been submitted.'}.merge(state_snapshot)}\n when :start, :stop, :abort, :terminate\n submit_process(command) if @project.send(\"may_#{command}?\")\n @project.send(\"#{command}!\") # TODO refactor as a :before callback to events\n format.html { redirect_to project_path(@project, :submit_action => params[:process]), notice: 'Request for project '+params[:process]+' has been submitted.' }\n format.json {render :json => {'data' => 'Request for project '+params[:process]+' has been submitted.'}.merge(state_snapshot)}\n when :download, :export\n\n id_ary = params[:ids].map(&:to_i).reverse\n # save data for selected results\n result_download_data = Hash.new\n result_download_data[:test_ids] = id_ary.join(',')\n result_download_data[:project_id] = @project.id\n result_download_data[:result_type] = params[:process]\n result_download = ProjectResultDownload.new(result_download_data)\n result_download.save!\n\n project_results_download(params[:process], id_ary, result_download.id)\n\n format.json {render :json => {'request_id' => result_download.id, 'status' => 0}}\n else\n format.html { redirect_to project_path(@project), notice: 'Unidentified process command.' }\n format.json {render :json => {'data' => 'Unidentified process command.'}}\n end\n\n end\n end", "def new\n authorize! :create_task_list, @active_project\n \n @task_list = @active_project.task_lists.build()\n \n begin\n @task_list.milestone = @active_project.milestones.find(params[:milestone_id])\n @task_list.is_private = @task_list.milestone.is_private\n rescue ActiveRecord::RecordNotFound\n @task_list.milestone_id = 0\n end\n \n respond_to do |format|\n format.html # new.html.erb\n \n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n form_tag task_lists_path \n error_messages_for :task_list \n t('name') \n text_field 'task_list', 'name', :id => 'taskListFormName', :class => 'long' \n t('priority') \n text_field 'task_list', 'priority', :id => 'taskListPriority', :class => 'long' \n t('description') \n text_area 'task_list', 'description', :id => 'taskListFormDescription', :class => 'short', :rows => 10, :cols => 40 \n t('milestone') \n select 'task_list', 'milestone_id', select_milestone_options(@active_project), {}, {:class => 'select_milestone', :id => 'taskListFormMilestone'} \n if @logged_user.member_of_owner? \n t('is_private_list') \n t('is_private_list_info') \n yesno_toggle 'task_list', 'is_private', :id => 'taskListFormIsPrivate', :class => 'yes_no' \n end \n t('tags') \n text_field 'task_list', 'tags', :id => 'taskListFormTags', :class => 'long' \nt('tags_info') \n \n t('add_task_list') \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n }\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n form_tag task_lists_path \n error_messages_for :task_list \n t('name') \n text_field 'task_list', 'name', :id => 'taskListFormName', :class => 'long' \n t('priority') \n text_field 'task_list', 'priority', :id => 'taskListPriority', :class => 'long' \n t('description') \n text_area 'task_list', 'description', :id => 'taskListFormDescription', :class => 'short', :rows => 10, :cols => 40 \n t('milestone') \n select 'task_list', 'milestone_id', select_milestone_options(@active_project), {}, {:class => 'select_milestone', :id => 'taskListFormMilestone'} \n if @logged_user.member_of_owner? \n t('is_private_list') \n t('is_private_list_info') \n yesno_toggle 'task_list', 'is_private', :id => 'taskListFormIsPrivate', :class => 'yes_no' \n end \n t('tags') \n text_field 'task_list', 'tags', :id => 'taskListFormTags', :class => 'long' \nt('tags_info') \n \n t('add_task_list') \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n\n end", "def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend", "def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend", "def list_all_tasks\n #instance of View\n tasks = @repository.all # Array of tasks\n @view.display_all_tasks(tasks) #View to display all the tasks\n end", "def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend", "def do_action(action)\n\t\tcase action\n\t\twhen 'list'\n\t\t\tlist()\n\t\twhen 'find'\n\t\t\tputs 'Finding...'\n\t\t\tfind()\n\t\twhen 'sort'\n\t\t\tsort()\n\t\twhen 'add'\n\t\t\tadd()\n\t\twhen 'quit'\n\t\t\treturn :quit\n\t\telse\n\t\t\tputs \"\\nI don't understand that command.\\n\"\n\t\tend\n\tend", "def do_work()\n\n show_help()\n ::Twiga.say_info \"\\ntwiga> \"\n\n while (cmd = gets) do\n cmd.strip!\n tokens = cmd.split(/ /)\n unless tokens.empty?\n\n item = tokens[1] || 'test'\n \n case tokens.first.downcase\n\n when 'quit','exit' then break\n\n when 'register' then do_register( item )\n when 'refresh' then do_refresh( item )\n when 'list' then do_list( item )\n when 'fetch' then do_fetch( item )\n when 'delete' then do_delete( item )\n\n when 'save' then update_gcp_seed_tokens( item )\n when 'seed' then show_seed()\n when 'ready' then do_ready_state( item )\n when 'time' then show_time( item )\n when 'devices' then show_devices()\n\n when 'connect' then do_connect( item )\n\n when 'help' then show_help() \n when 'cups' then do_cups_work() \n when 'gcp' then show_gcp( item )\n\n else\n ::Twiga.say_err \"? unknown command: #{cmd}\"\n end # case\n \n end # unless no command\n\n ::Twiga.say_info \"\\ntwiga> \"\n end\n\n end", "def complete_submenu\n\t\tputs \"Enter number of task to complete:\"\n\t\tchoice = get_choice.to_i\n\t\t@todo_list.complete_item choice\n\t\tprint_menu\n\tend", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def work_order_menu\n header(\"Work Order Menu\")\n puts\n puts\n @prompt = TTY::Prompt.new\n\n puts \"1) view all work orders\"\n puts\n puts \"2) view my work orders\"\n puts\n puts \"3) create new work order\"\n puts\n puts \"4} update work order\"\n puts\n puts \"5) delete work order\"\n puts\n puts \"6) return to main menu\"\n puts\n #TTY::Prompt keypress method constantly monitors keyboard for input\n selection = @prompt.keypress(\"Please make your selection:\")\n case selection\n when '1'\n system \"clear\"\n view_all_work_orders\n press_any_key\n work_order_menu\n when '2'\n system \"clear\"\n view_my_work_orders\n press_any_key\n work_order_menu\n when '3'\n system \"clear\"\n create_work_order\n work_order_menu\n when '4'\n system \"clear\"\n view_all_work_orders\n update_work_order\n work_order_menu\n when '5'\n system \"clear\"\n view_all_work_orders\n delete_work_order\n work_order_menu\n when '6'\n system \"clear\"\n main_menu\n else\n error\n work_order_menu\n end\n end", "def task_actions(task_name)\n get \"#{base_url}/tasks/#{task_name}/actions\"\n end", "def list_tasks\r\n unless tasks\r\n puts \"No tasks yet. Add one!\"\r\n return\r\n end\r\n # Pretty-format hash and print\r\n print \" \" + \"ITEM\".ljust(30) + \" | \" +\r\n \"WHEN DUE\".ljust(15) + \" | \" +\r\n \"WHEN ADDED\".ljust(15) + \"\\n\"\r\n tasks.each do |task|\r\n print \"<#{tasks.find_index(task) + 1}>\".ljust(5) +\r\n task[:text].ljust(30) + \" | \" +\r\n task[:due].ljust(15) + \" | \" +\r\n task[:time].ljust(15) + \"\\n\"\r\n end\r\n end", "def show\n @tasks.each do |project_name, project_tasks|\n @output.puts project_name\n project_tasks.each do |task|\n @output.printf(\" [%c] %d: %s : %s \\n\", (task.done? ? 'x' : ' '), task.id, task.description, task.deadline)\n end\n @output.puts\n end\n end", "def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend", "def show\n set_task_for_show\n render 'tasks/index'\n end", "def list_tasks\n #begin\n #byebug\n @params=search_params[:search]\n #byebug\n if @params\n if !@params[:user].empty?\n query = iterate_add_tasks(User.where('handle LIKE ?', \"%#{@params[:user]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:client].empty?\n query = iterate_add_tasks(Client.where('name LIKE ?', \"%#{@params[:client]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:project].empty?\n query = iterate_add_tasks(Project.where('name LIKE ?', \"%#{@params[:project]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:activity].empty?\n query = iterate_add_tasks(Activity.where('name LIKE ?', \"%#{@params[:activity]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n \n if !@params[:date].empty?\n @start=Date.parse(@params[:date]).beginning_of_month\n @end=Date.parse(@params[:date]).end_of_month \n query = Task.where(date: @start..@end)\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n\n if @tasks\n #byebug\n @tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}\n @tasks=@tasks.reverse\n end\n \n flash[:notice]=nil\n \n all=true\n @params.each do |p|\n #byebug\n if !p[1].empty?\n all=false\n end\n end\n \n if all\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n else\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n #rescue\n #@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n #flash[:notice]='Listing the latest 20 tasks'\n #end\n @hours=total_hours(@tasks)\n respond_to do |format|\n format.html\n format.csv {send_data tasks_to_csv(@tasks)}\n end\n end", "def start_main_menu \n puts \"[1] Start\\n[2] Measurement Converter\\n[3] How to Use\".colorize(:yellow)\n user_input = gets.chomp.downcase\n if @answers[0][1].include?(user_input)\n self.start_recipe\n elsif @answers[0][2].include?(user_input)\n self.start_convert\n elsif @answers[0][3].include?(user_input)\n start_help() #module method\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts puts \"Do you not know how to press 1, 2 or 3 :| ... Try again.\".colorize(:red)\n self.start_main_menu\n end\n end", "def show\n\t\tlistable_actions = ActionType.where(:code=>['create', 'update', 'destroy', 'approve'])\n\n\t\t@project = Project.find(params[:id])\n\t\t@tasks = @project.root_tasks\n\t\t@events = @project.events.where(:action_type_id => listable_actions).limit 6\n\t\t@sprints = @project.sprints\n\t\t@user_relations = @project.project_user_relations\n\n\t\tmake_breadcrumbs\n\t\tsession[:last_controler] = self.controller_name\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @project }\n\t\tend\n\tend", "def show_taskling_action(taskling)\n\t\tif taskling.status == 0\n\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-question-sign task-action\"\n\t\telsif taskling.status == 1\n\t\t\tlink_to taskling_path(taskling, taskling: {status: 3}), method: :patch do\n\t\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-ok-circle task-action active\" \n\t\t\tend\n\t\telse\n\t\t\tlink_to taskling_path(taskling, taskling: {status: 1}), method: :patch do\n\t\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-ok-sign task-action complete\" \n\t\t\tend\n\t\tend\n\tend", "def index\n @user = current_user\n @tasks = @user.tasks.rank(:row_order)\n @label_list = Label.all\n @task = current_user.tasks.new\n @sort = nil\n if params[:task]\n selection = params.dig(:task, :keyword)\n # @tasks = Task.sort(selection)\n # @tasks = @tasks.where(user_id: current_user)\n @tasks = Task.where(user_id: current_user).order_by_key(selection)\n @sort = params[:task][:keyword]\n end\n end", "def show\n\t\t@project = Project.find(params[:id])\n\t\t@tasks = @project.tasks \n\n\tend", "def execute_action(action)\n case action\n when 1\n create_station\n when 2\n stations.size > 1 ? create_route : (puts 'Для создания маршрута нужно хотя бы 2 станции.')\n gets\n when 3\n routes.empty? ? (puts 'Маршрутов не создано.') : edit_route \n when 4\n create_train\n when 5\n system 'clear'\n move_train \n when 6\n system 'clear'\n add_carriage_to_train\n when 7\n remove_carriage\n when 8\n set_route\n when 9\n system 'clear'\n display_all_stations\n when 0\n abort\n else\n puts \"Неизвестная команда!\"\n end\n end", "def task\n end", "def task_c2e(task)\n\n case task\n when '1~2月營業稅'\n 'vat_jan'\n when '3~4月營業稅'\n 'vat_mar'\n when '5~6月營業稅'\n 'vat_may'\n when '7~8月營業稅'\n 'vat_jul'\n when '9~10月營業稅'\n 'vat_sept'\n when '11~12月營業稅'\n 'vat_nov'\n when '扣繳憑單申報'\n 'voucher'\n when '結算申報'\n 'income_tax'\n else\n redirect_to '/'\n end\n end", "def print_menu\n puts \"1. List patients\"\n # ....\n end", "def index\n @tasks = (current_user.admin? ? Task.all : current_user.tasks)\n @error = nil\n if params[:name].present?\n resp = Task.where(\"name ilike '%#{params[:name]}%'\")\n if resp.present? \n if !current_user.admin?\n resp = resp.where(:user_id => current_user.id)\n end\n @tasks = resp \n end\n if resp.blank?\n @error = \"No Task Present with \\'#{params[:name]}\\' name\"\n end\n end \n end", "def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end", "def launch!\n\t\tintroduction\n\n\t\tresult = nil\n\t\tuntil result == :quit\n\t\t\tprint \"> Choose one of these options: List, Sort, Find or Add.\\n\\n\"\n\t\t\tuser_response = gets.chomp\n\t\t\tresult = do_action(user_response)\n\t\tend\n\t\tconclusion\n\tend", "def print_menu(db)\n\tputs \"\\nDaily To-Do List Menu\"\n\tputs '*~'*20+'*'\n\tputs \"Choose 1, 2, 3, or 4:\"\n\tputs '1 - Add/Delete an activity to the activities list'\n\tputs '2 - Add/Delete an activity from the to-do list'\n\tputs '3 - Mark an activity as complete'\n\tputs '4 - Exit'\n\tchoice = gets.chomp\n\tuntil ['1','2','3','4'].index(choice)\n\t\tputs 'Please choose either 1, 2, 3, or 4'\n\t\tchoice = gets.chomp\n\tend\n\tchoice\nend", "def index\n @tasks = @project.tasks.finished(false).paginate(:page => params[:page])\n @allow_reordering = (@tasks.total_entries > 1)\n @final = false\n \n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def display_menu()\n return 'Welcome to the Chicken Farm Simulator'\nend", "def do_action(action, args=[])\n case action\n when 1\n Customer.create_a_customer_account\n output_action_header(\"\\nCustomer Added!\")\n between_views\n when 2\n ActiveCustomer.list\n between_views\n when 3\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Payment.add_payment_to_active_customer\n output_action_header(\"\\nPayment Added!\")\n between_views\n else\n Payment.add_payment_to_active_customer\n output_action_header(\"\\nPayment Added!\")\n between_views\n end\n when 4\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.add_product_to_active_customer\n output_action_header(\"\\nProduct Added!\")\n between_views\n else\n Product.add_product_to_active_customer\n output_action_header(\"\\nProduct Added!\")\n between_views\n end\n when 5\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.add_product_to_active_customer_order\n between_views\n else\n Product.add_product_to_active_customer_order\n between_views\n end\n when 6\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n CompleteOrder.get_active_user_order\n between_views\n else\n CompleteOrder.get_active_user_order\n between_views\n end\n when 7\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.remove_product\n between_views\n else\n Product.remove_product_customer\n between_views\n end\n when 8\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.update_product\n between_views\n else\n Product.update_product_customer\n between_views\n end\n when 9\n Product.stale_products\n between_views\n when 10\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n CustomerRevenue.check_active_customer_rev\n between_views\n else\n CustomerRevenue.check_active_customer_rev\n between_views\n end\n when 11\n Product.product_popularity\n between_views\n when 12\n return :quit\n else\n puts \"I don't understand that command\"\n end\n end", "def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end", "def execute_task\n \t@task = Task.find(params[:id])\n \t@cloud = Cloud.find(@task.cloud_id) if @task.cloud_id\n \t@platform = Platform.find(@task.platform_id) if @task.platform_id\n \t@favorite = Favorite.find(@task.favorite_id)\n\n respond_to do |format|\n format.js { render 'demo/execute_task' }\n end\n end", "def get_command\r\n\r\n print \"\\nType a Command to get to work (e.g. make-list to start a new list of todo´s)\r\n \\n( type <show-commands> to see your options)\r\n \\n\"\r\n\r\n cmd, target, *args = gets.chomp.downcase.split(' ')\r\n\r\n \r\n case cmd\r\n when 'up'\r\n @lists[target].up(*args.map(&:to_i))\r\n\r\n when 'down'\r\n @lists[target].down(*args.map(&:to_i))\r\n\r\n when 'swap'\r\n @lists[target].swap(*args.map(&:to_i))\r\n\r\n when 'sort'\r\n @lists[target].sort_by_date!\r\n\r\n when 'priority'\r\n if @lists[target].items.empty?\r\n puts \"\\nList #{target} does not contain any Todos yet! You can add some next.\r\n \\nWould you like to do that now?\r\n \\n[y] to create new Todo in #{target}\r\n \\n[n] to go back home.\r\n \\n\"\r\n what = gets.chomp.downcase\r\n\r\n if what == \"y\"\r\n @lists[target].add_item(*TodoBoard.todo_configurator(target))\r\n puts \"\\nYay, you created a new Todo! \\n\"\r\n @lists[target].print_priority\r\n else\r\n return true\r\n end\r\n\r\n else\r\n @lists[target].print_priority\r\n end\r\n\r\n when 'print'\r\n if args.empty?\r\n @lists[target].print\r\n else\r\n @lists[target].print_full_item(*args.first.to_i)\r\n end\r\n\r\n when 'make-list'\r\n @lists[target] = List.new(target.to_s)\r\n puts \"\\nList '#{target}' was successfully created!\\n\"\r\n\r\n when 'ls'\r\n @lists.each_key do |key|\r\n puts key\r\n end\r\n\r\n when 'showall'\r\n @lists.each do |k, v|\r\n v.print\r\n end\r\n\r\n when 'all-priorities'\r\n @lists.each do |k, v|\r\n v.print_priority\r\n end\r\n\r\n when 'make-todo'\r\n @lists[target].add_item(*TodoBoard.todo_configurator(target)) # make-todo calls self.todo_configurator to get arguments for add_item\r\n puts \"\\nYay, you created a new Todo! \\n\"\r\n\r\n when 'remove'\r\n self.remove_todo(*args.first.to_i, target)\r\n\r\n when 'delete-list'\r\n @lists.delete(target)\r\n\r\n when 'quit'\r\n return false\r\n\r\n when 'check'\r\n @lists[target].toggle_item(*args.first.to_i)\r\n\r\n when 'purge'\r\n @lists[target].purge\r\n\r\n when 'show-commands' || '<show-commands>' || 'show commands'\r\n puts \"--COMMANDS--\"\r\n p \"You can type the following commands, followed by the parameters (all seperated by \" \" and withouth the <>)\"\r\n puts \"---\"\r\n puts \"CREATE LISTS AND TODO-ITEMS\"\r\n p \"make-list <list name>\"\r\n p \"=> (Create a new list)\"\r\n p \"make-todo <list name>\"\r\n p \"=> (Create a new todo)\"\r\n p \"---\"\r\n p \"DISPLAY LISTS AND TODO ITEMS\"\r\n p \"print <list name>\"\r\n p \"=> (Print a specific list)\"\r\n p \"print <list name> <item-index>\"\r\n p \"=> (shows more detail on specific item on list)\" \r\n p \"ls\" \r\n p \"=> (shows all lists)\"\r\n p \"priority <list name>\"\r\n p \"=> (shows top item on list)\"\r\n p \"all-priorities\"\r\n p \"=> (displays all priority items from all lists)\"\r\n p \"---\"\r\n p \"MANAGE LISTS AND TODO ITEMS\"\r\n p \"sort <list name>\"\r\n p \"=> (sorts list by deadline)\"\r\n p \"swap <list name> <index1> <index2>\"\r\n p \"=> (swaps items with the indexes on list)\"\r\n p \"up <list name> <index> <optional amount of ups>\"\r\n p \"=> (moves item with index UP on list. If no amout is put, item is moved up once. If amount is put, item is moved up amount times.\"\r\n p \"down <index> <optional amount of downs>\"\r\n p \"=> (moves item with index DOWN on list. If no amout is put, item is moved down once. If amount is put, item is moved down amount times.\"\r\n p \"remove <list name> <item-index>\"\r\n p \"=> (Removes item with index on list)\"\r\n p \"check < list name> <item-index>\"\r\n p \"=> (Checks off/marks as done item index on list)\"\r\n p \"---\"\r\n p \"END THE PROGRAM\"\r\n p \"quit\"\r\n p \"=> (ends program)\"\r\n\r\n else\r\n print \"Sorry, that command is not recognized.\"\r\n end\r\n\r\n true\r\n end", "def menu\n input = nil\n puts \"Enter the number of the question you want to see, type 'list' to choose a new list of quesitons or type 'exit': \"\n puts @@divider\n input = gets.strip.downcase\n if input.to_i > 0 && input.to_i < @questions.length + 1\n question = @questions[input.to_i - 1]\n display_question(question)\n elsif input == \"list\"\n list_questions\n elsif input == \"exit\"\n goodbye\n else\n puts \"Please make a valid selection.\"\n menu\n end\n end", "def settings_print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # get all collaborators\n @collaborators = @project.collaborators\n end", "def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end", "def menu\n selection = gets.chomp.to_i\n case selection\n when 1\n all_tickets = Tickets.new(@zendesk_tickets)\n all_tickets.view_all\n when 2\n single_ticket = Ticket.new(@zendesk_tickets)\n single_ticket.view_all\n when 3\n system 'clear'\n puts \"Goodbye!\"\n exit\n else\n system 'clear'\n puts \"Invalid choice, select between 1, 2 or 3\"\n welcome_message \n menu\n end\n end", "def action\n end", "def index\n redirect_to root_path and return unless signed_in?\n set_tasks\n @task = Task.new\n end", "def route_menu_hint\n puts ''\n puts '=== route_Menu_Hint ==='\n routes_list_show\n name = @routes[@routes_ptr]&.first_last_name\n puts \"current route => #{name}\"\n route_stations_list_show\n puts '1 : add new route'\n puts '2 : select next route in list'\n puts '3 : select prev route in list'\n puts '4 : add station to route'\n puts '5 : remove station from route'\n puts '0: return to main menu'\nend" ]
[ "0.71651375", "0.6940298", "0.6725844", "0.6418946", "0.64142907", "0.62632257", "0.6232328", "0.6231454", "0.6224932", "0.6217372", "0.6185048", "0.6183097", "0.6151595", "0.6147367", "0.6134832", "0.6092321", "0.6072719", "0.60461104", "0.60439694", "0.6033779", "0.60330987", "0.6009785", "0.5991918", "0.5982442", "0.5966009", "0.5952567", "0.5951396", "0.59510344", "0.59478694", "0.5942312", "0.5929351", "0.59273773", "0.5921784", "0.590285", "0.59013283", "0.58985287", "0.5868939", "0.5859671", "0.58551145", "0.5821052", "0.5820403", "0.58088005", "0.58077484", "0.58039486", "0.5803825", "0.57983714", "0.57800984", "0.57794833", "0.57790667", "0.577418", "0.5769174", "0.5758801", "0.57570374", "0.5737391", "0.5733397", "0.5723727", "0.5719907", "0.5717692", "0.57140154", "0.5713681", "0.57132924", "0.57126784", "0.57069105", "0.5704673", "0.5704673", "0.5704673", "0.5704673", "0.5704673", "0.57005405", "0.56877935", "0.56844413", "0.56791663", "0.56712383", "0.5664726", "0.5664077", "0.5659158", "0.5658071", "0.5655913", "0.56555164", "0.5642706", "0.56325555", "0.56315845", "0.5630157", "0.5625057", "0.56245416", "0.56211936", "0.5617884", "0.56173927", "0.5615271", "0.56132346", "0.5606369", "0.55990976", "0.55958766", "0.5589213", "0.5588203", "0.55833304", "0.5581488", "0.55766785", "0.55766314", "0.5575511", "0.55707633" ]
0.0
-1
////// // // // // // // // // // /////////// ///// Question Answer Logic Starts Here //// ///// // // // // // // // // // //////////____________________
def answer_to_question(answer) @recipients = answer.question.profile.email @subject = "Your question has been answered" self.body = {:question => answer.question, :answer => answer, :profile_url => url_for(:controller => :profiles, :action => :show, :id => answer.profile_id), :question_url => url_for(:controller => :questions, :action => :show, :id => answer.question_id), } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prapor_quest; end", "def who_we_are\r\n end", "def find_answer\nend", "def q3_page\n\"\n\n\n\n\n\n\n\n\n\n What is your Food Mood?\n\n *-------------------* *-------------------* *-------------------*\n | | | | | |\n | | | | | |\n | | | | | |\n | Old Faves | | Surprise Me! | | Craving |\n | | | | | |\n | | | | | |\n | | | | | |\n *-------------------* *-------------------* *-------------------*\n\n 1: 2: Input your Craving:\n\nAnswer: \"\nend", "def ask_question\n\n end", "def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend", "def skier_quest; end", "def similar_questions\n\n end", "def questions\n \n end", "def quiz\n end", "def mechanic_quest; end", "def process_question\n #There are two types of Questions - One which starts with 'how many Credits is ' and the other is 'how much is' \n if @line.start_with? \"how many Credits is \"\n main_question_part = @line.split(\"how many Credits is \")[1] #e.g from how many Credits is glob prok Silver ? gets glob prok Silver ?\n galatic_literals = Translation.translate_question(main_question_part) #e.g from glob prok Silver gets glob prok\n trademetal = TradeMetal.get_trade_metal(main_question_part) #e.g from glob prok Silver gets Silver\n if trademetal && galatic_literals\n trademetal_price_credit = (galatic_literals.galactic_words_to_numeral * trademetal.unit_price).to_i\n puts \"#{galatic_literals} #{trademetal.coin_name} is #{trademetal_price_credit} Credits\"\n return\n end\n elsif @line.start_with? \"how much is \"\n main_question_part = @line.split(\"how much is \")[1] #e.g from how much is pish tegj glob glob ? gets pish tegj glob glob ?\n galatic_literals = Translation.translate_question(main_question_part) #e.g from pish tegj glob glob ? gets pish tegj glob glob\n if galatic_literals\n conversion_value = galatic_literals.galactic_words_to_numeral\n puts \"#{galatic_literals} is #{conversion_value}\"\n return\n end\n end\n throw_away_meaningless_line\n end", "def process_question\n\t\t#There are two types of Questions - One which starts with 'how many Credits is ' and the other is 'how much is' \n\t\tif @line.start_with? \"how many Credits is \"\n\t\t\tmain_question_part = @line.split(\"how many Credits is \")[1] #e.g from how many Credits is glob prok Silver ? gets glob prok Silver ?\n\t\t\tgalatic_literals = Translation.translate_question(main_question_part) #e.g from glob prok Silver gets glob prok\n\t\t\ttrademetal = TradeMetal.get_trade_metal(main_question_part) #e.g from glob prok Silver gets Silver\n\t\t\tif trademetal && galatic_literals\n\t\t\t\ttrademetal_price_credit = (galatic_literals.galactic_words_to_numeral * trademetal.unit_price).to_i\n\t\t\t\tputs \"#{galatic_literals} #{trademetal.coin_name} is #{trademetal_price_credit} Credits\"\n\t\t\t\treturn\n\t\t\tend\n\t\telsif @line.start_with? \"how much is \"\n\t\t\tmain_question_part = @line.split(\"how much is \")[1] #e.g from how much is pish tegj glob glob ? gets pish tegj glob glob ?\n\t\t\tgalatic_literals = Translation.translate_question(main_question_part) #e.g from pish tegj glob glob ? gets pish tegj glob glob\n\t\t\tif galatic_literals\n\t\t\t\tconversion_value = galatic_literals.galactic_words_to_numeral\n\t\t\t\tputs \"#{galatic_literals} is #{conversion_value}\"\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\tthrow_away_meaningless_line\n\tend", "def quality_control(answer)\n\tif answer == \"cheat code\"\n\t\tsession[\"p1_total_score\"] = 100 - 1 \n\t\treturn true\n\telsif answer == \"rock\" or answer == \"scissors\" or answer == \"paper\"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\t\nend", "def result_of_checking; end", "def ask_question_and_check_answer\n question = MathGame::Question.new\n puts \"#{@turn}: #{question.display_question}\"\n question.obtain_answer\n question.display_message_on_answer\n question.correct?\n end", "def phq2?; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end", "def verify_answer?(question, answer)\n case question[:type]\n when :add\n question[:first_num] + question[:second_num] == answer\n when :subtract\n question[:first_num] - question[:second_num] == answer\n when :multiply\n question[:first_num] * question[:second_num] == answer\n when :divide\n question[:first_num] / question[:second_num] == answer\n end\nend", "def determine_correctness\n answer = self.question.answer\n \t#Upcase to take care of all capitalization issues\n \tresponse = self.content.upcase\n\n \tanswer = answer.split(', ')\n\n \t#Score Keeping\n \tscore = 0\n \tscore_incremental = 1.0/answer.length\n \t\n \t#Determining how many of keywords are in response\n \tanswer.each do |correct_word|\n \t\tcorrect_word = correct_word.upcase\n \t\tif response.include?(correct_word)\n \t\t\tscore += score_incremental\n \t\tend\n \tend\n \tself.correctness = score\n end", "def faq\n\n end", "def validate_answer(answer)\n end", "def ask\n end", "def questioning\n return text\n end", "def questioning\n return text\n end", "def equation\n # assigning a variable with the \n question = @math_equations.to_a.sample\n math_count = 0\n puts question[:question]\n answer = gets.chomp.to_i\n\n # While variable math_count is less than 3\n while math_count < 3\n # if the math count is more than 1 and question does not equal to answer\n if math_count > 1 and question[:answer] != answer\n var = \"taxi\".colorize(:yellow).underline\n puts \"It seems you may still be drunk. It's safer to catch a #{var}.\"\n # if the variable \n elsif question[:answer] == answer \n font = TTY::Font.new(:doom) \n puts font.write \"You got it right!\"\n puts \"\"\n puts \"You are okay to drive, but DRIVE SAFELY!\"\n break\n else\n puts \"You seems you got quesiton wrong. Try answer it again.\"\n answer = gets.chomp.to_i\n end\n math_count += 1\n end\n end", "def question_type\n Exercise::Q_CODING\n end", "def explanation\n end", "def therapist_quest; end", "def food_question1(food_answer1)\n if food_answer1 == \"never\"\n @food_score1 = 0\n elsif food_answer1 == \"1 - 3 days per week\"\n @food_score1 = 1\n elsif food_answer1 == \"4 or more days per week\"\n @food_score1 = 2\n end\n @food_score1\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def faq\n end", "def faq\n end", "def anchored; end", "def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end", "def perform(user, questions)\n \n end", "def check_answer_input(range) #this method both prints and checks the answer\r\n\r\n\tequation = new_equation(range)\r\n\tanswer = false\r\n\r\n\twhile answer == false\r\n\t\tputs equation\r\n\t\tresult = eval equation\r\n\t\tputs \"{answer: #{result}}\"\r\n\t\tanswer_user = gets.chomp\r\n\r\n\t\tif answer_user.downcase == \"q\" #make a new method for if ??? - yes, I would make a new method\r\n\t\t\texit\r\n\t\telsif answer_user.to_i == result\r\n\t\t\tputs \"Correct!\"\r\n\t\t\tcheck_answer_input(range)\r\n\t\telse\r\n\t\t\tputs \"Try again\"\r\n\t\tend\r\n\tend\r\nend", "def condition; end", "def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end", "def questions_explanation\n puts \"Time to do the quiz!.\"\n puts \"\"\n puts \"Each question will be printed to the screen.\"\n puts \"Once you see it, simply type in your answer and hit the enter/return key.\"\n puts \"If you can't think of an answer right away, you can skip the question and return to it at the end.\"\n puts \"\"\n puts \"Ok, let's go! (Hit enter/return when you're ready)\"\n gets\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend", "def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend", "def positive?; end", "def food_question2(food_answer2)\n if food_answer2 == \"never\"\n @food_score2 = 0\n elsif food_answer2 == \"1 - 3 days per week\"\n @food_score2 = 1\n elsif food_answer2 == \"4 or more days per week\"\n @food_score2 = 2\n end\n @food_score2\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def feedback\n # check to see if correct is true\n if correct?\n # if correct is true return \"Correct!\"\n \"Correct!\"\n # or else return \"Incorrect.\"\n else\n \"Incorrect.\"\n end\n end", "def p15\n\t\nend", "def question\n answer.question\n end", "def in_law; end", "def fitness_question1(fitness_answer1)\n if fitness_answer1 == \"3 or more times per week\"\n @fitness_score1 = 0\n elsif fitness_answer1 == \"1 - 2 times per week\"\n @fitness_score1 = 1\n elsif fitness_answer1 == \"never\"\n @fitness_score1 = 2\n end\n @fitness_score1\nend", "def question!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n\n type = QUESTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 165:11: '?'\n match( 0x3f )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end", "def probers; end", "def fashion_question1(fashion_answer1)\n if fashion_answer1 == \"I don't shop.\"\n @fashion_score1 = 0\n elsif fashion_answer1 == \"thrift stores/second hand\"\n @fashion_score1 = 1\n elsif fashion_answer1 == \"Forever 21, H&M, Zara, Urban Outfitters, GAP, Wet Seal\"\n @fashion_score1 = 2\n end\n @fashion_score1\nend", "def informational?; end", "def proceed!; end", "def proceed!; end", "def askQuestion(timeframe=1*DAY_TO_SECONDS)\n facts = @kb.getFacts(timeframe)\n while facts.length > 0\n fact = facts.sample\n matched = []\n @qat.each do |qat|\n ismatch = qat.matches(fact)\n matched.push(ismatch) if ismatch\n end\n qat,matchesArr = matched.sample\n if not qat #matching failed to match QAT and Tag\n facts = facts - [fact]\n next\n else\n #write question\n question,answers = qat.generateQuestionAnswerPair(fact,matchesArr)\n answers = [answers]\n if qat.aconds.first[:type] and qat.aconds.first[:type].include? 'list'\n similar = @kb.getSimilar(fact,timeframe,(not qat.aconds.first[:type].include? 'anysubclass'))\n similar.each do |simfact|\n answers << qat.generateQuestionAnswerPair(simfact,matchesArr)[1]\n end\n end\n puts \"Question:#{question}\"\n puts \"Possible Answers:#{answers.map {|a| a.gsub(\"\\n\",\"\")}}\"\n return [question,answers]\n end\n end\n return false\n end", "def answerQuestion()\n return if $intQuestionOnScreen == 0\n case $strAnswer\n when \"A\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n when \"B\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n when \"C\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"D\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"AB\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n when \"AC\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"AD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"BC\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"BD\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"CD\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"ABC\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"ABD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"ACD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"BCD\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n else\n $lblAnswerA['style'] =\"Correct.TLabel\"\n $lblAnswerB['style'] =\"Correct.TLabel\"\n $lblAnswerC['style'] =\"Correct.TLabel\"\n $lblAnswerD['style'] =\"Correct.TLabel\"\n end\nend", "def formation; end", "def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end", "def peacekeeper_quest; end", "def strategy; end", "def what_was_that?\n puts \"-\" * 70\n puts \"***** I didn't catch that *****\"\n puts \"\"\n puts \"Would you please try a different answer?\"\n puts \"-\" * 70\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def generate_question(player)\n\n question = Question.new\n\n operand_1 = generate_an_operand\n\n operator = generate_an_operator\n\n operand_2 = generate_an_operand\n\n # calculate actual_answer\n case\n when operator == \"plus\"\n question.actual_answer = operand_1.to_f + operand_2.to_f\n when operator == \"minus\"\n question.actual_answer = operand_1.to_f - operand_2.to_f\n when operator == \"times\"\n question.actual_answer = operand_1.to_f * operand_2.to_f\n when operator == \"divide by\"\n question.actual_answer = operand_1.to_f / operand_2.to_f\n else\n puts \"generate_question() method -- Error calculating actual_answer operator wrong #{operator}\"\n end\n\n # limit float to two decimal places\n question.actual_answer = question.actual_answer.round(2)\n\n question.text_of_question = \"#{player.name}: What does #{operand_1} #{operator} #{operand_2} equal?\"\n\n question\nend", "def fence_quest; end", "def contains_response_and_soln?() true ; end", "def initialize answer; @answer = answer\n@solved = false\n# Validate input\n raise \"Answer must be between 1 and 100\" unless VALID_Numbers.include? @answer\n end", "def verify_answer(question, current_player)\n\n if question.answer == question.actual_answer\n result = \"won round\"\n current_player.score += 1\n else\n result = \"lost round\"\n current_player.score -= 1\n end\n\n result\n\nend", "def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend", "def semact?; false; end", "def ask_if_ready(step, index)\n puts \"Are you ready for step #{index + 1}?\\n(#{step[:description]})\"\n answer = gets.chomp\n\n answer.upcase == 'Y' #if answer equals to yes...(if true)\nend", "def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end", "def test_answer_initalized\n assert_equal(\"Pavel\", @question.answer)\n end", "def will_answer?\n return true\n end", "def coach_answer(your_message)\n # TODO: return coach answer to your_message\n if your_message[-1] == \"?\" then puts \"Silly question, get dressed and go to work !\"\n else puts \"I don't care son, get dressed and go to work !\"\n end\nend", "def revealed? ; false ; end", "def tell_fortune()\r\n\t\tprint \"The answer is \" + $predicition + \". \\n\\n: \"\r\n\tend", "def ask_for_answer(curr_question, answer_hash, correct, colorized_ans = nil)\n fifty = $game_session.fifty_fifty == 0 ? \"#{$game_session.fifty_fifty}\".colorize(:red) : \"#{$game_session.fifty_fifty}\"\n phone = $game_session.phone_a_friend == 0 ? \"#{$game_session.phone_a_friend}\".colorize(:red) : \"#{$game_session.phone_a_friend}\"\n puts \" Current bear-bucks: #{$game_session.current_total_score} 50/50: #{fifty} Phone-a-friend: #{phone}\"\n puts\n print \"Enter your answer: \"\n # user_input = gets.chomp\n user_input = get_answer(curr_question)\n\n # Check for use of gameshow helpers\n if (user_input.downcase.start_with?(\"fifty\") || user_input.start_with?(\"50\"))\n if $game_session.fifty_fifty == 0\n no_helper_usage(\"fifty-fifty\", curr_question, answer_hash, correct, colorized_ans)\n else\n colorized_ans = fifty_fifty(answer_hash, correct)\n print_question(curr_question)\n puts colorized_ans\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n elsif (user_input.downcase.start_with?(\"phone\"))\n if $game_session.phone_a_friend == 0\n no_helper_usage(\"phone-a-friend\", curr_question, answer_hash, correct, colorized_ans)\n else\n phone_a_friend(curr_question, answer_hash, colorized_ans)\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n # Else check answer for correctness\n else\n check_answer(curr_question, answer_hash, user_input)\n sleep(3) if !$TEST_MODE\n system \"clear\"\n end\nend", "def win_condition\nend", "def scientist; end", "def challenge; end", "def food_question3(food_answer3)\n if food_answer3 == \"none\"\n @food_score3 = 0\n elsif food_answer3 == \"1 meal\"\n @food_score3 = 1\n elsif food_answer3 == \"2+ meals\"\n @food_score3 = 2\n end\n @food_score3\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def corrections; end", "def how_it_works\r\n end", "def missed?; end", "def king_richard_iii; end", "def scoring(answer)\n# everytime someone chooses a certain letter than 1 will be added on to their behind the senses score \n if answer == \"a\"\n @@action += 1\n elsif answer == \"b\"\n @@romance += 1\n elsif answer == \"c\"\n @@horror += 1\n elsif answer == \"d\"\n @@family += 1\n elsif answer == \"e\"\n @@comedy += 1\n else\n return \"nothing\"\n end\n\nend", "def evaluate_q42_data(data)\n\tcase\n\twhen data <= 2\n\t\t:yes\n\twhen data <= 4\n\t\t:sometimes\n\twhen data == 5\n\t\t:never\n\telse\n\t\t:refuse_to_say\n\tend\nend", "def corrector; end", "def corrector; end", "def corrector; end", "def corrector; end", "def ask question\r\n\twhile true\r\n\t\tputs question\r\n\t\treply = gets.chomp.downcase\r\n\t\tif reply == 'yes'\r\n\t\t\t\treturn true\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\tif reply == 'no'\r\n\t\t\t\treturn false\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\t#else - I had an \"else\" in here, which doesn't belong. Need to remove and just 'Puts' if neither of the two above are included.\r\n\r\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\r\n\t\tend\r\n\t\r\nend", "def test_answer_check_works\n assert_equal(true, @question.check_answer?(\"Pavel\"))\n assert_equal(false, @question.check_answer?(\"Wrong Answer\"))\n end", "def schubert; end", "def solved?\n end" ]
[ "0.6147879", "0.61033773", "0.5989831", "0.5969488", "0.5938336", "0.5935493", "0.5892898", "0.58628786", "0.5857635", "0.5847956", "0.58397216", "0.5819048", "0.57810897", "0.5780488", "0.57799315", "0.5769298", "0.57669115", "0.5765418", "0.5764097", "0.57512146", "0.5744161", "0.5742309", "0.5718683", "0.57082254", "0.5703395", "0.5703395", "0.5697611", "0.5671805", "0.56672305", "0.5659001", "0.56499344", "0.56484526", "0.56340677", "0.56340677", "0.5633499", "0.56294423", "0.56250757", "0.56248224", "0.5617299", "0.560878", "0.5598855", "0.5593866", "0.5578066", "0.5578066", "0.5568472", "0.5559606", "0.55568194", "0.55568194", "0.5554694", "0.5552326", "0.554675", "0.5542096", "0.55318874", "0.55274606", "0.55242056", "0.55199015", "0.5515475", "0.551391", "0.551391", "0.55056953", "0.5504724", "0.5503055", "0.5503023", "0.54987156", "0.5498696", "0.54916716", "0.549034", "0.5489429", "0.5487173", "0.5481869", "0.54788816", "0.5477968", "0.5477265", "0.5476698", "0.54760206", "0.54715973", "0.5470189", "0.54691327", "0.54611963", "0.54591024", "0.54577696", "0.5456257", "0.54537034", "0.5452882", "0.5441529", "0.543827", "0.54365194", "0.54362875", "0.5436188", "0.5435956", "0.5432908", "0.5425257", "0.5423828", "0.5423816", "0.5423816", "0.5423816", "0.5423816", "0.5415331", "0.54152375", "0.54098827", "0.5406858" ]
0.0
-1
Overwriting the sign_out redirect path method
def after_sign_out_path_for(resource_or_scope) Rails.env.development? ? root_path : FrontEndApp::ROOT_URL end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end", "def after_sign_out_path_for(_resource_or_scope)\n '/'\n end", "def after_sign_out_path_for(resource_or_scope); end", "def signout_url\n {:controller => 'auth', :action => 'signout'}\n end", "def after_sign_out_path_for(resource_or_scope)\n '/users/sign_in'\n end", "def after_sign_out_path_for(resource_or_scope)\n \"/app/users/sign_in\"\n end", "def after_sign_out_path_for(resource_or_scope)\n Faraday.get(logout_path) if logout_path.present?\n super(resource_or_scope)\n end", "def after_sign_out_path_for(resource)\n '/'\n end", "def after_sign_out_path_for(user)\n '/'\n end", "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n user_session_path\n end", "def sign_out_and_redirect(resource_or_scope); end", "def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end", "def after_sign_out_path_for(resource_or_scope)\n flash[:logout] = true\n root_path\n end", "def sign_out_and_redirect!(return_to = \"/\")\n sign_out_user\n redirect_to sign_out_url(return_to)\n end", "def after_sign_out_path_for(resource)\n \tnew_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end", "def after_sign_out_path_for(resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n '/'\n end", "def after_sign_out_path_for(resource_or_scope)\n '/'\n end", "def after_sign_out_path_for user\n reset_session\n\n # for hijacking\n # cookies.delete :secure_user_id\n\n new_user_session_path\n # root_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n # require 'pry'\n # binding.pry\n # Note: at this time: flash[:notice] => \"Signed out successfully.\"\n # current_user is nil.\n new_user_session_path # signIn page\n end", "def after_sign_out_path_for(resource_or_scope)\n # path before sign out request\n \"#{URI(request.referer).path}?logged_out=1\"\n end", "def destroy\n super\n after_sign_out_path_for(resource)\n end", "def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end", "def after_sign_out_path_for(resource_or_scope)\n if request.params[:type] == \"sso\"\n Rails.configuration.devise[:sign_out_redirect_url]\n else\n super\n end\n end", "def after_sign_out_path_for(resource_or_scope)\r\n '/'\r\n end", "def after_sign_out_path_for(resource_or_scope)\n sign_in_path\n end", "def after_sign_out_path_for(resource_or_scope)\n sign_in_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(_resource)\n root_path\n end", "def after_sign_out_path_for(_resource)\n root_path\n end", "def after_sign_out_path_for(_resource_or_scope)\n root_path\n # new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n cookies.delete :pa_auth_token\n \n \"#{Civiccommons::PeopleAggregator.URL}/logout.php?redirect=http://#{request.host}#{request.port == \"80\" ? nil : \":#{request.port}\"}\"\n end", "def after_sign_out_path_for(resource)\n #if current_user_signed_in?\n # redirect_to home_path \n # else\n redirect_to site_index_path \n #end \n end", "def after_sign_out_path_for(_resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource)\n\t\tnew_user_session_path\n\tend", "def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path \n end", "def sign_out\n logout\n end", "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end", "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end", "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end", "def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end", "def after_sign_out_path_for(resource_or_scope)\n \tuser_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n \tlogin_path\n \tend", "def after_sign_out_path_for(resource_or_scope)\n login_url\n end", "def after_sign_out_path_for(resource_or_scope)\n home_path(:ref => \"logout\")\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n \tlogin_path\n end", "def after_sign_out_path_for(resource_or_scope)\n \t\t\troot_path\n \t\t end", "def after_sign_out_path_for(_resource)\n root_url\n end", "def after_sign_out_path_for resource_or_scope\n redirect_uri = params[:redirect_uri]\n redirect_uri ? redirect_uri : super\n end", "def after_sign_out_path_for(resource_or_scope)\n '/members/sign_in'\n end", "def signout\n self.oaw_signout\n redirect_to root_url\n end", "def after_sign_out_path_for(resource)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n login_path\n end", "def after_sign_out_path_for(resource_or_scope)\n # root_path\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\r\n login_path\r\n end", "def after_sign_out_path_for(_)\n root_url\n end", "def after_sign_out_path_for(resource)\r\n app_root + \"/sessions/new\"\r\n end", "def after_sign_out_path_for(resource)\n root_path\n end", "def after_sign_out_path_for(resource)\n root_path\n end", "def after_sign_out_path_for(resource)\n root_path\n end", "def signed_out_user\n redirect_to root_path unless !user_signed_in?\n end", "def after_sign_out_path_for(params)\n bienvenida_path\n end", "def destroy\n redirect_path = after_sign_out_path_for(\"user\")\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(\"user\"))\n set_flash_message :notice, :signed_out if signed_out && is_navigational_format?\n super\n end", "def after_sign_out_path_for(_resource)\n I18n.locale == I18n.default_locale ? '/' : \"/#{I18n.locale}\"\n end", "def after_sign_out_path_for(_resource_or_scope)\n home_path\n end", "def after_sign_out_path_for(resource_or_scope)\n \tnew_user_session_path\n end", "def after_sign_out_path_for(user)\n new_user_session_path\n end", "def after_sign_out_path_for(resource)\n home_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end", "def after_sign_out_path_for(resource_or_scope)\n new_user_session_path\n end" ]
[ "0.8102037", "0.8007481", "0.7984188", "0.79324496", "0.7897868", "0.78892565", "0.7874593", "0.78685254", "0.7857867", "0.78436327", "0.78436327", "0.78436327", "0.78436327", "0.7842701", "0.7821579", "0.77880424", "0.7748489", "0.77373666", "0.7731692", "0.77291566", "0.77291566", "0.77291566", "0.77291566", "0.77291566", "0.77275157", "0.77275157", "0.77213097", "0.7716111", "0.77091455", "0.7708274", "0.7705286", "0.7694537", "0.769133", "0.76831216", "0.76831216", "0.7682263", "0.7682263", "0.76777554", "0.76777554", "0.766948", "0.76651865", "0.7643722", "0.7641334", "0.7640336", "0.7632876", "0.76290107", "0.7623703", "0.7622437", "0.7622437", "0.7622437", "0.7622437", "0.7620571", "0.76168233", "0.76150995", "0.7613417", "0.76068157", "0.7601874", "0.75970936", "0.75918543", "0.7589092", "0.7588269", "0.75851965", "0.7572588", "0.75579655", "0.75575614", "0.7550016", "0.75415194", "0.75405365", "0.7534009", "0.7534009", "0.7534009", "0.7527172", "0.7521995", "0.75215167", "0.75173414", "0.7514277", "0.7509254", "0.7504709", "0.74846214", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154", "0.74819154" ]
0.0
-1
The message version is the 1B encoding of the `VERSION` above. It is encoded using Arraypack 'C' (8bit unsigned integer). The max value it can encode is 255 (`(2 8) 1`).
def msg_version; @msg_version ||= PackedHeader.new(1, 'C').encode(VERSION); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_version\n msg['_version']\n end", "def message_version\r\n\t\t\tCURRENT_VERSION\r\n\t\tend", "def version\na = unpack\nv = (a[2] & 0xF000).to_s(16)[0].chr.to_i\nreturn v if (1..5).include? v\nreturn nil\nend", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def vvec( version_string )\n\t\t\treturn version_string.split( '.' ).\n\t\t\t\tcollect {|num| num.to_i }.pack( 'N*' )\n\t\tend", "def version; PACKET_VERSION; end", "def version_hex\n @version_hex ||= control_transfer(function: :version, dataIn: 1).unpack('c').first\n end", "def vvec( ver )\n\t\treturn ver.split('.').collect {|char| char.to_i }.pack('N*')\n\tend", "def vvec( ver )\n\t\treturn ver.split('.').collect {|char| char.to_i }.pack('N*')\n\tend", "def vvec( ver )\n\t\treturn ver.split('.').collect {|char| char.to_i }.pack('N*')\n\tend", "def vvec( ver )\n\t\treturn ver.split('.').collect {|char| char.to_i }.pack('N*')\n\tend", "def vvec( ver )\n\t\treturn ver.split('.').collect {|char| char.to_i }.pack('N*')\n\tend", "def vvec( ver )\n\t\treturn ver.split('.').collect {|char| char.to_i }.pack('N*')\n\tend", "def binary_version; end", "def protocol_version\n 1.0\n end", "def get_version_message(version)\n unless @versions.key?(OcflTools::Utils.version_int_to_string(version))\n raise OcflTools::Errors::RequestedKeyNotFound, \"Version #{version} does not yet exist!\"\n end\n\n @versions[OcflTools::Utils.version_int_to_string(version)]['message']\n end", "def firmware_version\n buffer = PN532::DataBuffer.new\n PN532.get_firmware_version(pn_struct, buffer)\n buffer[1..3]\n end", "def short_version\n\t\tretval = message.length > 35 ? message[0..34] << \"...\" : message\n\tend", "def version\n v = KJess::Request::Version.new\n r = send_recv( v )\n return r.version if Response::Version === r\n raise KJess::Error, \"Unexpected Response from VERSION command\"\n end", "def send_version_message\n message = Message.create(\n :version,\n @node.host, @node.port, @node.services,\n \"0.0.0.0\", Client::LISTEN_ON_PORT, Client::SERVICES_PROVIDED, # The :src_ip will be ignored by our peer.\n @client.nonce\n )\n send_data message\n end", "def value\n @bytes.pack('C*')\n end", "def msg_size; @msg_size ||= PackedHeader.new(4, 'N'); end", "def header\n MAGIC + [VERSION].pack('n')\n end", "def send_version\n from = \"#{@node.external_ip}:#{@node.config[:listen][1]}\"\n version = Bitcoin::Protocol::Version.new({\n :version => 70001,\n :last_block => @node.store.get_depth,\n :from => from,\n :to => @host,\n :user_agent => \"/bitcoin-ruby:#{Bitcoin::VERSION}/\",\n #:user_agent => \"/Satoshi:0.8.3/\",\n })\n send_data(version.to_pkt)\n log.debug { \"<< version: #{Bitcoin.network[:protocol_version]}\" }\n end", "def send_version\n version = Bitcoin::Protocol::Version.new({\n :version => 70001,\n :last_block => Toshi::Models::Block.max_height,\n :from => \"127.0.0.1:#{Bitcoin.network[:default_port]}\",\n :to => @host,\n :user_agent => user_agent,\n })\n send_data(version.to_pkt)\n log \">> version: #{version.version}, user_agent: #{version.user_agent}\" if @debug\n end", "def serialize_old_format\n buf = [version].pack('V')\n buf << Bitcoin.pack_var_int(inputs.length) << inputs.map(&:to_payload).join\n buf << Bitcoin.pack_var_int(outputs.length) << outputs.map(&:to_payload).join\n buf << [lock_time].pack('V')\n buf\n end", "def to_s\n [0xFFFFFFFF, @content_data.string].pack('Va*')\n end", "def version\n v = @properties['VERSION']\n\n unless v\n raise InvalidEncodingError, \"Invalid calendar, no version field!\"\n end\n\n v = v.to_f * 10\n v = v.to_i\n end", "def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end", "def version_needed_to_extract\n 0x0014\n end", "def version_needed_to_extract\n 0x0014\n end", "def protocol_version\n @protocol_version\n end", "def to_version\n Babushka::VersionStr.new self\n end", "def to_version\n Babushka::VersionStr.new self\n end", "def version\n 0\n end", "def properties\n { 'message_type' => 'compatibility', 'protocol_version' => @protocol_version }\n end", "def client_protocol_version\n match = @automation_client << VERSION_CONSTANT_NAME >> /\\d*/\n version = match[0].to_i\n return version\n end", "def encryption_control_information\n \"Version: 1\"\n end", "def version\n network(hex: true) + 1\n end", "def ver\n @values.fetch('ver') { \n @values['ver'] = 1\n }\n end", "def serialize(message)\n message.to_msgpack\n end", "def serialize_old_format\n buf = [self.version].pack('V')\n buf << Bitcoin.pack_var_int(self.inputs.length) << self.inputs.order(index: :asc).map(&:to_payload).join\n buf << Bitcoin.pack_var_int(self.outputs.length) << self.outputs.order(n: :asc).map(&:to_payload).join\n buf << [self.lock_time].pack('V')\n buf\n end", "def version_id\n \"#{size}+#{timestamp}-#{md5}\"\n end", "def version\n FlexArray::VERSION\n end", "def encode_uint8(value)\n [value].pack(\"C\")\n end", "def decode_message(message)\n if message[0..1].unpack(\"CC\") == [Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION]\n begin\n Marshal.load message\n rescue => ex\n raise InvalidMessageError, \"invalid message: #{ex}\"\n end\n else raise InvalidMessageError, \"couldn't determine message format: #{message}\"\n end\n end", "def version\n Airplay.configuration.load\n v = Airplay::CLI::VERSION\n puts <<-EOS\n\n i@@@@@@@@@@@@@@@@@@@@@@@@@\n i80000000000000000000000000000\n i80000000000000000000000000000000G\n i8000000000000000000000000000000000000\n i80000000000000000000000000000000000000000\n @00000 @0000000000000000000000000000000000000@ 000000@\n @0000008 @000000000000000000000000000000000@ 80000000@\n @001 @00000000000000000000000000000@ 100@\n @001 @0000000000000000000000000@ 100@\n @001 80000000000000000000008 t00@\n @001 8000000000000000008 t00@\n @001 800000000000008 t00@\n @001 G000000000G t00@\n @001 G00000G t00@\n @001 L0L t00@\n @001 t00@\n @001 air t00@\n @001 #{v} t00@\n @001 t00@\n @001 t00@\n @001 100@\n @00000000000000000000000000000000000000000000000000000G000@\n @000000000000000000000000000000000000000000000000000000000@\n\n EOS\n end", "def version\n 1\n end", "def to_s\n \"<Version #{number}>\"\n end", "def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend", "def version=(val)\n if (val.kind_of?(Integer)) \n make_major_minor_version(val & 0xff)\n elsif(val.kind_of?(String))\n raise ArgumentError, \"Value should be 1-byte, but was #{val.length}.\" if (val.length != 1) \n make_major_minor_version(val.unpack('C')[0])\n else\n raise ArgumentError, \"Expected Integer, but #{val.class} provided.\" \n end\n end", "def version\n return ExtPubkey.version_from_purpose(number) if depth == 1\n ver ? ver : Bitcoin.chain_params.extended_pubkey_version\n end", "def marshal_dump\n [version]\n end", "def bytes\n\t\tbin.unpack('C*')\n\tend", "def ver\n @values['ver']\n end", "def packed()\n header = self.version.chr + \n @type.chr + \n @seq_no.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@session_id,4) + \n TacacsPlus.pack_int_net(@length,4)\n return(header)\n end", "def packed()\n body = @status.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@server_msg_len,2) + \n TacacsPlus.pack_int_net(@data_len,2) \n \n body << @server_msg if (@server_msg)\n body << @data if (@data) \n return(body)\n end", "def to_s\n @version\n end", "def version\n build_string\n end", "def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end", "def to_s\n @version\n end", "def to_s\n @version\n end", "def marshal_dump\n [version]\n end", "def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end", "def version\n @sock.cmd(\"String\" => \"version\", \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def to_s\n packet = build_packet\n @packet_size = packet.length\n return [@packet_size].pack(\"V\") + packet\n end", "def set_version_message(version, message)\n unless @versions.key?(OcflTools::Utils.version_int_to_string(version))\n raise OcflTools::Errors::RequestedKeyNotFound, \"Version #{version} does not yet exist!\"\n end\n\n @versions[OcflTools::Utils.version_int_to_string(version)]['message'] = message\n end", "def eka_version\n if @version.first < 8\n 1\n elsif @version.first > 8\n 2\n elsif @version.last == \"a\"\n 1\n elsif @version.last == \"b\"\n 2\n else\n raise\n end\n end", "def to_s\n @@version ||= [ MAJOR, MINOR, PATCH ] * '.'\n end", "def pack_format\n \"a#{width}\"\n end", "def version_number\n @version\n end", "def version\n @version || 0\n end", "def packed()\n body = TacacsPlus.pack_int_net(@server_msg_len,2) +\n TacacsPlus.pack_int_net(@data_len,2) + \n @status.chr\n \n body << @server_msg if (@server_msg)\n body << @data if (@data)\n\n return(body)\n end", "def ver\n @values.fetch('ai.application.ver') { \n @values['ai.application.ver'] = nil\n }\n end", "def str2bin(message)\n binary = message.unpack(\"B*\")[0]\n return binary\nend", "def encode_uint8(int); [int].pack(PACK_FORMAT_UINT8); end", "def build_version\n @semver.to_s '%M.%m.%p'\n end", "def generate_full_payload_address\n case version\n when CKB::Address::Version::CKB2019\n format_type = CKB::ScriptHashType::TYPE == script.hash_type ? FULL_TYPE_FORMAT : FULL_DATA_FORMAT\n CKB::ConvertAddress.encode(prefix, first_version_full_payload(format_type), Bech32::Encoding::BECH32)\n when CKB::Address::Version::CKB2021\n # payload = 0x00 | code_hash | hash_type | args\n CKB::ConvertAddress.encode(prefix, current_version_full_payload(FULL_WITH_IDENTIFIER_FORMAT), Bech32::Encoding::BECH32M)\n else\n raise InvalidVersionError, \"invalid address version\"\n end\n end", "def marshal_dump\n [@version]\n end", "def version\n 1\n end", "def version\n (version_from_class.to_f / 10).to_s\n end", "def minimum_required_minor_engine_version\n data.minimum_required_minor_engine_version\n end", "def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end", "def to_ber_application tag\n [0x40 + tag].pack(\"C\") + to_ber_internal\n end", "def v51\n fetch_version(:v51)\n end", "def marshal_load(array)\n self.version = array[0]\n end", "def version(t)\n @socket << \"VERSION #{t}\"\n end", "def package_version\n @semver.to_s '%M.%m.%p%s'\n end", "def wrap(msg,len)\n finalmsg = [msg].pack(\"v\")\n finalLen = [len].pack(\"V\")\n return finalmsg+finalLen\nend", "def fbe_body\n 4 + 4 \\\n + byte0.fbe_size \\\n + byte1.fbe_size \\\n + byte2.fbe_size \\\n + byte3.fbe_size \\\n + byte4.fbe_size \\\n + byte5.fbe_size \\\n + char0.fbe_size \\\n + char1.fbe_size \\\n + char2.fbe_size \\\n + char3.fbe_size \\\n + char4.fbe_size \\\n + char5.fbe_size \\\n + wchar0.fbe_size \\\n + wchar1.fbe_size \\\n + wchar2.fbe_size \\\n + wchar3.fbe_size \\\n + wchar4.fbe_size \\\n + wchar5.fbe_size \\\n + int8b0.fbe_size \\\n + int8b1.fbe_size \\\n + int8b2.fbe_size \\\n + int8b3.fbe_size \\\n + int8b4.fbe_size \\\n + int8b5.fbe_size \\\n + uint8b0.fbe_size \\\n + uint8b1.fbe_size \\\n + uint8b2.fbe_size \\\n + uint8b3.fbe_size \\\n + uint8b4.fbe_size \\\n + uint8b5.fbe_size \\\n + int16b0.fbe_size \\\n + int16b1.fbe_size \\\n + int16b2.fbe_size \\\n + int16b3.fbe_size \\\n + int16b4.fbe_size \\\n + int16b5.fbe_size \\\n + uint16b0.fbe_size \\\n + uint16b1.fbe_size \\\n + uint16b2.fbe_size \\\n + uint16b3.fbe_size \\\n + uint16b4.fbe_size \\\n + uint16b5.fbe_size \\\n + int32b0.fbe_size \\\n + int32b1.fbe_size \\\n + int32b2.fbe_size \\\n + int32b3.fbe_size \\\n + int32b4.fbe_size \\\n + int32b5.fbe_size \\\n + uint32b0.fbe_size \\\n + uint32b1.fbe_size \\\n + uint32b2.fbe_size \\\n + uint32b3.fbe_size \\\n + uint32b4.fbe_size \\\n + uint32b5.fbe_size \\\n + int64b0.fbe_size \\\n + int64b1.fbe_size \\\n + int64b2.fbe_size \\\n + int64b3.fbe_size \\\n + int64b4.fbe_size \\\n + int64b5.fbe_size \\\n + uint64b0.fbe_size \\\n + uint64b1.fbe_size \\\n + uint64b2.fbe_size \\\n + uint64b3.fbe_size \\\n + uint64b4.fbe_size \\\n + uint64b5.fbe_size \\\n end", "def minor_version; end", "def compute_pack_code(size: self.size, integer: self.integer?, unsigned: self.unsigned?)\n if integer\n INTEGER_PACK_CODES[[size, unsigned, ModelKit::Types.big_endian?]]\n else\n FLOAT_PACK_CODES[[size, ModelKit::Types.big_endian?]]\n end\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def encode # rubocop:disable Metrics/AbcSize\n [\n DATA_STREAM, name.size, name,\n typename.size, typename,\n registry_xml.size, registry_xml,\n metadata_yaml.size, metadata_yaml\n ].pack(\"CVa#{name.size}Va#{typename.size}\"\\\n \"Va#{registry_xml.size}Va#{metadata_yaml.size}\")\n end", "def pack_message(arr)\n\t\treturn arr.collect {|x| sprintf(\"%03d\", x)}.join(\",\") + \",\"\n\tend", "def version\n data.version\n end", "def version\n render json: { result: 'Ok', version: '1', protocol: 'EBUio-PlugIt' }\n end", "def version\n self[:ip_vhl] >> 4\n end", "def proto_info\n Mysql::Protocol::VERSION\n end" ]
[ "0.68111587", "0.66897714", "0.6539145", "0.6185384", "0.6054243", "0.5982473", "0.5863531", "0.58546376", "0.585361", "0.585361", "0.585361", "0.585361", "0.585361", "0.57980716", "0.5789196", "0.5775429", "0.57546926", "0.5741168", "0.5719009", "0.5622509", "0.56210524", "0.56093544", "0.5602801", "0.56024605", "0.5597581", "0.55555516", "0.55282485", "0.55145127", "0.54529697", "0.5442736", "0.5442736", "0.543017", "0.5429882", "0.5429882", "0.54245275", "0.54195064", "0.5410987", "0.54002136", "0.53991246", "0.53980964", "0.5391765", "0.5361243", "0.5358538", "0.53430766", "0.5340837", "0.5320323", "0.53147304", "0.53124297", "0.5301666", "0.529859", "0.52918464", "0.52881265", "0.52840364", "0.5277687", "0.52768636", "0.5276001", "0.52745813", "0.52695686", "0.5269205", "0.5254734", "0.52325517", "0.52325517", "0.52264506", "0.5224978", "0.52222687", "0.52173674", "0.5205212", "0.51981646", "0.5193582", "0.5175428", "0.51737267", "0.51704067", "0.5158614", "0.5155282", "0.5135272", "0.51282394", "0.5117696", "0.5108522", "0.51063037", "0.51059043", "0.51048887", "0.50991833", "0.5098191", "0.5098101", "0.5094095", "0.50929195", "0.50923926", "0.508068", "0.5078676", "0.5069306", "0.5065929", "0.5065894", "0.5062347", "0.50546974", "0.50438946", "0.5035545", "0.50339293", "0.50258726", "0.5025422", "0.50195605" ]
0.7580419
0
The message size is encoded using Arraypack 'N'. This encoding represents a 32bit (4 byte) unsigned integer. The max value that can be encoded in 4 bytes is 4,294,967,295 (`(2 32) 1`) or a size of ~4GB.
def msg_size; @msg_size ||= PackedHeader.new(4, 'N'); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n to_payload.bytesize\n end", "def total_payload_size\n length + 16 * character_count\n end", "def size\r\n @pack.size\r\n end", "def length\n pack.length\n end", "def size\n (@bit_length*@length*@count)/8.0\n end", "def byte_size(); @data.byte_size + 4; end", "def byte_size()\n @value.length * 4\n end", "def byte_size()\n @value.length * 4\n end", "def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end", "def request_size\n 2 + 2 + topic.length + 4 + 8 + 4\n end", "def size\n @length / 4\n end", "def size_in_nibbles\n adder = size % 4 == 0 ? 0 : 1\n (size / 4) + adder\n end", "def encode\n [@size].pack(\"N\") + @buffer\n end", "def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end", "def max_size()\n AUTHENTICATION_REPLY_MAX_SIZE\n end", "def size\n self.data.length + 4\n end", "def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end", "def compressed_size\n # A number of these are commented out because we just don't care enough to read\n # that section of the header. If we do care, uncomment and check!\n proto = @data_buffer.read_int64(0)\n size = proto & 0xFFFFFFFFFFFF\n msg_type = (proto >> 48) & 0xFF\n\n return nil if msg_type != AS_MSG_TYPE_COMPRESSED\n\n size\n end", "def size_mum_record\n 8\n end", "def max_iso_packet_size(endpoint_number); end", "def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end", "def min_size()\n AUTHENTICATION_CONTINUE_MIN_SIZE\n end", "def padding_size\n -total_payload_size % 64\n end", "def message_length; complete_message.length; end", "def max_packet_size(endpoint_number); end", "def min_size()\n ACCOUNTING_REPLY_MIN_SIZE\n end", "def min_size()\n AUTHENTICATION_REPLY_MIN_SIZE\n end", "def d_size\n uint64(header, 'size') / @blockSize\n end", "def min_chunk_size\n size_t * 4\n end", "def mailbox_size\n @strategy.mailbox_size\n end", "def size\n @data.bytesize\n end", "def specific_max_size(number); end", "def ws_message_size_limit\n\t\t\tGRHttp.ws_message_size_limit\n\t\tend", "def content_size; @message_impl.getContentSize; end", "def pay_size_enc(total_size)\n\t#The 32 here is for the 4 added bytes denoting the total size of the payload\n\tsize_signature = (8 * total_size + 32).to_s(2) #8 for bits per byte\n\n\t#Pad 0's here I think(bad commenting)\n\tsize_signature = ((\"0\" * (32 - size_signature.size)) + size_signature).split('')\nend", "def size\n return @messages.size\n end", "def remote_maximum_packet_size; end", "def getSizeConst(var)\n return \"ARRAYSZ_\" + var.name.upcase\n end", "def size\n @messages_as_text.size\n end", "def maximum_size\n @ids.size\n end", "def size\n stream_size * 8\n end", "def NumMessages\n Builtins.size(@messages)\n end", "def size\n @n\n end", "def size\n @n\n end", "def key_size server, key\n server\n .debug(:object, key)\n .scan(/serializedlength:([0-9]+)/)\n .flatten.first.to_i\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def size\n Float::MAX.to_i\n end", "def message_for_sending\n json = self.to_apple_json\n raise APN::Errors::ExceededMessageSizeError.new(json) if json.size.to_i > APN::Errors::ExceededMessageSizeError::MAX_BYTES\n\n \"\\0\\0 #{self.subscription.to_hexa}\\0#{(json.length).chr}#{json}\"\n end", "def local_maximum_packet_size; end", "def size\n 4\n end", "def max_size; end", "def size\n @max\n end", "def interpret_size(size); end", "def getSizeConst(var)\n return \"ARRAYSZ_\" << var.name.upcase\n end", "def size\n data.values.inject(0){|m,v| m+=v.size}\n end", "def size\n BitCounter.count(@val)\n end", "def size\n pad.size\n end", "def size_in_byte\n return @size_in_byte\n end", "def data_len_bytes()\n 1\n end", "def ws_message_size_limit=val\n\t\t\tGRHttp.ws_message_size_limit = val\n\t\tend", "def size\n\t\tlengths.reduce(&:*)\n\tend", "def size\n @max_entries\n end", "def pack_uint(n)\n bounds_check(n, 0, 4294967295)\n [n].pack('N')\n end", "def default_protocol_envelope_size(protocol_version)\n protocol_version > '2.1' ? 512000 : 153600\n end", "def size; @size end", "def add_max_message_size(current_string)\n add_if_present(@max_message_size, current_string, \" -max-msg-sz #{@max_message_size} \")\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def max_size\n 1\n end", "def sz\n self.to_s.size\n end", "def fbe_size\n 8\n end", "def fbe_size\n 8\n end", "def fbe_size\n 8\n end", "def fbe_size\n 8\n end", "def size\n return @args[:data].length\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def window_size_message\n WINDOW_SIZE_MAGIC_COOKIE + [@rows, @columns, @pixel_x, @pixel_y].pack(\"nnnn\")\n end", "def win_size\n @binhdr[14, 2].unpack(\"n\").pop\n end", "def min_size()\n AUTHENTICATION_START_MIN_SIZE\n end", "def _size\n @allocated.length + @available_connections.length\n end", "def max_digits size\n (1..size).map{|x| x.to_s.size}.max\n end", "def copy_size\n MAX_DATA_LEN + 2\n end", "def is_big_enough_to_store_message?(message)\n msg_a = Image::get_message_as_binary_array_with_leading_zeros(message)\n msg_a.length <= @width*@height\n end", "def specific_max_size(number)\n [self.size, number].min\n end", "def size(num)\n params(size: num)\n end", "def buffer_size\n @buffer.size\n end", "def net_pack_bigint(int, size)\n sum = ''\n div = size - 1\n (size - 1).times do\n buf = int / ((NET_MAX_INT + 1)**div)\n sum += net_pack_int(buf)\n int = int % ((NET_MAX_INT + 1)**div)\n div -= 1\n end\n sum += net_pack_int(int)\n # TODO: check reminder and so on\n # throw and error when int is too big for size\n int /= NET_MAX_INT\n sum\nend", "def raw_size\n valid_blobs.map(&:raw_size).sum\n end" ]
[ "0.66808796", "0.6674084", "0.6663601", "0.65916175", "0.63128614", "0.6294512", "0.62791353", "0.62791353", "0.6266398", "0.6248313", "0.6179435", "0.6147006", "0.6145162", "0.61416656", "0.61341494", "0.6125885", "0.6041502", "0.6033389", "0.60078526", "0.60053056", "0.59995794", "0.5995452", "0.5981593", "0.59812397", "0.59712374", "0.59650147", "0.59439117", "0.5941516", "0.59264004", "0.59191805", "0.5918632", "0.591247", "0.59006935", "0.5899574", "0.5892276", "0.5869694", "0.5863876", "0.5849159", "0.5844907", "0.5842923", "0.58258843", "0.5819851", "0.5818082", "0.5818082", "0.5814391", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.57998526", "0.579663", "0.5795449", "0.57928133", "0.575188", "0.57425", "0.57412493", "0.5713404", "0.5701884", "0.5691415", "0.56870306", "0.5686831", "0.5684762", "0.5654153", "0.5651734", "0.5644083", "0.56436735", "0.5642129", "0.56417495", "0.56385237", "0.5637441", "0.56207985", "0.56207985", "0.56207156", "0.5615832", "0.56104803", "0.55943227", "0.55943227", "0.55943227", "0.55943227", "0.5583355", "0.55660915", "0.55660915", "0.55660915", "0.5565329", "0.55518657", "0.5551587", "0.5550637", "0.5549122", "0.5546411", "0.5543559", "0.5543315", "0.5539156", "0.55325115", "0.5530129", "0.5527352" ]
0.72234046
0
THe message body is encoded using BSON.
def msg_body; @msg_body ||= BsonBody.new; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(data); ::BSON.serialize(data).to_s; end", "def to_bson\n [ self ].pack(bson_pack_directive)\n end", "def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end", "def to_bson(buffer = ByteBuffer.new)\n position = buffer.length\n buffer.put_int32(0)\n buffer.put_byte(@raw_type)\n buffer.put_int32(data.bytesize) if type == :old\n buffer.put_bytes(data)\n buffer.replace_int32(position, buffer.length - position - 5)\n end", "def encode_body(buffer)\n # Encode the message count.\n buffer << {\n :count => messages.length\n }.to_msgpack\n \n # Encode all the messages.\n messages.each do |message|\n message.encode(buffer)\n end\n end", "def to_bson\n end", "def to_bson(buffer = ByteBuffer.new)\n as_json.to_bson(buffer)\n end", "def decode(binary); ::BSON.deserialize(binary); end", "def payload\n BSON::Document.new(\n command_name: command.keys.first.to_s,\n database_name: global_args[DATABASE_IDENTIFIER],\n command: command,\n request_id: request_id,\n reply: sections[0]\n )\n end", "def client_empty_message\n BSON::Binary.new('')\n end", "def encode_body(buffer)\n buffer << property_id.to_msgpack\n end", "def encode_body(buffer)\n buffer << property.to_msgpack\n end", "def client_final_message\n BSON::Binary.new(\"#{without_proof},p=#{client_final}\")\n end", "def to_bson(buffer = ByteBuffer.new)\n buffer\n end", "def to_bson(buffer = ByteBuffer.new)\n to_s.to_bson(buffer)\n end", "def body\n Base64::decode64(self[:body])\n end", "def encode(body)\n body\n end", "def encoded_body\n @encoded_body ||= should_encode? ? encode(body) : body.to_s\n end", "def to_bson\n to_h.to_bson\n end", "def inspect\n \"<BSON::Binary:0x#{object_id} type=#{type} data=0x#{data[0, 8].unpack1('H*')}...>\"\n end", "def print_b2json(io)\n while not io.eof? do\n bsonobj = BSON.read_bson_document(io)\n Yajl::Encoder.encode(bsonobj, STDOUT)\n STDOUT << \"\\n\"\n end\nend", "def encoding\n @body.encoding\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n documents = []\n document = event.to_hash()\n documents.push(document)\n LogStash::Json.dump(documents)\n elsif @format == \"message\"\n event.sprintf(@message)\n else\n encode(map_event(event))\n end\n end", "def to_s\n data.unpack(\"H*\")[0].force_encoding(Moped::BSON::UTF8_ENCODING)\n end", "def encode_body\n '' # No body by default\n end", "def to_body\r\n to_hash\r\n end", "def message_content\n JSON.parse(body).with_indifferent_access\n end", "def body\n @document.to_s\n end", "def to_bson\n encode_bson_with_placeholder do |encoded|\n encoded << javascript.to_bson << scope.to_bson\n end\n end", "def encode_body(data)\n @serializer.encode(data)\n end", "def encode_body(data)\n @serializer.encode(data)\n end", "def to_bson\n #----------\n self\n end", "def to_bson\n #----------\n self\n end", "def to_bson\n #----------\n self\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def encode_body(body, content_type)\n if content_type == 'application/json'\n dump_json(body)\n else\n body\n end\n end", "def encode_bson_with_placeholder(encoded = \"\".force_encoding(BINARY))\n encoded << PLACEHOLDER\n yield(encoded)\n encoded << NULL_BYTE\n encoded[0, 4] = encoded.bytesize.to_bson\n encoded\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end" ]
[ "0.6660244", "0.65159535", "0.6455533", "0.64504915", "0.6373777", "0.6351061", "0.6295756", "0.628682", "0.6257544", "0.6227274", "0.62202144", "0.61677545", "0.61517864", "0.6133742", "0.61247176", "0.60864556", "0.6074265", "0.6021508", "0.59797966", "0.59219116", "0.5885784", "0.5849732", "0.58415675", "0.5840339", "0.5840339", "0.5840339", "0.5840339", "0.58285815", "0.58084047", "0.58070314", "0.5806926", "0.5799233", "0.57688344", "0.5711736", "0.57087135", "0.57087135", "0.57085806", "0.57085806", "0.57085806", "0.57046413", "0.57046413", "0.5703461", "0.5660941", "0.56473356", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201", "0.5647201" ]
0.7670512
0
BSON returns a byte buffer when serializing. This doesn't always behave like a string, so convert it to one.
def encode(data); ::BSON.serialize(data).to_s; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_binary(s)\n s = s.dup if s.frozen? || s.encoding != Encoding::ASCII_8BIT\n ::BSON::Binary.new(s)\n end", "def to_bson(buffer = ByteBuffer.new)\n to_s.to_bson(buffer)\n end", "def to_bson(buffer = ByteBuffer.new)\n buffer\n end", "def to_s\n data.unpack(\"H*\")[0].force_encoding(Moped::BSON::UTF8_ENCODING)\n end", "def to_bson(buffer = ByteBuffer.new)\n as_json.to_bson(buffer)\n end", "def to_bson(buffer = ByteBuffer.new)\n position = buffer.length\n buffer.put_int32(0)\n buffer.put_byte(@raw_type)\n buffer.put_int32(data.bytesize) if type == :old\n buffer.put_bytes(data)\n buffer.replace_int32(position, buffer.length - position - 5)\n end", "def to_bson(buffer = ByteBuffer.new)\n BSON::Decimal128.new(to_s).to_bson(buffer)\n end", "def to_bson(buffer = ByteBuffer.new)\n if buffer.respond_to?(:put_array)\n buffer.put_array(self)\n else\n position = buffer.length\n buffer.put_int32(0)\n each_with_index do |value, index|\n unless value.respond_to?(:bson_type)\n raise Error::UnserializableClass,\n \"Array element at position #{index} does not define its BSON serialized type: #{value}\"\n end\n\n buffer.put_byte(value.bson_type)\n buffer.put_cstring(index.to_s)\n value.to_bson(buffer)\n end\n buffer.put_byte(NULL_BYTE)\n buffer.replace_int32(position, buffer.length - position)\n end\n end", "def to_str\n bytes\n end", "def to_str\n bytes\n end", "def to_str\n bytes\n end", "def to_bytes; end", "def to_bytes; end", "def to_bson(buffer = ByteBuffer.new)\n buffer.put_byte(FALSE_BYTE)\n end", "def serialize_to_string\n sio = ProtocolBuffers.bin_sio\n serialize(sio)\n return sio.string\n end", "def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end", "def to_bson\n [ self ].pack(bson_pack_directive)\n end", "def to_bson(buffer = ByteBuffer.new)\n buffer.put_int32(value)\n end", "def to_s\n str_p = Binding.mongocrypt_binary_data(ref)\n len = Binding.mongocrypt_binary_len(ref)\n str_p.read_string(len)\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def inspect\n \"<BSON::Binary:0x#{object_id} type=#{type} data=0x#{data[0, 8].unpack1('H*')}...>\"\n end", "def serialize(buffer = BSON::ByteBuffer.new, max_bson_size = nil)\n super\n add_check_sum(buffer)\n buffer\n end", "def as_bytes\n raise NotImplementedError\n end", "def bson_type\n String::BSON_TYPE\n end", "def decode(binary); ::BSON.deserialize(binary); end", "def client_empty_message\n BSON::Binary.new('')\n end", "def to_binary; ''; end", "def serialize(buffer = BSON::ByteBuffer.new, max_bson_size = nil, bson_overhead = nil)\n max_size =\n if max_bson_size && bson_overhead\n max_bson_size + bson_overhead\n elsif max_bson_size\n max_bson_size\n else\n nil\n end\n\n start = buffer.length\n serialize_header(buffer)\n serialize_fields(buffer, max_size)\n buffer.replace_int32(start, buffer.length - start)\n end", "def to_binary\n return '' unless @ready\n\n to_a.pack('C*') rescue binding.pry\n end", "def to_blob\n @blob\n end", "def to_bson\n end", "def to_s\n to_buffer.to_s\n end", "def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n value\n end", "def convert_data(v, opts = {})\n v.is_a?(BSON::Binary) ? v : BSON::Binary.new(to_hex(v['$hex'], opts), :generic)\n end", "def to_b\n return self.to_s(2)\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def to_sequel_blob\n self\n end", "def data_as_bytes\n raise \"subclass responsibility\"\n end", "def binary_string; end", "def to_bson\n to_h.to_bson\n end", "def bytes\n self\n end", "def serialize(object)\n if object.is_a?(::String)\n BSON::ObjectId.from_string(object) unless object.blank?\n else\n object\n end\n end", "def to_b\r\n return self\r\n end", "def to_s\n\t\t\treturn @buffer.to_s\n\t\tend", "def bytesize\n case value\n when NilClass\n 0\n when String\n @value.bytesize\n else\n @s ||= Marshal.dump(@value).bytesize\n end\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def to_sequel_blob\n SQL::Blob.new(self)\n end", "def to_bencode\n BEncode.dump(self)\n end", "def to_bson(buffer = ByteBuffer.new)\n value = _bson_to_i * 1000 + usec.divmod(1000).first\n buffer.put_int64(value)\n end", "def to_bson\n NO_VALUE\n end", "def to_byte\n self.chr\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def bson_type\n BSON_TYPE\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def to_s\n fill\n String.from_java_bytes(@baos.toByteArray)\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type,\n # :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(p)<<\n SSHUtils.convert_bignum(q)<<\n SSHUtils.convert_bignum(g)<<\n SSHUtils.convert_bignum(pub_key)\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type, :bignum, e, :bignum, n).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(e)<<\n SSHUtils.convert_bignum(n)\n end", "def result\n ActiveSupport::JSON.encode(@buffer)\n end", "def to_buffer\n validate_binary_operations\n @request.perform(binary: true)\n end", "def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)\n buffer.put_decimal128(@low, @high)\n end", "def string\n Util.from_bytes :string, value\n end", "def typecast_value_blob(value)\n value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)\n end", "def string_stream\n s = @object.to_s\n s = s.dup if s.frozen?\n marker_string(0x80, 0xD0, @object.to_s.bytesize) + s.force_encoding(Encoding::BINARY)\n end", "def to_bson\n #----------\n self\n end", "def to_bson\n #----------\n self\n end", "def to_bson\n #----------\n self\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def to_string_or_binary(value)\n encoding = value.encoding\n if encoding == Encoding::ASCII_8BIT\n Puppet::Pops::Types::PBinaryType::Binary.from_binary_string(value).to_s\n else\n # Transform to UTF-8 (do not assume UTF-8 is correct) with source invalid byte\n # sequences and UTF-8 undefined characters replaced by the default unicode uFFFD character\n # (black diamond with question mark).\n value.encode(Encoding::UTF_8, encoding, :invalid => :replace, :undef => :replace)\n end\n end", "def to_primitive\n data\n end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def to_bson(options={})\n options = options.dup\n encrypt = options.delete(:encrypt) || false\n compress = options.delete(:compress) || false\n options.each{ |o| raise ArgumentError, \"Invalid option: #{o.inspect}\" }\n\n attrs = attributes.dup\n attrs['records'] = if encrypt || compress\n # Convert slice of records in a single string\n str = BSON.serialize('r' => to_a).to_s\n data = if encrypt\n # Encrypt to binary without applying an encoding such as Base64\n # Use a random_iv with each encryption for better security\n SymmetricEncryption.cipher.binary_encrypt(str, true, compress)\n else compress\n Zlib::Deflate.deflate(str)\n end\n BSON::Binary.new(data)\n else\n to_a\n end\n attrs\n end", "def bytes; end", "def get_byte\n byte = @connection.getbyte.to_s 2\n byte = \"0\" * (8 - byte.length) + byte\n end", "def encode(object)\n ''.force_encoding(Encoding::BINARY).tap do |bytes|\n newest_version = schema_versions.keys.max\n schema = schema_versions[newest_version]\n bytes << newest_version.chr if has_version_tag\n write(object, bytes, schema)\n end\n end", "def bytes()\n #This is a stub, used for indexing\n end", "def to_s_ignore_encoding\n if self.respond_to?(:force_encoding)\n self.force_encoding(\"BINARY\")\n else\n self\n end\n end", "def to_bytes()\n\t\treturn self.chars.map(&:ord)\n\tend", "def convert_binary\n end", "def raw_bytes\n @raw_bytes ||= read_raw_bytes\n end", "def get_bytes()\n @value\n end", "def raw\n @buffer\n end", "def to_blob\n File.binread(path)\n end", "def to_s()\n serialize.to_s()\n end", "def to_s()\n serialize.to_s()\n end", "def bytes(str)\n Simms::Bytes.new(str)\n end", "def bytes_to_bin(bytes)\n bytes.pack(\"C*\")\n end", "def read_bson_document(io)\n bytebuf = BSON::ByteBuffer.new\n # Read 4 byte size of following BSON document\n bytes = io.read(4)\n return unless bytes\n # Read BSON document\n sz = bytes.unpack(\"V\")[0]\n bytebuf.append!(bytes)\n bytes = io.read(sz-4)\n return unless bytes\n bytebuf.append!(bytes)\n return BSON.deserialize(bytebuf)\nend", "def to_binary(metadata: {})\n io = StringIO.new ''.b\n write_to io, metadata: metadata\n io.string\n end", "def string()\n len = self.uint32()\n self.bytes(len)\n end" ]
[ "0.7851469", "0.7756517", "0.7677009", "0.75692385", "0.7357522", "0.7342663", "0.71870923", "0.7080933", "0.70724297", "0.70724297", "0.70724297", "0.7022939", "0.7022939", "0.694147", "0.6941039", "0.6875041", "0.68029934", "0.669292", "0.6673658", "0.6615697", "0.6615697", "0.6615697", "0.6615697", "0.6615697", "0.6615697", "0.66004384", "0.65835017", "0.6566943", "0.6463068", "0.6449194", "0.6438981", "0.64083076", "0.6360548", "0.63054645", "0.62788796", "0.6257932", "0.62461543", "0.62233233", "0.6205575", "0.62001276", "0.61996156", "0.6186167", "0.6182605", "0.6181325", "0.6176837", "0.6160281", "0.6158873", "0.6135672", "0.61314356", "0.6067367", "0.603833", "0.5999544", "0.59985596", "0.5992178", "0.59707993", "0.59600395", "0.5933185", "0.59331053", "0.59331053", "0.59331053", "0.59331053", "0.59241277", "0.59241277", "0.5885399", "0.5879533", "0.5850431", "0.58486855", "0.58331144", "0.5832359", "0.58209836", "0.5796674", "0.5795698", "0.57901955", "0.57901955", "0.57901955", "0.5786639", "0.5777316", "0.5763341", "0.5749528", "0.57390875", "0.57342416", "0.57294893", "0.5712874", "0.5694434", "0.5690815", "0.56829715", "0.56572276", "0.5649518", "0.5646385", "0.56440365", "0.56343585", "0.56322545", "0.56272745", "0.5623699", "0.5623699", "0.5620588", "0.56141573", "0.5597493", "0.55849767", "0.55797976" ]
0.6818904
16
BSON returns an ordered hash when deserializing. This should be functionally equivalent to a regular hash.
def decode(binary); ::BSON.deserialize(binary); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bson_ordered_hash_to_hash(bson_ordered_hash)\n new_hash = {}\n # loop through the BSON::OrderedHash\n bson_ordered_hash.each { |key, val|\n # if the element is a BSON::OrderedHash, then iterate, else if it is\n # an Array, check each element of the array to see if any of them are\n # BSON::OrderedHash objects (and if so, convert them), otherwise\n # just move the value from one hash to the other\n if val.class == BSON::OrderedHash\n new_hash[key] = bson_ordered_hash_to_hash(val)\n elsif val.class == Array\n new_hash[key] = bson_hash_array_to_hash_array(val)\n else\n new_hash[key] = val\n end\n }\n # finally, return the coverted Hash\n new_hash\n end", "def bson_to_hash(bson_hash)\n new_hash = {}\n bson_hash.each_key do\n |k|\n if bson_hash[k].class == BSON::OrderedHash\n new_hash[k] = bson_to_hash(bson_hash[k])\n else\n new_hash[k] = bson_hash[k]\n end\n end\n new_hash\n end", "def to_hash() end", "def mongoize\n ::Hash.mongoize(self)\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\n return to_s.hash\n end", "def hash\n to_a.hash\n end", "def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_s.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n self.begin.hash ^ self.end.hash\n end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash\n return self.document.to_hash\n end", "def hash\n self.to_f.hash\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 hash\n @hash || @hash = (value.hash * -1)\n end", "def to_hash\n @hash\n end", "def to_hash\n @hash\n end", "def to_hash\n to_a.hash\n end", "def hash\n bytes.hash\n end", "def to_bson_key\n to_s.to_bson_key\n end", "def to_hash\n @_hash_\n end", "def hash\n return @id.hash\n end", "def binary_hash\n [@hash].pack(\"H*\").reverse\n end", "def to_hash\n @hash\n end", "def as_hash\n @hash\n end", "def to_bson_normalized_key\n to_s\n end", "def to_bson_key\n value\n end", "def save_hash_field_order; end", "def to_hash\n validate!\n @hash ||= json\n end", "def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end", "def to_dict\n @hash\n end", "def to_ordered_hash(opts={})\n force = opts.fetch(:force, false)\n sort_json_ld_keys = opts.fetch(:sort_json_ld_keys, true)\n\n unless force\n self.validate\n end\n\n export_hash = IIIF::OrderedHash.new\n\n if sort_json_ld_keys\n self.keys.select { |k| k.start_with?('@') }.sort!.each do |k|\n export_hash[k] = self.data[k]\n end\n end\n\n sub_opts = {\n include_context: false,\n sort_json_ld_keys: sort_json_ld_keys,\n force: force\n }\n self.keys.each do |k|\n unless sort_json_ld_keys && k.start_with?('@')\n if self.data[k].respond_to?(:to_ordered_hash) #.respond_to?(:to_ordered_hash)\n export_hash[k] = self.data[k].to_ordered_hash(sub_opts)\n\n elsif self.data[k].kind_of?(Hash)\n export_hash[k] = IIIF::OrderedHash.new\n self.data[k].each do |sub_k, v|\n\n if v.respond_to?(:to_ordered_hash)\n export_hash[k][sub_k] = v.to_ordered_hash(sub_opts)\n\n elsif v.kind_of?(Array)\n export_hash[k][sub_k] = []\n v.each do |member|\n if member.respond_to?(:to_ordered_hash)\n export_hash[k][sub_k] << member.to_ordered_hash(sub_opts)\n else\n export_hash[k][sub_k] << member\n end\n end\n else\n export_hash[k][sub_k] = v\n end\n end\n\n elsif self.data[k].kind_of?(Array)\n export_hash[k] = []\n\n self.data[k].each do |member|\n if member.respond_to?(:to_ordered_hash)\n export_hash[k] << member.to_ordered_hash(sub_opts)\n\n elsif member.kind_of?(Hash)\n hsh = IIIF::OrderedHash.new\n export_hash[k] << hsh\n member.each do |sub_k,v|\n\n if v.respond_to?(:to_ordered_hash)\n hsh[sub_k] = v.to_ordered_hash(sub_opts)\n\n elsif v.kind_of?(Array)\n hsh[sub_k] = []\n\n v.each do |sub_member|\n if sub_member.respond_to?(:to_ordered_hash)\n hsh[sub_k] << sub_member.to_ordered_hash(sub_opts)\n else\n hsh[sub_k] << sub_member\n end\n end\n else\n hsh[sub_k] = v\n end\n end\n\n else\n export_hash[k] << member\n # there are no nested arrays, right?\n end\n end\n else\n export_hash[k] = self.data[k]\n end\n\n end\n end\n export_hash.remove_empties\n export_hash.camelize_keys\n export_hash\n end", "def hash\n self.respond_to?(:id) && self.id ? self.id.to_i : self.to_hash.hash\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def to_hash\n @hash.dup\n end", "def hash\n @id.hash\n end", "def hash\n offset.hash\n end", "def hash\n @__set.to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n [model, pk.nil? ? @values.sort_by{|k,v| k.to_s} : pk].hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def to_hash\n @hash.dup\n end", "def to_bson\n to_h.to_bson\n end", "def hash\r\n id.hash\r\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 to_hash\n Hash[to_a]\n end", "def hash\n from_end.hash + to_end.hash + overlap.hash + reverse_overlap.to_s.hash\n end", "def hash\n @hash.hash\n end", "def hash\n guid.hash\n end", "def hash\n self.class.hash ^ @ns.hash\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n return @revision.hash if @revision\n return object_id\n end", "def to_hash\n return self\n end", "def to_hash\n @_hash.dup\n end", "def convert(hash)\n if encoded?(hash)\n hash.sort{ |a, b| a[0].to_i <=> b[0].to_i }.map { |key, value| value }\n else\n hash\n end\n end", "def to_jaxb_json_hash\n _h = super\n _h['order'] = order.to_jaxb_json_hash unless order.nil?\n return _h\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n @node.sort.push(@edge).hash\n end", "def normalized_hash\n normalize! unless @normalized\n hashify(:normalized)\n end", "def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end", "def hash\n from_end.hash + to_end.hash + overlap.hash + complement_overlap.to_s.hash\n end", "def hash\n @orig.hash\n end", "def hash\n @orig.hash\n end", "def hash\n @orig.hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n\t\t[@id].hash\n\tend", "def bson_type\n ::Hash::BSON_TYPE\n end", "def to_hash\n call\n @hash = @value\n @hash[:sort] = @sort.to_hash if @sort\n @hash\n end", "def hash\n [to_d.hash, currency.hash].hash\n end", "def to_hash\n Hash[self]\n end" ]
[ "0.6293328", "0.61925036", "0.619222", "0.61392343", "0.61002564", "0.6097594", "0.60710585", "0.6041954", "0.6025704", "0.5973566", "0.5967965", "0.592084", "0.592084", "0.58972055", "0.58871055", "0.58871055", "0.58871055", "0.58871055", "0.58871055", "0.58871055", "0.58648956", "0.5853905", "0.5849708", "0.5849708", "0.58462936", "0.5830957", "0.5830957", "0.5826611", "0.5825922", "0.5811306", "0.5810914", "0.58014154", "0.5797089", "0.5784839", "0.5773751", "0.57690674", "0.5765224", "0.57523566", "0.5730882", "0.57065463", "0.5704927", "0.56997067", "0.5683816", "0.5673349", "0.5667934", "0.56645393", "0.5664424", "0.56511617", "0.5647386", "0.5645072", "0.5630686", "0.56301975", "0.56301975", "0.56301975", "0.56301975", "0.56301975", "0.56301975", "0.56301975", "0.56301975", "0.56301975", "0.5627365", "0.5627365", "0.56210864", "0.56185484", "0.56135064", "0.5612458", "0.5607902", "0.56073546", "0.5600977", "0.5596346", "0.5592948", "0.5584875", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.5578908", "0.55743366", "0.55742526", "0.55704033", "0.55669326", "0.55544543", "0.5551282", "0.5546724", "0.55282944", "0.5517052", "0.5516312", "0.54860574", "0.54860574", "0.54860574", "0.5479896", "0.54767287", "0.5475951", "0.54728436", "0.5463561", "0.546191" ]
0.0
-1
=begin isaacs = TomcatUtility::TomcatDeploymentsCache.instance.get_isaac_deployments isaacs.first.tomcat.name isaacs.first.get_db_uuid isaacs.first.get_name isaacs.first.komets.first.get_name isaacs.first.komets.first.get_isaac_db_uuid will match with isaacs.first.get_db_uuid include TomcatUtility TomcatDeploymentsCache.instance.last_activity_time =end same as get_cached_deployments, but hash is indifferent
def get_indifferent_cached_deployments HashWithIndifferentAccess.new get_cached_deployments end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deployment_hash\n deployment = deployments\n if deployment.size == 1\n deployment[0]\n elsif deployment.size > 1\n next_deployment_after_measured\n else\n {}\n end\n end", "def deployed_at() ; info_time(:deployed_datetime) ; end", "def deployed_at() ; info_time(:deployed_datetime) ; end", "def current_deployment application_name, organization_id, environment_id, cached_token=token\n # query parameters to fetch only the newest deployment\n params = {:orderByDate => \"DESC\", :limit => \"1\"}\n uri = URI.parse(\"https://anypoint.mulesoft.com/cloudhub/api/v2/applications/#{application_name}/deployments\")\n uri.query = URI.encode_www_form(params)\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n request.add_field(\"X-ANYPNT-ENV-ID\", environment_id)\n request.add_field(\"X-ANYPNT-ORG-ID\", organization_id)\n\n response = client.request(request)\n json = JSON.parse(response.body)\n return json['data'][0]\n end", "def deployed_or_running_deploy\n deploys.joins(:job).find_by(\"jobs.status\" => Job::ACTIVE_STATUSES + [\"succeeded\"])\n end", "def check_if_deployment_exists\n @api.account_id = @options[:src]\n @old_deployment = @api.deployments(:id => @options[:deployment], :view => \"inputs_2_0\").show\n\n @api.account_id = @options[:dst]\n if @api.deployments.index(:filter => [\"name==#{@old_deployment.name}\"]).length != 0\n $stderr.puts \"ERROR: Deployment with name \\\"#{@old_deployment.name}\\\" already exists in account #{@options[:dst]}\\n\"\n exit 1\n end\nend", "def tracking_deployments\n @@deployment ||= begin\n uri = URI.parse(ENV[\"NPOLAR_API_COUCHDB\"])\n uri.path = \"/#{Service.factory(\"tracking-deployment-api\").database}\"\n client = Npolar::Api::Client::JsonApiClient.new(uri.to_s)\n \n d = client.get_body(\"_all_docs\", {\"include_docs\"=>true}).rows.map {|row|\n Hashie::Mash.new(row.doc)\n }\n d\n end\n end", "def index\n\n\t\tapp_id = params[:deployable_application_id] || current_user.deployable_applications.first.id\n\n\t\tif deployable_application_id = app_id\n\t\t\t@deployable_application = DeployableApplication.find_by_id(deployable_application_id)\n\t\t\t@deployments = @deployable_application.deployments.order(:created_at => :desc)\n\t\telse\n\t\t\t@deployments = Deployment.none\n\t\tend\n\tend", "def show\n @app = App.find(params[:id])\n @dynect_cname_log = if @app.ec2_sg_to_authorize.blank?\n \"Please, assign an EC2 SG to authorize so we can look for the AWS ELB\"\n elsif @app.lb_dns =~ /ERROR/\n \"\"\n elsif @app.lb_dns.blank?\n \"Please, update the app record saving it so se can look for the AWS ELB\"\n elsif @app.deployments.try(:last).try(:dynect_cname_log)\n if @app.deployments.last.app_name.blank? or @app.deployments.last.app_name == @app.name\n @app.deployments.last.dynect_cname_log\n else\n 'Pending: app name has changed, It has to be deployed in order to create the CNAME in Dynect'\n end\n else\n 'Pending: It has to be deployed in order to create the CNAME in Dynect'\n end\n @deployment_status = \n if !@app.databag_item_timestamp\n \"Never Deployed\"\n elsif @app.databag_item_timestamp.to_i == @app.app_timestamp.to_i\n \"Deploy at: #{@app.app_timestamp}\"\n else\n \"Undeployed Changes\"\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def get_deploy_response(client, body_obj)\n \n artifact_id = body_obj['appName']\n artifact_group = body_obj['groupID']\n artifact_version = body_obj['versionNumber']\n \n response = client.search index: 'lead_time', body:\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"nested\": {\n \"path\": \"builds\",\n \"query\": {\n \"term\": {\n \"builds.artifact.id\": {\n \"value\": artifact_id\n }\n }\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"builds\",\n \"query\": {\n \"term\": {\n \"builds.artifact.group\": {\n \"value\": artifact_group\n }\n }\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"builds\",\n \"query\": {\n \"term\": {\n \"builds.artifact.version\": {\n \"value\": artifact_version\n }\n }\n }\n }\n }\n ]\n }\n }\n }\n return response\n end", "def index\n @deployments = Deployment.all\n end", "def describe(cloud_id: nil, update_cache: false)\n if cloud_id.nil? and !@cloudobj.nil?\n @cloud_id ||= @cloudobj.cloud_id\n end\n res_type = self.class.cfg_plural\n res_name = @config['name'] if !@config.nil?\n @credentials ||= @config['credentials'] if !@config.nil?\n deploydata = nil\n if !@deploy.nil? and @deploy.is_a?(MU::MommaCat) and\n !@deploy.deployment.nil? and\n !@deploy.deployment[res_type].nil? and\n !@deploy.deployment[res_type][res_name].nil?\n deploydata = @deploy.deployment[res_type][res_name]\n else\n # XXX This should only happen on a brand new resource, but we should\n # probably complain under other circumstances, if we can\n # differentiate them.\n end\n\n if self.class.has_multiples and !@mu_name.nil? and deploydata.is_a?(Hash) and deploydata.has_key?(@mu_name)\n @deploydata = deploydata[@mu_name]\n elsif deploydata.is_a?(Hash)\n @deploydata = deploydata\n end\n\n if @cloud_id.nil? and @deploydata.is_a?(Hash)\n if @mu_name.nil? and @deploydata.has_key?('#MU_NAME')\n @mu_name = @deploydata['#MU_NAME']\n end\n if @deploydata.has_key?('cloud_id')\n @cloud_id ||= @deploydata['cloud_id']\n else\n # XXX temp hack to catch old Amazon-style identifiers. Remove this\n # before supporting any other cloud layers, otherwise name\n # collision is possible.\n [\"group_id\", \"instance_id\", \"awsname\", \"identifier\", \"vpc_id\", \"id\"].each { |identifier|\n if @deploydata.has_key?(identifier)\n @cloud_id ||= @deploydata[identifier]\n if @mu_name.nil? and (identifier == \"awsname\" or identifier == \"identifier\" or identifier == \"group_id\")\n @mu_name = @deploydata[identifier]\n end\n break\n end\n }\n end\n end\n\n return [@mu_name, @config, @deploydata]\n end", "def deployed?\n success =\n @deploy_details[:deploy_name] == self.deploy_name if @deploy_details\n\n return success if success\n\n deploy_details(true)[:deploy_name] == self.deploy_name rescue false\n end", "def deployment_roles\n return proposed_snapshot.deployment_roles if proposed? \n return active_snapshot.deployment_roles if active?\n []\n end", "def audit options={}\n # Loop through each org at a time\n Organization.all.each do |org|\n # Only process operational assets\n write_to_activity_log org, \"Performing #{context.name} on asset inventory\"\n all_assets = Rails.application.config.asset_base_class_name.constantize.operational\n\n if Rails.application.config.try(:asset_auditor_config).present?\n all_assets = Rails.application.config.asset_auditor_config[:class_name].constantize.operational.where(Rails.application.config.asset_auditor_config[:query])\n else\n all_assets = Rails.application.config.asset_base_class_name.constantize.operational\n end\n\n all_assets.where('transam_assets.in_service_date <= ?', context.end_date).where(:organization => org).pluck(:object_key).each do |obj_key|\n asset = Rails.application.config.asset_base_class_name.constantize.find_by(object_key: obj_key)\n update_status asset, context.start_date, context.end_date, context.filterable_class_name\n end\n end\n\n end", "def show\n @deployment = Deployment.find(params[:id])\n @log = Rails.cache.read(\"log_#{@deployment.id}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment }\n end\n end", "def get_deploy_info\n { :deployed_at => @shell.call(\"date\"),\n :deployed_as => @shell.call(\"whoami\"),\n :deployed_by => Sunshine.shell.user,\n :deploy_name => File.basename(self.checkout_path),\n :name => self.name,\n :env => shell_env,\n :roles => @roles,\n :path => self.root_path,\n :sunshine_version => Sunshine::VERSION\n }.merge @info\n end", "def last_deploy_for(project)\n @projects_last_deployed_at ||= Deploy.successful.\n last_deploys_for_projects.\n includes(:project, job: :user).\n index_by(&:project_id)\n\n @projects_last_deployed_at[project.id]\n end", "def deploy_id\n self['DEPLOY_ID']\n end", "def ic_version_if_changed\n return nil if do_not_check_for_version_change\n if step_not_modified\n begin\n # ae = application_environment\n ae = []\n request.apps.each do |app|\n ae << app.application_environments.find_by_environment_id(request.environment_id)\n end\n # ac = application_component\n ac = []\n ae.each do |app_env|\n ac << app_env.application_components.find_by_component_id(component_id)\n end\n ae.flatten!\n ac.flatten!\n # ic = installed_component\n ic = InstalledComponent.find_by_application_component_id_and_application_environment_id(ac.map(&:id), ae.map(&:id))\n ic.nil? ? nil : (ic.version.eql?(version_name) ? nil : ic.version)\n rescue\n nil\n end\n end\n end", "def exact_deployment?\n artifact_hash = digest_of_artifact\n deployed_hash = digest_of_deployed\n if artifact_hash == deployed_hash\n Puppet.debug \"Same exact deployment found, compared by hash: #{artifact_hash}. Skipping deploy.\"\n true\n else\n Puppet.debug \"Deployment hash: #{deployed_hash} differs from expected artifact hash: #{artifact_hash}. Redeploying.\"\n false\n end\n end", "def taggable_role_appointments_container\n Rails.cache.fetch(taggable_role_appointments_cache_digest, expires_in: 1.day) do\n role_appointments_container_for(RoleAppointment)\n end\n end", "def has_deployment?(name)\n available_deployments.has_key?(name)\n end", "def all_deployments\n deployments_dir = PathUtils.join(@container_dir, 'app-deployments')\n\n Dir[deployments_dir + \"/*\"].entries.reject { |e| %w(by-id current).include?(File.basename(e)) }\n end", "def wait(timeout = 60)\n Timeout::timeout(timeout) do\n deployments = nil\n while deployments.nil? or deployments.select{|e| e.id == deploymentId}.size > 0 do\n sleep(RECHECK_INTERVAL)\n deployments = Marathon::Deployment.list\n end\n end\n end", "def to_hash\n {\n \"deployment_id\" => deployment_id, \"created_at\" => created_at, \"hot_deploy\" => hot_deploy,\n \"force_clean_build\" => force_clean_build, \"ref\" => ref, \"sha1\" => sha1, \"artifact_url\" => artifact_url, \"activations\" => activations\n }\n end", "def deployment_i_ds\n if !block_given?\n return ::Vertx::Util::Utils.to_set(@j_del.java_method(:deploymentIDs, []).call()).map! { |elt| elt }\n end\n raise ArgumentError, \"Invalid arguments when calling deployment_i_ds()\"\n end", "def latest_deployment_datetime\n latest = all_deployments_by_activation[-1]\n File.basename(latest)\n end", "def deployed?\n git_info[\"deployed_commit_sha\"].present?\n end", "def deploy_key\n params[:version] ||= 'release'\n case params[:version]\n when 'release' then 'release'\n when 'canary' then redis.lindex('releases', 0)\n else\n params[:version]\n end\n end", "def fetch_deployment_details(app_id, deployment_id)\n http_get_request(Scalarium.applications_url+\"/#{app_id}/deployments/#{deployment_id}\")\n end", "def attributes_for_environment_page(deploy_environment)\n deploy_environment.attributes.merge(\n deployments: deploy_environment.deployments.latest.map { |deployment|\n deployment.attributes.slice(\"id\", \"version\", \"deploy_tag\", \"status\")\n },\n migrations: deploy_environment.migrations.latest.map { |migration|\n migration.attributes.slice(\"id\", \"version\", \"deploy_tag\", \"status\", \"migration_command\")\n }\n )\n end", "def get_deployments\n deployments = collect_inventory(:deployments) { gather_data_for_this_region(@tds, 'list') }\n process_collection(deployments, :orchestration_stacks) { |dp| parse_stack(dp) }\n end", "def assets_under_lease\n ActiveFedora::Base.where(\"#{Hydra.config.permissions.lease.expiration_date}:[* TO *]\")\n end", "def last_deployed_references\n last_deployed = deploy_scope.pluck(Arel.sql('max(deploys.id)'))\n Deploy.reorder(nil).where(id: last_deployed).pluck(Arel.sql('distinct reference'))\n end", "def deploy(yaml_manifest)\n status, task_id = api.deploy(yaml_manifest)\n [status, task_id]\n end", "def glue_etl_jobs_for_comparison(client, deployment_id)\n jobs = []\n if client\n client.get_jobs.each do |resp|\n resp.jobs.each do |job|\n if deployment_id\n if job.default_arguments.key?('--convergdb_deployment_id')\n if job.default_arguments['--convergdb_deployment_id'] == deployment_id\n jobs << {\n name: job.name,\n technology: 'aws_glue',\n this_deployment: true\n }\n else\n jobs << {\n name: job.name,\n technology: 'aws_glue',\n this_deployment: false\n }\n end\n end\n else\n jobs << {\n name: job.name,\n technology: 'aws_glue',\n this_deployment: false\n }\n end\n end\n end\n else\n puts(\"no glue client\")\n end\n return jobs\n end", "def last_deployed_references\n last_deployed = deploy_scope.pluck(Arel.sql('max(deploys.id)'))\n Deploy.reorder(id: :asc).where(id: last_deployed).pluck(Arel.sql('distinct reference, id')).map(&:first)\n end", "def deployment_string(deploymentJsonObject)\n string = \"\\n\" + \"+-\" * 25 + \" DEPLOYMENT INFO \" + \"+-\" * 25 + \"\\n\"\n deploymentJsonObject.sort.each do |k,v|\n case v\n when String\n string += k + \" => \" + v + \"\\n\"\n when Fixnum\n string += k + \" => \" + v.to_s + \"\\n\"\n when Array\n string += k + \" => \" + v.join(',') + \"\\n\"\n else\n string += \"#{k} + #{v}\\n\"\n end\n end\n return string\n end", "def list_asgs\n # collect the list of running instances in this zone\n ec2 = AWS::EC2.new\n region = ec2.regions[AMI_REGION]\n instances = region.instances.select { |i| i.tags.to_h[\"server\"] == APP_NAME }\n\n # now find the list of running asgs\n format = \"%-32s %s\"\n puts\n puts format % [\"Instance Groups\", \"Tags\"]\n puts format % [\"-\" * 32, \"-\" * 60]\n auto_scaling = new_auto_scaling\n count = 0\n auto_scaling.groups.each do |group|\n count = count + 1\n puts format % [group.name, tag_value(group.tags, \"env\")]\n\n instances.each do |i|\n if i.tags.to_h[\"env\"] == tag_value(group.tags, \"env\")\n puts \"\\t%s %-13s %s\" % [i.id, i.status, i.dns_name]\n end\n end\n puts\n end\n puts format % [\"-\" * 32, \"-\" * 60]\n puts \"Found #{count} ASGs\"\n puts\nend", "def current_deployed_version\n 5\n end", "def inject_platform_deployment_metadata\n \n deployment = deployment_hash\n \n if not deployment.nil? and deployment.key? :id\n deployment_uri = base_uri\n deployment_uri.path = \"/tracking/deployment/#{deployment[:id]}\"\n self[:deployment] = deployment_uri.to_s\n end\n \n # We add object like \"Arctic fox\" - also for messages before/after deployment\n if not object? and deployment.key? :object\n self[:object] = deployment.object\n end\n \n # We add species like \"Vulpes lagopus\" - also for messages before/after deployment\n if not species? and deployment.key? :species\n self[:species] = deployment.species\n end\n \n # Set platform model\n if not platform_model? and deployment.key? :platform_model\n self[:platform_model] = deployment.platform_model\n end\n \n # Set platform type\n if not platform_type? and deployment.key? :platform_type\n self[:platform_type] = deployment.platform_type\n end\n \n # Set platform_name\n if not platform_name? and deployment.key? :platform_name\n self[:platform_name] = deployment.platform_name\n end\n \n # Add deployed and terminated so that we can later compare these with the Tracking Deployment API\n # and and detect if republishing of data for certain platform is needed.\n # This is useful (1) When tagging the deployed date is not yet Tracking Deployment API, but data flow is real time (ie. needs to be fixed after setting the individual)\n # (2) When deployed / terminated / individual data is corrected\n if not deployed? and deployment.key? :deployed\n self[:deployed] = deployment.deployed\n end\n if not terminated? and deployment.key? :terminated\n self[:terminated] = deployment.terminated\n end\n end", "def show\n @environment = Environment.find(params[:id])\n @last_deployment_log = @environment.deployment_logs.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @environment }\n end\n end", "def deploy2\r\n 'Deploy time is: ' + @@class_variable.to_s\r\n end", "def prior_ass(tax_stats)\n # get category and release data of genomes\n assemblies = {}\n tax_stats[:assids].keys.each {|ass|\n @refseq_list.each {|refseq|\n if ass == refseq[\"assembly_accession\"] && !assemblies.has_key?(ass)\n refseq_category = refseq[\"refseq_category\"]\n release_date = refseq[\"release_date\"]\n assemblies[\"#{ass}\"] = {:refseq_category => refseq_category, :release_date => release_date }\n end\n }\n }\n #compare\n reference = assemblies.select { |k, v| v[:refseq_category] == \"reference genome\" }\n if reference.size == 1\n return reference.keys.first\n elsif reference.size > 1 #if has multi reference genome, return released earlier\n return reference.min_by {|k, v| v[:release_date]}.first\n else #no reference genomes, check representative genome\n representative = assemblies.select { |k, v| v[:refseq_category] == \"representative genome\" }\n if representative.size == 1\n return representative.keys.first\n elsif representative.size > 1 #if has multi representative genome, return released earlier\n return representative.min_by {|k, v| v[:release_date]}.first\n else #no reference/representative genome, retrn released earlier\n return assemblies.min_by {|k, v| v[:release_date]}.first\n end\n end\n end", "def index\n @deployment_statuses = DeploymentStatus.all\n end", "def getServerName(serverName)\n server = nil\n serverUrl = @appContext.getMasterURL() + \"/applications/\" + @appContext.getProject() + \"/assets/\" + serverName\n log(\"DEBUG\", \"serverurl from serverhelper:\" + serverUrl)\n\n deployResult = @cloudmunchDataService.getDataForContext(serverUrl, @appContext.getAPIKey(),nil)\n if deployResult == nil then\n return false\n else\n deployResult = JSON.parse(deployResult)\n deployData = deployResult[\"data\"]\n if deployData.nil? then\n log(\"ERROR\", \"Server does not exist\") \n return nil\n else\n if (deployResult[serverName].include?(\"assetname\")) && (deployResult[serverName][\"assetname\"] == \"ElasticBeanStalk\") then\n server = ElasticBeanStalkServer.new \n else\n server = Server.new\n\n server.servername = deployData[\"id\"]\n server.description = deployData[\"description\"]\n server.dns = deployData[\"dnsName\"]\n server.domainName = deployData[\"domainName\"]\n server.CI = deployData[\"CI\"]\n server.deploymentStatus = deployData[\"deploymentStatus\"]\n server.instanceId = deployData[\"instanceId\"]\n server.imageID = deployData[\"amiID\"]\n server.launcheduser = deployData[\"username\"]\n server.build = deployData[\"build\"]\n server.appName = deployData[\"appName\"]\n server.deployTempLoc = deployData[\"deployTempLoc\"]\n server.buildLocation = deployData[\"buildLoc\"]\n server.privateKeyLoc = deployData[\"privateKeyLoc\"]\n server.publicKeyLoc = deployData[\"publicKeyLoc\"]\n server.loginUser = deployData[\"loginUser\"]\n server.serverType = deployData[\"serverType\"]\n server.assetType = deployData[\"assettype\"]\n server.status = deployData[\"status\"]\n server.startTime = deployData[\"starttime\"]\n server.provider = deployData[\"provider\"]\n server.region = deployData[\"region\"]\n server.cmserver = deployData[\"cmserver\"]\n server.assetName = deployData[\"assetname\"]\n server.instanceSize = deployData[\"instancesize\"]\n server.password = deployData[\"password\"]\n server.sshport = deployData[\"sshport\"]\n server.tier = deployData[\"tier\"]\n \n if server.instance_of?(ElasticBeanStalkServer) then\n server.environmentName = deployData[\"environmentName\"]\n server.bucketName = deployData[\"bucketName\"]\n server.applicationName = deployData[\"applicationName\"]\n server.templateName = deployData[\"templateName\"]\n end\n\n return server\n end\n end\n end \n end", "def deployment_summary\n return @deployment_summary\n end", "def activity\n act = []\n\n tables.each do |table|\n act << {\n table: table.name,\n stats: [\n {\n action: 'INSERTs',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM #{table.audit} WHERE `_copied_at` >= #{cutoff.to_i}\").to_a[0]['CNT']\n },\n {\n action: 'DELETEs',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM #{table.audit} WHERE `_deleted_at` >= #{cutoff.to_i}\").to_a[0]['CNT']\n },\n {\n action: 'UPDATEs',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM #{table.audit} WHERE `_copied_at` < #{cutoff.to_i} AND _last_version >= #{cutoff.to_i}\").to_a[0]['CNT']\n },\n {\n action: 'Violations',\n value: db.query(\"SELECT COUNT(*) AS CNT FROM `#{audit_db}`._rule_violations WHERE `audited_table` = '#{table.name}' AND `stamp` > #{cutoff.to_i}\").to_a[0]['CNT']\n }\n ]\n }\n end\n\n act\n end", "def db_instance_automated_backups_replications\n data[:db_instance_automated_backups_replications]\n end", "def taggable_role_appointments_cache_digest\n @taggable_role_appointments_cache_digest ||= calculate_digest(RoleAppointment.order(:id), \"role-appointments\")\n end", "def deploy\n ::Taxi::Status.list_by_status(status: 'deploy', format: options[:format], agency: options[:agency])\n end", "def related_releases\n Rails.cache.fetch(\"releases/release-#{id}\", :expires_in => 1.hour) do\n real_releases.all(:order => 'date DESC', :limit => 15)\n end\n end", "def status_cache_key\n [\n ip,\n ip_port,\n outlet,\n secondary_outlet,\n # Include username/password so that if one of the shared schedule is right and\n # the other is wrong we still do multiple queries: one gets an error and the other\n # doesn't.\n username,\n password,\n ]\n end", "def notify\n deploy_struct = {\n \"awsname\" => @mu_name,\n \"dns\" => cloud_desc.dns_name,\n \"targetgroups\" => {}\n }\n deploy_struct[\"arn\"] = cloud_desc.load_balancer_arn if !@config['classic']\n @targetgroups.each { |tgname, tg|\n deploy_struct[\"targetgroups\"][tgname] = tg.target_group_arn\n }\n return deploy_struct\n end", "def currently_deployed_param\n if defined?(@currently_deployed_param)\n @currently_deployed_param\n else\n @currently_deployed_param = params(default: {})[:currentlyDeployed]\n end\n end", "def get_state(stemcell_list = nil, release_list = nil, deployment_list = nil)\n state = STATE_REMOTE_ONLY\n\n if File.exist?(bits_full_local_path_dl)\n state = STATE_DOWNLOADING\n end\n\n if File.exist?(bits_full_local_path) || Dir.exist?(bits_full_local_path)\n state = STATE_LOCAL\n end\n\n if @product.type == 'ucc'\n if $config[:version] == @version\n state = STATE_DEPLOYED\n end\n elsif @product.type == 'stemcell'\n found_on_bosh = ( stemcell_list || Uhuru::BoshCommander::Stemcell.new().list_stemcells).any? do |stemcell|\n (stemcell['name'] == @product.name) && (stemcell['version'] == @version)\n end\n\n if found_on_bosh\n state = STATE_AVAILABLE\n deployments = deployment_list || Deployment.get_director_deployments\n deployments.each do |deployment|\n deployment[\"stemcells\"].each do |stemcell|\n if (stemcell[\"name\"] == @product.name) &&\n (stemcell[\"version\"] == @version)\n state = STATE_DEPLOYED\n break\n end\n end\n if (state == STATE_DEPLOYED)\n break\n end\n end\n end\n\n elsif @product.type == 'software'\n if (state == STATE_LOCAL)\n bosh_releases = release_list || Uhuru::BoshCommander::Release.new().list_releases\n deployment_erb = File.read(File.join(bits_full_local_path, 'config', \"#{@product.name}.yml.erb\"))\n deployment_rendered = ERB.new(deployment_erb).result()\n deployment_yaml = YAML.load(deployment_rendered)\n\n releases = []\n if (deployment_yaml[\"release\"])\n releases << deployment_yaml[\"release\"]\n else\n deployment_yaml[\"releases\"].each do |release|\n releases << release\n end\n\n end\n\n releases.each do |release|\n bosh_releases.each do |bosh_release|\n if (bosh_release['name'] == release['name'])\n bosh_release['release_versions'].each do |release_version|\n if release_version['version'] == @version.to_s\n if (release_version['currently_deployed'])\n state = STATE_DEPLOYED\n else\n state = STATE_AVAILABLE\n end\n break\n end\n end\n end\n end\n if (state != STATE_DEPLOYED)\n break\n end\n end\n end\n end\n\n state\n end", "def run\n\n installs = []\n results = []\n users = []\n print_status(\"Enumerating Tomcat Servers on #{sysinfo['Computer']}\")\n if check_tomcat\n installs += identify_registry\n if not installs.empty?\n installs.each do |inst|\n results += enumerate_tomcat(inst[0],inst[1])\n users += enumerate_tomcat_creds(inst[0])\n end\n else\n print_status(\"Done, Tomcat Not Found\")\n return\n end\n end\n if results.empty?\n print_status(\"Done, Tomcat Not Found\")\n return\n end\n print_status(\"Done, Tomcat Found.\")\n\n tbl_services = Rex::Text::Table.new(\n 'Header' => \"Tomcat Applications \",\n 'Indent' => 1,\n 'Columns' =>\n [\n \"Host\",\n \"Tomcat Version\",\n \"Port\",\n \"Web Application\"\n ])\n\n results.each { |r|\n report_service(:host => session.sock.peerhost, :port => r[2], :name => \"http\", :info => \"#{r[0]} Tomcat #{r[1]}, Application:#{r[3]}\")\n tbl_services << r\n }\n\n tbl_users = Rex::Text::Table.new(\n 'Header' => \"Tomcat Server Users \",\n 'Indent' => 1,\n 'Columns' =>\n [\n \"Host\",\n \"User\",\n \"Password\",\n \"Roles\"\n ])\n\n users.each { |u|\n tbl_users << [ session.sock.peerhost,u[0],u[1],u[2] ]\n }\n\n print_line()\n print_line(tbl_services.to_s)\n print_line(tbl_users.to_s)\n p = store_loot(\"host.webservers.tomcat\", \"text/plain\", session, tbl_services.to_s + \"\\n\" + tbl_users.to_s, \"tomcat.txt\", \"Tomcat Server Enum\")\n print_good(\"Results stored in: #{p}\")\n end", "def check_clustering(manifest, bosh_properties)\n # :: hash (release -> hash (job -> hash (property -> default)))\n\n params = {}\n manifest['configuration']['templates'].each do |property, template|\n params[property] = Common.parameters_in_template(template)\n end\n\n # Iterate over roles\n # - Iterate over jobs\n # - Determine templates used by job\n # - Determine parameters used by template\n # - Collect /_CLUSTER_IPS$/\n\n manifest['roles'].each do |role|\n rparams = params.dup\n if role['configuration'] && role['configuration']['templates']\n role['configuration']['templates'].each do |property, template|\n rparams[property] = Common.parameters_in_template(template)\n end\n end\n\n collected_params = Hash.new { |h, parameter| h[parameter] = [] }\n # collected_params :: hash (parameter -> array (pair (job,release)))\n # And default unknown elements as empty list.\n\n (role['jobs'] || []).each do |job|\n job_name = job['name']\n release_name = job['release_name']\n unless bosh_properties.has_key? release_name\n STDOUT.puts \"Role #{role['name']} has job #{job_name} from unknown release #{release_name}\"\n end\n unless bosh_properties[release_name].has_key? job_name\n STDOUT.puts \"Role #{role['name']} has job #{job_name} not in release #{release_name}\"\n @has_errors += 1\n next\n end\n bosh_properties[release_name][job_name].each_key do |property|\n (rparams[\"properties.\" + property] || []).each do |param|\n next unless /^(KUBERNETES_CLUSTER_DOMAIN|KUBE_.*_CLUSTER_IPS)$/ =~ param\n collected_params[param] << [job_name, release_name]\n end\n end\n end\n\n if collected_params.empty?\n next unless has_script(role, @configure_ha)\n STDOUT.puts \"Superfluous use of #{@configure_ha.red} by role #{role['name'].red}\"\n @has_errors += 1\n else\n next if has_script(role, @configure_ha)\n # secrets-generation uses KUBERNETES_CLUSTER_DOMAIN for cert generation but is not an HA role itself\n next if role['name'] == 'secret-generation'\n STDOUT.puts \"Missing #{@configure_ha.red} in role #{role['name'].red}, requested by\"\n collected_params.each do |param, jobs|\n STDOUT.puts \"- #{param.red}\"\n jobs.each do |job|\n STDOUT.puts \" - Job #{job[0].red} in release #{job[1].red}\"\n end\n end\n @has_errors += 1\n end\n end\nend", "def getLatestVersions(matchVersion)\n ret = {}\n keyMap = {\n 'Test_services' => 'server-Test-services-deployment',\n 'Test_api' => 'server-Test-apis-deployment',\n 'Test_mysql_proxy' => 'Test-mysql-proxy'}\n\n s3 = getS3()\n keyMap.each do |deployment, key|\n ret[deployment] = getLatestVersion(key, matchVersion, s3)\n end\n ret\nend", "def taggable_ministerial_role_appointments_container\n Rails.cache.fetch(taggable_ministerial_role_appointments_cache_digest, expires_in: 1.day) do\n role_appointments_container_for(RoleAppointment.for_ministerial_roles)\n end\n end", "def fetch!\n cm = @api.api('apps/v1').resource('deployments', namespace: @ns).get(@deployment)\n volume = cm.spec.template.spec.volumes.map(&:to_h).find { |h| h[:name] == @volume }\n items = volume.dig(:configMap, :items) || []\n @_current = items.find { |item| item[:key] == @key }\n end", "def verify_prior_nodes_live(node)\n if node.workorder.has_key?(\"rfcCi\")\n ci = node.workorder.rfcCi\n actionName = node.workorder.rfcCi.rfcAction\n else\n ci = node.workorder.ci\n actionName = node.workorder.actionName\n end\n \n timeout_sec = node['solr_api_timeout_sec'].to_i\n \n #get the map with all cloud's id & deployment order in the form |key,value| => |cloudId, deployment_order|\n #ex {34951930=>\"7\", 35709237=>\"8\", 34951924=>\"4\"}\n cloudIdsWithDpmtOrderMap = cloud_deployment_order(node)\n Chef::Log.info(\"Cloud id & deployment order map : #{cloudIdsWithDpmtOrderMap.to_json}\")\n \n #get array of solrcloud nodes for the action selected\n #get list of all solrcloud nodes which are selected for this action in the deployment\n nodesInAction = get_solrcloud_instances_by_action(node, actionName)\n \n thisNodeCiName = ci[:ciName]\n Chef::Log.info(\"This solrcloud node's ciName : #{thisNodeCiName}\")\n \n #get the node cloud id \"solrcloud-34951924-1\" => \"34951924\"\n thisCloudId = thisNodeCiName.split('-')[1]\n \n #get the deployment order of this node's cloud\n thisNodeCloudDpmtOrder = cloudIdsWithDpmtOrderMap.fetch(thisCloudId.to_i)\n Chef::Log.info(\"This node's cloud deployment order : #{thisNodeCloudDpmtOrder}\")\n \n #get all cloud ids having deployment order <= node_cloud_deployment_order. This is required to make sure that all prior cloud deployment was completed\n #ex From all clouds {34951930=>\"7\", 35709237=>\"8\", 34951924=>\"4\"} for node_cloud_deployment_order = 7 => {34951930=>\"7\", 34951924=>\"4\"}\n #same node_cloud_id is inclusive because there may be multiple nodes in node's cloud.\n #This list is used to make sure that all nodes across this cloud list are deployed first\n cloudIdsTobeDeployedPrior = []\n cloudIdsWithDpmtOrderMap.each do |k, v|\n if v.to_i <= thisNodeCloudDpmtOrder.to_i\n cloudIdsTobeDeployedPrior.push k\n end\n end\n Chef::Log.info(\"Cloud ids to be deployed before : #{cloudIdsTobeDeployedPrior.to_json}\")\n \n #get solrcloud nodes for cloud ids to be deployed prior\n nodeIndexesTobeDeployedPrior = []\n nodesInAction.each do |n|\n ciName = n['ciName']\n cloudId = ciName.split('-')[1]\n index = ciName.split('-', 2)[1]\n if cloudIdsTobeDeployedPrior.include? cloudId.to_i\n # prefx the cloud deployment order to determine the order of solr instace in the deployment\n # User might select the lower cloudId with higher deployment order and vice-versa so deployment order will be useful\n nodeIndexesTobeDeployedPrior.push cloudIdsWithDpmtOrderMap[cloudId.to_i]+\"-\"+index\n end\n end\n \n #sort solrcloud_nodes_tobe_deployed_prior by ciName (cloudId & compute index)\n nodeIndexesTobeDeployedPrior.sort! {|a, b| b <=> a}\n #default sorting is in descending order, we want to process the deployment in the ascending order of compute number\n #so reverse the order\n nodeIndexesTobeDeployedPrior.reverse!\n Chef::Log.info(\"solrclouds to executed before #{nodeIndexesTobeDeployedPrior.to_json}\")\n \n computeCloudIdIpMap = get_compute_number_to_ip_map(node)\n Chef::Log.info(\"compute number to ip map : #{computeCloudIdIpMap.to_json}\")\n # prefx the cloud deployment order to determine the order of solr instace in the deployment\n # User might select the lower cloudId with higher deployment order and vice-versa so deployment order will be useful\n thisNodeIndex = thisNodeCloudDpmtOrder+\"-\"+thisNodeCiName.split('-',2)[1]\n Chef::Log.info(\"This node index : #{thisNodeIndex}\")\n \n # select only the nodes with lower index & this node index\n nodeIndexesTobeDeployedPrior = nodeIndexesTobeDeployedPrior.select {|cloudIdIndex| cloudIdIndex <= thisNodeIndex}\n \n index = nodeIndexesTobeDeployedPrior.index {|id| id == thisNodeIndex}\n Chef::Log.info(\"index = #{index}\")\n \n wait_time = index * 10;\n Chef::Log.info(\"Allowing #{wait_time} seconds for prior nodes to start the deployment before\")\n sleep wait_time\n \n nodeIpsTobeDeployedPrior = []\n nodeIndexesTobeDeployedPrior.each do |nodeIndex|\n if !nodeIndex.eql? thisNodeIndex\n nodeIndexWithoutDpmtOrder = nodeIndex.split('-',2)[1]\n Chef::Log.info(\"nodeIndexWithoutDpmtOrder = #{nodeIndexWithoutDpmtOrder}\")\n nodeIpsTobeDeployedPrior.push computeCloudIdIpMap[nodeIndexWithoutDpmtOrder]\n end\n end\n \n # No need to check for other nodes to confirm those are live before processing this node as there are no prior nodes in the list\n if nodeIpsTobeDeployedPrior.empty?\n return\n end\n \n Chef::Log.info(\"nodeIpsTobeDeployedPrior = #{nodeIpsTobeDeployedPrior.to_json}\")\n host = nodeIpsTobeDeployedPrior[0]\n cluster_state = get_cluster_state(host, node['port_no'], timeout_sec)\n nodes_up_status = nodes_live?(host, node['port_no'], nodeIpsTobeDeployedPrior, timeout_sec)\n Chef::Log.info(\"Node live status : #{nodes_up_status}\")\n if !nodes_up_status \n error = \"Some of the prior nodes from list #{nodeIpsTobeDeployedPrior.to_json} in the deployment are not live.\"\n puts \"***FAULT:FATAL=#{error}\"\n raise error\n end\n end", "def staging_production(staging)\n return nil unless staging\n @deploy.updated_at.to_i - staging.updated_at.to_i\n end", "def installed_assets()\n installed = Array.new()\n asset_on_segment_historys.each do |hist|\n if !hist.assets.first.nil?\n asset = Asset.find_by_guid(hist.assets.first.g_u_i_d)\n installed << asset unless asset.asset_on_segment_history.nil?\n end\n end\n return installed\n end", "def notify\n ### TO DO: Flatten the replication group deployment metadata structure. It is probably waaaaaaay too nested.\n if @config[\"create_replication_group\"]\n repl_group = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @region, credentials: @credentials)\n # DNS records for the \"real\" zone should always be registered as late as possible so override_existing only overwrites the records after the resource is ready to use.\n if @config['dns_records']\n @config['dns_records'].each { |dnsrec|\n dnsrec['name'] = repl_group.node_groups.first.primary_endpoint.address.downcase if !dnsrec.has_key?('name')\n dnsrec['name'] = \"#{dnsrec['name']}.#{MU.environment.downcase}\" if dnsrec[\"append_environment_name\"] && !dnsrec['name'].match(/\\.#{MU.environment.downcase}$/)\n }\n end\n # XXX this should be a call to @deploy.nameKitten\n MU::Cloud.resourceClass(\"AWS\", \"DNSZone\").createRecordsFromConfig(@config['dns_records'], target: repl_group.node_groups.first.primary_endpoint.address)\n\n deploy_struct = {\n \"identifier\" => repl_group.replication_group_id,\n \"create_style\" => @config[\"create_style\"],\n \"region\" => @region,\n \"members\" => repl_group.member_clusters,\n \"automatic_failover\" => repl_group.automatic_failover,\n \"snapshotting_cluster_id\" => repl_group.snapshotting_cluster_id,\n \"primary_endpoint\" => repl_group.node_groups.first.primary_endpoint.address,\n \"primary_port\" => repl_group.node_groups.first.primary_endpoint.port\n }\n\n repl_group.member_clusters.each { |id|\n cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(id, region: @region)\n\n vpc_sg_ids = []\n cluster.security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.security_group_id\n }\n\n cache_sg_ids = []\n unless cluster.cache_security_groups.empty?\n cluster.cache_security_groups.each { |cache_sg|\n cache_sg_ids << cache_sg.security_group_id\n }\n end\n\n deploy_struct[id] = {\n \"configuration_endpoint\" => cluster.configuration_endpoint,\n \"cache_node_type\" => cluster.cache_node_type,\n \"engine\" => cluster.engine,\n \"engine_version\" => cluster.engine_version,\n \"num_cache_nodes\" => cluster.num_cache_nodes,\n \"preferred_maintenance_window\" => cluster.preferred_maintenance_window,\n \"notification_configuration\" => cluster.notification_configuration,\n \"cache_security_groups\" => cache_sg_ids,\n \"cache_parameter_group\" => cluster.cache_parameter_group.cache_parameter_group_name,\n \"cache_subnet_group_name\" => cluster.cache_subnet_group_name,\n \"cache_nodes\" => cluster.cache_nodes,\n \"auto_minor_version_upgrade\" => cluster.auto_minor_version_upgrade,\n \"vpc_security_groups\" => vpc_sg_ids,\n \"replication_group_id\" => cluster.replication_group_id,\n \"snapshot_retention_limit\" => cluster.snapshot_retention_limit,\n \"snapshot_window\" => cluster.snapshot_window \n }\n }\n\n repl_group.node_groups.first.node_group_members.each{ |member| \n deploy_struct[member.cache_cluster_id][\"cache_node_id\"] = member.cache_node_id\n deploy_struct[member.cache_cluster_id][\"read_endpoint_address\"] = member.read_endpoint.address\n deploy_struct[member.cache_cluster_id][\"read_endpoint_port\"] = member.read_endpoint.port\n deploy_struct[member.cache_cluster_id][\"current_role\"] = member.current_role\n }\n else\n cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @region, credentials: @credentials)\n\n vpc_sg_ids = []\n cluster.security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.security_group_id\n }\n\n cache_sg_ids = []\n unless cluster.cache_security_groups.empty?\n cluster.cache_security_groups.each { |cache_sg|\n cache_sg_ids << cache_sg.security_group_id\n }\n end\n\n deploy_struct = {\n \"cache_node_type\" => cluster.cache_node_type,\n \"engine\" => cluster.engine,\n \"engine_version\" => cluster.engine_version,\n \"num_cache_nodes\" => cluster.num_cache_nodes,\n \"preferred_maintenance_window\" => cluster.preferred_maintenance_window,\n \"notification_configuration\" => cluster.notification_configuration,\n \"cache_security_groups\" => cache_sg_ids,\n \"cache_parameter_group\" => cluster.cache_parameter_group.cache_parameter_group_name,\n \"cache_subnet_group_name\" => cluster.cache_subnet_group_name,\n \"cache_nodes\" => cluster.cache_nodes,\n \"auto_minor_version_upgrade\" => cluster.auto_minor_version_upgrade,\n \"vpc_security_groups\" => vpc_sg_ids,\n \"replication_group_id\" => cluster.replication_group_id,\n \"snapshot_retention_limit\" => cluster.snapshot_retention_limit,\n \"snapshot_window\" => cluster.snapshot_window \n }\n if !cluster.configuration_endpoint.nil?\n deploy_struct[\"configuration_endpoint_address\"] = cluster.configuration_endpoint.address\n deploy_struct[\"configuration_endpoint_port\"] = cluster.configuration_endpoint.port\n end\n end\n\n return deploy_struct\n end", "def deploy_to_hosts\n all_hosts = self.roles.map(&:host).uniq\n return all_hosts - self.excluded_hosts\n end", "def deploy_to_hosts\n all_hosts = self.roles.map(&:host).uniq\n return all_hosts - self.excluded_hosts\n end", "def deploy_to_hosts\n all_hosts = self.roles.map(&:host).uniq\n return all_hosts - self.excluded_hosts\n end", "def deploy_to_hosts\n all_hosts = self.roles.map(&:host).uniq\n return all_hosts - self.excluded_hosts\n end", "def digest_sheets_created\n all_viewable_sheets\n .where(project_id: all_digest_projects.select(:id), missing: false)\n .where(\"sheets.created_at > ?\", last_business_day)\n end", "def run_deploys(deployments, app_name, app_data)\n did_we_deploy = false\n\n deployments.each do |application, deploy|\n\n if application != app_name\n debug_log(\"#{application} skipped: #{app_name}\")\n next\n end\n\n layer_name = app_data['layer']\n next unless allow_deploy(application, app_name, layer_name)\n\n debug_log('Deployment started')\n debug_log(\"Deploying as user: #{deploy['user']} and #{deploy['group']}\")\n\n easybib_deploy application do\n deploy_data deploy\n end\n\n did_we_deploy = true\n\n nginx_config = app_data.fetch('nginx', nil)\n next if nginx_config.nil? # no nginx\n\n config_template = get_template(nginx_config)\n next if config_template.nil? # no nginx\n\n config_cookbook = get_cookbook(nginx_config)\n\n listen_opts = get_additional('listen_opts', app_data)\n\n easybib_nginx application do\n cookbook config_cookbook\n config_template config_template\n domain_name deploy['domains'].join(' ')\n doc_root deploy['document_root']\n htpasswd \"#{deploy['deploy_to']}/current/htpasswd\"\n listen_opts listen_opts\n notifies :reload, 'service[nginx]', :delayed\n notifies node['php-fpm']['restart-action'], 'service[php-fpm]', :delayed\n end\n end\n\n did_we_deploy\nend", "def deploy_order_by_group\n step =0\n deployement_step = compute_role_deployement_step\n deployement_host_step = []\n while @env.length >0 do\n deployement_host_step[step]=[]\n deployement_host_step[step+1]=[]\n nb_machine_before = @env.length\n #pp \" @env length before #{@env.length}\"\n\n @env.each { |name, node|\n list_role = node[:roles] ? node[:roles]: []\n\n if list_role.length == 0 then\n @env.delete(name)\n next\n end\n\n nb_role_choosen = 0\n\n list_role.each { |role|\n # pick the role\n if !deployement_step[step][role].nil? and deployement_step[step][role] > 0 then\n nb_role_choosen = nb_role_choosen + 1\n else\n break\n end\n }\n\n if nb_role_choosen == list_role.length and list_role.length !=0 then\n # all roles statified, add machine to the step et delete her from the list_role\n deployement_host_step[step].push(name)\n @env.delete(name)\n #pp \"DELETE HOST #{name}\"\n # solder deployed\n list_role.each { |role|\n deployement_step[step][role] = deployement_step[step][role] - 1\n }\n end\n }\n # verify if roles remains , if it's true, add them to the next step\n deployement_step[step].each { |role, number|\n if number > 0 then\n if deployement_step[step+1].nil? then\n deployement_step[step+1] = {}\n end\n deployement_step[step+1][role] = deployement_step[step+1][role].nil? ? number : deployement_step[step+1][role] + number\n end\n }\n #pp \" @env length after #{@env.length}\"\n nb_machine_after = @env.length\n step = step + 1\n if nb_machine_before == nb_machine_after then\n break\n end\n end\n return deployement_host_step\n end", "def configuration_deployment_summary_per_app\n return @configuration_deployment_summary_per_app\n end", "def regional_rolling_deploy(stack_id:, layer_id:, app_id:, revision: '')\n log(\"Starting opsworks deploy for app #{app_id}\\n\\n\")\n\n instances = @opsworks_client.describe_instances(layer_id: layer_id)[:instances]\n\n instances_by_group = instances.map {|v| v.to_h}.group_by { |d| d[:availability_zone] }\n\n instances_by_group.each do |region, instance_group|\n # Only deploy to online instances\n online_instance = instance_group.select{|k| k[:status] == 'online'}\n instances_ids = online_instance.map{|k| k[:instance_id]}\n instances_names = online_instance.map{|k| k[:hostname]}\n\n next if instances_names.empty?\n\n puts \"#{instances_names} in #{region}\"\n\n begin\n load_balancers = {}\n log(\"=== Starting deploy for #{instances_names} ===\")\n\n online_instance.each do |instance|\n instance = Aws::OpsWorks::Types::Instance.new(instance)\n load_balancers[instance.instance_id] = detach_from_elbs(instance: instance)\n end\n\n wait_for_detach(@lb_wait_params)\n\n deploy(\n stack_id: stack_id,\n app_id: app_id,\n instance_id: instances_ids,\n revision: revision\n )\n ensure\n online_instance.each do |instance|\n instance = Aws::OpsWorks::Types::Instance.new(instance)\n attach_to_elbs(instance: instance, load_balancers: load_balancers[instance.instance_id]) if load_balancers[instance.instance_id]\n end\n\n wait_for_re_attach(@lb_wait_params)\n\n log(\"=== Done deploying on #{instances_names} ===\\n\\n\")\n end\n end\n\n log(\"SUCCESS: completed opsworks deploy for all instances on app #{app_id}\")\n end", "def notify\n deploy_struct = MU.structToHash(cloud_desc)\n# XXX stages and whatnot\n return deploy_struct\n end", "def wait_termination(timeout = nil)\n result, @terminated_deployments =\n terminated_deployments, Hash.new\n result\n end", "def scheduled_activities(validity=:sa_content)\n # TODO: how to memoize with proper cache invalidation?\n days = schedule(validity)['days']\n return {} unless days\n days.inject({}) do |index, (day, day_value)|\n day_value['activities'].each do |row|\n sa = Psc::ScheduledActivity.from_schedule(row)\n\n index[sa.id] = sa\n end\n index\n end\n end", "def security_baseline_auditd_redhat(_os, _distid, _release)\n security_baseline_auditd = {}\n arch = Facter.value(:architecture)\n\n val = Facter::Core::Execution.exec('grep \"^max_log_file.*=\" /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n security_baseline_auditd['max_log_file'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('grep \"^space_left_action.*=\" /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n security_baseline_auditd['space_left_action'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('grep action_mail_acct /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n security_baseline_auditd['action_mail_acct'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('grep \"^admin_space_left_action.*=\" /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n security_baseline_auditd['admin_space_left_action'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('grep max_log_file_action /etc/audit/auditd.conf | awk -F\\'=\\' \\'{print $2;}\\'').strip\n security_baseline_auditd['max_log_file_action'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n security_baseline_auditd['srv_auditd'] = check_service_is_enabled('auditd')\n val = Facter::Core::Execution.exec('grep \"^\\s*linux\" /boot/grub2/grub.cfg')\n security_baseline_auditd['auditing_process'] = if val.empty? || val.nil?\n 'none'\n else\n val\n end\n\n val = Facter::Core::Execution.exec('auditctl -l | grep time-change')\n expected = [\n '-a always,exit -F arch=b32 -S stime,settimeofday,adjtimex -F key=time-change',\n '-a always,exit -F arch=b32 -S clock_settime -F key=time-change',\n '-w /etc/localtime -p wa -k time-change',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=time-change')\n expected.push('-a always,exit -F arch=b64 -S clock_settime -F key=time-change')\n end\n security_baseline_auditd['time-change'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep identity')\n expected = [\n '-w /etc/group -p wa -k identity',\n '-w /etc/passwd -p wa -k identity',\n '-w /etc/gshadow -p wa -k identity',\n '-w /etc/shadow -p wa -k identity',\n '-w /etc/security/opasswd -p wa -k identity',\n ]\n security_baseline_auditd['identity'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep system-locale')\n expected = [\n '-a always,exit -F arch=b32 -S sethostname,setdomainname -F key=system-locale',\n '-w /etc/issue -p wa -k system-locale',\n '-w /etc/issue.net -p wa -k system-locale',\n '-w /etc/hosts -p wa -k system-locale',\n '-w /etc/sysconfig/network -p wa -k system-locale',\n '-w /etc/sysconfig/network-scripts -p wa -k system-locale',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S sethostname,setdomainname -F key=system-locale')\n end\n security_baseline_auditd['system-locale'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep MAC-policy')\n expected = [\n '-w /etc/selinux -p wa -k MAC-policy',\n '-w /usr/share/selinux -p wa -k MAC-policy',\n ]\n security_baseline_auditd['mac-policy'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep logins')\n expected = [\n '-w /var/log/lastlog -p wa -k logins',\n '-w /var/run/faillock -p wa -k logins',\n ]\n security_baseline_auditd['logins'] = check_values(val, expected, true)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep session')\n expected = [\n '-w /var/run/utmp -p wa -k session',\n ]\n security_baseline_auditd['session'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"logins$\"')\n expected = [\n '-w /var/log/wtmp -p wa -k logins',\n '-w /var/log/btmp -p wa -k logins',\n ]\n security_baseline_auditd['session-logins'] = check_values(val, expected, true)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep perm_mod')\n expected = [\n '-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F key=perm_mod',\n '-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod',\n '-a always,exit -F arch=b32 -S setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F auid>=1000 -F auid!=-1 -F key=perm_mod',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F key=perm_mod')\n expected.push('-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod')\n expected.push('-a always,exit -F arch=b64 -S setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F auid>=1000 -F auid!=-1 -F key=perm_mod')\n end\n security_baseline_auditd['perm-mod'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep access')\n expected = [\n '-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat -F exit=-EACCES -F auid>=1000 -F auid!=-1 -F key=access',\n '-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat -F exit=-EPERM -F auid>=1000 -F auid!=-1 -F key=access',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S open,truncate,ftruncate,creat,openat -F exit=-EACCES -F auid>=1000 -F auid!=-1 -F key=access')\n expected.push('-a always,exit -F arch=b64 -S open,truncate,ftruncate,creat,openat -F exit=-EPERM -F auid>=1000 -F auid!=-1 -F key=access')\n end\n security_baseline_auditd['access'] = check_values(val, expected)\n\n rules = {}\n priv_cmds = []\n expected = []\n # Facter.value(:partitions).each do |_part, data|\n # if (data.key?('mount')) && (data['filesystem'] != 'iso9660') && ! _part.match(%r{^\\/dev/loop}) && ! _part.match(%r{^\\/dev/mapper\\/docker})\n # mount = data['mount']\n # cmd = \"find #{mount} -xdev \\\\( -perm -4000 -o -perm -2000 \\\\) -type f | awk '{print \\\"-a always,exit -S all -F path=\\\" $1 \\\" -F perm=x -F auid>=1000 -F auid!=-1 -F key=privileged\\\"; }'\"\n # rules_raw = Facter::Core::Execution.exec(cmd).split(\"\\n\")\n # priv_cmds.push(rules_raw)\n # rules[mount] = rules_raw\n # expected.push(*rules_raw)\n # end\n # end\n cmd = \"find /usr -xdev \\\\( -perm -4000 -o -perm -2000 \\\\) -type f | awk '{print \\\"-a always,exit -S all -F path=\\\" $1 \\\" -F perm=x -F auid>=1000 -F auid!=-1 -F key=privileged\\\"; }'\"\n rules_raw = Facter::Core::Execution.exec(cmd).split(\"\\n\")\n priv_cmds.push(rules_raw)\n rules['/usr'] = rules_raw\n expected.push(*rules_raw)\n expected.uniq!\n security_baseline_auditd['priv-cmds-rules'] = rules\n security_baseline_auditd['priv-cmds-list'] = priv_cmds.uniq\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"privileged$\"')\n security_baseline_auditd['priv-cmds'] = check_values(val, expected, true)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"mounts$\"')\n expected = [\n '-a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=-1 -F key=mounts',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=-1 -F key=mounts')\n end\n security_baseline_auditd['mounts'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"delete$\"')\n expected = [\n '-a always,exit -F arch=b32 -S unlink,rename,unlinkat,renameat -F auid>=1000 -F auid!=-1 -F key=delete',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S rename,unlink,unlinkat,renameat -F auid>=1000 -F auid!=-1 -F key=delete')\n end\n security_baseline_auditd['delete'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep scope')\n expected = [\n '-w /etc/sudoers -p wa -k scope',\n '-w /etc/sudoers.d -p wa -k scope',\n ]\n security_baseline_auditd['scope'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep actions')\n expected = [\n '-w /var/log/sudo.log -p wa -k actions',\n ]\n security_baseline_auditd['actions'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('auditctl -l | grep \"modules$\"')\n expected = [\n '-w /sbin/insmod -p x -k modules',\n '-w /sbin/rmmod -p x -k modules',\n '-w /sbin/modprobe -p x -k modules',\n ]\n if arch == 'x86_64'\n expected.push('-a always,exit -F arch=b64 -S init_module,delete_module -F key=modules')\n else\n expected.push('-a always,exit -F arch=b32q -S init_module,delete_module -F key=modules')\n end\n security_baseline_auditd['modules'] = check_values(val, expected)\n\n val = Facter::Core::Execution.exec('grep \"^\\s*[^#]\" /etc/audit/audit.rules | tail -1')\n security_baseline_auditd['immutable'] = if val.empty? || val.nil?\n false\n elsif val == '-e 2'\n true\n else\n false\n end\n\n security_baseline_auditd\nend", "def notify\n return nil if !@cloud_id or !cloud_desc(use_cache: false)\n deploy_struct = MU.structToHash(cloud_desc, stringify_keys: true)\n deploy_struct['url'] = \"https://\"+@cloud_id+\".execute-api.\"+@region+\".amazonaws.com\"\n deploy_struct['url'] += \"/\"+@config['deploy_to'] if @config['deploy_to']\n# XXX stages and whatnot\n return deploy_struct\n end", "def report_deployments(gear_env, options = {})\n broker_addr = @config.get('BROKER_HOST')\n domain = gear_env['OPENSHIFT_NAMESPACE']\n app_name = gear_env['OPENSHIFT_APP_NAME']\n app_uuid = gear_env['OPENSHIFT_APP_UUID']\n url = \"https://#{broker_addr}/broker/rest/domain/#{domain}/application/#{app_name}/deployments\"\n\n params = broker_auth_params\n if params\n deployments = calculate_deployments\n deployments.reject! { |d| d[:activations].empty? }\n\n params['deployments[]'] = deployments\n params[:application_id] = app_uuid\n\n begin\n request = RestClient::Request.new(method: :post,\n url: url,\n timeout: 30,\n headers: {accept: 'application/json;version=1.6', user_agent: 'OpenShift'},\n payload: params)\n\n response = request.execute { |response, request, result| response }\n rescue => e\n options[:out].puts \"Failed to report deployment to broker. This will be corrected on the next git push. Message: #{e.message}\" if options[:out]\n else\n if 300 <= response.code\n options[:out].puts \"Failed to report deployment to broker with status #{response.code}. This will be corrected on the next git push.\" if options[:out]\n end\n end\n end\n end", "def sql_inventory\n \"SELECT * from DIM_COMM_TOOL_ASSET_HIST_V ah\n join dim_comm_os_v as os on os.os_id = ah.os_id\n where org_l1_id=#{org_l1_id} and org_id=#{org_id}\n AND CURRENT_TIMESTAMP BETWEEN ah.row_from_timestamp AND COALESCE(ah.row_to_timestamp, CURRENT_TIMESTAMP)\n order by host_name\"\n end", "def manifestations_launched\n find_related_frbr_objects( :launches, :which_manifestations?) \n end", "def test_for_node\n deploy_info = @deployer.deployment_info_from(@node)[@node]\n if deploy_info.key?(:error)\n error \"Error while getting deployment info: #{deploy_info[:error]}\"\n elsif Time.now.utc - deploy_info[:deployment_info][:date] > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS\n error \"Last deployment has been done on #{deploy_info[:deployment_info][:date].strftime('%F')}. Should refresh it.\"\n end\n end", "def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend", "def deploy\n\t# This task is typiclly run after the site is updated but before the server is restarted.\nend", "def do_servers_storages_database_resources\n depl_resource_types = {}\n (@deployment.servers.all(:include => :patterns) + @deployment.storages.all(:include => :patterns) +\n @deployment.database_resources.all(:include => :patterns)).each do |resource|\n cloud = @clouds[resource.cloud_id]\n depl_resource_type_id = case resource.class.to_s\n when 'Server'\n resource.server_type_id\n when 'Storage'\n resource.storage_type_id\n when 'DatabaseResource'\n resource.database_type_id\n end\n depl_resource_types[depl_resource_type_id] ||= {}\n depl_resource_types[depl_resource_type_id][cloud.id] ||= {}\n\n ['instance_hour', 'transaction', 'storage_size', 'read_request', 'write_request'].each do |ccs_name|\n # Skip this ccs_name if the resource doesn't have it\n next unless resource.respond_to?(\"#{ccs_name}_monthly_baseline\")\n\n values = get_monthly_values(resource, ccs_name)\n quantity_values = get_monthly_values(resource, 'quantity')\n\n depl_resource_types[depl_resource_type_id][cloud.id][ccs_name] ||= {}\n depl_resource_types[depl_resource_type_id][cloud.id][ccs_name][:values] ||= Array.new(@costs.length){0}\n depl_resource_types[depl_resource_type_id][cloud.id][ccs_name][:quantity_values] ||= Array.new(@costs.length){0}\n @costs.each_with_index do |month, i|\n # A month has max number of hours, enforce this in case user patterns accidentally make it go over this value\n if ccs_name == 'instance_hour'\n hours_in_month = 24 * Time.days_in_month(month[:timestamp].month, month[:timestamp].year)\n values[i] = hours_in_month if values[i] > hours_in_month\n end\n # Protect users from creating stupid patterns that set values to less than 0\n values[i] = 0 if values[i] < 0\n quantity_values[i] = 0 if quantity_values[i] < 0\n\n depl_resource_types[depl_resource_type_id][cloud.id][ccs_name][:values][i] += (values[i] * quantity_values[i])\n depl_resource_types[depl_resource_type_id][cloud.id][ccs_name][:quantity_values][i] += quantity_values[i]\n end\n end\n end\n\n depl_resource_types.each do |depl_resource_type_id, cloud_ids|\n cloud_ids.each do |cloud_id, ccs_names|\n cloud = @clouds[cloud_id]\n ccs_names.each do |ccs_name, values_hash|\n price_details = get_price_details(cloud_id, depl_resource_type_id, ccs_name)\n\n unless price_details.empty?\n if price_details[:custom_algorithm]\n self.send(\"do_#{price_details[:custom_algorithm]}\")\n else\n @costs.each_with_index do |month, i|\n # No need to multiply the quantity again as values[i] already has the total usage\n usage = values_hash[:values][i]\n cost = get_tiered_cost(usage, price_details[:units], price_details[:tiers])\n recurring_cost = price_details[:recurring_cost_values][i] * values_hash[:quantity_values][i]\n total_cost = cost + recurring_cost\n month[ccs_name.to_sym] += total_cost.to_money(cloud.billing_currency).exchange_to(@user_currency).to_f\n end\n end\n end\n end\n end\n end\n end", "def tenantHome(aptArr,tenantArr)\n tenantArr.each do |tenant|\n tenantApt = tenant[:apartment_id]\n aptArr.each do |apt|\n if apt[:id] == tenantApt\n puts \"#{tenant[:name]} lives at: #{apt[:address]}\"\n end\n end\n end\n end", "def deploy_to\n fetch(:deploy_to, nil) || \"/opt/apps/#{fetch(:application)}\"\n end", "def enumerate_tomcat(val_installpath,val_version)\n results = []\n found = false\n print_good(\"\\t\\t+ Version: #{val_version}\")\n print_good(\"\\t\\t+ Path: #{val_installpath}\")\n\n if not exist?(val_installpath + \"\\\\conf\\\\server.xml\")\n print_error(\"\\t\\t! tomcat configuration not found\")\n return results\n end\n\n appname = find_application_name(val_installpath)\n\n ports = []\n xml_data = read_file(val_installpath + \"\\\\conf\\\\server.xml\")\n doc = REXML::Document.new(xml_data)\n doc.elements.each('Server/Service/Connector') do |e|\n ports << e.attributes['port']\n end\n ports.uniq.each do |p|\n print_good(\"\\t\\t+ Port: #{p}\")\n found = true\n results << [session.sock.peerhost,\"#{val_version}\",p,appname]\n end\n if found\n print_good(\"\\t\\t+ Application: [#{appname}]\")\n else\n print_error(\"\\t\\t! port not found\")\n end\n return results\n rescue\n print_error(\"\\t\\t! could not identify information\")\n return results || []\n end", "def deploy_organization\n name, app_url = configure_heroku\n log_url = \"https://dashboard.heroku.com/apps/#{name}/logs\"\n success_box(\"Your app #{name} is now deployed at #{app_url}! If you encounter any issues, check the logs at #{log_url}.\")\n dns_target = get_heroku_dns_target(name, app_url)\n unless dns_target.nil?\n box(\"NOTE: Since you configured a custom host URL (#{app_url}), you must set your URL's DNS settings to point to #{dns_target} before using the app if you haven't already. You can find more info #{TTY::Link.link_to(\"here.\", \"http://url.perlmutterapp.com/custom-url\")}\")\n end\nend", "def cache_names\n names = {}\n dcns = self.defined_cache_names.sub('[', '')\n\n list = dcns.split(')')\n list.each do |cache_name|\n unless cache_name == \"]\"\n if cache_name.include? \"(not created\"\n names.store(cache_name.sub(\"(not created\", \"\"), \"not created\")\n else\n names.store(cache_name.sub(\"(created\", \"\"), \"created\")\n end\n end\n end\n\n names\n end", "def get_existing_commits!\n release_meta_paths = Dir.glob(\"#{RELEASE_META_DIR}/*.toml\").to_a\n\n release_meta_paths.collect do |release_meta_path|\n contents = File.read(release_meta_path)\n parsed_contents = TomlRB.parse(contents)\n release_hash = parsed_contents.fetch(\"releases\").values.fetch(0)\n release_hash.fetch(\"commits\").collect do |c|\n message_data = parse_commit_message!(c.fetch(\"message\"))\n\n {\n \"sha\" => c.fetch(\"sha\"),\n \"message\" => c.fetch(\"message\"),\n \"author\" => c.fetch(\"author\"),\n \"date\" => c.fetch(\"date\"),\n \"pr_number\" => message_data.fetch(\"pr_number\"),\n \"files_count\" => c[\"files_count\"],\n \"insertions_count\" => c[\"insertions_count\"],\n \"deletions_count\" => c[\"deletions_count\"]\n }\n end\n end.flatten\nend", "def cache_change\n @project = Project.find_by_id(project_id)\n if !@project.nil? # prevents issue where @project was returning null, if the project hadn't been approved yet.\n if @project.is_stage_one == \"Is not Stage One\" && @project.active == true && attribute_name != 'active' && @project.donor.name == 'China'\n\n first = Rails.cache.fetch(\"recent/first\")\n\n # if the last project was the same as this one, store it in the string\n # instead of making a new entry\n if first && first[:id] == project_id\n action = first[:action]\n new_action = \"#{(attribute_name || \"#{association_model}s\").titleize.downcase}\"\n\n #no duplicates\n unless /#{new_action}/ =~ action\n first[:action] = action << \", #{new_action}\"\n first[:time] = self.updated_at\n Rails.cache.write(\"recent/first\", first)\n else\n false\n end\n\n else\n # add a new entry and move the old ones down\n second = Rails.cache.fetch(\"recent/second\")\n\n Rails.cache.write(\"recent/third\", second)\n Rails.cache.write(\"recent/second\", first)\n @update_sent = \"updated #{(attribute_name || \"#{association_model}s\").titleize.downcase}\"\n json = {\n id: @project.id,\n title: @project.title,\n info: @project.to_english(exclude_title: true),\n action: @update_sent,\n time: self.updated_at\n }\n\n Rails.cache.write(\"recent/first\", json)\n end\n else\n false\n end\n end\n end", "def fetch_deploy_lock\n # Return if we know that the deploy lock has just been removed\n return if fetch(:deploy_lock_removed)\n\n unless fetch(:deploy_lock)\n # Check all matching servers for a deploy lock.\n on roles(fetch(:deploy_lock_roles)), in: :parallel do |host|\n if test(\"[ -f #{fetch(:deploy_lock_file)} ]\")\n output = capture \"cat #{fetch(:deploy_lock_file)}\"\n set :deploy_lock, YAML.load(output)\n else\n # no deploy lock was found on server\n next\n end\n end\n end\nend", "def deployed_app_count\n return @deployed_app_count\n end", "def find_or_create(name)\n @log.info \"Looking for deployment: '#{name}'...\"\n deployment = @api_shim.find_deployment_by_name(name)\n @log.info \"Deployment #{deployment.nil? ? \"not found\" : \"found\"}.\"\n unless deployment\n deployment = @api_shim.create_deployment(name)\n @log.info \"Deployment created: '#{name}'\"\n end\n deployment\n end", "def update_all_agent_deployed\n stored = self.class.find(id)\n if stored.nil? || label != stored.label || log_path != stored.log_path\n # only label and log_path effects agent.conf\n self.agent_updated_at = updated_at if updated_at\n self.all_agent_deployed = false\n end\n true\n end", "def update_deployment_monitors(deployments)\n \n deployments.each do |dep|\n monitor = UrlMonitor.first(:conditions => [\"parent_id= ? AND parent_type= ?\", dep.id, dep.class.to_s ])\n if monitor.nil?\n mon = UrlMonitor.new(:parent_id => dep.id, \n :parent_type => dep.class.to_s, \n :property => \"endpoint\")\n if !@options[:test]\n if mon.save\n puts \"Created new monitor for deployment id : #{dep.id}\"\n end\n else\n puts \"found endpoint that needs monitoring : #{dep.endpoint}\"\n end\n end\n end\nend", "def is_deploy_active?(stack, stage)\n if deployname = get_deploy_process_title(stack,stage)\n return system(\"pgrep -f '#{deployname}'\")\n end\n false\n end" ]
[ "0.64817715", "0.5889312", "0.5889312", "0.5880407", "0.5748293", "0.5628184", "0.5487089", "0.5376809", "0.5224653", "0.52022636", "0.51979077", "0.51937354", "0.51916146", "0.5180423", "0.517036", "0.5150626", "0.5133205", "0.5132308", "0.5040332", "0.50386935", "0.5038627", "0.50182396", "0.5004514", "0.49993643", "0.49850067", "0.49820048", "0.497436", "0.49703965", "0.49661514", "0.49408153", "0.49404347", "0.49336416", "0.49222702", "0.4900922", "0.48696247", "0.4838756", "0.48364648", "0.48318332", "0.48292425", "0.47842643", "0.4781489", "0.47746316", "0.47721067", "0.47710323", "0.47534356", "0.47517958", "0.4751098", "0.47367802", "0.47287825", "0.4717692", "0.46826056", "0.46814805", "0.46802685", "0.46770093", "0.4674712", "0.46731058", "0.4666952", "0.46618164", "0.4658323", "0.46462464", "0.46450412", "0.46340048", "0.46331584", "0.46276554", "0.46240607", "0.46216753", "0.46205705", "0.46205705", "0.46205705", "0.46205705", "0.46160835", "0.46060938", "0.46047953", "0.45984414", "0.4578257", "0.4576788", "0.45696288", "0.45652437", "0.45652273", "0.45605552", "0.4549983", "0.45448464", "0.45424825", "0.45386413", "0.45384628", "0.45384628", "0.45351437", "0.45330274", "0.45289195", "0.45236924", "0.45176566", "0.45151603", "0.45149726", "0.45142296", "0.45121512", "0.4509232", "0.4509182", "0.45087382", "0.4508239", "0.45072386" ]
0.59113157
1
GET /invites GET /invites.json
def index @invites = current_user.invites respond_to do |format| format.html # index.html.erb format.json { render json: @invites } end session[:new_invite_error] = nil session[:new_invite_error_url] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def show\n @invites = Invite.all\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\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 index\n @inviteds = Invited.all\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def index\n\t\t@guild_invites = @guild.invites.order(\"id DESC\")\n\tend", "def invitations\n res = []\n\n tmp = GoodData.get @json['project']['links']['invitations']\n tmp['invitations'].each do |invitation|\n res << GoodData::Invitation.new(invitation)\n end\n\n res\n end", "def invited_users\n render json: @moot.list_users_can_vote\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end", "def index\n @title = 'Invitations'\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @invitations }\n end\n end", "def index\n @list_invites = ListInvite.all\n end", "def index\n @invites = Invite.find(:all, :conditions => \"to_user_id = #{current_user.id} or to_email = '#{current_user.email}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invites }\n end\n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end", "def index\n @invites = current_user.invites.where(is_declined: nil).all\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n user = User.find_by(id: params[:id]) #should use session id\n if user\n invitations = user.invitations\n if invitations\n render json: invitations, status: :ok\n else\n head :no_content\n end\n else\n render json: {error: \"User not found\"}, status: :not_found\n end\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def index\n # @invitations = Invitation.all\n end", "def index\n @team_invites = TeamInvite.where(team: current_team)\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invts = Invt.all\n end", "def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\n end", "def get_mission_invites\n\t#get all missions of user with invitaion_status = pending\n user = User.exists? (params[:user_id])\n\tif user\n\t\tmissions = user.missions.references( :user_missions).select('missions.id, missions.title, user_missions.invitation_time').where( user_missions:{ invitation_status: PENDING_MESA_INVITATION})\n\t\trespond_to do |format|\n\t\t format.json {render :json=> {:mesa_invites=> missions, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No user exists with id' , :status => false} }\n\t end\n\tend\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.find :all\n render :layout => 'plain'\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end", "def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend", "def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end", "def accepted_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation.accepted\n .where('created_at > ?', since)\n .count\n respond_with json_response('accepted_invites', count)\n end", "def show\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_status }\n end\n end", "def index\n # LE TEMPS DE ...\n if self.admin?\n @invites = Invite.all\n elsif self.check_user && self.check_no_guild\n @invites = Invite.where(:user_id => session[:user_id])\n elsif self.check_user && self.check_is_guild_owner\n @invites = Invite.where(:guild_id => @guild[:id])\n end\n end", "def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end", "def show\n @invite = @event.invites.find(params[:id])\n end", "def index\n @invites = current_user.recieved_team_requests\n @sent = current_user.sent_team_requests\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.all\n render :layout => 'plain'\n end", "def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end", "def index\n @user_invitations = UserInvitation.all\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def index\n @invs = Inv.all\n end", "def index\n\t\t@events = Event.where(\"creator_id = ?\", current_user.id)\n\t\tInvitation.where(\"email = ? and accepted = ?\", current_user.email, true).each do |invitation|\n\t\t\t@events << invitation.event\n\t\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def invite\n @data['invite']\n end", "def invite\n @obj['invite']\n end", "def show\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { render json: @invitee }\n end\n end", "def index\n if params[:admin] == \"1\"\n @invites = Invite.all\n else\n render file: \"#{Rails.root}/public/403.html\", status: 403, layout: false\n end\n end", "def all_inviters(page = nil, per_page = nil)\n pipeline = [\n { '$project' =>\n { _id: 0,\n f_id: 1,\n invitable_id: 1,\n invitable_type: 1\n }\n },\n {\n '$match' => {\n 'invitable_id' => self.id,\n 'invitable_type' => self.class.name.split('::').last\n }\n }\n ]\n\n if page && per_page\n pipeline << { '$skip' => (page * per_page) }\n pipeline << { '$limit' => per_page }\n end\n\n pipeline << { '$project' => { f_id: 1 } }\n\n command = {\n aggregate: 'invits',\n pipeline: pipeline\n }\n\n if defined?(Mongoid)\n db = Mongoid.default_session\n elsif defined?(MongoMapper)\n db = MongoMapper.database\n end\n\n users_hash = db.command(command)['result']\n\n ids = users_hash.map {|e| e['f_id']}\n\n User.where(id: { '$in' => ids }).all.entries\n end", "def get_unissued_invites()\n User.find(session[:user_id]).unissued_invites\n end", "def get_public_dashboard_invitations(token, opts = {})\n data, _status_code, _headers = get_public_dashboard_invitations_with_http_info(token, opts)\n data\n end", "def index\n @invited_fiends = InvitedFiend.all\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def index\n @invstatuses = Invstatus.all\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\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 subId = message[:data][0][:id]\n else\n # Port is open in our router\n params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }\n newRes = HTTParty.post URL, body: params, headers: HEADERS\n message = JSON.parse newRes.body, symbolize_names: true\n # TODO need error handling\n subId = message[:id]\n end\n end\n end", "def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end", "def index\n @friend_invites = FriendInvite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_invites }\n end\n end", "def invitations()\n return MicrosoftGraph::Invitations::InvitationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n\t\t@users = Invitation.pending_users(params[:page])\n\tend", "def index\n # first check if user is signed\n if !user_signed_in?\n render :status => 401, :json => {:success => false, :errors => [\"Unauthorized access\"] }\n elsif Invitee.where(:event_id => params[:event_id], :user_id => current_user.id).count <= 0\n # user hasn't been invited to this event, so don't allow them to see informatin about it\n render :status => 401, :json => {:success => false, :errors => [\"Not authorized to view this event\"] }\n else\n render :json => EventTimeUserChoice.joins(:event_time_option => :event)\n .where(:user_id => current_user.id, :events => {:id => params[:event_id]})\n .as_json\n end\n end", "def index\n @invitecodes = Invitecode.all\n end", "def index\n @invitaciones = Invitacione.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n invitations = Invitation.where('email = ? AND status = ?', @current_user.email, 'pending')\n invitations_array = []\n\n invitations.each do |inv|\n user = User.find(inv.from_user)\n user_hash = { :id => @current_user.id, :email => user.email, :first_name => user.user_info.first_name, :last_name => user.user_info.last_name }\n\n project = Project.find(inv.project_id)\n project_hash = { :id => project.id , :project_title => project.title, :project_profile => inv.project_profile_id }\n\n invitations_array << { :id => inv.id, :user => user_hash, :project => project_hash, :date => \"#{l inv.created_at, format: :long}\" }\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render json: invitations_array }\n end\n end", "def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end", "def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end", "def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end", "def index\n @teams = current_user.teams\n\n @team_invitations = current_user.team_invitations_as_receiver\n end", "def pending_invites\n list = []\n pending_contacts.links(:class=>\"s3d-bold s3d-regular-light-links\", :title=>/View/).each { |link| list << link.text }\n return list\n end", "def total_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation\n .where('created_at > ?', since)\n .count\n respond_with json_response('total_invites', count)\n end", "def find_invitations(opts = {})\n data, _status_code, _headers = find_invitations_with_http_info(opts)\n data\n end", "def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def find_invite\n @invite = Invite.find(params[:id])\n end", "def index\n @events = Event.where({ user_id: current_user.id }).order(created_at: :desc)\n @invitations = EventUser.where({ number: current_user.phone }).map { |invite| invite.event }\n \n end", "def index\n\n @emails = Email.all\n #redirect_to invites_path\n\n end" ]
[ "0.7959769", "0.79404175", "0.79404175", "0.79404175", "0.7742536", "0.76677245", "0.76677245", "0.76677245", "0.76677245", "0.76677245", "0.76200795", "0.7401339", "0.72609353", "0.7259135", "0.72381604", "0.7088142", "0.70818603", "0.7015903", "0.700781", "0.7004371", "0.69964284", "0.69862264", "0.68589884", "0.6813902", "0.6806257", "0.6756857", "0.6746963", "0.67205703", "0.6679445", "0.66752577", "0.6657125", "0.6657125", "0.6657125", "0.66470003", "0.66470003", "0.66416657", "0.66275895", "0.6601714", "0.6601714", "0.6601714", "0.6601714", "0.6592756", "0.6581124", "0.6560491", "0.6551222", "0.64720106", "0.64407474", "0.6438179", "0.64199245", "0.6418885", "0.63994724", "0.63807595", "0.6366112", "0.63523465", "0.6348669", "0.6344142", "0.6299388", "0.62961364", "0.6296053", "0.6275466", "0.62623376", "0.62563664", "0.6228046", "0.6219141", "0.6188908", "0.61794585", "0.61384934", "0.6136197", "0.609538", "0.6077624", "0.60776156", "0.60680515", "0.6048092", "0.6039582", "0.6024127", "0.59622127", "0.5943607", "0.594162", "0.5941545", "0.59332657", "0.5919882", "0.59167683", "0.59136665", "0.5907778", "0.5902455", "0.5892935", "0.5886336", "0.5883177", "0.58820266", "0.58820266", "0.58781475", "0.58721167", "0.5845627", "0.58437467", "0.5836157", "0.5826278", "0.5817926", "0.5812125", "0.58083135", "0.58004737" ]
0.7490277
11
GET /invites/1 GET /invites/1.json
def show @invite = Invite.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @invite } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def show\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\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 show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end", "def index\n @inviteds = Invited.all\n end", "def index\n\t\t@guild_invites = @guild.invites.order(\"id DESC\")\n\tend", "def show\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_status }\n end\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def index\n @invites = Invite.find(:all, :conditions => \"to_user_id = #{current_user.id} or to_email = '#{current_user.email}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invites }\n end\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def show\n user = User.find_by(id: params[:id]) #should use session id\n if user\n invitations = user.invitations\n if invitations\n render json: invitations, status: :ok\n else\n head :no_content\n end\n else\n render json: {error: \"User not found\"}, status: :not_found\n end\n end", "def show\n @invite = @event.invites.find(params[:id])\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def index\n @title = 'Invitations'\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @invitations }\n end\n end", "def show\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { render json: @invitee }\n end\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @list_invites = ListInvite.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end", "def index\n # @invitations = Invitation.all\n end", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end", "def get_mission_invites\n\t#get all missions of user with invitaion_status = pending\n user = User.exists? (params[:user_id])\n\tif user\n\t\tmissions = user.missions.references( :user_missions).select('missions.id, missions.title, user_missions.invitation_time').where( user_missions:{ invitation_status: PENDING_MESA_INVITATION})\n\t\trespond_to do |format|\n\t\t format.json {render :json=> {:mesa_invites=> missions, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No user exists with id' , :status => false} }\n\t end\n\tend\n end", "def invited_users\n render json: @moot.list_users_can_vote\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.find :all\n render :layout => 'plain'\n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end", "def index\n @team_invites = TeamInvite.where(team: current_team)\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def show\n @maintain_invite_user = Maintain::InviteUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maintain_invite_user }\n end\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\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 subId = message[:data][0][:id]\n else\n # Port is open in our router\n params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }\n newRes = HTTParty.post URL, body: params, headers: HEADERS\n message = JSON.parse newRes.body, symbolize_names: true\n # TODO need error handling\n subId = message[:id]\n end\n end\n end", "def find_invite\n @invite = Invite.find(params[:id])\n end", "def index\n @invts = Invt.all\n end", "def invitations\n res = []\n\n tmp = GoodData.get @json['project']['links']['invitations']\n tmp['invitations'].each do |invitation|\n res << GoodData::Invitation.new(invitation)\n end\n\n res\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend", "def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invites = current_user.invites.where(is_declined: nil).all\n end", "def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end", "def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def invite\n @obj['invite']\n end", "def invite\n @data['invite']\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.all\n render :layout => 'plain'\n end", "def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invitation }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def index\n # LE TEMPS DE ...\n if self.admin?\n @invites = Invite.all\n elsif self.check_user && self.check_no_guild\n @invites = Invite.where(:user_id => session[:user_id])\n elsif self.check_user && self.check_is_guild_owner\n @invites = Invite.where(:guild_id => @guild[:id])\n end\n end", "def show\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invite_request }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end", "def index\n @invs = Inv.all\n end", "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def index\n @invstatuses = Invstatus.all\n end", "def index\n if params[:admin] == \"1\"\n @invites = Invite.all\n else\n render file: \"#{Rails.root}/public/403.html\", status: 403, layout: false\n end\n end", "def index\n @invites = current_user.recieved_team_requests\n @sent = current_user.sent_team_requests\n end", "def show\n render json: @invitation\n end", "def show\n #@trips = Trip.find params[:user_id]\n @user = User.find(params[:id])\n @invitations = Invitation.where(email: session[:user_email])\n @num_of_invites = @invitations.length\n end", "def edit\n @invite = Invite.find(params[:id])\n end", "def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end", "def index\n @user_invitations = UserInvitation.all\n end", "def index\n invitations = Invitation.where('email = ? AND status = ?', @current_user.email, 'pending')\n invitations_array = []\n\n invitations.each do |inv|\n user = User.find(inv.from_user)\n user_hash = { :id => @current_user.id, :email => user.email, :first_name => user.user_info.first_name, :last_name => user.user_info.last_name }\n\n project = Project.find(inv.project_id)\n project_hash = { :id => project.id , :project_title => project.title, :project_profile => inv.project_profile_id }\n\n invitations_array << { :id => inv.id, :user => user_hash, :project => project_hash, :date => \"#{l inv.created_at, format: :long}\" }\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render json: invitations_array }\n end\n end", "def index\n @invitaciones = Invitacione.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def set_invited\n @invited = Invited.find(params[:id])\n end", "def show\n @linked_in_invitation = LinkedInInvitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @linked_in_invitation }\n end\n end", "def show\n\t\tif current_invite.nil?\n\t\t\tinvite = Invite.where(:id => params[:id], :secret => params[:secret]).where('expires > ?', Time.now).first\n\t\t\tif invite.present?\n\t\t\t\tsession[:invite_id] = invite.id\n\t\t\tend\n\t\tend\n\tend", "def show\n @inbox = Inbox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inbox }\n end\n end", "def index\n @friend_invites = FriendInvite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_invites }\n end\n end", "def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end", "def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end", "def show\n if params[:ids]\n ids = params[:ids].split(\",\")\n @invitation = Invitation.find_by_permalink(ids[0]) \n else\n @invitation = Invitation.find_by_permalink(params[:id]) \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invitation }\n end\n end" ]
[ "0.7688263", "0.7688263", "0.7688263", "0.74287134", "0.73801136", "0.73801136", "0.73801136", "0.73801136", "0.73801136", "0.7367896", "0.7329601", "0.70713496", "0.7045998", "0.699091", "0.69735", "0.695193", "0.6947367", "0.69188094", "0.6821972", "0.674742", "0.6738955", "0.673815", "0.67157745", "0.66967696", "0.6694719", "0.66926855", "0.66702056", "0.6638442", "0.6615245", "0.65606195", "0.6550315", "0.6550315", "0.6520919", "0.6509887", "0.6509887", "0.6509887", "0.65041715", "0.64590573", "0.64397377", "0.64019614", "0.6391752", "0.63846797", "0.6379426", "0.6356056", "0.63446313", "0.634039", "0.6336375", "0.6319267", "0.6315724", "0.6306563", "0.62950087", "0.6294987", "0.6293407", "0.62931705", "0.6283002", "0.6271622", "0.6257223", "0.62480515", "0.6243049", "0.6241002", "0.62121207", "0.61851966", "0.61851966", "0.61851966", "0.61851966", "0.6174741", "0.6169305", "0.6156601", "0.61212194", "0.61212194", "0.61212194", "0.6117923", "0.61075497", "0.6091854", "0.60574204", "0.6047542", "0.60360175", "0.60264313", "0.6018515", "0.6018387", "0.59763724", "0.5962994", "0.59578055", "0.59526634", "0.59365594", "0.59219015", "0.59156173", "0.58949715", "0.58808285", "0.58704674", "0.5858418", "0.5854822", "0.5817461", "0.58144516", "0.581419", "0.5814155", "0.58074784" ]
0.7069864
14
GET /invites/new GET /invites/new.json
def new flag_no_problem = current_user.problems.count + current_user.code_problems.count flag_no_collection = current_user.collections.count flag_no_balance = current_user.invite_balance if flag_no_problem == 0 error_message = (t 'invite.errors.no_problem') error_message_url = new_problem_url else if flag_no_collection == 0 error_message = t 'invite.errors.no_collection' error_message_url = new_collection_url else if flag_no_balance == 0 error_message = t 'invite.errors.nil_balance' error_message_url = recharge_url end end end session[:new_invite_error] = error_message session[:new_invite_error_url] = error_message_url logger.warn session[:new_invite_error] if flag_no_balance == 0 || flag_no_collection == 0 || flag_no_problem == 0 redirect_to invites_path return end @invite = Invite.new @invite.instruction = render_to_string 'invites/_instruction', :layout => false respond_to do |format| format.html # new.html.erb format.json { render json: @invite } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite }\n end\n end", "def new\n @title = 'New Invitation'\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @invitation }\n end\n end", "def new\n @invite_request = InviteRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite_request }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def new\n @invitee = Invitee.new\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n\n respond_to do |format|\n format.html { render :layout=> false } # new.html.erb\n format.json { render json: @invitee }\n\t\t\tformat.js\n end\n end", "def new\n @maintain_invite_user = Maintain::InviteUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @maintain_invite_user }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new_from_invite_data\n new\n render :new\n end", "def new\n @invitation = Invitation.new(event: Event.find(params[:event_id]), user: User.new)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def create\n @invited = Invited.new(invited_params)\n\n respond_to do |format|\n if @invited.save\n format.html { redirect_to @invited, notice: 'Invited was successfully created.' }\n format.json { render :show, status: :created, location: @invited }\n else\n format.html { render :new }\n format.json { render json: @invited.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invitee = Invitee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitee }\n end\n end", "def new\n @activite = Activite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activite }\n end\n end", "def new\n @inbox = Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inbox }\n end\n end", "def create\n @invite = @event.invites.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to [@event, @invite], notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@event, @invite] }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invite }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n return if auth(\"website_administrator\")\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @incident }\n end\n end", "def new\n @invitee = Invitee.new\n end", "def new\n @inbox = Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inbox }\n end\n end", "def new\n @inv_type = InvType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inv_type }\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gift = Gift.new\n\t@invitations = current_host.invitations\n\t@invite_hash = {}\n @invitations.each do |i| \n\t\t@invite_hash[\"#{i.party.name} | #{i.guest.name}\"] = i.id\n\tend\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident }\n end\n end", "def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end", "def new\n @linked_in_invitation = LinkedInInvitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @linked_in_invitation }\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n InviteMailer.invite_friend(@invite, @user).deliver\n format.html { redirect_to new_invite_path, notice: \"Invitation was successfully sent to #{@invite.name} &lt;#{@invite.email}&gt;\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end", "def create\n @inv = Inv.new(inv_params)\n\n respond_to do |format|\n if @inv.save\n format.html { redirect_to @inv, notice: 'Inv was successfully created.' }\n format.json { render :show, status: :created, location: @inv }\n else\n format.html { render :new }\n format.json { render json: @inv.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @email = @user.emails.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @invoice_status = InvoiceStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def new\n @invitation = Invitation.new\n respond_with(@invitation)\n end", "def create\n @invite = Invite.new(params[:invite])\n\n respond_to do |format|\n if @invite.save\n flash[:notice] = 'Invite was successfully created.'\n format.html { redirect_to(@invite) }\n format.xml { render :xml => @invite, :status => :created, :location => @invite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@guild_invite = GuildInvitMember.new(guild_invite_params)\n\t\t@guild_invite.guild = @guild\n\t\t@guild_invite.by = current_user\n\t\t@guild_invite.state = \"waiting\"\n\n\t\trespond_to do |format|\n\t\t\tif @guild_invite.save\n\t\t\t\tback_page = guild_invites_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Invite was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @guild_invite.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end", "def new\n @invitado = Invitado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitado }\n end\n end", "def create\n if params[:invite]\n @invite = Invite.new(invite_params)\n elsif params[:user_id]\n @invite = Invite.new(:user_id => params[:user_id], :request_id => params[:request_id], :to_id => params[:to_id] )\n end\n @invite.state = 'sent' if @invite.state.blank?\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @inventory_entry = InventoryEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_entry }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end", "def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end", "def new\n @inventory_status = InventoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_status }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end", "def new\n @identity_table = IdentityTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identity_table }\n end\n end", "def new\n @breadcrumb = 'create'\n @invoice_type = InvoiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_type }\n end\n end", "def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def new\n InvitationMailer.request_invitation(@league, current_user, _invitation_params[:email], _invitation_params[:message]).deliver\n render json: { message: { type: SUCCESS, content: \"An invite request for #{_invitation_params[:email]} has been sent to the commish\" } }, status: :ok\n end", "def new\n @inv_x_ref = InvXRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inv_x_ref }\n end\n end", "def new\n @invitation = Invitation.new\n end", "def new\n @invitation = Invitation.new\n end", "def new\n\t\tif !@currentuser.administrator\n\t\t\tredirect_to :action => \"index\"\n\t\t\treturn\n\t\tend\n\t\t@voip_account = VoipAccount.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @voip_account }\n\t\tend\n\tend", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def new\r\n @profile_invite = Profile::Invite.new\r\n end", "def create\n @invitee = Invitee.new(params[:invitee])\n\t\t@invitee.user_account = current_user.user_account\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully created.' }\n format.json { render json: @invitee, status: :created, location: @invitee }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n format.html { render action: \"new\" }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "def new\n @inventoryitem = Inventoryitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventoryitem }\n end\n end", "def new\n @sitio_entrega = SitioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def new\n @investment_type = InvestmentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investment_type }\n end\n end", "def new\n @incident_type = IncidentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident_type }\n end\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def new\n @investigation = Investigation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investigation }\n end\n end", "def new\n @exchange = Exchange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exchange }\n end\n end", "def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end", "def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end", "def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end", "def new\n @ins_company = InsCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ins_company }\n end\n end", "def new\n @email_listing = EmailListing.new\n @countries = []\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_listing }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def create\n @invitee = Invitee.new(invitee_params)\n\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to @invitee, notice: 'Invitee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invitee }\n else\n format.html { render action: 'new' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.77566123", "0.77566123", "0.77566123", "0.7493549", "0.7443391", "0.71866524", "0.70564896", "0.7012656", "0.6996705", "0.6996705", "0.69863653", "0.69833046", "0.6968096", "0.69313127", "0.6828738", "0.6754267", "0.6735638", "0.6729011", "0.67265517", "0.66909343", "0.6641987", "0.6636304", "0.6627488", "0.6620253", "0.65854686", "0.6570762", "0.6554248", "0.6553712", "0.65534675", "0.6521568", "0.6510108", "0.64956", "0.6486967", "0.6486967", "0.64736605", "0.6463717", "0.64551526", "0.64519274", "0.6448437", "0.6436675", "0.64199114", "0.6413402", "0.64105386", "0.64095825", "0.6397881", "0.63845056", "0.63835394", "0.6379356", "0.6362088", "0.6359003", "0.63530284", "0.6332225", "0.63279027", "0.6307799", "0.63029146", "0.6297358", "0.6296836", "0.62907255", "0.628868", "0.6287447", "0.6287447", "0.62845767", "0.62808836", "0.6276716", "0.6276532", "0.6270935", "0.62495315", "0.6247249", "0.6247249", "0.6241623", "0.62402844", "0.62402844", "0.62402844", "0.6233905", "0.623281", "0.6221898", "0.6220052", "0.6218845", "0.6215801", "0.6215801", "0.6215801", "0.6215801", "0.62155956", "0.6208994", "0.61982113", "0.6195473", "0.61940324", "0.61935323", "0.61876255", "0.6181305", "0.6174911", "0.61695737", "0.61674994", "0.61604965", "0.61601645", "0.61549777", "0.6154056", "0.6153478", "0.61526364", "0.6147453" ]
0.6172485
91
POST /invites POST /invites.json
def create @invite = Invite.new(params[:invite]) @invite.user_id = current_user.id @invite.url_hash = get_new_invite_hash candidate = User.find_or_create(@invite.candidate_email, @invite.candidate_name, 'candidate') if candidate.nil? render action: "new" return end @invite.candidate_id = candidate.id #Need to generate the hash and check whether mail was successfully being sent before savnig the #db record. The probability of failing to save the db record is very small compare to probability of #fail to send the record respond_to do |format| if @invite.save current_user.invite_balance = current_user.invite_balance - 1 current_user.save InviteMailer.delay.invite_test_email(@invite) format.html { redirect_to invites_path, notice: (t 'invite.sent') } format.json { render json: @invite, status: :created, location: @invite } else format.html { render action: "new" } format.json { render json: @invite.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def create\n @invite = @event.invites.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to [@event, @invite], notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@event, @invite] }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invited = Invited.new(invited_params)\n\n respond_to do |format|\n if @invited.save\n format.html { redirect_to @invited, notice: 'Invited was successfully created.' }\n format.json { render :show, status: :created, location: @invited }\n else\n format.html { render :new }\n format.json { render json: @invited.errors, status: :unprocessable_entity }\n end\n end\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n InviteMailer.invite_friend(@invite, @user).deliver\n format.html { redirect_to new_invite_path, notice: \"Invitation was successfully sent to #{@invite.name} &lt;#{@invite.email}&gt;\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end", "def create\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def invite\n invitation_service.invite(invitation_params)\n end", "def create\n @users = User.all\n\n @event = current_user.events.build(event_params.except(:invites))\n\n respond_to do |format|\n if @event.save\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:invite]\n @invite = Invite.new(invite_params)\n elsif params[:user_id]\n @invite = Invite.new(:user_id => params[:user_id], :request_id => params[:request_id], :to_id => params[:to_id] )\n end\n @invite.state = 'sent' if @invite.state.blank?\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invite }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_invite(body)\n raise ArgumentError unless body.is_a?(Array)\n raise ArgumentError unless body.first.is_a?(Hash)\n\n api.post('user/invite', body, 'application/json')\n end", "def invite\n service_response = AdminManagement::AdminUser::Invite::Send.new(params).perform\n render_api_response(service_response)\n end", "def create\n @invite = Invite.new(invite_params)\n\n if (self.admin? || (self.check_user && self.check_no_guild && self.check_own_invite)) && @invite.save\n render json: @invite, status: :created\n else\n render json: @invite.errors, status: :unprocessable_entity\n end\n end", "def test_should_not_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def create\n @event = current_user.created_events.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n\n @event.invitees_email.split(',').each do | user_email |\n user = User.find_by(email: user_email)\n @event.invitees << user\n end\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @inviteds = Invited.all\n end", "def create\n\t\t@guild_invite = GuildInvitMember.new(guild_invite_params)\n\t\t@guild_invite.guild = @guild\n\t\t@guild_invite.by = current_user\n\t\t@guild_invite.state = \"waiting\"\n\n\t\trespond_to do |format|\n\t\t\tif @guild_invite.save\n\t\t\t\tback_page = guild_invites_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Invite was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @guild_invite.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def accept\n @invite = Invite.find_by(dinner_id: params[:id], invited_id: @current_user.json_hash[:id])\n if @invite\n @acceptance = AttendeeDinner.new\n @acceptance.dinner_id = @invite.dinner_id\n @acceptance.attendee_id = @invite.invited_id\n if @acceptance.valid?\n @acceptance.save\n @invite.delete\n render json: @acceptance\n else\n puts @acceptance.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @acceptance.errors.messages\n }\n end\n end\n end", "def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "def create\n @invite = Invite.new(invite_params)\n @invite.sender_id = current_user.id # set the sender to the current user\n # @invite.invited_at = Time.now.utc\n\n respond_to do |format|\n if @invite.save\n # if the user already exists\n if @invite.recipient != nil\n InvitationMailer.existing_user_invite(@invite).deliver\n @invite.recipient.projects.push(@invite.project)\n flash.now[:notice] = \"User convidado\"\n else\n InvitationMailer.deliver_invitation(@invite, invite_sign_up_url(:invite_token => @invite.token)).deliver\n\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n end\n else\n format.html { redirect_to \"/\", notice: \"Não enviou convite\" }\n # format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n\n respond_to do |format|\n if @invite.save\n flash[:notice] = 'Invite was successfully created.'\n format.html { redirect_to(@invite) }\n format.xml { render :xml => @invite, :status => :created, :location => @invite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end", "def invite\n \n end", "def create\n successes = []\n (params[:invitations].split(',') || []).each do |name|\n name.strip!\n invitation = @game.invitations.build(:twitter_login => name, :invited_by => current_user)\n successes << name if invitation.save\n # TODO: send actual invitations as DMs from the user??\n # TODO: verify that the listed people are actually followers of the user?\n end\n flash[:notice] = \"Invitations have been sent to the #{successes.length} people you selected\"\n redirect_to(game_path(@game))\n end", "def create\n @inv = Inv.new(inv_params)\n\n respond_to do |format|\n if @inv.save\n format.html { redirect_to @inv, notice: 'Inv was successfully created.' }\n format.json { render :show, status: :created, location: @inv }\n else\n format.html { render :new }\n format.json { render json: @inv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n user = params[:user]\n \n #abort(\"user #{user}\")\n\n from_id = user[:fb_id]\n\n existing_fb_user = User.find_by_fb_id(from_id)\n\n if existing_fb_user\n \n user_invitations = user[:invitations]\n \n @invitations_array = []\n\n user_invitations.each do |inv|\n\n inv[:fb_id] = from_id\n inv[:is_accept] = false\n inv[:isPoints] = false\n\n\n @invitation = Invitation.new(inv)\n\n @invitations_array.push(inv) \n\n render :json => { :errors => @invitation.errors.full_messages } unless @invitation.save\n\n end\n\n Invitation.new.getInvitations(@invitations_array)\n\n else\n render :json => { :message => \"No user found\" }\n end\n \n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def create\n @invite = NewInvite.new(invite_params, current_user)\n @invite.call\n respond_with @invite, location: wallet_path(id: invite_params[:wallet_id])\n end", "def create\n @attr = params[:idea]\n puts \"----- idea.create #{current_user.inspect}\"\n @attr[:organizer] = current_user \n \n guest_emails = params[:email]\n if (guest_emails.nil?)\n arr_emails = []\n else\n arr_emails = guest_emails.split(\",\")\n end\n \n @idea = current_user.ideas.build(@attr)\n @idea.users << current_user\n \n arr_emails.each do |email|\n puts \"building invite #{email}\"\n invitee = Invite.new\n invitee.email = email\n puts \"Phone #{email}\"\n @idea.invites << invitee\n end\n \n host = request.host\n \n if (host =~ /localhost/i)\n host = request.host_with_port\n end\n \n respond_to do |format|\n if @idea.save\n @idea.invites.each do |invite|\n twilio(invite.email, @idea.id, host)\n end\n \n format.html { redirect_to(root_path, :notice => 'Idea was successfully created.') }\n format.xml { render :xml => @idea, :status => :created, :location => @idea }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @invite_list = InviteList.new(params[:invite_list])\n\n respond_to do |format|\n if @invite_list.save\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully created.' }\n format.json { render json: @invite_list, status: :created, location: @invite_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def create\n\t\tif !params[:add_invites].blank?\n\t\t\tUser.add_to_invitation_limit(params[:add_invites].to_i)\n flash[:notice] = \"Invitation limit updated.\"\n redirect_to admin_users_path\n else\n\t\t\tflash[:error] = \"There was a problem updating the invitation limit.\"\n redirect_to admin_invites_path\n\t\tend\n\tend", "def create\n @invite_request = InviteRequest.new(invite_request_params)\n\n respond_to do |format|\n if @invite_request.save\n format.html { redirect_to @invite_request, notice: 'Invite request was successfully created.' }\n format.json { render :show, status: :created, location: @invite_request }\n else\n format.html { render :new }\n format.json { render json: @invite_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def invite\n\t@micropost.add_to_invited(@invitee)\n\t\n\trespond_to do |format|\n\t\tformat.html { }\n\t\tformat.mobile { render json: {status: \"success\"} }\n\t\tformat.js { }\n\tend\n end", "def post_user_invitation(email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)\n body = {\n data: {\n type: \"userInvitations\",\n attributes: {\n email: email,\n firstName: first_name,\n lastName: last_name,\n roles: roles,\n provisioningAllowed: provisioning_allowed,\n allAppsVisible: all_apps_visible\n }\n }\n }\n users_request_client.post(\"userInvitations\", body)\n end", "def invited_users\n render json: @moot.list_users_can_vote\n end", "def mass_create\n requests = []\n group_invite_params[:mass_requests].each do |element|\n requests << @current_user.requests_as_sender.new(:group_id => element[:group_id], :receiver_id => element[:receiver_id], :status => \"pending\")\n end\n\n @invites = Request.import requests\n\n if @invites\n render json: requests, status: :created\n else\n render json: requests.errors, status: :unprocessable_entity\n end\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def invite\n invite = params[:invite]\n profile.update_attribute(:email, invite[:email])\n invite = Notifier.send_invite(profile, invite[:message])\n invite.deliver\n flash[:notice] = \"An invititation to join YentaFriend was sent to #{profile.name}. Check your dashboard for an update when they join!\"\n end", "def without_users_create\n response = params[:values].reduce({}) do |response, value|\n response[value[:id]] = UserInviter.new(\n self, User, current_user, Devise\n ).invite(value[:email], params[:resend_invitation])\n response\n end\n respond_to do |format|\n format.json { render :json => response.to_json }\n end\n end", "def create\n @invitee = Invitee.new(params[:invitee])\n\t\t@invitee.user_account = current_user.user_account\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully created.' }\n format.json { render json: @invitee, status: :created, location: @invitee }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n format.html { render action: \"new\" }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "def invite\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n User.find(params[:user_id]).invites << current_user\n redirect_to friends_path\n end\n end", "def invite\r\n if request.post?\r\n @pi = PrivateInvite.new(params[:pi]) \r\n if @pi.email == User.find(session[:user_id]).email\r\n flash[:notice] = \"you are already listed\"\r\n redirect_to :back\r\n return \r\n end \r\n PrivateInvite.find_all_by_private_event_id(@pi.private_event_id).each do |p|\r\n if p.email == @pi.email\r\n flash[:notice] = \"#{@p.email}is already on the guest list\"\r\n redirect_to :back\r\n return \r\n end\r\n end\r\n \r\n @pi.invited_at = Date.today \r\n invite = Invitation.new\r\n invite.title = PrivateEvent.find(@pi.private_event_id).title\r\n invite.host_email = User.find(session[:user_id]).email\r\n invite.guest_email = @pi.email \r\n email = InvitationMailer.create_invite(invite)\r\n email.set_content_type(\"text/html\")\r\n @guest_list = PrivateInvite.find(:all)\r\n if @pi.save\r\n begin\r\n InvitationMailer.deliver(email) \r\n rescue\r\n @pi.destroy\r\n flash[:notice] = \"address not found\"\r\n end \r\n end \r\n end\r\n redirect_to :back\r\n end", "def create\n @team_invite = TeamInvite.new(team_invite_params)\n respond_to do |format|\n if @team_invite.save\n format.html { redirect_to team_team_invites_url, notice: 'TeamInvite was successfully created.' }\n format.json { render :show, status: :created, location: team_team_invites_url }\n else\n format.html { render :new }\n format.json { render json: @team_invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @invites = Invite.all\n end", "def create\n #create the guest\n @guest = Guest.new(guest_params)\n\n #save the guest and create the invitation\n if @guest.save\n @inv = Invitation.new()\n @inv.guest_id = @guest.id\n @inv.event_id = Event.find_by(id:request.headers['EventId'].to_s).id\n @inv.user_id = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).id\n else\n render json: @guest.errors, status: :unprocessable_entity\n end\n\n #save the invitation and return the guest\n if @inv.save\n render json: @guest, status: :created, location: @guest\n else\n render json: @inv.errors, status: :unprocessable_entity\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def create\n @list_invite = ListInvite.new(list_invite_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @list_invite.save\n format.html { redirect_to lists_path, notice: 'List invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list_invite }\n else\n format.html { render action: 'new' }\n format.json { render json: @list_invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invitee = Invitee.new(invitee_params)\n\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to @invitee, notice: 'Invitee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invitee }\n else\n format.html { render action: 'new' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end", "def accept!()\n self.status = Invite::Status::ACCEPTED\n invitable.add_member invitee\n save!\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 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 event_params\n params.require(:event).permit(:time, :location, :title, :description, :creator_id, invites: [])\n end", "def index\n @list_invites = ListInvite.all\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def create\n @invite = current_dwelling.invites.new(params[:invite])\n if @invite.save\n # Mail a link to join the dwelling to the invitee.\n InviteMailer.invite(@invite, invites_url(@invite.token)).deliver\n end\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to dwelling_path(@invite.dwelling_id),\n notice: 'Invite was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def update\n @users = User.all\n respond_to do |format|\n if @event.update(event_params.except(:invites))\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end", "def create\n @invite_status = InviteStatus.new(params[:invite_status])\n\n respond_to do |format|\n if @invite_status.save\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully created.' }\n format.json { render json: @invite_status, status: :created, location: @invite_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def accepted_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation.accepted\n .where('created_at > ?', since)\n .count\n respond_with json_response('accepted_invites', count)\n end", "def invite(email, role, label_or_expression, value)\n muf = prepare label_or_expression, value\n\n invitation = {\n \"invitations\" => [ {\n \"invitation\" => {\n \"content\" => {\n \"email\" => email,\n \"userFilters\" => [ muf[:url] ],\n \"role\" => role\n }\n }\n } ]\n }\n pp invitation\n GoodData.post \"/gdc/projects/#{@project_id}/invitations\", invitation\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def invite(firm_name, firstname, lastname, email, phone)\n invite_params = vendor_params(firm_name, firstname, lastname, email, phone)\n @client.post(\"/#{@model}\", {}, invite_params)\n end", "def create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end", "def invite_params\n params.require(:invite).permit(:email, :sender_id, :recipient_id, :token)\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n\n invited_users = InvitedUser.where(email: @user.email)\n invited_users.each do |invited_user|\n Message.create(sender_id: 1, receiver_id: invited_user.inviter.id, title: \"Your friend has just joined\", content: \"I have just joined to TennisBuddy World! Thank you for inviting me. #{@user.full_name}\")\n end\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.info('~log_invite: ' + invite_params.to_s)\n logger.info('~log_invite: ' + invite_params['reciever'])\n @invite = Invite.new(invite_params)\n @invite.sender = current_user.email\n @invite.accepted = false\n\n # check if target exists?\n invite_old = Invite.find_by(sender: current_user.email, reciever: invite_params['reciever'])\n invite_back = Invite.find_by(reciever: current_user.email, sender: invite_params['reciever'])\n\n logger.info('~log_no_old: ' + invite_old.nil?.to_s)\n logger.info('~log_no_back: ' + invite_back.nil?.to_s)\n\n ok = true\n\n ok = @invite.save if invite_old.nil?\n\n unless invite_back.nil?\n invite_back.accepted = true\n ok = (invite_back.save && ok)\n if invite_old.nil?\n @invite.accepted = true\n ok = (@invite.save && ok)\n else\n invite_old.accepted = true\n ok = (invite_old.save && ok)\n end\n end\n\n respond_to do |format|\n if ok\n format.html # { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @maintain_invite_user = Maintain::InviteUser.new(params[:maintain_invite_user])\n\n respond_to do |format|\n if @maintain_invite_user.save\n format.html { redirect_to @maintain_invite_user, notice: 'Invite user was successfully created.' }\n format.json { render json: @maintain_invite_user, status: :created, location: @maintain_invite_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @maintain_invite_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def invite(invitation)\n client.post(\"workspaces/#{@id}/invite\", invitation: invitation) if persisted?\n end", "def create\n count = Member.mass_invite!(params[\"MassInvite\"][\"emails\"])\n respond_to do |format|\n format.html { redirect_to new_member_path, notice: \"Yaay! Totalt #{count} invitasjoner ble sendt.\" }\n end\n end", "def invite_params\n params.require(:invite).permit(:sender_id, :receiver_id, :token, :email, :list_id)\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def invite_params\n params.require(:invite).permit(:request_id, :state, :to_id, :user_id)\n end", "def invite_resource\n resource_class.invite!(invite_params, current_inviter) do |invitable|\n invitable.company_id = current_user.company_id\n invitable.is_admin = true\n invitable.require_email = true\n invitable.save\n end\n end", "def create\n @member=current_member\n @invitation=Invitation.new(params[:invitation])\n \n \n respond_to do |format|\n if @invitation.save\n @myevent.invitations << @invitation\n \n format.html { redirect_to event_invitations_path, :notice => 'Invitation was successfully sent to your friends email address.' }\n format.json { render :json => @invitation, :status => :created, :location => @invitation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def resend_invite\n service_response = AdminManagement::AdminUser::Invite::Resend.new(params).perform\n render_api_response(service_response)\n end", "def invite_params\n params.require(:invite).permit(:event_id, :user_id, :attendee_status)\n end" ]
[ "0.69848865", "0.6835423", "0.665867", "0.6657357", "0.66251135", "0.6613855", "0.66080153", "0.6599364", "0.6599364", "0.6599364", "0.65854967", "0.6575549", "0.65548944", "0.65405744", "0.65033305", "0.64781004", "0.64531684", "0.64299184", "0.6427502", "0.6420567", "0.6420567", "0.6420567", "0.6420567", "0.6420567", "0.63681364", "0.63386184", "0.6263155", "0.6263154", "0.6209127", "0.6123565", "0.6102241", "0.6099782", "0.6089795", "0.6074822", "0.60601205", "0.60532427", "0.60088336", "0.60085016", "0.60060334", "0.60012317", "0.598974", "0.59740573", "0.5972263", "0.5962795", "0.5953667", "0.5952631", "0.59398025", "0.59386677", "0.5938587", "0.59157", "0.5907318", "0.59059155", "0.5897755", "0.5896464", "0.5895478", "0.5884574", "0.58766717", "0.586757", "0.5863742", "0.5854111", "0.58512753", "0.58341205", "0.5833954", "0.5833299", "0.58319324", "0.5819994", "0.58155304", "0.5812806", "0.57999015", "0.5785688", "0.5770446", "0.57702905", "0.5766703", "0.5760771", "0.57557493", "0.5751477", "0.57452625", "0.5744329", "0.5744329", "0.5719664", "0.5719664", "0.5719664", "0.5713457", "0.57070005", "0.5703317", "0.5687728", "0.5680725", "0.5663056", "0.56421196", "0.563138", "0.56258076", "0.5621183", "0.5616717", "0.56068593", "0.560631", "0.55968404", "0.5595846", "0.55674624", "0.55639577", "0.5561314", "0.5559897" ]
0.0
-1
No edit , update or destroy on invite GET /invites/1/edit
def edit @invite = Invite.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n \t@user = User.find_by_invite_token!(params[:id])\n end", "def edit\n @invite_user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n @role = @invite_user.roles.first\n @inviter = User.where(:id => @role.invite_user_id).first\n @course = @role.course\n @user = User.new(params[:user])\n store_location\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: (t 'invite.update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n if @invitee.update_attributes(params[:invitee])\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully updated.' }\n format.json { head :ok }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n \n format.html { render action: \"edit\"}\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to event_invites_url, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n flash[:notice] = 'Invite was successfully updated.'\n format.html { redirect_to(@invite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @invite = @event.invites.find(params[:id])\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n if @invitee.update_attributes(params[:invitee])\n flash[:notice] = 'Invitee was successfully updated.'\n format.html { redirect_to(@invitee) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @invitee\n\n respond_to do |format|\n if @invitee.update\n if @invitee.role == Databank::UserRole::NETWORK_REVIEWER\n format.html { redirect_to \"/data_curation_network/accounts\", notice: \"Invitee was successfully updated.\" }\n else\n format.html { redirect_to @invitee, notice: \"Invitee was successfully updated.\" }\n end\n format.json { render :show, status: :ok, location: @invitee }\n else\n if @invitee.role == Databank::UserRole::NETWORK_REVIEWER\n edit_path = \"/data_curation_network/account/#{@invitee_id}/edit\"\n format.html { redirect_to(edit_path, notice: \"Error attempting to update invitee.\") }\n else\n format.html { render :edit }\n end\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def update\n respond_to do |format|\n if @invitee.update(invitee_params)\n format.html { redirect_to @invitee, notice: 'Invitee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def edit\n\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def invite\n @event = Event.find(params[:id])\n end", "def set_invite\n if params[:id]\n @invite = Invite.find(params[:id])\n else\n @invite = Invite.find_by_url(params[:path])\n end\n end", "def edit\n resource.invitermail = params[:invitermail]\n super\n end", "def set_invited\n @invited = Invited.find(params[:id])\n end", "def find_invite\n @invite = Invite.find(params[:id])\n end", "def edit\n\t\t\n\tend", "def edit\n \n end", "def edit\n\n end", "def edit\r\n end", "def show\n if self.admin? || (self.check_user && session[:user_id] == Invite.find(params[:id])[:user_id]) \\\n || (self.check_user && self.check_is_guild_owner && @guild[:id] == Invite.find(params[:id])[:guild_id])\n @invite = Invite.find(params[:id])\n end\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def update\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n if @invite_request.update_attributes(params[:invite_request])\n flash[:notice] = 'InviteRequest was successfully updated.'\n format.html { redirect_to(@invite_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\r\n \r\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end" ]
[ "0.739073", "0.73263067", "0.6957787", "0.69538087", "0.6876259", "0.6871937", "0.6871937", "0.6871937", "0.68659145", "0.68556875", "0.68451524", "0.67601275", "0.67601275", "0.6760038", "0.66684943", "0.6647012", "0.6647012", "0.6647012", "0.6647012", "0.66464335", "0.66464335", "0.66464335", "0.66464335", "0.661644", "0.661644", "0.661644", "0.661644", "0.661644", "0.661644", "0.661325", "0.6611954", "0.6580736", "0.656468", "0.6564619", "0.65616906", "0.6557339", "0.6553521", "0.65207154", "0.6504904", "0.64701146", "0.6461803", "0.644684", "0.6429868", "0.6419932", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.64187634", "0.6411213", "0.64104056", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6408629", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174", "0.6390174" ]
0.8278068
0
PUT /invites/1 PUT /invites/1.json
def update @invite = Invite.find(params[:id]) respond_to do |format| if @invite.update_attributes(params[:invite]) format.html { redirect_to @invite, notice: (t 'invite.update') } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @invite.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n flash[:notice] = 'Invite was successfully updated.'\n format.html { redirect_to(@invite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_invited\n @invited = Invited.find(params[:id])\n end", "def update\n respond_to do |format|\n if @invited.update(invited_params)\n format.html { redirect_to @invited, notice: 'Invited was successfully updated.' }\n format.json { render :show, status: :ok, location: @invited }\n else\n format.html { render :edit }\n format.json { render json: @invited.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @invite = Invite.find(params[:id])\n end", "def update\n @users = User.all\n respond_to do |format|\n if @event.update(event_params.except(:invites))\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to event_invites_url, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @invitations = args[:invitations] if args.key?(:invitations)\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inv.update(inv_params)\n format.html { redirect_to @inv, notice: 'Inv was successfully updated.' }\n format.json { render :show, status: :ok, location: @inv }\n else\n format.html { render :edit }\n format.json { render json: @inv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n if @invite_status.update_attributes(params[:invite_status])\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def update_invitations\n # user: nil is here to make sure invitations are linked only once\n invitations << Invitation.where(token: invitation_token, user: nil)\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def update\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n if @invitee.update_attributes(params[:invitee])\n flash[:notice] = 'Invitee was successfully updated.'\n format.html { redirect_to(@invitee) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invitado = Invitado.find(params[:id])\n\n respond_to do |format|\n if @invitado.update_attributes(params[:invitado])\n format.html { redirect_to(@invitado, :notice => 'Invitado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.update_attributes(invitation_params)\n\n head 204\n end", "def update\n begin\n @collection = Collection.find(params[:id])\n if params[:collection][:invite_only] && params[:invitations]\n @collection.invited_user_ids = params[:invitations][:user_ids] \n end\n @collection.assign_attributes(params[:collection])\n\n @collection.transaction do\n @collection.save!\n end\n\n render \"show\", handlers: [:rabl]\n \n rescue ActiveRecord::RecordInvalid => invalid\n render :json => @collection.errors.full_messages, status: 422\n end\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def update\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n if @invite_request.update_attributes(params[:invite_request])\n flash[:notice] = 'InviteRequest was successfully updated.'\n format.html { redirect_to(@invite_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_inv\n @inv = Inv.find(params[:id])\n end", "def update\n @gift = Gift.find(params[:id])\n\t@invitations = current_host.invitations\n\t@invite_hash = {}\n @invitations.each do |i| \n\t\t@invite_hash[\"#{i.party.name} | #{i.guest.name}\"] = i.id\n\tend\n\n respond_to do |format|\n if @gift.update_attributes(params[:gift])\n format.html { redirect_to(@gift, :notice => 'Gift was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def set_invite\n if params[:id]\n @invite = Invite.find(params[:id])\n else\n @invite = Invite.find_by_url(params[:path])\n end\n end", "def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end", "def set_invupdate\n @invupdate = Invupdate.find(params[:id])\n end", "def set_invite_request\n @invite_request = InviteRequest.find(params[:id])\n end", "def update!(**args)\n @invitations = args[:invitations] if args.key?(:invitations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def invite_resource\n resource_class.invite!(invite_params, current_inviter) do |invitable|\n invitable.company_id = current_user.company_id\n invitable.is_admin = true\n invitable.require_email = true\n invitable.save\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n @invitation.update_attributes(params[:invitation])\n respond_with(@invitation)\n end", "def associate_invites\n Invitation.where_email_matches(email)\n .where(invitee: nil)\n .update_all(invitee_id: id)\n end", "def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @maintain_invite_user = Maintain::InviteUser.find(params[:id])\n\n respond_to do |format|\n if @maintain_invite_user.update_attributes(params[:maintain_invite_user])\n format.html { redirect_to @maintain_invite_user, notice: 'Invite user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @maintain_invite_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n if @invitee.update_attributes(params[:invitee])\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully updated.' }\n format.json { head :ok }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n \n format.html { render action: \"edit\"}\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "def set_invstatus\n @invstatus = Invstatus.find(params[:id])\n end", "def update\n @invitations = Invitation.where(:specification_id => session[:specification_sel_id]).all\n \n @act.update(act_params)\n @act.docencia = params[\"doc\"]\n @act.investigacion = params[\"inv\"]\n @act.extension = params[\"ext\"]\n @act.apoyo = params[\"apoyoA\"]\n @act.responsable = @act.responsable.upcase\n @act.justificacion = @act.justificacion.upcase\n @act.providencia = @act.providencia.upcase\n respond_to do |format|\n if @act.save\n format.html { redirect_to @act, notice: 'Act was successfully updated.' }\n format.json { render :show, status: :ok, location: @act }\n else\n format.html { render :edit }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def invite\n invitation_service.invite(invitation_params)\n end", "def accept!()\n self.status = Invite::Status::ACCEPTED\n invitable.add_member invitee\n save!\n end", "def update\n @invitacione = Invitacione.find(params[:id])\n\n respond_to do |format|\n if @invitacione.update_attributes(params[:invitacione])\n format.html { redirect_to @invitacione, :notice => 'Invitacione was successfully updated.' }\n\n else\n format.html { render :action => \"edit\" }\n\n end\n end\n end", "def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end", "def update\n respond_to do |format|\n if @invitee.update(invitee_params)\n format.html { redirect_to @invitee, notice: 'Invitee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def update\n inviter_mail = resource_params.delete \"invitermail\"\n \n accepted_inviter = resource_class.to_adapter.find_first(email: inviter_mail)\n \n # before inviting person gets credit for the new user: check if he is\n # really allowed to claim. Only certain vip users are allowed...\n if accepted_inviter && accepted_inviter.ability.can?(:invite, resource_class)\n self.resource = resource_class.accept_invitation!(resource_params) \n resource.invited_by = accepted_inviter\n else\n ## No discussion. User didn't have the right to invite, so show...\n flash[:error] = I18n.t(\"devise.invitations.no_authorized_inviter\")\n raise CanCan::AccessDenied\n end\n\n if resource.errors.empty?\n flash_message = resource.active_for_authentication? ? :updated : :updated_not_active \n set_flash_message :notice, flash_message\n sign_in(resource_name, resource)\n respond_with resource, :location => after_accept_path_for(resource)\n else\n respond_with_navigational(resource){ render :edit }\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n respond_to do |format|\n if @invite_request.update(invite_request_params)\n format.html { redirect_to @invite_request, notice: 'Invite request was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite_request }\n else\n format.html { render :edit }\n format.json { render json: @invite_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def update\n respond_to do |format|\n if @invstatus.update(invstatus_params)\n format.html { redirect_to @invstatus, notice: 'Invstatus was successfully updated.' }\n format.json { render :show, status: :ok, location: @invstatus }\n else\n format.html { render :edit }\n format.json { render json: @invstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @invites = Invite.all\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, :notice => 'Invitation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @invitee = @invitation.invitee\n accepted_invitees = @meeting.invitations.count { |invitation| invitation.response == \"Accepted\"}\n if @invitee==current_user && @meeting.max_size>= accepted_invitees\n if @invitation.update_attributes(invitation_update_params)\n return json_response(@invitation, :updated)\n end\n end\n end\n head :no_content\n end", "def update\n\t\tif current_invite.present?\n\t\t\treset_session\n\t\t\tsession[:invite_id] = current_invite.id\n\t\t\tredirect_to invite_path(current_invite.id)\n\t\telse\n\t\t\treset_session\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "def put(*args)\n request :put, *args\n end", "def update\n @identity = Identity.find(params[:id])\n\n if @identity.update(identity_params)\n head :no_content\n else\n render json: @identity.errors, status: :unprocessable_entity\n end\n end", "def update\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n if @invest.update_attributes(params[:invest])\n format.html { redirect_to(@invest, :notice => 'Invest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @invite_user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n @role = @invite_user.roles.first\n @inviter = User.where(:id => @role.invite_user_id).first\n @course = @role.course\n @user = User.new(params[:user])\n store_location\n end", "def create\n @invite = @event.invites.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to [@event, @invite], notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@event, @invite] }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.proces(confirmed_params, current_user)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.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 @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, flash: { success: 'Invitation was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inven.update(inven_params)\n format.html { redirect_to @inven, notice: 'Inven was successfully updated.' }\n format.json { render :show, status: :ok, location: @inven }\n else\n format.html { render :edit }\n format.json { render json: @inven.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invites\n @rescue_action = RescueAction.find(params[:rescue_action_id])\n end", "def index\n @inviteds = Invited.all\n end", "def organization_invite\n params['host'] = Ind.http_api\n params['api_key'] = Accounts.new.find_by_email(params['email']).api_key\n\n org_res = Organizations.new.list(params).orgs\n\n org_res[0][:related_orgs] << params['org_id']\n org_res[0][:api_key] = params['api_key']\n org_res[0][:email] = params['email']\n org_res[0][:host] = Ind.http_api\n\n res = Organizations.new.update(org_res[0])\n redirect_to root_url\n end", "def update\n @inv_type = InvType.find(params[:id])\n @inv_type.updated_id = current_user.id\n\n respond_to do |format|\n if @inv_type.update_attributes(params[:inv_type])\n format.html { redirect_to(@inv_type, :notice => 'Inv type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inv_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def invite\n \n end", "def update\n @invitation = @event.invitations.find(params[:id])\n if @invitation.key != params[:invitation][:key]\n redirect_to friendly_page_url(@page)\n return\n end\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to(\n friendly_page_url(@page, :invitation_key => @invitation.key),\n :notice => 'Invitation was successfully updated.') }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.67971027", "0.65787655", "0.65787655", "0.65787655", "0.6515703", "0.6389459", "0.6334293", "0.6333119", "0.63229674", "0.6315305", "0.6275967", "0.6265954", "0.6194329", "0.6194329", "0.6194329", "0.6194329", "0.61791176", "0.6152989", "0.6152989", "0.611643", "0.6109015", "0.6109015", "0.6109015", "0.6109015", "0.6094793", "0.60616624", "0.60616624", "0.60616624", "0.60616624", "0.60616624", "0.60616624", "0.60123706", "0.5976067", "0.5967739", "0.5966667", "0.595732", "0.59469867", "0.5946229", "0.59449744", "0.5924524", "0.5917976", "0.59064704", "0.5884557", "0.58709943", "0.58621156", "0.5861494", "0.5850417", "0.5838602", "0.5838602", "0.5838602", "0.5838602", "0.5838602", "0.58265156", "0.58265156", "0.58265156", "0.5822662", "0.5815024", "0.5806554", "0.5790271", "0.5786834", "0.57658446", "0.5756756", "0.57428247", "0.57367367", "0.5722037", "0.5707848", "0.5701819", "0.5694379", "0.5691152", "0.56756645", "0.5675524", "0.56682706", "0.56594634", "0.5655166", "0.56437296", "0.5633332", "0.5617241", "0.5605756", "0.5597313", "0.5596642", "0.55815375", "0.5580655", "0.5574401", "0.5561624", "0.5560792", "0.555562", "0.5543619", "0.5536429", "0.5536429", "0.5536429", "0.55324566", "0.5529563", "0.55201286", "0.5515543", "0.55134666", "0.54993546", "0.5496355", "0.5487983", "0.5486242", "0.5482523" ]
0.6617818
1
Given a card, insert it on the bottom your deck
def add_card(card) @deck.add(card, :back) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_bottom (card)\n @cards.unshift(card);\n end", "def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Increase the orders for cards above in the new deck\n cards.each do |r|\n r.update_attributes(card_order: (r.card_order+1) )\n end\n # Add the card to the bottom of the new deck\n card.update_attributes(deck_id: id, card_order: 1)\n end\n end", "def add_cards_to_deck(card)\n @game_deck.deck << card\n end", "def return_card( card )\n @deck.unshift( card )\n end", "def add_card card\n card.deck = self\n @cards[card.id] = card\n end", "def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end", "def add_card_to_top(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == get_top_order)\n #Update order of card's current deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Add the card to the top of the new deck\n card.update_attributes(deck_id: id, card_order: (get_top_order+1) )\n end\n end", "def add_a_card(card)\n if is_full?\n puts \"Deck is full.You can't add a card\"\n return false\n elsif empty?\n @deck << card\n @added_cards << card\n cards_left\n elsif !find_card(card)\n random = rand(cards_left)\n insert_card(random, card)\n @added_cards << card\n random\n else\n puts \"Can't add a duplicate card to the Deck\"\n return false\n end\n end", "def add(card)\n\t\t@hand_contents.push(card)\n\tend", "def add_top (card)\n @cards.push(card);\n end", "def add_to_deck (suit)\n cards = [2,3,4,5,6,7,8,9,10,'J','Q','K','A']\n cards.each {|val| @deck << Card.new(val, suit)}\n end", "def add_card(card)\n raise \"invalid placement!\" unless valid_placement?(card)\n @store << card\n end", "def insert_random(card)\n @cards.insert(Random.new().rand(0...@cards.count), card)\n end", "def insert(index, card)\n error_unless_param_is_a_card card, \"insert\"\n error_unless_index_is_in_bounds index unless index == count\n\n @stack.insert index, card\n end", "def add_card(new_card)\n self.cards.append(new_card)\n end", "def add_card(card)\n @cards.push(card)\n end", "def add_card(card)\n @addhand = @addhand + card\n end", "def addCardToHand(card)\n @hand << card\n end", "def add_card(new_card)\n cards.push(new_card)\n end", "def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend", "def add_card(card)\n \t@cards << card\n end", "def add_card(card)\n @cards << card\n end", "def add_card(card)\n @cards << card\n end", "def add_card(card)\n @cards.push\n end", "def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to this hand anymore.\"\n \tend\n end", "def addCard(card)\n\t\t@cards << card\n\t\t@value += getValue(card.rank)\n\t\tif card.rank == 'Ace'\n\t\t\t@hasAce = true\n\t\tend\n\t\tif @cards.length == 2 and @value == 21 and @hasAce # updates should be in different method\n\t\t\t@blackjack = true\n\t\tend\n\t\tif @value > 21 and @hasAce\n\t\t\t@value -= 10\n\t\t\t@hasAce = false\n\t\tend\n\tend", "def add_card(c)\n @cards_showing.push(c)\n @table_size += 1\n end", "def draw_into(deck)\n card = draw\n deck << card\n card\n end", "def add!(playing_card)\n if playing_card.suit == suit &&\n (\n (playing_cards.empty? && playing_card.rank == 1) ||\n playing_card.rank == (playing_cards.last.rank + 1)\n )\n playing_cards.push(playing_card)\n else\n raise \"Cannot add #{playing_card} to #{self}\"\n end\n end", "def add_card_to_hand(curr_hand)\n curr_hand.push(get_rand_card)\n end", "def deal(card)\n\t\t@hand.push(card)\n\tend", "def <<(card)\n @cards << card\n end", "def add_deck_to_top(add_deck)\n if add_deck.cards and add_deck.id != self.id and add_deck.cards.size > 0\n orig_count = self.cards.size\n add_deck.cards.each do |c|\n c.update_attributes(deck_id: id, card_order: (c.card_order + orig_count))\n end\n end\n end", "def insert(item, where = :top)\r\n\t\tcase where\r\n\t\t\twhen :top\r\n\t\t\t\t@deck.unshift(item)\r\n\t\t\twhen :bottom\r\n\t\t\t\t@deck << item\r\n\t\t\twhen :random\r\n\t\t\t\titem = @deck.insert(rand(@deck.size), item)\r\n\t\tend\t\t\r\n\t\tself\r\n\tend", "def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend", "def replace_card_with_new(player, card)\n @deck << card\n @deck.shuffle!\n new_card = @deck.shift\n return if new_card == card\n # This will raise if player didn't have the old card\n player.replace_cards(@main_token, [card], [new_card])\n @output_streams.each { |os| os.new_cards(player.user) }\n end", "def get_card(card)\n @hand.append(card)\n end", "def add card\r\n @card_list.add card\r\n end", "def add card\n if card.is_a? Card\n @hand.push card\n else\n @hand.push Card.new(card)\n end\n\n @analysis = analyse @hand\n end", "def add_card(name, suit, rank)\r\n card = Card.new(name, suit, rank)\r\n @cards << card\r\n @order << card.to_s\r\n end", "def take_card(card)\n @cards << card\n end", "def place(card)\n end", "def add card\n @card_list.add card\n end", "def add card\n @card_list.add card\n end", "def add card\n @card_list.add card\n end", "def add card\n @cards.push card\n end", "def push(card)\n @pile.push(card)\n card.arm!\n end", "def add_to_pile_beneath(card)\n @pile_beneath << @pile.remove(card)\n end", "def hit\n @cards.push @deck.shift\n end", "def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend", "def hit!(deck)\n @dealt << deck.cards.shift\n end", "def push(card)\n error_unless_param_is_a_card card, \"push\"\n @stack.push(card)\n end", "def move_joker_b\n b_pos = $deck.find_index('B')\n $deck.delete('B')\n if b_pos == 51\n $deck << 'B'\n else\n $deck.insert (b_pos + 2) % 53, 'B'\n end\nend", "def add(card)\n return unless card.is_a? Card\n # only allow cards to be added\n @cards << card\n end", "def add_card(rank)\n @cards << Card.new(rank)\n end", "def add_card(card)\r\n\t\tcards << card\r\n\t\tcalc_value\r\n\tend", "def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend", "def add_cards(cs)\n\t\tcards.concat cs\n\tend", "def addCardsToHand(cards)\n @hand.concat(cards)\n end", "def push_card_on_table(player, card)\n \tp_cards = player.get_player_cards\n \tif key = p_cards.index(card)\n \t\tself.cards_on_table << card\n \t\tp_cards.delete_at(key)\n \t\tplayer.player_cards = p_cards\n\t\tend\n send_update\n\t\treturn self.cards_on_table\n end", "def add_card(card)\n card.save if card.kind_of?(Balanced::Card) && card.hash.nil?\n self.card_uri = Balanced::Utils.extract_uri_from_object(card)\n save\n end", "def addToBoard(player, card)\n\t\tif player.side == 1\n\t\t\t@p1Board.push(card)\n\t\telse\n\t\t\t@p2Board.push(card)\n\t\tend\n\tend", "def deal_card(player)\n if !self.is_empty?\n player.hand << cards.pop\n else\n self.initialize(1)\n end\n end", "def move_card( card, places )\n \n n = places\n card_locus = @deck.index( card )\n while (n != 0) do\n \n if (card_locus + 1 < @deck.length )\n @deck[card_locus], @deck[card_locus +1] = @deck[card_locus+1], @deck[card_locus]\n card_locus = card_locus+1\n else\n card = @deck.slice!(card_locus)\n @deck.insert(1, card)\n card_locus = 1\n \n end\n # subtract 1 from n\n n -= 1\n \n end\n \n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def <<(deck)\n @decks << deck\n end", "def take_card\n @deck.shift\n end", "def add_card_without_revealing_details(card)\n player.add_card_to_hand(card)\n message = \"#{player.name} drew a card from the center.\"\n game.players.each {|player| player.send_message_to_user(message)}\n end", "def hit(hand, deck)\n hand.push(deck.pop)\nend", "def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end", "def add_card_with_inversion card\n add_card card\n add_card card.invert\n end", "def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end", "def hit(card)\n hand = @hands[@current_hand]\n hand.cards.push(card)\n puts \"New card received - #{card}\"\n if hand.is_bust()\n print_player_hands()\n puts \"Player #{@position} busts!\"\n @current_hand += 1\n end\n end", "def hit(deck)\n @hand << deck.draw!\n end", "def hit(card)\n @cards[@cards.length] = card\n end", "def deal_card(hand)\n\t# pick a random card and add to the hand\n\tindex = rand($card_deck.length)\n\thand << $card_deck[index]\n\n\t# remove the card from the deck\n\t$card_deck.delete_at(index)\nend", "def deal_card\n @deck.pop\n end", "def deal\r\n @cards.shift\r\n end", "def add_card(aCard)\n @cards << aCard\n @cards.sort!() {|card1, card2| card1.rank <=> card2.rank}\n @rank_histogram[aCard.rank] += 1\n @suit_histogram[aCard.suit] += 1\n @evaluation = nil\n @score = 0\nend", "def deal\n @deckOfCards.shift\n end", "def deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\n end", "def hit(card)\n @cards << card\n end", "def addCard(card = Card.new)\n @cards << card\n @cards.sort! #sorts least to greatest\n return self \n end", "def addCardToDeck\n @user = current_user\n card_id = params[:card_id]\n card = MTG::Card.where(id: card_id).all\n card = card[0]\n deck_id = params[:deck_id]\n number = params[:quantity].to_i\n @deck = Deck.find(deck_id)\n\n for i in 1..number\n @deck.cardlist += (card_id + \",\")\n @deck.cardtypes += (card.type + \",\")\n if card.image_url != nil\n @deck.imageurls += (card.image_url + \",\")\n else\n @deck.imageurls += (\"nil,\")\n end\n @deck.cardnames += (card.name + \"%\")\n end\n @deck.save\n\n redirect_back(fallback_location: root_path)\n #redirect_to \"/users/#{@user.id}/decks/#{@deck.id}/edit/1\"\n end", "def draw_card\n #change for chapel if no card to draw\n if ! (top_card = deckcards.find_by(library_position: 1))\n shuffle\n top_card = deckcards.find_by(library_position: 1)\n end\n top_card.status = \"hand\"\n top_card.library_position = nil\n top_card.save\n library.each do |library_member|\n library_member.library_position -=1\n library_member.save\n end\n top_card\n end", "def insert_at(column, player)\n return false if(@height[column] > 5)\n \n # Insert a disc at the next possible slot in the specified column\n @board[@height[column]][column] = player\n @height[column] += 1\n return true\n end", "def move_joker_a\n a_pos = $deck.find_index('A')\n if a_pos == 53\n $deck.delete 'A'\n $deck.insert 1, 'A'\n else\n temp = $deck[a_pos + 1]\n $deck[a_pos + 1] = $deck[a_pos]\n $deck[a_pos] = temp\n end\nend", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def return(cards)\n @deck += cards\n end", "def add_cards(new_cards)\n #checked if new_cards was one card or an array, then sorted if it was\n if new_cards.class == Array\n new_cards = new_cards.sort_by {|card| card.value}\n new_cards.each { |card| @cards.unshift(card) }\n else\n @cards.unshift(new_cards)\n end\n end", "def move_card(draw, play)\n if play.empty? && draw.any?\n play << draw.shift\n elsif draw.any? && (within_one?(draw[0].rank.to_i, play[-1].rank.to_i))\n play << draw.shift\n else\n end\nend", "def putOnTable\n # take the 12 cards on top of the deck and deal on \"table\"\n @cardsOnTable = @cards[0..11]\n 12.times{@cards.shift}\n end", "def drawcard\n @deck.pop\n end", "def draw_from(deck)\n cards.concat(deck.take(1))\n end", "def give_card_to_player(card,player)\n\t\t#player is another player object\n\t\t@cards[card].times do\n\t\t\tplayer.add_card(card)\n\t\tend\n\n\n\t\t#remove cards from hand if selected by another player\n\t\tself.remove_set_from_hand(card)\n\tend", "def deal\n @deck.shift\n end", "def draw\n raise \"not enough cards\" if @cards.empty?\n @cards.shift\n end", "def draw_card(number_of_cards)\n for i in 1..number_of_cards\n @hand.push(@deck.pop)\n end\n end", "def deal_into_new_stack(deck)\n deck.reverse\nend", "def hit(hand)\n hand.push(random_card)\n end" ]
[ "0.826293", "0.8149494", "0.78617173", "0.75007695", "0.7479656", "0.7441609", "0.74125063", "0.7366898", "0.73449177", "0.7342745", "0.7334327", "0.7331764", "0.72779423", "0.72772646", "0.7261177", "0.7246629", "0.7169112", "0.71673834", "0.71518415", "0.7144674", "0.71385324", "0.7138361", "0.7138361", "0.7112616", "0.71031916", "0.7080699", "0.7072485", "0.70316344", "0.7005535", "0.693536", "0.6907323", "0.6867935", "0.6857599", "0.6856422", "0.68534756", "0.6849788", "0.6846482", "0.68404096", "0.68315744", "0.67961466", "0.6793458", "0.6784502", "0.67749065", "0.67749065", "0.67749065", "0.6772336", "0.67529285", "0.67049974", "0.6699413", "0.66871566", "0.66733396", "0.6664884", "0.6652634", "0.6639348", "0.66290814", "0.6618511", "0.6612467", "0.66035706", "0.66004366", "0.65963167", "0.65904003", "0.6578808", "0.6537527", "0.6504318", "0.64853597", "0.6483127", "0.64637446", "0.6446813", "0.643846", "0.64259636", "0.6412197", "0.6380357", "0.63757783", "0.633947", "0.6334758", "0.6330948", "0.63153917", "0.6299775", "0.6289772", "0.6287441", "0.62865454", "0.62810916", "0.62775", "0.62736285", "0.6252215", "0.62259567", "0.62134856", "0.62030494", "0.61998975", "0.6194302", "0.61622596", "0.61545944", "0.6147454", "0.6145437", "0.6120971", "0.60820216", "0.6069535", "0.60603726", "0.60588604", "0.60564053" ]
0.81820077
1
Mix around the order of the cards in your deck
def shuffle # You can't use .shuffle! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_deck\n CARD_SUITS.product(CARD_VALUES).shuffle\nend", "def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end", "def initialize_deck\n SUITS.product(VALUES).shuffle\nend", "def initialize_deck\n VALUES.product(SUITS).shuffle\nend", "def deal\n # pack cards past the default 12 into the begining\n if @cards.length > 12\n # cards still in play past the standard 12 positions\n extra = @cards.last(@cards.length - 12).compact\n # move what can be moved into the standard 12 positions\n @cards = @cards.take(12).map! { |c| c || extra.pop }\n # hopefully extra is empty now, but maybe not\n @cards += extra\n end\n\n # sets is still valid as we haven't modified the combinaion of cards in play\n # do we need to expand the cards in play?\n if(@sets && @sets.none?)\n @cards += Array.new(3)\n end\n \n ## fill any gaps from the deck\n @cards.map! { |x| x || @deck.pop }\n\n # recompute sets\n #@sets = []\n @sets = IsASet.sets @cards.compact\n end", "def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\n end", "def deal_cards(old_deck, num_cards)\n hand = old_deck.sample(num_cards)\n new_deck = old_deck - hand\n return [hand, new_deck]\nend", "def shuffleCards!()\n\t\t@cards.shuffle!\n\tend", "def shuffle\n shuffled_order = cards.pluck('card_order').shuffle\n counter = 0\n cards.each do |r|\n r.update_attribute(:card_order, shuffled_order[counter])\n counter += 1\n end\n end", "def shuffle\n\t\t@cards.shuffle\n\tend", "def redeal\n # take all current cards in play and add to deck\n @deck.concat(@cards_in_play)\n @cards_in_play = Array.new\n\n #shuffle cards \n @deck.shuffle!\n\n #deal 12 more new cards\n @cards_in_play.concat(@deck.pop(12))\nend", "def deal\r\n @deck_of_cards.shift\r\n end", "def shuffle\r\n @cards.shuffle!\r\n end", "def shuffle_into_deck(c1, c2 = nil)\n self.deck << c1\n self.deck << c2 if c2\n self.deck.shuffle!\n end", "def trump_cards\n @cards.select {|c| c.suit == @trump_suit}\n end", "def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend", "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end", "def shuffle\n @cards.shuffle!\n end", "def shuffle\n @cards.shuffle!\n end", "def generate_deck\n (1..3).to_a.product(@colors, @shapes, @textures).each{|arr| @deck.push(Card.new(arr[0], arr[1], arr[2], arr[3]))}\n @deck.shuffle!\nend", "def deal\n @deckOfCards.shift\n end", "def shuffle\n @cards.shuffle! \n end", "def shuffled_deck\n ranks = [2, 3, 4, 5, 6, 7, 8, 9, 10, \"Jack\", \"Queen\", \"King\", \"Ace\"]\n suits = [\"Clubs\", \"Diamonds\", \"Hearts\", \"Spades\"]\n brand_new_deck = ranks.product(suits)\n deck_that_is_shuffled = brand_new_deck.shuffle\n deck_that_is_shuffled\nend", "def shuffle\n\t\t@deck.shuffle!\n\tend", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def shuffle\n @cards.replace @cards.sort_by {rand}\n end", "def cards_by_suit\n @cards_by_suit ||= @cards.group_by(&:suit)\n end", "def remix(drinks)\n alcohols = strip(drinks, 0)\n mixers = strip(drinks, 1)\n solution = mixer(alcohols, mixers)\nend", "def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end", "def shuffle!\n @deck.shuffle!\n end", "def shuffle!\n @deck.shuffle!\n end", "def shuffle\n @deck.sort_by{rand}\n end", "def deal\r\n @cards.shift\r\n end", "def initialize_deck\n deck = []\n SUIT.each do |suit|\n CARDS.each do |card|\n deck << [suit, card]\n end\n end\n deck.shuffle!\nend", "def shuffle_card(cards, value, suit)\n suit.each do |ele1|\n value.each do |ele2|\n cards.push(suit: ele1, value: ele2)\n end\n end\n\n cards = cards * 4\n cards.shuffle!\nend", "def shuffle\n facedown_cards = cards.find_all {|card| card.facedown? }\n shuf_cards = facedown_cards.sort_by { rand }\n shuf_cards.each_with_index do |sc, i|\n # assigning ordering position manually. This code pre-empts\n # acts_as_list for increased speed -- DO NOT reload Card objects!\n # (not reloading the objects is a feature here, not a bug.)\n sc.facedown_position = i + 1\n sc.save!\n end\n save!\n end", "def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end", "def replaceThree\n # move cards from deck to cardsOnTable\n 3.times{ |c|\n @cardsOnTable.push(@cards.at(c))\n }\n # subtract 3 cards from deck\n 3.times{cards.shift}\n end", "def remix(ingredients)\n alchohols, mixers = [], []\n ingredients.each do |a, b|\n alchohols << a\n mixers << b\n end\n alchohols, mixers = alchohols.shuffle, mixers.shuffle\n alchohols.zip(mixers)\nend", "def shuffle_deck!\n @deck.shuffle\n @deck_position = @deck.each\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def shuffle\n @cards.shuffle!\n self\n end", "def return(cards)\n @deck.concat(cards)\n end", "def shuffle\r\n @pack.shuffle!\r\n end", "def deal_cards(cards)\n @players.each do |player|\n player.hand += @deck.cards.pop(cards)\n end\n end", "def deal\n @deck.shift\n end", "def draw_cards(count)\n self.deck.shift(count)\n end", "def shuffle!\n cards.shuffle!\n end", "def shuffle!\n @cards.shuffle!\n self\n end", "def remix(ingredients)\n alcohol = ingredients.map {|el| el[0]}\n mixers = ingredients.map {|el| el[1] }\n alcohol.shuffle!\n mixers.shuffle!\n result = []\n alcohol.each_with_index do |al, i| \n result << [al, mixers[i]]\n end\n result\nend", "def combine(deck)\n if block_given?\n @cards = yield(@cards, deck.empty)\n else\n @cards.concat(deck.empty)\n end\n\n end", "def shuffle!\n @cards = self.cards.sort_by { rand }\n end", "def shuffle!\n self.cards.shuffle!\n self\n end", "def new_deck(num_decks)\n reset_deck()\n num_decks.times do\n (1..13).each do |num|\n Deck << num.to_s + \" of Hearts\"\n Deck << num.to_s + \" of Diamonds\"\n Deck << num.to_s + \" of Spades\"\n Deck << num.to_s + \" of Clubs\"\n end\n\n Deck.each do |ele|\n if ele[0..1] == \"1 \"\n ele[0..1] = \"A \"\n elsif ele[0..1] == \"11\"\n ele[0..1] = \"J\"\n elsif ele[0..1] == \"12\"\n ele[0..1] = \"Q\"\n elsif ele[0..1] == \"13\"\n ele[0..1] = \"K\"\n end\n end\n end\n shuffle(num_decks)\nend", "def shuffle\n @deck.shuffle! # Contents of @deck will be permanently changed\n end", "def return(cards)\n @deck += cards\n end", "def init_deck\n deck = []\n suits = ['S', 'C', 'D', 'H']\n values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']\n # can also use .product for this, but here's logic behind it for future reference\n suits.each do |suit|\n values.each do |value|\n deck << [suit, value]\n end\n end\n # work on own method for shuffling, here's shortcut, remember bang (!) modifies object\n deck.shuffle!\nend", "def flush_cards(cards)\n\t\thsh = {}\n\t\tcards.each {|c| hsh[c.suit] ||= []; hsh[c.suit] << c}\n\t\tret = []\n\t\thsh.each {|suit, suit_cards| ret = suit_cards if suit_cards.size > ret.size}\n\t\tret.sort_by {|x| x.sort_value}\n\tend", "def flush_deck (n = 1)\n deck = []\n n.times { deck.concat(generate_deck) }\n\n # swap two random cards (4 * deck.length) times\n (4 * deck.length).times do\n \n i, j = rand(deck.length), rand(deck.length)\n deck[i], deck[j] = deck[j], deck[i]\n end\n deck\nend", "def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end", "def sort_cards\n hearts = []\n spades = []\n clubs = []\n diamonds = []\n\n # Sort each card into its corresponding suit array\n @cards.each do |card|\n case card.suit\n when :hearts\n hearts << card\n when :spades\n spades << card\n when :clubs\n clubs << card\n when :diamonds\n diamonds << card\n end\n end\n\n # Cards need to be in descending order, so sort\n # then reverse the arrays\n hearts.sort!.reverse!\n spades.sort!.reverse!\n clubs.sort!.reverse!\n diamonds.sort!.reverse!\n\n # Combine all suit arrays in order\n @cards = hearts + spades + clubs + diamonds\n end", "def add_deck_to_top(add_deck)\n if add_deck.cards and add_deck.id != self.id and add_deck.cards.size > 0\n orig_count = self.cards.size\n add_deck.cards.each do |c|\n c.update_attributes(deck_id: id, card_order: (c.card_order + orig_count))\n end\n end\n end", "def deal(deck)\n unless players.size == 4\n raise NotImplementedError, \"only 4 players are supported\"\n end\n raise ArgumentError, \"deck has fewer than 43 cards\" if deck.size < 43\n\n deck = deck.shuffle\n\n merge(\n hands: Hamster::Hash[players.map {|p| [p, deck.shift(10)] }],\n kitty: deck.shift(3),\n )\n end", "def playcard\n @cards.shuffle.slice!(0,2)\n end", "def draw_from(deck)\n cards.concat(deck.take(1))\n end", "def hit!(deck)\n @dealt << deck.cards.shift\n end", "def order_list\n\t\t@cards = @cards.order(:cmc)\n\tend", "def deck_cards\n ranks = [\"A\", 2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\" ]\n suits = [ \"hearts\", \"spades\", \"clubs\", \"diamonds\" ]\n deck = []\n players = []\n\n values.each_with_index do |value, index|\n suits.each do |suit|\n deck.push([value,suit])\n end\n end\n return deck.shuffle\nend", "def cut\n count = @cards.count\n rnd = Random.rand(count/3)\n cut_point = (count/3 + rnd)\n @cards = @cards.slice(cut_point, count - cut_point) + @cards.slice(0, cut_point)\n end", "def initialize_deck\n [\"A\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"J\", \"Q\", \"K\"].product(['S', 'H', 'C', 'D'])\nend", "def initialize_deck\n [\"A\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"J\", \"Q\", \"K\"].product(['S', 'H', 'C', 'D'])\nend", "def assemble_deck\n cards = (north_south_tricks + east_west_tricks).map(&:cards)\n BeloteDeck.new cards\n end", "def deal_cards\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n end", "def deal()\n loop_size = Constant::CARD_COUNT / 6\n loop_size.times do\n @players.each do |player|\n break if @deck.cards.empty?\n player.hand += @deck.cards.pop(2)\n end\n end\n end", "def createDeck\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\t@deck.shuffle!\t\n\tend", "def return(cards)\n @stockpile += cards\n end", "def shuffle(cards)\n cards.size.times do \n rand1, rand2, rand3 = get_rand(cards.size-1)\n temp = cards[rand1]\n cards[rand1] = cards[rand2]\n cards[rand2] = cards[rand3]\n cards[rand3] = temp\n end\n cards\n end", "def shuffle\n @fulldeck.shuffle!\n end", "def initialize\n @cards = []\n suits = [:hearts, :diamonds, :spades, :clubs]\n suits.each do |suit|\n (2..10).each do |value|\n @cards << Card.new(suit, value)\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |facecard|\n @cards << Card.new(suit, facecard)\n end\n end\n\n def shuffle!\n cards.shuffle!\n end\n\n def empty?\n self.cards.empty?\n end\n\n\nend", "def draw_for(player)\n @cards.shuffle!\n player.cards << @cards.pop\n end", "def non_trump_cards\n @cards.select {|c| c.suit != @trump_suit}\n end", "def shuffle_cards\n n = self.cards.length - 1\n while n > 0\n i = rand(n -= 1 )\n temp = self.cards[i]\n self.cards[i] = self.cards[n]\n self.cards[n] = temp\n # can be written more elegantly like:\n # self.cards[i], self.cards[n] = self.cards[n], self.cards[i]\n end\n self.cards.each do |c|\n puts c.face\n end\n self\n end", "def return_card( card )\n @deck.unshift( card )\n end", "def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end", "def shuffle_list\n @cardList.shuffle!\n end", "def draw\n # if there are no more cards in the deck,\n # we readd all of the cards and shuffle\n if self.size == 0\n for suit in suits\n for rank in ranks\n self.push(BlackJackCard.new(rank, suit))\n end\n end\n self.shuffle\n end\n return self.shift\n end", "def add_inversions\n @cards.values.each {|c| add_card c.invert }\n end", "def pass_out_characters_and_coins\n if self.players.size == 2 && @settings.include?(:twoplayer)\n side_decks = [[], []]\n # Uh this is kinda wonky.\n # Oh Well YOLT (You only live twice) in Coup.\n 5.times {\n side_decks[0] << self.draw_cards(1)[0]\n side_decks[1] << self.draw_cards(1)[0]\n self.deck.rotate!\n }\n end\n\n self.deck.shuffle!\n\n # assign loyalties\n self.players.each_with_index do |player, index|\n if self.players.size == 2\n if @settings.include?(:twoplayer)\n player.receive_characters(self.draw_cards(1))\n player.receive_side_characters(*side_decks[index].shuffle)\n else\n player.receive_characters(self.draw_cards(2))\n end\n # first player gets 1 coin and second gets 2.\n player.give_coins(index + 1)\n else\n player.receive_characters(self.draw_cards(2))\n player.give_coins(2)\n end\n end\n end", "def deal_card\n @deck.pop\n end", "def build_deck\n @deck = []\n @decks.times do\n @suits.each { |each_suit| @ranks.each { |each_rank| @deck.push(Card.new(each_rank, each_suit)) } }\n end\n end", "def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end", "def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend", "def cut!(index)\n (0..index).each { @cards << @cards.shift }\n self\n end", "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def draw\n @deck.shift\n end", "def deal(player)\n cards = []\n 26.times do \n cards << self.deck.shift\n end\n\n player.receive_cards(cards)\n end", "def pile_cards\n if type == :basic\n @spoils_of_war << @player1.deck.cards[0]\n @spoils_of_war << @player2.deck.cards[0]\n @player1.deck.cards.shift\n @player2.deck.cards.shift\n elsif type == :war\n @spoils_of_war << @player1.deck.cards[0]\n @spoils_of_war << @player1.deck.cards[1]\n @spoils_of_war << @player1.deck.cards[2]\n @spoils_of_war << @player2.deck.cards[0]\n @spoils_of_war << @player2.deck.cards[1]\n @spoils_of_war << @player2.deck.cards[2]\n @player1.deck.cards.shift(3)\n @player2.deck.cards.shift(3)\n else\n @player1.deck.cards.shift(3)\n @player2.deck.cards.shift(3)\n p \"MUTALLY ASSURED DESTRUCTION\"\n end\n end", "def hit(hand, deck)\n hand.push(deck.pop)\nend", "def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the highest combination to win\n $hash_7_card = array_suit_rank\n end", "def add_cards(cs)\n\t\tcards.concat cs\n\tend" ]
[ "0.69107836", "0.6739678", "0.67210054", "0.66971433", "0.66793084", "0.66206455", "0.6620253", "0.65783685", "0.6576435", "0.6559651", "0.6551457", "0.65489596", "0.65349287", "0.65342915", "0.6522916", "0.65169555", "0.6502207", "0.6496645", "0.6453775", "0.6448532", "0.643704", "0.64315844", "0.6424983", "0.6413161", "0.6407103", "0.6388272", "0.6380376", "0.63585603", "0.6352831", "0.6321759", "0.63176274", "0.63176274", "0.63121223", "0.62877446", "0.6283317", "0.6277976", "0.62618625", "0.62501574", "0.6235746", "0.6229381", "0.6222038", "0.6215278", "0.6209519", "0.6207517", "0.6200932", "0.6196118", "0.61820036", "0.6175963", "0.61728406", "0.6170175", "0.61659425", "0.61589605", "0.61544603", "0.61514187", "0.61450315", "0.61420846", "0.6140269", "0.6111179", "0.61046714", "0.61030066", "0.6097683", "0.609459", "0.60931736", "0.6092344", "0.60809374", "0.60681814", "0.6055058", "0.6049498", "0.60455656", "0.6037261", "0.60305923", "0.60305923", "0.60141444", "0.59587663", "0.5948607", "0.5929705", "0.59291184", "0.5922408", "0.5917452", "0.5904978", "0.59030724", "0.5900677", "0.58990955", "0.5896055", "0.58956546", "0.58869606", "0.5876059", "0.5874019", "0.5873998", "0.586739", "0.585484", "0.5853672", "0.58495903", "0.5843479", "0.5837649", "0.5836795", "0.58353704", "0.58290917", "0.58215225", "0.58136904", "0.5813476" ]
0.0
-1
Remove the top card from your deck and return it
def deal_card @deck.remove(:front) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_card_top\n @cardList.pop\n end", "def remove_card\n cards.shift\n return cards\n end", "def remove_card\n @cards.shift\n end", "def remove_card\n @cards.shift\n\n end", "def remove_card\n @cards.delete_at(0)\n end", "def remove_card\n self.cards.delete_at(0)\n end", "def get_card\n @deck.pop\n end", "def deal_card\n @deck.pop\n end", "def hit \n card = self.cards_deck.pop\n return card\n end", "def test_discard_top_card\n top_card = @manager.draw_pile.cards[0]\n assert_not_equal(top_card, @manager.discard_pile.cards[0])\n @manager.discard_top_card\n assert_equal(top_card, @manager.discard_pile.cards[0])\n end", "def take_card\n raise OutOfCardsError if empty?\n @cards.pop\n end", "def pull(card)\n card = self.cards.delete(card)\n raise \"Cannot find card. May already have been dealt\" unless card\n return card\n end", "def deal_card\r\n\t\tcards.pop\r\n\tend", "def drawcard\n @deck.pop\n end", "def remove_card_from_deck (card)\n\t\t@deck -= [card]\n\tend", "def remove remove_card\r\n @card_list.remove remove_card\r\n end", "def retrieve_card\n card = @cards.pop\n if card.nil?\n self.reset\n card = @cards.pop\n end\n return card\n end", "def deal_card\n @cards.pop\n end", "def deal_flop\n @pokerdeck.pop\n flop = @pokerdeck.pop(3)\n @communal_cards = flop\n return flop\n end", "def take_card\n @deck.shift\n end", "def remove remove_card\n @card_list.remove remove_card\n end", "def deal_one\n cards.pop\n end", "def get_card()\n return @cards.delete_at(rand(@cards.length))\n end", "def deal()\n card = self.cards.shift()\n raise \"Cannot deal more than 52 cards.\" unless card\n return card\n end", "def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end", "def show_top_card\n self.discard(draw)\n end", "def remove_cards\n\t\t@cards.slice!(0,2)\n\tend", "def top_card\n return nil if @discard.empty?\n @discard.last.to_s\n end", "def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end", "def take_card\n @store.pop\n end", "def top_card\n raise 'This pile is empty!' if empty?\n @store.last\n end", "def high_card\n @cards.sort[-1]\n end", "def top\n cards.first\n end", "def play_like_a_dummy\r\n # very brutal algorithm , always play the first card\r\n card = @cards_on_hand.pop\r\n return card\r\n end", "def removeCard(card)\n @cards.delete(card)\n end", "def hit(deck)\n rand_card = deck.sample # pulls a random card from the playing deck.\n deck.delete(rand_card)\nend", "def remove_card(card)\n @all_cards.delete(card)\n end", "def deal_turn\n @pokerdeck.pop\n turn = @pokerdeck.pop\n @communal_cards << turn\n return turn\n end", "def pick_random_card\n random_card = @all_cards.sample\n remove_card(random_card)\n return random_card\n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def get_trump_card\n if self.trump_card.nil?\n trump_index = rand(self.cards_set.length)\n self.trump_card = self.cards_set[trump_index]\n self.cards_set.delete_at(trump_index)\n end \n send_update\n return self.trump_card\n end", "def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n elsif player.player_hand.wildcards.size > 0\n wildcards = player.player_hand.wildcards\n rand_index = rand(wildcards.size)\n return wildcards.fetch(rand_index)\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end", "def pick\n raise NoMoreCardsException.new(\"Deck is empty\") if cards_left == 0\n @deck.shift\n end", "def discard\n player.hand.first\n end", "def select_card\n num_random = rand(@cards.length)\n card = @cards[num_random]\n @cards.delete_at(num_random)\n card\n end", "def draw(amount = 1)\n cards.pop(amount)\n end", "def discard_card(player)\n if player.player_hand.size == 0\n nil\n else\n rand_index = rand(5)\n rand_index += 1\n Keepem.new(Image.new(\"keepem.gif\"), rand_index)\n end\n end", "def discard\n\n # organize hand into sorted array of cards\n #### METHOD\n\n puts \"here is your hand #{hand}\"\n\n puts 'what cards? you can only discard 3.'\n\n #the player returns [2,3]\n ##### METHOD\n\n # find hand[2], hand[3] and remove from hand\n ##### METHOD\n\n # hand currently has 3 cards\n\n # hand << deck.deal(2)\n\n #RETURNS new hand\n\n\n #....player1.hand = the new hand\n end", "def draw\n return @cards.pop\n end", "def draw_card\n self.cards.pop\n end", "def remove remove_card\n @cards.each_with_index do |card, i|\n if card.to_string == remove_card.to_string\n @cards.delete_at(i)\n return true\n end\n end\n false\n end", "def deal_card\n if @cards.length > 0 then\n return @cards.slice!(0)\n else\n raise StandardError, \"No cards left in shoe; please use can_play\"\n end\n end", "def deal\r\n @cards.shift\r\n end", "def deal\n\n @first_card = @cards.shift\n\n return @first_card\n\n end", "def discard(card)\n discard_pile << card\n end", "def hand_over_player \r\n puts \"Player getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @player_deck[@random_card] = random_card_val # to player\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@player_deck = #{@player_deck}\"\r\n\r\n end", "def take!\n\t\t@cards.shift\n\tend", "def up_card\n return @cards[0]\n end", "def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end", "def choose_card \n\n @cards.shift\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def pop_cards(num_pops)\r\n #p @deck_todisp.size\r\n num_pops.times{|ix| @deck_todisp.pop}\r\n if @briscola and @card_briscola_todisp and @deck_todisp.size == 0\r\n #if @card_briscola_todisp and @realgame_num_cards == 0\r\n # no more cards on deck, pick the briscola\r\n @card_briscola_todisp.visible = false\r\n end\r\n #p @deck_todisp.size\r\n end", "def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end", "def pull_from(index)\n error_unless_index_is_in_bounds index\n\n card = @stack[index]\n @stack.delete_at index\n card\n end", "def deal\n @deckOfCards.shift\n end", "def remove_all_but_top_cards\n piles.map { |pile| pile.slice!(0, pile.size - 1) }\n end", "def return_card( card )\n @deck.unshift( card )\n end", "def draw\n @cards.pop\n end", "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def playCard()\n if (@hand.length == 0)\n puts \"#{@name} RAN OUT OF CARDS\"\n return false\n end\n topCard = @hand.shift\n return topCard\n end", "def pick_random\n if @cards.length == 0\n return false\n end\n index = rand(@cards.length)\n card = @cards[index]\n @cards.delete_at(index)\n card\n end", "def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end", "def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\n end", "def create_card(deck)\n card = deck.shuffle.pop\nend", "def pop\n delete_at(0)\n end", "def drawCards!(n)\n\t\treturn @cards.pop(n)\n end", "def deal(num_cards)\n card_lst = @cards.slice!(0,num_cards)\n return (num_cards == 1 ? ((card_lst == nil) ? nil : card_lst[0]) : card_lst)\n end", "def deal\n @deck.shift\n end", "def discard(card)\n hand.transfer!(card: card, to: discard_pile)\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def delete card\n @hand.delete(Card.new(card))\n end", "def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end", "def deal_card(hand)\n\t# pick a random card and add to the hand\n\tindex = rand($card_deck.length)\n\thand << $card_deck[index]\n\n\t# remove the card from the deck\n\t$card_deck.delete_at(index)\nend", "def remove_set_from_hand(card)\n\t\t@cards.delete(card)\n\tend", "def deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\n end", "def get_top_order\n cards.maximum('card_order') || 0\n end", "def deal\n puts @deck.first\n @deck.shift\n end", "def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end", "def deal_river\n @pokerdeck.pop\n river = @pokerdeck.pop\n @communal_cards << river\n return river\n end", "def hand_over_dealer\r\n puts \"Dealer getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @dealer_deck[@random_card] = random_card_val # to dealer\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@dealer_deck = #{@dealer_deck}\"\r\n end", "def get_card(deck, n)\n new_card = deck.cards.pop(n)\n cards << new_card\n cards.flatten!\n new_card\n end", "def draw_card\n #change for chapel if no card to draw\n if ! (top_card = deckcards.find_by(library_position: 1))\n shuffle\n top_card = deckcards.find_by(library_position: 1)\n end\n top_card.status = \"hand\"\n top_card.library_position = nil\n top_card.save\n library.each do |library_member|\n library_member.library_position -=1\n library_member.save\n end\n top_card\n end", "def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\n end", "def draw\n raise \"not enough cards\" if @cards.empty?\n @cards.shift\n end", "def card_from_user(hand, cards_played)\n next_card_prompt(hand)\n\n puts \"What card would you like to play?\"\n card = get_card_following_suit(hand, cards_played)\n\n puts \"You picked #{card}\"\n hand.delete(card)\n\n card\n end", "def pop\n # assume head of @store is top of stack\n return @store.remove_first()\n end", "def top_cut(pack,cut=nil)\nif cut == nil\ncut = rand(1...pack.length)\nend\ntop = pack.slice(0,cut)\nbottom = pack.slice(cut..-1)\ncut_pack = bottom + top\np \"#{cut} card(s) cut from top of deck.\"\ncut_pack\nend", "def pop\n raise \"Stack Underflow - The stack is empty\" if self.is_empty?\n top_element = @store.pop\n @top -= 1\n top_element\n end", "def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end", "def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end" ]
[ "0.8080477", "0.797509", "0.795018", "0.78866357", "0.78304535", "0.7752167", "0.7716863", "0.74881166", "0.7431325", "0.7344642", "0.7321089", "0.7269207", "0.7224345", "0.7137483", "0.7137167", "0.71336883", "0.7132554", "0.71280104", "0.705911", "0.70585537", "0.70545757", "0.70088774", "0.6995148", "0.6972479", "0.69679475", "0.69584733", "0.69499505", "0.69350886", "0.69308037", "0.692612", "0.68798715", "0.6869722", "0.6869656", "0.68453383", "0.68319744", "0.6813328", "0.6789179", "0.67416346", "0.67389", "0.67368895", "0.67121184", "0.6687539", "0.66851294", "0.6674781", "0.6669141", "0.66374034", "0.6626308", "0.6621088", "0.66154045", "0.6604699", "0.6603791", "0.6600733", "0.65923595", "0.6581509", "0.6568842", "0.6566466", "0.6557956", "0.65221477", "0.65181834", "0.6505481", "0.65000474", "0.64462817", "0.6441678", "0.6436694", "0.6435177", "0.6429759", "0.64153963", "0.6406025", "0.63792586", "0.63713694", "0.63635206", "0.63446355", "0.6340655", "0.63281775", "0.63274515", "0.63149077", "0.63136864", "0.62985355", "0.6281698", "0.6265399", "0.6258501", "0.6233874", "0.6213109", "0.62127286", "0.61817396", "0.6163835", "0.6160807", "0.6158472", "0.6151631", "0.6149106", "0.6143558", "0.6143328", "0.6142702", "0.612338", "0.6113177", "0.61063385", "0.6102033", "0.6095615", "0.6087697", "0.6087697" ]
0.74016935
9
Reset this deck with 52 cards
def create_shuffled_deck # value = (2..10).to_a ranks = (2..10).to_a + ["J", "Q", "k", "A"] values = (2..14).to_a suits = ["Spades", "Diamonds", "Hearts", "Clubs"] # suits.each do |suit| # ranks.each_with_index do |rank| # @deck << Card.new(rank, value[index], suit) # end # end i = 0 counter = 0 temp_deck = [] until i == 4 (0...ranks.length).each do |j| temp_deck << Card.new(ranks[j], values[j], suits[i]) counter += 1 end i += 1 end #Shuffling cards until temp_deck.length == 0 index = rand(0...temp_deck.length) self.add_card(temp_deck[index]) temp_deck.delete_at(index) end counter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @cards = Card.suits.keys.map do |suit|\n Card.values.map {|i| Card.new(suit, i)}\n end.flatten\n @dealt = []\n self\n end", "def reset!\n @cards = load_cards\n end", "def reset!\n self.cards = CARDS.dup\n end", "def reset!\n @hands.each(&:discard!)\n @cards += @used\n @used = []\n end", "def reset\n # delete all old cards, then reload deck\n cards.each {|card| Card.delete card }\n reload\n # create new cards\n Cardface.all.each do |cf|\n c_new = Card.new :cardface_id => cf.id, :facedown_position => cf.id\n cards << c_new\n c_new.save!\n end\n save!\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def redeal\n # take all current cards in play and add to deck\n @deck.concat(@cards_in_play)\n @cards_in_play = Array.new\n\n #shuffle cards \n @deck.shuffle!\n\n #deal 12 more new cards\n @cards_in_play.concat(@deck.pop(12))\nend", "def deal\n # pack cards past the default 12 into the begining\n if @cards.length > 12\n # cards still in play past the standard 12 positions\n extra = @cards.last(@cards.length - 12).compact\n # move what can be moved into the standard 12 positions\n @cards = @cards.take(12).map! { |c| c || extra.pop }\n # hopefully extra is empty now, but maybe not\n @cards += extra\n end\n\n # sets is still valid as we haven't modified the combinaion of cards in play\n # do we need to expand the cards in play?\n if(@sets && @sets.none?)\n @cards += Array.new(3)\n end\n \n ## fill any gaps from the deck\n @cards.map! { |x| x || @deck.pop }\n\n # recompute sets\n #@sets = []\n @sets = IsASet.sets @cards.compact\n end", "def reshuffle_deck\n @output.puts ''.center(WIDTH, '-')\n @output.puts 'Shuffling new deck.'\n @output.puts ''.center(WIDTH, '-')\n @game.deck = Gambler::Deck.new\n 3.times { @game.deck.shuffle! }\n end", "def reset_self\r\n @hole_cards = []\r\n @folded = false\r\n @bet = 0\r\n end", "def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end", "def reset_unused!\n @cards += @used\n @used = []\n end", "def shuffle_deck\n if !@cards.nil?\n @cards = manual_shuffle\n end\n end", "def reset\n\t\t@hand = Array.new\n\t\t@total = 0\n\tend", "def reset\n @dice_cup.clear\n @number_of_dice = 6\n @farkle_count= 0\n end", "def new_deck(num_decks)\n reset_deck()\n num_decks.times do\n (1..13).each do |num|\n Deck << num.to_s + \" of Hearts\"\n Deck << num.to_s + \" of Diamonds\"\n Deck << num.to_s + \" of Spades\"\n Deck << num.to_s + \" of Clubs\"\n end\n\n Deck.each do |ele|\n if ele[0..1] == \"1 \"\n ele[0..1] = \"A \"\n elsif ele[0..1] == \"11\"\n ele[0..1] = \"J\"\n elsif ele[0..1] == \"12\"\n ele[0..1] = \"Q\"\n elsif ele[0..1] == \"13\"\n ele[0..1] = \"K\"\n end\n end\n end\n shuffle(num_decks)\nend", "def flush_deck (n = 1)\n deck = []\n n.times { deck.concat(generate_deck) }\n\n # swap two random cards (4 * deck.length) times\n (4 * deck.length).times do\n \n i, j = rand(deck.length), rand(deck.length)\n deck[i], deck[j] = deck[j], deck[i]\n end\n deck\nend", "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "def shuffle\n @deck.shuffle! # Contents of @deck will be permanently changed\n end", "def reset\n @round = 0\n @turn = 0 \n assign_player_colors\n seat_players\n seed_player_funds\n reset_state_bins\n add_home_state_picks\n pick_who_goes_first\n start_at_first_day\n end", "def build_deck\n @deck = []\n @decks.times do\n @suits.each { |each_suit| @ranks.each { |each_rank| @deck.push(Card.new(each_rank, each_suit)) } }\n end\n end", "def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end", "def init_deck\n deck = []\n n = 0\n suit = 0x8000\n\n (0..3).each do\n (0..12).each do |j|\n deck[n] = Arrays::PRIMES[j] | (j << 8) | suit | (1 << (16+j))\n n+=1\n end\n suit >>= 1\n end\n deck\n end", "def initialize_deck\n deck = []\n SUIT.each do |suit|\n CARDS.each do |card|\n deck << [suit, card]\n end\n end\n deck.shuffle!\nend", "def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end", "def build_deck\n# This function builds an array of 52 cards made up of 4 copies of fixed nums with values from 1 to 13\n\t@deck = []\n\tfor num in 1..4\n\t\tfor num in 1..13\n\t\t\t@deck.push(num)\n\t\tend\n\tend\nend", "def reset_hand\n @hand = []\n end", "def create_52_card_deck\n\n end", "def initialize\n @deck = (CARD_TYPES * 5).shuffle\n @board = @deck.shift(3)\n end", "def initialize(num_decks)\n #Init cards array\n @cards = []\n\n #Create a card for each suit/value combo\n SUITS.each do |suit|\n VALUES.each do |val|\n @cards << Card.new(suit, val)\n end\n end\n\n #Duplicate to make num_decks decks\n @cards = @cards * num_decks\n\n #shuffle the deck\n @cards.shuffle!\n end", "def reset\n\t\tfor i in (0...9)\n\t\t\t@board[i] = nil\n\t\tend\n\tend", "def initialize_deck\n # Delete the redis user data\n data.reset\n deck = data.create_deck\n Card.all.each do |card|\n # zadd key, score, value\n deck.update_card_interval(interval: 0.second, card_id: card.id)\n end\n end", "def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend", "def initialize num_decks = 1\n @shoe = []\n @used_cards = []\n @dealt_cards = []\n num_decks.times do\n @shoe.concat(Deck.new.deck)\n end\n shuffle!\n end", "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end", "def initialize(number_of_decks)\n @deck = (SINGLE_DECK * number_of_decks).shuffle\n end", "def reset\n @player_status = \"in\" \n @hands = [] \n @hands_status = [] \n @bets = [] \n @values = [] \n @cur = 0 \n end", "def reset_base_card\n new_card = Card.no_mavericks.find_by!(number: self.number, expansion_id: self.expansion.id)\n self.base_card = new_card\n end", "def recycle(cards)\n LOGGER.debug \"Recycling #{cards.size} cards: #{self}\"\n return if cards.nil?\n\n top = @pile.pop\n\n if cards.respond_to?(:pop) # is it an array?\n @pile.concat(cards)\n else\n @pile.push(cards)\n end\n\n @pile.push(top)\n LOGGER.debug \"Done recycling: #{self}\"\n end", "def reset\n @hand = []\n @value = nil\n @status = \"unfinished\"\n end", "def clear_hand\n @hand_cards.clear\n @points = 0\n end", "def shuffle_deck!\n @deck.shuffle\n @deck_position = @deck.each\n end", "def clear\n\t\t@save_time = 0.0\n\t\t@top_card = 0\n\t\t@number_of_hint = 0\n\t\t@number_of_correct = 0\n\t\t@number_of_wrong= 0\n\t\t@deck = []\n\t\t@hand = []\n\t\t@username = \"\"\n\t\t@total_hint=0\n\t\t@is_end=false\n\tend", "def initialize_deck\n VALUES.product(SUITS).shuffle\nend", "def setup_game\n @deck.shuffle!\n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def reset_players\n # Replaces the hands array with a new array, with only one hand in it.\n @players.each {|p| p.hands = [p.hand.reset!] }\n\n # Resets the dealers only hand.\n @dealer.hand.reset!\n end", "def reset\n\t\t@board = Hash[:one => 1, :two => 2, :three => 3, :four => 4, :five => 5, :six => 6, :seven => 7, :eight => 8, :nine => 9]\n\t\tself.display\n\tend", "def initialize_cards\n cards = []\n 4.times { cards += (2..14).to_a }\n cards.sample(52)\n end", "def shuffleCards!()\n\t\t@cards.shuffle!\n\tend", "def draw_cards(count)\n self.deck.shift(count)\n end", "def build_deck\n CARD_SUITS.product(CARD_VALUES).shuffle\nend", "def deal_card\n @deck.remove(:front)\n end", "def initialize\n @ranks = %w(1 2 3 4 5 6 7 8 9 10 11 12)\n @suits = %w(Spades Diamonds Clubs Hearts)\n @cards = []\n generate_deck\n \n\n end", "def init_deck\n deck = []\n suits = ['S', 'C', 'D', 'H']\n values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']\n # can also use .product for this, but here's logic behind it for future reference\n suits.each do |suit|\n values.each do |value|\n deck << [suit, value]\n end\n end\n # work on own method for shuffling, here's shortcut, remember bang (!) modifies object\n deck.shuffle!\nend", "def shuffle\n\t\t@deck.shuffle!\n\tend", "def initialize_deck\n SUITS.product(VALUES).shuffle\nend", "def createDeck\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\t@deck.shuffle!\t\n\tend", "def reset_board\n @board = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n end", "def shuffle!\n @cards.shuffle!\n self\n end", "def prepare_deck\n (1..104).each do |i|\n v = [1, 2, 3, 5, 7]\n if i == 55\n @deck[i] = v[4]\n elsif (i % 11 == 0.0) && i != 55\n @deck[i] = v[3]\n elsif (i % 10 == 0.0) && i != 55\n @deck[i] = v[2]\n elsif (i % 5 == 0.0) && i != 55\n @deck[i] = v[1]\n else\n @deck[i] = v[0]\n end\n end\n end", "def initialize\n @cards = full_deck.shuffle\n @used = []\n @inhand = []\n @hands = []\n end", "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def shuffle!\n @deck.shuffle!\n end", "def shuffle!\n @deck.shuffle!\n end", "def setTheSuit(suit) #generating the deck\n i =1;\n for i in 1..13\n if i === 1\n @cards << Card.new(\"Ace\", suit)\n elsif i < 11 && i > 1\n @cards << Card.new(\"#{i}\", suit)\n elsif i === 11\n @cards << Card.new(\"Jack\", suit)\n elsif i === 12\n @cards << Card.new(\"Queen\", suit)\n else\n @cards << Card.new(\"King\",suit)\n end\n i = i + 1 # making sure it goes to 13\n end\n end", "def reset\n @players.each { |player| player.reset }\n @dealer.reset\n system \"clear\"\n end", "def return_cards\n @hand = []\n end", "def shuffle\n @cards.shuffle!\n self\n end", "def shuffle\r\n @cards.shuffle!\r\n end", "def reset_all()\n\t@totalbets.text = \"$0\"\n\tfor i in 0..4\n\t\t@playerimages[i].path = \"images/#{$game.players[0].hand[i]}.png\" \n\tend\n\t@playerrank.text = $game.ranks[$game.players[0].ranks[0]]\n\t@winner.text = \"-----\"\n\t@rounds.text = $game.roundnum\n\tfor i in 0..3\n\t\t@fflag[i].text = \"\"\n\tend\n\nend", "def initialize\n @deck = Array.new\n suits = ['Club', 'Diamond', 'Heart','Spades']\n cards = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']\n suits.each do |suit|\n cards.each do |card|\n @deck << Card.new(suit,card)\n end\n end\n @deck.shuffle!\n end", "def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end", "def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end", "def initialize\n @cards = ((1..6).to_a * 3 + (7..10).to_a * 4 + (11..17).to_a * 2 + (18..25).to_a).shuffle\n end", "def reset\n @dice.each(&:reset)\n if @dice.size > 2\n @dice.slice!(-2..-1)\n end\n end", "def shuffle\n @cards.shuffle!\n end", "def reshuffle\n @deck = Deck.find(params[:id])\n @deck.shuffle_cards\n render json: {\n deck_id: @deck.id,\n shuffled: @deck.shuffled,\n remaining: @deck.card_codes.count\n }\n end", "def setup\n Card::CURRENCIES.each do |currency|\n slot = self[currency]\n slot.tile = nil\n slot.save\n end\n end", "def shuffle!\n self.cards.shuffle!\n self\n end", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def shuffle_deck\n 300.times do\n # Select cards to swap\n position_one = rand(52)\n position_two = rand(52)\n # Get the cards from the array and swap.\n card_one = @deck_array[position_one]\n @deck_array[position_one] = @deck_array[position_two]\n @deck_array[position_two] = card_one\n end\n end", "def reset_codes_and_computer\n self.secret_combination = []\n self.guess = []\n computer.reset_computer\n end", "def setup_game()\n @players.each { |p| p.reset() } # Reset the player\n @cards = Array.new # Reset cards \n @dealer = Array.new # Reset dealer cards\n (@num_decks*4).times { @cards += CARDS }\n puts \"Shuffling cards....\"\n @cards = @cards.sort_by { rand } # Hack to shuffle. Ruby 1.9 has shuffling built-in!\n\n @players.find_all { |p| p.money <= 0}.each do |p|\n puts \"Player #{p.index} is out of money, removing from game...\"\n end\n @players.reject! { |p| p.money <= 0}\n if @players.length == 0\n puts \"Everybody is out of money, quitting game...\"\n exit()\n end\n\n\n @players.each do |p|\n p.cards = [@cards.pop, @cards.pop]\n end\n\n puts \"Dealer taking cards....\"\n 2.times { @dealer.push @cards.pop }\n\n get_player_bets()\n end", "def shuffle\n @cards.shuffle!\n end", "def populate\n number_of_pairs = (size**2) / 2\n # dibagi dua krn masing2 kartu punya kembaran/pair\n cards = Card.shuffled_pairs(number_of_pairs)\n # populate the entire board with shuffled deck\n grid.each_index do |i|\n grid[i].each_index do |j|\n self[[i, j]] = cards.pop\n end\n end\n # p cards\n # p cards.count\n end", "def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\n end", "def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end", "def initialize(deck = nil)\n deck ? @cards = deck.deal(5) : @cards = []\n end", "def shuffle\n @fulldeck.shuffle!\n end", "def deal(n)\n @dealt = []\n n.times do\n @dealt << @fulldeck.pop\n end\n @dealt\n end", "def reset_board\n\t\t@secret_board = []\n\t\tMastermind::BOARD_WIDTH.times { @secret_board << Mastermind::COLORS[:blank] }\n\t\t@decoding_board = blank_board\n\t\t@rating_board = blank_board\n\tend", "def reset_board\n # Reset the board\n\t\t9.times do |i|\n\t\t\t@buttons[i].set_text(\"\")\n\t\t\t@board[i] = C_V\n\t\tend\n end", "def populate_deck\n # self.initial_size.times do\n # new_card_class = Card.library.values.sample\n # new_card = new_card_class.new\n # self.cards << new_card\n # end\n 40.times do\n new_card_type = Card.library.values.sample\n new_card = new_card_type.create\n self.cards << new_card\n end\n end", "def initialize\n self.cards = []\n (0..51).each { |i| cards << Card.new(i) }\n self.cards.shuffle! \n end", "def reset_game()\n # If money in pot, distribute\n while (self.pot > 0)\n winners = []\n # In case where everyone has folded, set the winner to whoever is left\n if self.players.where(:in_hand => true).length <= 1\n winners = self.players.where(:in_hand => true)\n else\n #gets people with highest score\n winners = get_winners()\n end\n winners.each do |winner|\n #TO IMPLEMENT: more advanced side pots\n winner.money += self.pot / winners.length()\n winner.save\n end\n self.pot = 0\n end\n # reset deck of cards\n self.cards.where.not(:location => -1).each do |card|\n card.location = -1\n card.save\n end\n # reset amount each player has in the pot to 0\n self.players.each do |player|\n player.in_hand = true\n player.in_pot_hand = 0\n player.in_pot_current = 0\n player.hand = ''\n player.save\n end\n # reset pot to empty, increment dealer if not first hand\n if self.round != -1\n self.dealer = (self.dealer + 1)%10 + 10\n end\n # makes sure a player exists where the dealer is set\n while self.players.where(:location => self.dealer).length == 0\n self.dealer = (self.dealer + 1)%10 + 10\n end\n self.round = 0\n self.high_bet = 0\n self.high_better = get_next_player(self.dealer)\n self.save\n deal(self.round)\n end", "def deal_initial_hands\n INITIAL_CARDS.times do\n @players_in_round.each do |player|\n @deck.deal_to player\n end\n end\n end", "def deal_card\n @deck.pop\n end", "def initialize\n @cards = []\n suits = [:hearts, :diamonds, :spades, :clubs]\n suits.each do |suit|\n (2..10).each do |value|\n @cards << Card.new(suit, value)\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |facecard|\n @cards << Card.new(suit, facecard)\n end\n end\n\n def shuffle!\n cards.shuffle!\n end\n\n def empty?\n self.cards.empty?\n end\n\n\nend", "def create_deck(num_decks)\n ## Initializing the card deck\n @num_decks = num_decks\n @cards = SUITE * @num_decks * 4 ## replicate the suite 4 times to form 1 deck, and replicate 1 dec num times to form num decks in the shoe\n @max_deck_mod = @max_deck_mod * @num_decks ## figure out the max modulo, in this impl , i will just repeat cards from 0 ... modulo-1 , 0 ...\n 10.times {@cards.shuffle! } ## Shuffle the shoe 10 times\n @deck_index = 0\n end" ]
[ "0.77629274", "0.7316694", "0.73152006", "0.7235672", "0.7161999", "0.70690644", "0.6839646", "0.6708019", "0.66941214", "0.66939616", "0.66676503", "0.6655808", "0.66557175", "0.660112", "0.6550918", "0.654736", "0.6534253", "0.64918154", "0.6455401", "0.64467067", "0.64177495", "0.64007545", "0.6397977", "0.63691056", "0.63633764", "0.6351595", "0.63418835", "0.63362664", "0.6335985", "0.6306848", "0.6291137", "0.628809", "0.62793565", "0.6278598", "0.6275178", "0.6267488", "0.62627906", "0.62605435", "0.623344", "0.62279546", "0.6218752", "0.62126315", "0.6191141", "0.6191019", "0.6188627", "0.6185814", "0.6184142", "0.6174335", "0.61669755", "0.6164552", "0.6153227", "0.6150845", "0.61474204", "0.6139421", "0.6135392", "0.6134196", "0.61283076", "0.6124688", "0.61215913", "0.61104393", "0.610701", "0.61038995", "0.61027974", "0.6088501", "0.6088501", "0.6087708", "0.60827464", "0.60772437", "0.60749555", "0.6062925", "0.6062791", "0.60622483", "0.6047097", "0.60452056", "0.6044737", "0.6040466", "0.60383207", "0.6037757", "0.6034554", "0.6034017", "0.6025578", "0.6017622", "0.60172445", "0.601555", "0.60128796", "0.60031843", "0.5996264", "0.5992174", "0.59898746", "0.5989408", "0.59876084", "0.5985532", "0.59850407", "0.59714514", "0.59689724", "0.59654886", "0.59626156", "0.5957597", "0.5953812", "0.59528625" ]
0.5949235
100
Reset this deck with 52 cards
def create_52_card_deck end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @cards = Card.suits.keys.map do |suit|\n Card.values.map {|i| Card.new(suit, i)}\n end.flatten\n @dealt = []\n self\n end", "def reset!\n @cards = load_cards\n end", "def reset!\n self.cards = CARDS.dup\n end", "def reset!\n @hands.each(&:discard!)\n @cards += @used\n @used = []\n end", "def reset\n # delete all old cards, then reload deck\n cards.each {|card| Card.delete card }\n reload\n # create new cards\n Cardface.all.each do |cf|\n c_new = Card.new :cardface_id => cf.id, :facedown_position => cf.id\n cards << c_new\n c_new.save!\n end\n save!\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def redeal\n # take all current cards in play and add to deck\n @deck.concat(@cards_in_play)\n @cards_in_play = Array.new\n\n #shuffle cards \n @deck.shuffle!\n\n #deal 12 more new cards\n @cards_in_play.concat(@deck.pop(12))\nend", "def deal\n # pack cards past the default 12 into the begining\n if @cards.length > 12\n # cards still in play past the standard 12 positions\n extra = @cards.last(@cards.length - 12).compact\n # move what can be moved into the standard 12 positions\n @cards = @cards.take(12).map! { |c| c || extra.pop }\n # hopefully extra is empty now, but maybe not\n @cards += extra\n end\n\n # sets is still valid as we haven't modified the combinaion of cards in play\n # do we need to expand the cards in play?\n if(@sets && @sets.none?)\n @cards += Array.new(3)\n end\n \n ## fill any gaps from the deck\n @cards.map! { |x| x || @deck.pop }\n\n # recompute sets\n #@sets = []\n @sets = IsASet.sets @cards.compact\n end", "def reshuffle_deck\n @output.puts ''.center(WIDTH, '-')\n @output.puts 'Shuffling new deck.'\n @output.puts ''.center(WIDTH, '-')\n @game.deck = Gambler::Deck.new\n 3.times { @game.deck.shuffle! }\n end", "def reset_self\r\n @hole_cards = []\r\n @folded = false\r\n @bet = 0\r\n end", "def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end", "def reset_unused!\n @cards += @used\n @used = []\n end", "def shuffle_deck\n if !@cards.nil?\n @cards = manual_shuffle\n end\n end", "def reset\n\t\t@hand = Array.new\n\t\t@total = 0\n\tend", "def reset\n @dice_cup.clear\n @number_of_dice = 6\n @farkle_count= 0\n end", "def new_deck(num_decks)\n reset_deck()\n num_decks.times do\n (1..13).each do |num|\n Deck << num.to_s + \" of Hearts\"\n Deck << num.to_s + \" of Diamonds\"\n Deck << num.to_s + \" of Spades\"\n Deck << num.to_s + \" of Clubs\"\n end\n\n Deck.each do |ele|\n if ele[0..1] == \"1 \"\n ele[0..1] = \"A \"\n elsif ele[0..1] == \"11\"\n ele[0..1] = \"J\"\n elsif ele[0..1] == \"12\"\n ele[0..1] = \"Q\"\n elsif ele[0..1] == \"13\"\n ele[0..1] = \"K\"\n end\n end\n end\n shuffle(num_decks)\nend", "def flush_deck (n = 1)\n deck = []\n n.times { deck.concat(generate_deck) }\n\n # swap two random cards (4 * deck.length) times\n (4 * deck.length).times do\n \n i, j = rand(deck.length), rand(deck.length)\n deck[i], deck[j] = deck[j], deck[i]\n end\n deck\nend", "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "def shuffle\n @deck.shuffle! # Contents of @deck will be permanently changed\n end", "def reset\n @round = 0\n @turn = 0 \n assign_player_colors\n seat_players\n seed_player_funds\n reset_state_bins\n add_home_state_picks\n pick_who_goes_first\n start_at_first_day\n end", "def build_deck\n @deck = []\n @decks.times do\n @suits.each { |each_suit| @ranks.each { |each_rank| @deck.push(Card.new(each_rank, each_suit)) } }\n end\n end", "def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end", "def init_deck\n deck = []\n n = 0\n suit = 0x8000\n\n (0..3).each do\n (0..12).each do |j|\n deck[n] = Arrays::PRIMES[j] | (j << 8) | suit | (1 << (16+j))\n n+=1\n end\n suit >>= 1\n end\n deck\n end", "def initialize_deck\n deck = []\n SUIT.each do |suit|\n CARDS.each do |card|\n deck << [suit, card]\n end\n end\n deck.shuffle!\nend", "def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end", "def build_deck\n# This function builds an array of 52 cards made up of 4 copies of fixed nums with values from 1 to 13\n\t@deck = []\n\tfor num in 1..4\n\t\tfor num in 1..13\n\t\t\t@deck.push(num)\n\t\tend\n\tend\nend", "def reset_hand\n @hand = []\n end", "def initialize\n @deck = (CARD_TYPES * 5).shuffle\n @board = @deck.shift(3)\n end", "def initialize(num_decks)\n #Init cards array\n @cards = []\n\n #Create a card for each suit/value combo\n SUITS.each do |suit|\n VALUES.each do |val|\n @cards << Card.new(suit, val)\n end\n end\n\n #Duplicate to make num_decks decks\n @cards = @cards * num_decks\n\n #shuffle the deck\n @cards.shuffle!\n end", "def reset\n\t\tfor i in (0...9)\n\t\t\t@board[i] = nil\n\t\tend\n\tend", "def initialize_deck\n # Delete the redis user data\n data.reset\n deck = data.create_deck\n Card.all.each do |card|\n # zadd key, score, value\n deck.update_card_interval(interval: 0.second, card_id: card.id)\n end\n end", "def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend", "def initialize num_decks = 1\n @shoe = []\n @used_cards = []\n @dealt_cards = []\n num_decks.times do\n @shoe.concat(Deck.new.deck)\n end\n shuffle!\n end", "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end", "def initialize(number_of_decks)\n @deck = (SINGLE_DECK * number_of_decks).shuffle\n end", "def reset\n @player_status = \"in\" \n @hands = [] \n @hands_status = [] \n @bets = [] \n @values = [] \n @cur = 0 \n end", "def reset_base_card\n new_card = Card.no_mavericks.find_by!(number: self.number, expansion_id: self.expansion.id)\n self.base_card = new_card\n end", "def recycle(cards)\n LOGGER.debug \"Recycling #{cards.size} cards: #{self}\"\n return if cards.nil?\n\n top = @pile.pop\n\n if cards.respond_to?(:pop) # is it an array?\n @pile.concat(cards)\n else\n @pile.push(cards)\n end\n\n @pile.push(top)\n LOGGER.debug \"Done recycling: #{self}\"\n end", "def reset\n @hand = []\n @value = nil\n @status = \"unfinished\"\n end", "def clear_hand\n @hand_cards.clear\n @points = 0\n end", "def shuffle_deck!\n @deck.shuffle\n @deck_position = @deck.each\n end", "def clear\n\t\t@save_time = 0.0\n\t\t@top_card = 0\n\t\t@number_of_hint = 0\n\t\t@number_of_correct = 0\n\t\t@number_of_wrong= 0\n\t\t@deck = []\n\t\t@hand = []\n\t\t@username = \"\"\n\t\t@total_hint=0\n\t\t@is_end=false\n\tend", "def initialize_deck\n VALUES.product(SUITS).shuffle\nend", "def setup_game\n @deck.shuffle!\n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def reset_players\n # Replaces the hands array with a new array, with only one hand in it.\n @players.each {|p| p.hands = [p.hand.reset!] }\n\n # Resets the dealers only hand.\n @dealer.hand.reset!\n end", "def reset\n\t\t@board = Hash[:one => 1, :two => 2, :three => 3, :four => 4, :five => 5, :six => 6, :seven => 7, :eight => 8, :nine => 9]\n\t\tself.display\n\tend", "def initialize_cards\n cards = []\n 4.times { cards += (2..14).to_a }\n cards.sample(52)\n end", "def shuffleCards!()\n\t\t@cards.shuffle!\n\tend", "def draw_cards(count)\n self.deck.shift(count)\n end", "def build_deck\n CARD_SUITS.product(CARD_VALUES).shuffle\nend", "def deal_card\n @deck.remove(:front)\n end", "def initialize\n @ranks = %w(1 2 3 4 5 6 7 8 9 10 11 12)\n @suits = %w(Spades Diamonds Clubs Hearts)\n @cards = []\n generate_deck\n \n\n end", "def init_deck\n deck = []\n suits = ['S', 'C', 'D', 'H']\n values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']\n # can also use .product for this, but here's logic behind it for future reference\n suits.each do |suit|\n values.each do |value|\n deck << [suit, value]\n end\n end\n # work on own method for shuffling, here's shortcut, remember bang (!) modifies object\n deck.shuffle!\nend", "def shuffle\n\t\t@deck.shuffle!\n\tend", "def initialize_deck\n SUITS.product(VALUES).shuffle\nend", "def createDeck\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\t@deck.shuffle!\t\n\tend", "def reset_board\n @board = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n end", "def shuffle!\n @cards.shuffle!\n self\n end", "def prepare_deck\n (1..104).each do |i|\n v = [1, 2, 3, 5, 7]\n if i == 55\n @deck[i] = v[4]\n elsif (i % 11 == 0.0) && i != 55\n @deck[i] = v[3]\n elsif (i % 10 == 0.0) && i != 55\n @deck[i] = v[2]\n elsif (i % 5 == 0.0) && i != 55\n @deck[i] = v[1]\n else\n @deck[i] = v[0]\n end\n end\n end", "def initialize\n @cards = full_deck.shuffle\n @used = []\n @inhand = []\n @hands = []\n end", "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def shuffle!\n @deck.shuffle!\n end", "def shuffle!\n @deck.shuffle!\n end", "def setTheSuit(suit) #generating the deck\n i =1;\n for i in 1..13\n if i === 1\n @cards << Card.new(\"Ace\", suit)\n elsif i < 11 && i > 1\n @cards << Card.new(\"#{i}\", suit)\n elsif i === 11\n @cards << Card.new(\"Jack\", suit)\n elsif i === 12\n @cards << Card.new(\"Queen\", suit)\n else\n @cards << Card.new(\"King\",suit)\n end\n i = i + 1 # making sure it goes to 13\n end\n end", "def reset\n @players.each { |player| player.reset }\n @dealer.reset\n system \"clear\"\n end", "def return_cards\n @hand = []\n end", "def shuffle\n @cards.shuffle!\n self\n end", "def shuffle\r\n @cards.shuffle!\r\n end", "def reset_all()\n\t@totalbets.text = \"$0\"\n\tfor i in 0..4\n\t\t@playerimages[i].path = \"images/#{$game.players[0].hand[i]}.png\" \n\tend\n\t@playerrank.text = $game.ranks[$game.players[0].ranks[0]]\n\t@winner.text = \"-----\"\n\t@rounds.text = $game.roundnum\n\tfor i in 0..3\n\t\t@fflag[i].text = \"\"\n\tend\n\nend", "def initialize\n @deck = Array.new\n suits = ['Club', 'Diamond', 'Heart','Spades']\n cards = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']\n suits.each do |suit|\n cards.each do |card|\n @deck << Card.new(suit,card)\n end\n end\n @deck.shuffle!\n end", "def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end", "def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end", "def initialize\n @cards = ((1..6).to_a * 3 + (7..10).to_a * 4 + (11..17).to_a * 2 + (18..25).to_a).shuffle\n end", "def reset\n @dice.each(&:reset)\n if @dice.size > 2\n @dice.slice!(-2..-1)\n end\n end", "def shuffle\n @cards.shuffle!\n end", "def reshuffle\n @deck = Deck.find(params[:id])\n @deck.shuffle_cards\n render json: {\n deck_id: @deck.id,\n shuffled: @deck.shuffled,\n remaining: @deck.card_codes.count\n }\n end", "def setup\n Card::CURRENCIES.each do |currency|\n slot = self[currency]\n slot.tile = nil\n slot.save\n end\n end", "def shuffle!\n self.cards.shuffle!\n self\n end", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def shuffle_deck\n 300.times do\n # Select cards to swap\n position_one = rand(52)\n position_two = rand(52)\n # Get the cards from the array and swap.\n card_one = @deck_array[position_one]\n @deck_array[position_one] = @deck_array[position_two]\n @deck_array[position_two] = card_one\n end\n end", "def reset_codes_and_computer\n self.secret_combination = []\n self.guess = []\n computer.reset_computer\n end", "def setup_game()\n @players.each { |p| p.reset() } # Reset the player\n @cards = Array.new # Reset cards \n @dealer = Array.new # Reset dealer cards\n (@num_decks*4).times { @cards += CARDS }\n puts \"Shuffling cards....\"\n @cards = @cards.sort_by { rand } # Hack to shuffle. Ruby 1.9 has shuffling built-in!\n\n @players.find_all { |p| p.money <= 0}.each do |p|\n puts \"Player #{p.index} is out of money, removing from game...\"\n end\n @players.reject! { |p| p.money <= 0}\n if @players.length == 0\n puts \"Everybody is out of money, quitting game...\"\n exit()\n end\n\n\n @players.each do |p|\n p.cards = [@cards.pop, @cards.pop]\n end\n\n puts \"Dealer taking cards....\"\n 2.times { @dealer.push @cards.pop }\n\n get_player_bets()\n end", "def shuffle\n @cards.shuffle!\n end", "def populate\n number_of_pairs = (size**2) / 2\n # dibagi dua krn masing2 kartu punya kembaran/pair\n cards = Card.shuffled_pairs(number_of_pairs)\n # populate the entire board with shuffled deck\n grid.each_index do |i|\n grid[i].each_index do |j|\n self[[i, j]] = cards.pop\n end\n end\n # p cards\n # p cards.count\n end", "def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\n end", "def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end", "def initialize(deck = nil)\n deck ? @cards = deck.deal(5) : @cards = []\n end", "def shuffle\n @fulldeck.shuffle!\n end", "def deal(n)\n @dealt = []\n n.times do\n @dealt << @fulldeck.pop\n end\n @dealt\n end", "def reset_board\n\t\t@secret_board = []\n\t\tMastermind::BOARD_WIDTH.times { @secret_board << Mastermind::COLORS[:blank] }\n\t\t@decoding_board = blank_board\n\t\t@rating_board = blank_board\n\tend", "def reset_board\n # Reset the board\n\t\t9.times do |i|\n\t\t\t@buttons[i].set_text(\"\")\n\t\t\t@board[i] = C_V\n\t\tend\n end", "def populate_deck\n # self.initial_size.times do\n # new_card_class = Card.library.values.sample\n # new_card = new_card_class.new\n # self.cards << new_card\n # end\n 40.times do\n new_card_type = Card.library.values.sample\n new_card = new_card_type.create\n self.cards << new_card\n end\n end", "def initialize\n self.cards = []\n (0..51).each { |i| cards << Card.new(i) }\n self.cards.shuffle! \n end", "def reset_game()\n # If money in pot, distribute\n while (self.pot > 0)\n winners = []\n # In case where everyone has folded, set the winner to whoever is left\n if self.players.where(:in_hand => true).length <= 1\n winners = self.players.where(:in_hand => true)\n else\n #gets people with highest score\n winners = get_winners()\n end\n winners.each do |winner|\n #TO IMPLEMENT: more advanced side pots\n winner.money += self.pot / winners.length()\n winner.save\n end\n self.pot = 0\n end\n # reset deck of cards\n self.cards.where.not(:location => -1).each do |card|\n card.location = -1\n card.save\n end\n # reset amount each player has in the pot to 0\n self.players.each do |player|\n player.in_hand = true\n player.in_pot_hand = 0\n player.in_pot_current = 0\n player.hand = ''\n player.save\n end\n # reset pot to empty, increment dealer if not first hand\n if self.round != -1\n self.dealer = (self.dealer + 1)%10 + 10\n end\n # makes sure a player exists where the dealer is set\n while self.players.where(:location => self.dealer).length == 0\n self.dealer = (self.dealer + 1)%10 + 10\n end\n self.round = 0\n self.high_bet = 0\n self.high_better = get_next_player(self.dealer)\n self.save\n deal(self.round)\n end", "def deal_initial_hands\n INITIAL_CARDS.times do\n @players_in_round.each do |player|\n @deck.deal_to player\n end\n end\n end", "def deal_card\n @deck.pop\n end", "def initialize\n @cards = []\n suits = [:hearts, :diamonds, :spades, :clubs]\n suits.each do |suit|\n (2..10).each do |value|\n @cards << Card.new(suit, value)\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |facecard|\n @cards << Card.new(suit, facecard)\n end\n end\n\n def shuffle!\n cards.shuffle!\n end\n\n def empty?\n self.cards.empty?\n end\n\n\nend", "def create_deck(num_decks)\n ## Initializing the card deck\n @num_decks = num_decks\n @cards = SUITE * @num_decks * 4 ## replicate the suite 4 times to form 1 deck, and replicate 1 dec num times to form num decks in the shoe\n @max_deck_mod = @max_deck_mod * @num_decks ## figure out the max modulo, in this impl , i will just repeat cards from 0 ... modulo-1 , 0 ...\n 10.times {@cards.shuffle! } ## Shuffle the shoe 10 times\n @deck_index = 0\n end", "def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end" ]
[ "0.77629274", "0.7316694", "0.73152006", "0.7235672", "0.7161999", "0.70690644", "0.6839646", "0.6708019", "0.66941214", "0.66939616", "0.66676503", "0.6655808", "0.66557175", "0.660112", "0.6550918", "0.654736", "0.6534253", "0.64918154", "0.6455401", "0.64467067", "0.64177495", "0.64007545", "0.6397977", "0.63691056", "0.63633764", "0.6351595", "0.63418835", "0.6335985", "0.6306848", "0.6291137", "0.628809", "0.62793565", "0.6278598", "0.6275178", "0.6267488", "0.62627906", "0.62605435", "0.623344", "0.62279546", "0.6218752", "0.62126315", "0.6191141", "0.6191019", "0.6188627", "0.6185814", "0.6184142", "0.6174335", "0.61669755", "0.6164552", "0.6153227", "0.6150845", "0.61474204", "0.6139421", "0.6135392", "0.6134196", "0.61283076", "0.6124688", "0.61215913", "0.61104393", "0.610701", "0.61038995", "0.61027974", "0.6088501", "0.6088501", "0.6087708", "0.60827464", "0.60772437", "0.60749555", "0.6062925", "0.6062791", "0.60622483", "0.6047097", "0.60452056", "0.6044737", "0.6040466", "0.60383207", "0.6037757", "0.6034554", "0.6034017", "0.6025578", "0.6017622", "0.60172445", "0.601555", "0.60128796", "0.60031843", "0.5996264", "0.5992174", "0.59898746", "0.5989408", "0.59876084", "0.5985532", "0.59850407", "0.59714514", "0.59689724", "0.59654886", "0.59626156", "0.5957597", "0.5953812", "0.59528625", "0.5949235" ]
0.63362664
27
You will need to play the entire game in this method using the WarAPI
def play_game num_turns = 0 # @deck = Deck.new @deck.create_shuffled_deck deal_cards until (@player1.hand.deck.front == nil && @player1.hand.deck.back == nil) || (@player2.hand.deck.front == nil && @player2.hand.deck.back == nil) num_turns += 1 p1_card = @player1.hand.deal_card p2_card = @player2.hand.deal_card cards = WarAPI.play_turn(@player1, p1_card, @player2, p2_card) add_player_card(cards) end if @player1.hand.deck.front == nil puts "#{@player2.name}" return num_turns else puts "#{@player1.name}" return num_turns end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_game\n # WarAPI.play_turn()\n end", "def play\n #calls to all the methods that produce game!\n end", "def play\n board_setup\n gameplay_setup\n end", "def play\n\t\tgame_loop\n\tend", "def play\n \n end", "def play\n end", "def play\n greeting\n get_tiles\n move_sequence\n end", "def play\n\t\t@current_turn = 0\n\t\t@current_player = @hunter\n\t\tplayers.each{|p| p.write(game_parameters)}\n\t\tuntil is_game_over?\n\t\t\tpre_turn_wall_count = @walls.size\n\t\t\treport_state_to_spectators\n\t\t\t@current_player.take_turn\n\t\t\t# Only print the board every 10 turns or if a wall was added or removed\n\t\t\tprint_minified_board() if @current_turn%10 == 0 || @walls.size != pre_turn_wall_count\n\t\t\tadvance_turn!\n\t\t\tprint \"#{@current_turn} \"\n\t\tend\n\t\tresult = report_winner\n\t\tcleanup_players!\n\t\tcleanup_spectators!\n\t\tresult\t# Returns this so the EvasionServer can save results\n\tend", "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 play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "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 play; end", "def play \n end", "def play()\n @ole.Play()\n end", "def play()\n @ole.Play()\n end", "def play\n\tend", "def play\n @game.start if @game.waiting_to_start?\n if @game.active?\n play_cards if params[:commit] # play submitted cards, if a form submit occurred\n @sets = @game.fill_gamefield_with_sets\n end\n if @game.finished?\n publish_if_finished_and_promoted\n redirect_to :action => 'archive'\n else\n render :action => 'play'\n end\n end", "def start_a_game\n jeopardy_board\n play_game\nend", "def play()\n current_scene = @scene_map.opening_scene()\n last_scene = @scene_map.next_scene('finished')\n=begin Why do we need to define the last scene when each scenario says return?\nBecause what follows is a check. While you're alive, play, when you die and or move to a new room\n=end\n\n while current_scene != last_scene\n #While this current scenario isn't having died somehow\n next_scene_name = current_scene.enter()\n #Run the room you're in\n current_scene = @scene_map.next_scene(next_scene_name)\n #While each scenario says what scene it returns, it still needs to configure before we can go there? \n end\n\n # be sure to print out the last scene\n current_scene.enter()\n end", "def play\n take_turn until @master.game_over?\n @master.show_board\n @robot.speak\n end", "def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend", "def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end", "def hard\n g = Game.new\n sets = g.play\n \n sets\nend", "def go_to_war\n # for use in battle/war results\n set_game_state 'war'\n # clear previous hand..\n reset_hand\n @num_cards_per_war.times do |w|\n all_play_a_card\n end\n # clear previous hand also, as it's the face-down card or cards\n reset_hand\n\n # populate hand_played array again\n all_play_a_card\n # score it...\n score_battle @hand_played\n\n # after scoring, update war metadata for players \n @winning_player.won_war\n players.each{|x| x.in_war }\n nil\n end", "def run\n start_game\n game_loop\n end_game\n end", "def play\n init_player()\n init_board()\n puts \"Test game play\"\n end", "def battletest_sceneswitch\r\n # Play battle start SE\r\n $game_system.se_play($data_system.battle_start_se)\r\n # Play battle BGM\r\n $game_system.bgm_play($game_system.battle_bgm)\r\n # Switch to battle screen\r\n $scene = Scene_Battle.new\r\n end", "def play_full_game\n Display.clear_screen\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_start_ui\n fast_forward(@data[\"moves\"].keys[-1], true)\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_end_ui(determine_winner)\n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def run \n Engine::play(Beginning)\nend", "def play\n\t\n\t\tuntil over?\n\t\tturn\n\t\tend\n\t\t\n\t\tif won? \n\t\t\twinner\n\t\telsif draw? \n\t\t\tputs \"The game was a Draw!\"\n\t\telse \n\t\t\tputs \"Unexpected Error Occured\" \n\t\tend\n\tend", "def war\n \n until winner?(self.player1,self.player2)\n 4.times do \n player1.play\n player2.play\n end\n end\n\n handle_winner(self.player1,self.player2)\n\n end", "def loadGame()\n\nend", "def play\n @game = Game.find_by_id(@id)\n raise RecordNotFound, 'Not found' if @game.nil?\n\n @game.increment_access\n render 'play', formats: 'json', handlers: 'jbuilder'\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 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 play(cmd)\n play_game(cmd)\n end", "def play\n start = Time.now\n until @board.won?\n @player ? round_player : round_ai\n @attempts += 1\n sleep(2)\n system(\"cls\")\n @board.render\n end\n finish = Time.now\n time_to_finish = finish - start\n declare_win(time_to_finish)\n end", "def play\n if Rails.env.production?\n @dungeon.draw_current_room( \"public/rooms/current_room_#{@dungeon_instance.id}.jpg\" )\n else\n @dungeon.draw_current_room( 'app/assets/images/current_room.jpg' )\n end\n\n @directions = @dungeon.available_directions\n @dungeon_content = @dungeon.current_room.content_description\n end", "def play\n\temulate do |emulator|\n\t\temulator.play(self)\n\tend\nend", "def play\n\t# while $game_end == false\n\t\t9.times { \n\t\t\tif $game_end == false\n\t\t\t\tturns\n\t\t\tend\n\t\t}\nend", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end", "def play_turn\n @player.send(:get_play)\n self.send(:attack, [1,1])\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 beginGameLoop\n @gameLoop.play\n end", "def play_game\n turns = 0\n begin\n hash = WarAPI.play_turn(@player1, @player1.hand.deal_card, @player2, @player2.hand.deal_card)\n cards = hash.flatten\n @player1.hand.add_card(cards[1])\n @player2.hand.add_card(cards[3])\n puts \"#{turns}\"\n turns += 1\n end until (@player1.hand.addhand.length == 0 && @player1.hand.unshuffled_deck[-1] == nil && cards[1].length == 0) || (@player2.hand.addhand.length == 0 && @player2.hand.unshuffled_deck[-1] == nil && cards[3].length == 0)\n puts \"#{@player1.name} wins!\" if @player1.hand.deal_card != nil\n puts \"#{@player2.name} wins!\" if @player2.hand.deal_card != nil\n end", "def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end", "def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n end\r\n end", "def go_game\n #RPG::BGM.fade(30)\n #Graphics.fadeout(30)\n #Graphics.frame_count = 0\n DataManager.autosave(true, false)\n SceneManager.goto(Scene_Map)\n #$game_system.on_after_load\n end", "def game_setup\n end", "def play_cycle\n play\n earn_achievements\n end_game\n end", "def playGame\n #start the opening of the game\n #introduce the rules, ask for human or computer etc\n self.opening()\n\n end", "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 play_sports\n end", "def start_game\n set_game_state 'play'\n @deck = Deck.new\n @deck.shuffle\n @deck.deal @players\n @hand_played = []\n @cards_on_table = []\n @war_is_on = false\n nil\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 play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end", "def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end", "def game_loop\n end", "def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def run(player)\n puts \"Hello!\"\n end", "def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end", "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "def play\n @board.print_board\n 9.times do |turns|\n if turn\n break\n end\n end\n end", "def play_game(game)\n\n\t\twhile game.totalHills > 1 and game.turn < 1000 \t\n\t \tgame.turn \n\t end\n\tend", "def play\n\t\t# This will return the move that the player will take. This will come\n\t\t# from a move generator for the AI\n\t\t# The ai player will require the ai_type to be passed through\n\t\t# TODO: To be changed possibly based off of the main gameplay code. Look\n\t\t# \t\tinto the player_lobby code\n\n\t\tai_type = Settings.instance.game_mode\n\t\tif ai_type == :Connect4\n\t\t\t@ai_object = AI_Connect4.new(@game, 2, @current_chip)\n\t\telsif ai_type == :TOOT\n\t\t\t# make it that otto object\n\t\t\t@ai_object = AI_OTTO.new(@game, 1, @current_chip)\n\t\t\t@ai_object.player_goal = @goal\n\t\tend\n\n\t\t#pre\n\t\tassert game.is_a?(Game)\n\n\t\t# AI will get the next position, will be determined based on the difficulty setting\n\t\t@current_column = @ai_object.getBestScore()\n\t\tif @ai_object.is_a?(AI_OTTO)\n\t\t\t# random value\n\t\t\ttemp_num = rand(2)\n\t\t\tif temp_num == 0\n\t\t\t\tup()\n\t\t\tend\n\t\tend\n\t\tdrop()\n\t\tfinished()\n\n\t\t#post\n\t\tassert @current_column.is_a?(Numeric)\n\tend", "def play\n\t\tloop do\n\t\t\tgetBets\n\t\t\tdealInitialCards\n\t\t\tmakeMoves\n\t\t\tif not @playing\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tdealerScore = @players[DEALER_INDEX].value\n\t\t\tcollectBets(dealerScore)\n\t\tend\n\t\t@out.puts \"Thank you for playing.\"\n\tend", "def play_hand\n\n p1 = self.player1\n p2 = self.player2\n p1.play\n p2.play\n winner = winner?(p1,p2)\n if winner\n handle_winner(p1,p2)\n else \n self.war\n end\n\n end", "def play\n # checks if the game is over after every turn\n until over?\n # plays the first few turns of the game\n turn\n end\n\n # checks if the game is won after every turn\n if won?\n puts \"Congratulations #{winner}!\"\n # checks if the game is draw after every turn\n elsif draw?\n puts \"Cats Game!\" # prints \"Cats Game!\" on a draw\n end\n\n end", "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\tif @game_over\n\t\t\traise Exception.new(\"GAME #{@id} IS ALREADY OVER\")\n\t\tend\n\t\tplayer_number = 1\n\t\tloop do\n\t\t\t@game_over = player_turn @players[player_number], player_number\n\t\t\tplayer_number = player_number % 2 + 1\n\t\t\tbreak if @game_over\n\t\tend\n\tend", "def play\n\n until self.over?\n self.turn\n end\n\n if self.won?\n self.board.display\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n self.board.display\n puts \"Cat's Game!\"\n end\n end", "def game_loop\n end", "def go_play\n puts \"Let's start a new game\"\n @grid.print_board # prints the initial blank layout of the board\n puts @player1.name + \" \" + \"your turn first!\" # player 1 always goes first\n end", "def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end", "def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def play\r\n self.display_board\r\n while !self.over? do\r\n self.turn\r\n end\r\n if self.draw? \r\n puts \"Cat's Game!\"\r\n else\r\n puts \"Congratulations #{self.winner}!\"\r\n end\r\n end", "def run_games\n user = get_user\n begin_game(pre_game_starters(user))\nend", "def do_player_turn\n eval_popup_queue\n start_player_turn if !@player_turn_init\n tbs_unit_selection \n \n map = $game_map\n show_unit_hud(map.events[map.tbu_id_xy($game_player.x,$game_player.y)])\n update_all_sh_acts_win\n update_hl_follow if TM.selecting_target?\n hide_skill_disp_win\n preview_effect_tb\n end", "def play\n while !over?\n turn\n board.display\n end\n if won?\n puts \"Congratulations #{winner}!\" \n elsif draw?\n puts \"Cats Game!\" \n end\n end", "def play\n while over? == false\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n self\n end", "def play\n\t\tputs intro\n\t\tsection_completed = false\n\t\twhile section_completed == false do\n\t\t\tprompt\n\t\t\taction = gets.chomp.downcase #action from users\n\t\t\t\n\t\t\tif action.include? \"overworld\"\n\t\t\t\tsection_completed = true\n\t\t\t\tputs \"You decide to start at Overworld. Good luck Mario!\"\n\t\t\t\tnew_overworld = Overworld.new #create new object of Overworld\n\t\t\t\tnew_overworld.play # call play Overworld!\n\t\t\t\t\n\t\t\telsif action.include? \"suicide\"\n\t\t\t\tputs \"You get nervouse.. It's too big for you to do it all alone!!\"\n\t\t\t\tsuicide\n\t\t\telsif action == \"\"\n\t\t\t\tno_action\n\t\t\telse\n\t\t\t\twrong_input\n\t\t\tend\n\t\t\t\n\t\tend #end of while loop\n\tend", "def new_game \n Game.new.play_game\n end", "def run\n game = Game.new\n game.game_start\nend", "def start_game(game_config)\n # start a new game\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 launch_battle\n puts \"\\n\"\n puts \"Que le combat commence!\"\n puts \"\\n\"\n end" ]
[ "0.841135", "0.78189", "0.7248748", "0.7238757", "0.71277416", "0.7107483", "0.7082697", "0.70531464", "0.70269275", "0.70221245", "0.7016833", "0.7016833", "0.7016833", "0.7016833", "0.7015383", "0.6993416", "0.69844455", "0.6973542", "0.6973542", "0.6957744", "0.69462305", "0.6929915", "0.69085985", "0.6893649", "0.6880664", "0.6835739", "0.6820664", "0.6808766", "0.67902124", "0.678304", "0.6782507", "0.6748256", "0.66972584", "0.66688716", "0.6660573", "0.66209817", "0.6613499", "0.66000134", "0.65884763", "0.658007", "0.6569617", "0.65609497", "0.65578014", "0.65546864", "0.6551473", "0.65459806", "0.65373397", "0.6516741", "0.6515674", "0.6509511", "0.650275", "0.65000826", "0.65000826", "0.64999574", "0.64999574", "0.64999574", "0.64999574", "0.64999574", "0.6499817", "0.64932007", "0.6488204", "0.6481598", "0.6480281", "0.6478211", "0.64728624", "0.64579505", "0.6448659", "0.644454", "0.64429724", "0.6439068", "0.6426338", "0.6418492", "0.6405012", "0.63988024", "0.6398004", "0.63958675", "0.6387581", "0.63640666", "0.6363919", "0.63600624", "0.6358903", "0.63426524", "0.6341319", "0.63381505", "0.633467", "0.6323704", "0.6313677", "0.6313344", "0.63109994", "0.6310882", "0.6301417", "0.6298027", "0.62905556", "0.6288841", "0.6287643", "0.6287449", "0.62808865", "0.62789124", "0.62718016", "0.62639713", "0.62616193" ]
0.0
-1
You will need to play the entire game in this method using the WarAPI
def play_game # WarAPI.play_turn() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\n #calls to all the methods that produce game!\n end", "def play\n board_setup\n gameplay_setup\n end", "def play\n\t\tgame_loop\n\tend", "def play\n \n end", "def play\n end", "def play\n greeting\n get_tiles\n move_sequence\n end", "def play\n\t\t@current_turn = 0\n\t\t@current_player = @hunter\n\t\tplayers.each{|p| p.write(game_parameters)}\n\t\tuntil is_game_over?\n\t\t\tpre_turn_wall_count = @walls.size\n\t\t\treport_state_to_spectators\n\t\t\t@current_player.take_turn\n\t\t\t# Only print the board every 10 turns or if a wall was added or removed\n\t\t\tprint_minified_board() if @current_turn%10 == 0 || @walls.size != pre_turn_wall_count\n\t\t\tadvance_turn!\n\t\t\tprint \"#{@current_turn} \"\n\t\tend\n\t\tresult = report_winner\n\t\tcleanup_players!\n\t\tcleanup_spectators!\n\t\tresult\t# Returns this so the EvasionServer can save results\n\tend", "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 play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "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 play; end", "def play \n end", "def play()\n @ole.Play()\n end", "def play()\n @ole.Play()\n end", "def play\n\tend", "def play\n @game.start if @game.waiting_to_start?\n if @game.active?\n play_cards if params[:commit] # play submitted cards, if a form submit occurred\n @sets = @game.fill_gamefield_with_sets\n end\n if @game.finished?\n publish_if_finished_and_promoted\n redirect_to :action => 'archive'\n else\n render :action => 'play'\n end\n end", "def start_a_game\n jeopardy_board\n play_game\nend", "def play()\n current_scene = @scene_map.opening_scene()\n last_scene = @scene_map.next_scene('finished')\n=begin Why do we need to define the last scene when each scenario says return?\nBecause what follows is a check. While you're alive, play, when you die and or move to a new room\n=end\n\n while current_scene != last_scene\n #While this current scenario isn't having died somehow\n next_scene_name = current_scene.enter()\n #Run the room you're in\n current_scene = @scene_map.next_scene(next_scene_name)\n #While each scenario says what scene it returns, it still needs to configure before we can go there? \n end\n\n # be sure to print out the last scene\n current_scene.enter()\n end", "def play\n take_turn until @master.game_over?\n @master.show_board\n @robot.speak\n end", "def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend", "def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end", "def hard\n g = Game.new\n sets = g.play\n \n sets\nend", "def go_to_war\n # for use in battle/war results\n set_game_state 'war'\n # clear previous hand..\n reset_hand\n @num_cards_per_war.times do |w|\n all_play_a_card\n end\n # clear previous hand also, as it's the face-down card or cards\n reset_hand\n\n # populate hand_played array again\n all_play_a_card\n # score it...\n score_battle @hand_played\n\n # after scoring, update war metadata for players \n @winning_player.won_war\n players.each{|x| x.in_war }\n nil\n end", "def run\n start_game\n game_loop\n end_game\n end", "def battletest_sceneswitch\r\n # Play battle start SE\r\n $game_system.se_play($data_system.battle_start_se)\r\n # Play battle BGM\r\n $game_system.bgm_play($game_system.battle_bgm)\r\n # Switch to battle screen\r\n $scene = Scene_Battle.new\r\n end", "def play\n init_player()\n init_board()\n puts \"Test game play\"\n end", "def play_full_game\n Display.clear_screen\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_start_ui\n fast_forward(@data[\"moves\"].keys[-1], true)\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_end_ui(determine_winner)\n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def run \n Engine::play(Beginning)\nend", "def play\n\t\n\t\tuntil over?\n\t\tturn\n\t\tend\n\t\t\n\t\tif won? \n\t\t\twinner\n\t\telsif draw? \n\t\t\tputs \"The game was a Draw!\"\n\t\telse \n\t\t\tputs \"Unexpected Error Occured\" \n\t\tend\n\tend", "def war\n \n until winner?(self.player1,self.player2)\n 4.times do \n player1.play\n player2.play\n end\n end\n\n handle_winner(self.player1,self.player2)\n\n end", "def loadGame()\n\nend", "def play\n @game = Game.find_by_id(@id)\n raise RecordNotFound, 'Not found' if @game.nil?\n\n @game.increment_access\n render 'play', formats: 'json', handlers: 'jbuilder'\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 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 play(cmd)\n play_game(cmd)\n end", "def play\n start = Time.now\n until @board.won?\n @player ? round_player : round_ai\n @attempts += 1\n sleep(2)\n system(\"cls\")\n @board.render\n end\n finish = Time.now\n time_to_finish = finish - start\n declare_win(time_to_finish)\n end", "def play\n if Rails.env.production?\n @dungeon.draw_current_room( \"public/rooms/current_room_#{@dungeon_instance.id}.jpg\" )\n else\n @dungeon.draw_current_room( 'app/assets/images/current_room.jpg' )\n end\n\n @directions = @dungeon.available_directions\n @dungeon_content = @dungeon.current_room.content_description\n end", "def play\n\temulate do |emulator|\n\t\temulator.play(self)\n\tend\nend", "def play\n\t# while $game_end == false\n\t\t9.times { \n\t\t\tif $game_end == false\n\t\t\t\tturns\n\t\t\tend\n\t\t}\nend", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end", "def play_turn\n @player.send(:get_play)\n self.send(:attack, [1,1])\n end", "def beginGameLoop\n @gameLoop.play\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 play_game\n turns = 0\n begin\n hash = WarAPI.play_turn(@player1, @player1.hand.deal_card, @player2, @player2.hand.deal_card)\n cards = hash.flatten\n @player1.hand.add_card(cards[1])\n @player2.hand.add_card(cards[3])\n puts \"#{turns}\"\n turns += 1\n end until (@player1.hand.addhand.length == 0 && @player1.hand.unshuffled_deck[-1] == nil && cards[1].length == 0) || (@player2.hand.addhand.length == 0 && @player2.hand.unshuffled_deck[-1] == nil && cards[3].length == 0)\n puts \"#{@player1.name} wins!\" if @player1.hand.deal_card != nil\n puts \"#{@player2.name} wins!\" if @player2.hand.deal_card != nil\n end", "def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end", "def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n end\r\n end", "def go_game\n #RPG::BGM.fade(30)\n #Graphics.fadeout(30)\n #Graphics.frame_count = 0\n DataManager.autosave(true, false)\n SceneManager.goto(Scene_Map)\n #$game_system.on_after_load\n end", "def game_setup\n end", "def playGame\n #start the opening of the game\n #introduce the rules, ask for human or computer etc\n self.opening()\n\n end", "def play_cycle\n play\n earn_achievements\n end_game\n end", "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 play_sports\n end", "def start_game\n set_game_state 'play'\n @deck = Deck.new\n @deck.shuffle\n @deck.deal @players\n @hand_played = []\n @cards_on_table = []\n @war_is_on = false\n nil\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 play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end", "def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end", "def game_loop\n end", "def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def run(player)\n puts \"Hello!\"\n end", "def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end", "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "def play\n @board.print_board\n 9.times do |turns|\n if turn\n break\n end\n end\n end", "def play\n\t\t# This will return the move that the player will take. This will come\n\t\t# from a move generator for the AI\n\t\t# The ai player will require the ai_type to be passed through\n\t\t# TODO: To be changed possibly based off of the main gameplay code. Look\n\t\t# \t\tinto the player_lobby code\n\n\t\tai_type = Settings.instance.game_mode\n\t\tif ai_type == :Connect4\n\t\t\t@ai_object = AI_Connect4.new(@game, 2, @current_chip)\n\t\telsif ai_type == :TOOT\n\t\t\t# make it that otto object\n\t\t\t@ai_object = AI_OTTO.new(@game, 1, @current_chip)\n\t\t\t@ai_object.player_goal = @goal\n\t\tend\n\n\t\t#pre\n\t\tassert game.is_a?(Game)\n\n\t\t# AI will get the next position, will be determined based on the difficulty setting\n\t\t@current_column = @ai_object.getBestScore()\n\t\tif @ai_object.is_a?(AI_OTTO)\n\t\t\t# random value\n\t\t\ttemp_num = rand(2)\n\t\t\tif temp_num == 0\n\t\t\t\tup()\n\t\t\tend\n\t\tend\n\t\tdrop()\n\t\tfinished()\n\n\t\t#post\n\t\tassert @current_column.is_a?(Numeric)\n\tend", "def play_game(game)\n\n\t\twhile game.totalHills > 1 and game.turn < 1000 \t\n\t \tgame.turn \n\t end\n\tend", "def play\n\t\tloop do\n\t\t\tgetBets\n\t\t\tdealInitialCards\n\t\t\tmakeMoves\n\t\t\tif not @playing\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tdealerScore = @players[DEALER_INDEX].value\n\t\t\tcollectBets(dealerScore)\n\t\tend\n\t\t@out.puts \"Thank you for playing.\"\n\tend", "def play_hand\n\n p1 = self.player1\n p2 = self.player2\n p1.play\n p2.play\n winner = winner?(p1,p2)\n if winner\n handle_winner(p1,p2)\n else \n self.war\n end\n\n end", "def play\n # checks if the game is over after every turn\n until over?\n # plays the first few turns of the game\n turn\n end\n\n # checks if the game is won after every turn\n if won?\n puts \"Congratulations #{winner}!\"\n # checks if the game is draw after every turn\n elsif draw?\n puts \"Cats Game!\" # prints \"Cats Game!\" on a draw\n end\n\n end", "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\tif @game_over\n\t\t\traise Exception.new(\"GAME #{@id} IS ALREADY OVER\")\n\t\tend\n\t\tplayer_number = 1\n\t\tloop do\n\t\t\t@game_over = player_turn @players[player_number], player_number\n\t\t\tplayer_number = player_number % 2 + 1\n\t\t\tbreak if @game_over\n\t\tend\n\tend", "def play\n\n until self.over?\n self.turn\n end\n\n if self.won?\n self.board.display\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n self.board.display\n puts \"Cat's Game!\"\n end\n end", "def game_loop\n end", "def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end", "def go_play\n puts \"Let's start a new game\"\n @grid.print_board # prints the initial blank layout of the board\n puts @player1.name + \" \" + \"your turn first!\" # player 1 always goes first\n end", "def play\r\n self.display_board\r\n while !self.over? do\r\n self.turn\r\n end\r\n if self.draw? \r\n puts \"Cat's Game!\"\r\n else\r\n puts \"Congratulations #{self.winner}!\"\r\n end\r\n end", "def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def run_games\n user = get_user\n begin_game(pre_game_starters(user))\nend", "def do_player_turn\n eval_popup_queue\n start_player_turn if !@player_turn_init\n tbs_unit_selection \n \n map = $game_map\n show_unit_hud(map.events[map.tbu_id_xy($game_player.x,$game_player.y)])\n update_all_sh_acts_win\n update_hl_follow if TM.selecting_target?\n hide_skill_disp_win\n preview_effect_tb\n end", "def play\n while !over?\n turn\n board.display\n end\n if won?\n puts \"Congratulations #{winner}!\" \n elsif draw?\n puts \"Cats Game!\" \n end\n end", "def play\n self\n end", "def play\n\t\tputs intro\n\t\tsection_completed = false\n\t\twhile section_completed == false do\n\t\t\tprompt\n\t\t\taction = gets.chomp.downcase #action from users\n\t\t\t\n\t\t\tif action.include? \"overworld\"\n\t\t\t\tsection_completed = true\n\t\t\t\tputs \"You decide to start at Overworld. Good luck Mario!\"\n\t\t\t\tnew_overworld = Overworld.new #create new object of Overworld\n\t\t\t\tnew_overworld.play # call play Overworld!\n\t\t\t\t\n\t\t\telsif action.include? \"suicide\"\n\t\t\t\tputs \"You get nervouse.. It's too big for you to do it all alone!!\"\n\t\t\t\tsuicide\n\t\t\telsif action == \"\"\n\t\t\t\tno_action\n\t\t\telse\n\t\t\t\twrong_input\n\t\t\tend\n\t\t\t\n\t\tend #end of while loop\n\tend", "def play\n while over? == false\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def new_game \n Game.new.play_game\n end", "def run\n game = Game.new\n game.game_start\nend", "def start_game(game_config)\n # start a new game\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 start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end" ]
[ "0.78186065", "0.724834", "0.7237337", "0.71275693", "0.7107241", "0.7082583", "0.7052699", "0.702659", "0.70212364", "0.70166296", "0.70166296", "0.70166296", "0.70166296", "0.70144576", "0.69931406", "0.6984065", "0.69730777", "0.69730777", "0.6957336", "0.69454926", "0.69298446", "0.69082975", "0.6893372", "0.68812066", "0.6834875", "0.68205976", "0.6808804", "0.67894804", "0.67835623", "0.6782528", "0.6747559", "0.6696486", "0.6669162", "0.66592866", "0.6620099", "0.6614088", "0.6599064", "0.65879405", "0.6580275", "0.65684927", "0.6560007", "0.6558235", "0.6554931", "0.6549349", "0.6546074", "0.65362495", "0.65147865", "0.6514763", "0.6508223", "0.65014154", "0.65001667", "0.65001667", "0.6500044", "0.6500044", "0.6500044", "0.6500044", "0.6500044", "0.6499895", "0.64913344", "0.6487663", "0.6482602", "0.647921", "0.6479138", "0.6472095", "0.6458281", "0.6447593", "0.6445178", "0.644134", "0.6438759", "0.6425598", "0.64171165", "0.640445", "0.639839", "0.63970196", "0.6395426", "0.6385714", "0.6364789", "0.6361893", "0.6359048", "0.63589406", "0.6341281", "0.634067", "0.6336966", "0.6333319", "0.6322977", "0.6312409", "0.6312164", "0.63093746", "0.63093466", "0.6301171", "0.6297312", "0.6289143", "0.6287921", "0.62869215", "0.62869084", "0.62816685", "0.6279699", "0.6272791", "0.6264016", "0.6261353" ]
0.8411591
0
GET /sources GET /sources.xml
def index # 最新发布的 @sources = Source.where("status != 0").order("created_at DESC").limit(20) # 最新翻译的 @translations = Translation.order("created_at DESC").limit(20) @untrans_sources = Source.where("status = 1").order("created_at DESC").limit(20) # 排行榜 @trans_rank = TranRank.where("campaign = 'all' and total_excredits > 0").order("total_excredits DESC").limit(30) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end", "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end", "def index\n @sources = Source.all\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def index\n @sources = Source.paginate(:page => page, :per_page => 10, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def get_sources(opts = {})\n data, _status_code, _headers = get_sources_with_http_info(opts)\n data\n end", "def index\n respond_with(sources)\n end", "def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end", "def index\n #@sources = Source.all\n \n @sources = Source.search(params[:search], params[:page])\n \n @title = \"Sources\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def show\n @source = Source.find(params[:id])\n\n @title = \"Source Details\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def urls\n @gapi.source_uris\n end", "def sources\n @sources ||= []\n end", "def sources\n @sources.names\n end", "def sources\n []\n end", "def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end", "def index\n @source_codes = SourceCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @source_codes }\n end\n end", "def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end", "def index\n @source_files = SourceFile.all\n end", "def nltk_sources\n @reviews = Review.all(:limit => 3, :category => \"amazon\", :state => \"to_analyze\")\n respond_to do |format|\n format.html # nltk_sources.html.erb\n format.xml # nltk_sources.xml.builder\n end\n end", "def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end", "def sources\n unless @sources\n\trequire_gem(\"sources\")\n\t@sources = Gem.sources\n end\n @sources\n end", "def show\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rss_source }\n end\n end", "def show\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_source }\n end\n end", "def index\n @founding_sources = FoundingSource.all\n end", "def show\n @source_code = SourceCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source_code }\n end\n end", "def sources\n filter.sources\n end", "def index\n @feed_sources = FeedSource.all\n end", "def source\n @source ||= begin\n source = ::Sources::Site.new(url)\n source.get\n\n source\n end\n end", "def sources\n @iTunes.sources.each do |source|\n @sources << source\n end\n end", "def index\n @source_refs = SourceRef.all\n end", "def sources(opts)\n if opts.edit\n path = File.expand_path(Config.instance.options['sources']['path'])\n Config.instance.open_file(path)\n else\n sources = Sources.instance\n sources.parse(@sources)\n sources_list_dl(sources, opts)\n end\n end", "def index\n @source_pages = SourcePage.all\n end", "def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end", "def get_source_and_collection\n source_uri = N::URI.from_encoded(params[:source])\n collection_uri = N::URI.from_encoded(params[:collection])\n source = TaliaCore::ActiveSource.find(source_uri)\n collection = TaliaCollection.find(collection_uri)\n @source_id = params[:source]\n @source = TaliaSource.find(source.id)\n [ source, collection ]\n end", "def find_sources\n names = \"\"\n Googlenews.items(100).each do |report|\n name = report['title'].match(/ - ([\\w. ]+)/)[1]\n names << name\n unless Source.find_by_name(name)\n source = Source.new({\n :name => name\n })\n source.save\n end\n end\n render :text => names\n end", "def index\n if (params['feed_id'] == nil) \n @sources = current_user.sources.order(\"name ASC\")\n render \"api/sources/index\"\n return\n end\n\n feed = Feed.find_by(id: params['feed_id'])\n\n if !feed \n render json: [\"Feed does not exist\"], status: 404 \n return\n elsif feed.user_id != current_user.id\n render json: [\"You don't own this feed \"], status: 401\n return\n end\n \n @sources = feed.sources\n render \"api/sources/index\"\n end", "def show\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def show\n @rep_source = RepSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rep_source }\n end\n end", "def search_sources(opts = {})\n data, _status_code, _headers = search_sources_with_http_info(opts)\n data\n end", "def index\n @bundle_sources = BundleSource.find(:all, :conditions => [\"user_id=#{@user.id}\"])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bundle_sources }\n end\n end", "def source_path\n File.expand_path \"feed.xml\", File.dirname(__FILE__)\n end", "def source\n @source ||= begin\n source = ::Sources::Strategies::Nijie.new(url)\n source.get\n\n source\n end\n end", "def index\n @cla_sources = ClaSource.all\n end", "def sources\n source_paths\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def source\n ap get_source\n end", "def read_source\n source = []\n File.open($source_file, \"r\") do |file|\n doc = REXML::Document.new(file)\n doc.root.elements.each do |element|\n source << [element.name.strip, element.text.strip]\n end\n end\n return source\nend", "def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\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[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @event_sources = EventSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_sources }\n end\n end", "def sources\n [root_source] + reference_sources\n end", "def data_sources\n src.collect{|v| v['source']}\n end", "def html_source\n @html_source ||= fetch_uri uri if uri\n @html_source\n end", "def source_index\n say \"Updating Gem source index for: #{@uri}\"\n begin\n require 'zlib'\n yaml_spec = fetch_path(\"/yaml.Z\")\n yaml_spec = Zlib::Inflate.inflate(yaml_spec)\n rescue\n yaml_spec = nil\n end\n begin\n\tyaml_spec = fetch_path(\"/yaml\") unless yaml_spec\n\tr = convert_spec(yaml_spec)\n rescue SocketError => e\n\traise RemoteSourceException.new(\"Error fetching remote gem cache: #{e.to_s}\")\n end\n end", "def get_data_from_source(source)\n url = URI.parse(source.api_url)\n\n if url.respond_to?(:request_uri)\n begin\n Net::HTTP.get_response(url).body\n rescue\n end\n end\n end", "def index \n @source_webs = SourceWeb.websources(params[:project_id]) \n end", "def index\n @student_sources = StudentSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_sources }\n end\n end", "def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end", "def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end", "def source\n unless @source\n @doc.xpath(\"xmlns:source\").each do |source|\n @source = Generator.new(source)\n end \n end\n \n return source\n end", "def sources\n sort!\n @sources\n end", "def load(rng = nil, attrs = {})\n\n params = {}\n params[:offset] = rng.begin unless rng.nil?\n params[:limit] =\n rng.end - rng.begin + (rng.exclude_end? ? 0 : 1) unless rng.nil?\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n req = Net::HTTP::Get.new(\"/sources?\"+uri_params)\n res = @lagoonserver.request_with_auth req\n json_sources = JSON.parse(res.body)\n @sources = json_sources.map { |src| Source.new(src, self)}\n return nil\n end", "def index\n @kernel_sources = KernelSource.all\n end", "def source_uri\n URI.parse(url_for(@software))\n end", "def index\n @chef_att_sources = ChefAttSource.all\n end", "def links\n @source._links\n end", "def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end", "def sources\n %w[\n sample_source\n ]\nend", "def index\n @study_sources = StudySource.all\n end", "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @queries = Query.all\n @sources = Source.all\n end", "def show\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event_source }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def index\n @source_code_types = SourceCodeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @source_code_types }\n end\n end", "def show\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creator_source }\n end\n end", "def show\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_source }\n end\n end", "def fetch_source(source)\n rsf = @fetcher_class.new(source, @http_proxy)\n rsf.source_index\n end", "def index\n if params[:item_id]\n @parent = Item.find(params[:item_id])\n @sources = @parent.sources\n elsif params[:person_id]\n @parent = Person.find(params[:person_id])\n @sources = @parent.sources\n else\n @sources = Source.scoped\n end\n\n @sources_all = @sources\n @q = @sources.search(params[:q])\n @sources = @q.result(distinct: true).includes(:author)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @sources }\n end\n end", "def sources\n return @sources if @sources\n\n @sources = ['_config.yml']\n @sources << flags.split(' ').map do |flag|\n file = File.join(@site.config['source'], flag.split('=').last)\n file if File.exist? file\n end\n\n @sources << posts.map(&:path)\n\n @sources = @sources.flatten.compact\n end", "def feed_source_path\n @feed_source_path ||= File.expand_path \"feed.xml\", __dir__\n end", "def index\n @portal_sources = PortalSource.all\n end", "def find(sources, options)\n paths = normalise_sources(sources, options)\n if options[:development]\n assets = paths.flat_map { |path| a = environment[path, bundle: true].to_a ; a.empty? ? [path] : a }\n else\n assets = paths.map { |path| environment[path] || path }\n end\n assets.map { |asset| to_url(asset, options[:development]) }\n end", "def show\n @funding_source = FundingSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @funding_source }\n end\n end", "def get_sources(workdir) # rubocop:disable Metrics/AbcSize\n sources.each do |source|\n src = Vanagon::Component::Source.source(\n source.url, workdir: workdir, ref: source.ref, sum: source.sum\n )\n src.fetch\n src.verify\n if source.erb\n erb_file(src.file, File.join(File.dirname(src.file), File.basename(src.file, \".erb\")), true)\n end\n # set src.file to only be populated with the basename instead of entire file path\n src.file = File.basename(src.url)\n extract_with << src.extract(platform.tar) if src.respond_to? :extract\n end\n end", "def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def index\n @city_sources = CitySource.all\n end", "def get_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.get_sources ...'\n end\n if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])\n fail ArgumentError, 'invalid value for \"query_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])\n fail ArgumentError, 'invalid value for \"filter_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])\n fail ArgumentError, 'invalid value for \"facets_interval\", must be one of year, month, week, day'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])\n fail ArgumentError, 'invalid value for \"profile\", must be one of full, list, minimal'\n end\n if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])\n fail ArgumentError, 'invalid value for \"preset\", must be one of analysis, latest, minimal'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?\n query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?\n query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?\n query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?\n query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?\n query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?\n query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?\n query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?\n query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?\n query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?\n query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?\n query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?\n query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?\n query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?\n query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?\n query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?\n query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8'])\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 => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#get_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sources\n @_configuration.fetch('sources') { DEFAULT_SOURCES }\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bundle_source }\n end\n end", "def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end", "def index\n @news_sources = NewsSource.all\n end", "def get_from_source(source_or_content, &block)\n request = Puppet::Indirector::Request.new(:file_content, :find, source_or_content.full_path.sub(/^\\//,''), nil, :environment => resource.catalog.environment)\n request.do_request(:fileserver) do |req|\n connection = Puppet::Network::HttpPool.http_instance(req.server, req.port)\n connection.request_get(indirection2uri(req), add_accept_encoding({\"Accept\" => \"raw\"}), &block)\n end\n end", "def show\n @src_gst = SrcGst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @src_gst }\n end\n end", "def sources\n files(!p?)\n end", "def index\n @historical_sources = HistoricalSource.all\n end" ]
[ "0.7759113", "0.72316724", "0.7025272", "0.69071704", "0.690646", "0.68049103", "0.6757319", "0.6757319", "0.67452633", "0.66782093", "0.66533446", "0.658766", "0.6563072", "0.6543264", "0.6455132", "0.6452723", "0.63742065", "0.63558364", "0.6331486", "0.63245726", "0.6320577", "0.63152075", "0.6263332", "0.6257531", "0.625155", "0.6242587", "0.6235332", "0.6231181", "0.62210894", "0.6213675", "0.6189784", "0.6162215", "0.61159074", "0.6114094", "0.6096194", "0.6088749", "0.6068768", "0.6047959", "0.60326266", "0.6030039", "0.60237443", "0.5997018", "0.599284", "0.5975145", "0.59701174", "0.5947575", "0.59326833", "0.59236175", "0.5916756", "0.5912862", "0.5882901", "0.58761513", "0.58567387", "0.5837655", "0.5825704", "0.5824947", "0.5820304", "0.5807501", "0.5805823", "0.5804143", "0.5799269", "0.5796004", "0.5794365", "0.5770207", "0.57574016", "0.5742974", "0.57359946", "0.5722731", "0.568866", "0.56783265", "0.5675338", "0.5671764", "0.5668419", "0.56682545", "0.5661508", "0.5657524", "0.5649052", "0.5648489", "0.56432205", "0.56425005", "0.56336546", "0.5620772", "0.56153256", "0.56091875", "0.56052613", "0.5597491", "0.5591776", "0.5589196", "0.5578774", "0.5577308", "0.55735344", "0.55668545", "0.5553349", "0.5550383", "0.5546953", "0.55223274", "0.5517846", "0.5517673", "0.551503", "0.55117214", "0.5506691" ]
0.0
-1
GET /sources/1 GET /sources/1.xml
def show @source = Source.find(params[:id]) # 查出所有提交的翻译 @translations = Translation.where("source_id = ?", @source.id) ActiveRecord::Base.connection.update("update sources set views = views+1 where id = " + @source.id.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n @title = \"Source Details\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def index\n @sources = Source.paginate(:page => page, :per_page => 10, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def index\n #@sources = Source.all\n \n @sources = Source.search(params[:search], params[:page])\n \n @title = \"Sources\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def index\n @sources = Source.all\n end", "def index\n respond_with(sources)\n end", "def show\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_source }\n end\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end", "def show\n @source_code = SourceCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source_code }\n end\n end", "def show\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def show\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rss_source }\n end\n end", "def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end", "def show\n @rep_source = RepSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rep_source }\n end\n end", "def source_index\n say \"Updating Gem source index for: #{@uri}\"\n begin\n require 'zlib'\n yaml_spec = fetch_path(\"/yaml.Z\")\n yaml_spec = Zlib::Inflate.inflate(yaml_spec)\n rescue\n yaml_spec = nil\n end\n begin\n\tyaml_spec = fetch_path(\"/yaml\") unless yaml_spec\n\tr = convert_spec(yaml_spec)\n rescue SocketError => e\n\traise RemoteSourceException.new(\"Error fetching remote gem cache: #{e.to_s}\")\n end\n end", "def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end", "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end", "def index\n @source_codes = SourceCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @source_codes }\n end\n end", "def nltk_sources\n @reviews = Review.all(:limit => 3, :category => \"amazon\", :state => \"to_analyze\")\n respond_to do |format|\n format.html # nltk_sources.html.erb\n format.xml # nltk_sources.xml.builder\n end\n end", "def index\n @source_files = SourceFile.all\n end", "def source_path\n File.expand_path \"feed.xml\", File.dirname(__FILE__)\n end", "def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end", "def index\n @source_refs = SourceRef.all\n end", "def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end", "def source\n @source ||= begin\n source = ::Sources::Site.new(url)\n source.get\n\n source\n end\n end", "def source\n @source ||= begin\n source = ::Sources::Strategies::Nijie.new(url)\n source.get\n\n source\n end\n end", "def index \n @source_webs = SourceWeb.websources(params[:project_id]) \n end", "def find_sources\n names = \"\"\n Googlenews.items(100).each do |report|\n name = report['title'].match(/ - ([\\w. ]+)/)[1]\n names << name\n unless Source.find_by_name(name)\n source = Source.new({\n :name => name\n })\n source.save\n end\n end\n render :text => names\n end", "def get_source_and_collection\n source_uri = N::URI.from_encoded(params[:source])\n collection_uri = N::URI.from_encoded(params[:collection])\n source = TaliaCore::ActiveSource.find(source_uri)\n collection = TaliaCollection.find(collection_uri)\n @source_id = params[:source]\n @source = TaliaSource.find(source.id)\n [ source, collection ]\n end", "def source\n ap get_source\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def get_sources(opts = {})\n data, _status_code, _headers = get_sources_with_http_info(opts)\n data\n end", "def index\n @bundle_sources = BundleSource.find(:all, :conditions => [\"user_id=#{@user.id}\"])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bundle_sources }\n end\n end", "def index\n @source_pages = SourcePage.all\n end", "def index\n @founding_sources = FoundingSource.all\n end", "def fetch_source(source)\n rsf = @fetcher_class.new(source, @http_proxy)\n rsf.source_index\n end", "def index\n if (params['feed_id'] == nil) \n @sources = current_user.sources.order(\"name ASC\")\n render \"api/sources/index\"\n return\n end\n\n feed = Feed.find_by(id: params['feed_id'])\n\n if !feed \n render json: [\"Feed does not exist\"], status: 404 \n return\n elsif feed.user_id != current_user.id\n render json: [\"You don't own this feed \"], status: 401\n return\n end\n \n @sources = feed.sources\n render \"api/sources/index\"\n end", "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @funding_source = FundingSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @funding_source }\n end\n end", "def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\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[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def urls\n @gapi.source_uris\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bundle_source }\n end\n end", "def index\n @feed_sources = FeedSource.all\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def source\n unless @source\n @doc.xpath(\"xmlns:source\").each do |source|\n @source = Generator.new(source)\n end \n end\n \n return source\n end", "def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def sources_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_get\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def get_from_source(source_or_content, &block)\n request = Puppet::Indirector::Request.new(:file_content, :find, source_or_content.full_path.sub(/^\\//,''), nil, :environment => resource.catalog.environment)\n request.do_request(:fileserver) do |req|\n connection = Puppet::Network::HttpPool.http_instance(req.server, req.port)\n connection.request_get(indirection2uri(req), add_accept_encoding({\"Accept\" => \"raw\"}), &block)\n end\n end", "def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end", "def sources\n @sources ||= []\n end", "def html_source\n @html_source ||= fetch_uri uri if uri\n @html_source\n end", "def get_data_from_source(source)\n url = URI.parse(source.api_url)\n\n if url.respond_to?(:request_uri)\n begin\n Net::HTTP.get_response(url).body\n rescue\n end\n end\n end", "def sources\n []\n end", "def load(rng = nil, attrs = {})\n\n params = {}\n params[:offset] = rng.begin unless rng.nil?\n params[:limit] =\n rng.end - rng.begin + (rng.exclude_end? ? 0 : 1) unless rng.nil?\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n req = Net::HTTP::Get.new(\"/sources?\"+uri_params)\n res = @lagoonserver.request_with_auth req\n json_sources = JSON.parse(res.body)\n @sources = json_sources.map { |src| Source.new(src, self)}\n return nil\n end", "def sources(opts)\n if opts.edit\n path = File.expand_path(Config.instance.options['sources']['path'])\n Config.instance.open_file(path)\n else\n sources = Sources.instance\n sources.parse(@sources)\n sources_list_dl(sources, opts)\n end\n end", "def read_source\n source = []\n File.open($source_file, \"r\") do |file|\n doc = REXML::Document.new(file)\n doc.root.elements.each do |element|\n source << [element.name.strip, element.text.strip]\n end\n end\n return source\nend", "def get_local_datasource(xmlfile)\n # does the provided xml filename exist?\n if (File.exist?(xmlfile))\n # yes. -- extract the xml\n source = open(xmlfile,'r')\n source_xml = source.read\n source.close\n else\n # no -- throw an error\n abort(\"ERROR: Unable to open file \" + xmlfile)\n end\n\n return source_xml\n end", "def fetch(resource)\n local_path = \"data/sources/#{resource}.xml\"\n xml = nil\n begin\n if File.exists?(local_path) && File.mtime(local_path) > (Time.now - 300) # More than 5 minutes ago.\n xml = File.read(local_path)\n else\n Timeout.timeout(REQUEST_TIMEOUT) { xml = open(SOURCES[resource]).read }\n File.open(local_path, 'w+') {|f| f.write(xml) }\n end\n rescue Timeout::Error, OpenURI::HTTPError => e\n xml = File.read(local_path) if File.exists? local_path\n end\n raise \"Could not fetch #{resource}\" unless xml\n Hpricot xml\n end", "def show\n @budget_src = BudgetSrc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_src }\n end\n end", "def show\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creator_source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# show.html.erb\n format.json { render json: @source }\n end\n end", "def show\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event_source }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def sources\n unless @sources\n\trequire_gem(\"sources\")\n\t@sources = Gem.sources\n end\n @sources\n end", "def show\n @src_gst = SrcGst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @src_gst }\n end\n end", "def index(file=selfdir+\"feed.xml\", args={})\n # feed from the adminserver host\n feeder = vespa.adminserver\n feedoutput = feeder.feedfile(file, args)\n feedoutput\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def feed_source_path\n @feed_source_path ||= File.expand_path \"feed.xml\", __dir__\n end", "def sources\n %w[\n sample_source\n ]\nend", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def index\n @cla_sources = ClaSource.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @repository }\n end\n end", "def show\n @url_migration = UrlMigration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def index\n @queries = Query.all\n @sources = Source.all\n end", "def show\n @source_code_type = SourceCodeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source_code_type }\n end\n end", "def show\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_source }\n end\n end", "def new\n @project = Project.new\n @source = params[:source]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def index\n if params[:item_id]\n @parent = Item.find(params[:item_id])\n @sources = @parent.sources\n elsif params[:person_id]\n @parent = Person.find(params[:person_id])\n @sources = @parent.sources\n else\n @sources = Source.scoped\n end\n\n @sources_all = @sources\n @q = @sources.search(params[:q])\n @sources = @q.result(distinct: true).includes(:author)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @sources }\n end\n end", "def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end", "def source_uri\n URI.parse(url_for(@software))\n end", "def show\n @recipesource = Recipesource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipesource }\n end\n end", "def new\n @source = Source.new\n \n @source.event_id = params[:ref]\n \n @title = \"Add Source\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def index\n\n if params[:source] == \"external\"\n @referrer_urls = ReferrerUrl.all(:conditions => \"url NOT LIKE '%http://www.onshutters.com%'\")\n elsif params[:source] == \"internal\"\n @referrer_urls = ReferrerUrl.all(:conditions => \"url LIKE '%http://www.onshutters.com%'\")\n else\n @referrer_urls = ReferrerUrl.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @referrer_urls }\n end\n end", "def list_d_b_source(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources'\n\t\targs[:query]['Action'] = 'ListDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :source_name\n\t\t\targs[:query]['SourceName'] = optional[:source_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def get_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'GetDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end", "def sources\n @sources.names\n end", "def get(url); end", "def index\n @event_sources = EventSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_sources }\n end\n end", "def get_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.get_sources ...'\n end\n if @api_client.config.client_side_validation && opts[:'query_operator'] && !['AND', 'OR'].include?(opts[:'query_operator'])\n fail ArgumentError, 'invalid value for \"query_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'filter_operator'] && !['AND', 'OR'].include?(opts[:'filter_operator'])\n fail ArgumentError, 'invalid value for \"filter_operator\", must be one of AND, OR'\n end\n if @api_client.config.client_side_validation && opts[:'facets_interval'] && !['year', 'month', 'week', 'day'].include?(opts[:'facets_interval'])\n fail ArgumentError, 'invalid value for \"facets_interval\", must be one of year, month, week, day'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling SourcesApi.get_sources, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'profile'] && !['full', 'list', 'minimal'].include?(opts[:'profile'])\n fail ArgumentError, 'invalid value for \"profile\", must be one of full, list, minimal'\n end\n if @api_client.config.client_side_validation && opts[:'preset'] && !['analysis', 'latest', 'minimal'].include?(opts[:'preset'])\n fail ArgumentError, 'invalid value for \"preset\", must be one of analysis, latest, minimal'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n query_params[:'query[value]'] = opts[:'query_value'] if !opts[:'query_value'].nil?\n query_params[:'query[operator]'] = opts[:'query_operator'] if !opts[:'query_operator'].nil?\n query_params[:'query[fields][]'] = @api_client.build_collection_param(opts[:'query_fields'], :csv) if !opts[:'query_fields'].nil?\n query_params[:'filter[field]'] = opts[:'filter_field'] if !opts[:'filter_field'].nil?\n query_params[:'filter[value][]'] = @api_client.build_collection_param(opts[:'filter_value'], :csv) if !opts[:'filter_value'].nil?\n query_params[:'filter[operator]'] = opts[:'filter_operator'] if !opts[:'filter_operator'].nil?\n query_params[:'filter[negate]'] = opts[:'filter_negate'] if !opts[:'filter_negate'].nil?\n query_params[:'filter[conditions][]'] = @api_client.build_collection_param(opts[:'filter_conditions'], :csv) if !opts[:'filter_conditions'].nil?\n query_params[:'facets[field]'] = opts[:'facets_field'] if !opts[:'facets_field'].nil?\n query_params[:'facets[name]'] = opts[:'facets_name'] if !opts[:'facets_name'].nil?\n query_params[:'facets[limit]'] = opts[:'facets_limit'] if !opts[:'facets_limit'].nil?\n query_params[:'facets[sort]'] = opts[:'facets_sort'] if !opts[:'facets_sort'].nil?\n query_params[:'facets[filter][]'] = @api_client.build_collection_param(opts[:'facets_filter'], :csv) if !opts[:'facets_filter'].nil?\n query_params[:'facets[interval]'] = opts[:'facets_interval'] if !opts[:'facets_interval'].nil?\n query_params[:'fields[include][]'] = @api_client.build_collection_param(opts[:'fields_include'], :csv) if !opts[:'fields_include'].nil?\n query_params[:'fields[exclude][]'] = @api_client.build_collection_param(opts[:'fields_exclude'], :csv) if !opts[:'fields_exclude'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort[]'] = @api_client.build_collection_param(opts[:'sort'], :csv) if !opts[:'sort'].nil?\n query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain; charset=utf-8'])\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 => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#get_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def fetch_xml(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n http.read_timeout = GoogleCustomSearch.configuration.timeout\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.initialize_http_header({ 'User-Agent' => user_agent })\n\n response = http.request(request)\n\n raise GoogleCustomSearch::InvalidRequest if response.code.match(/[34]\\d{2}/)\n raise GoogleCustomSearch::ServerError if response.code.match(/5\\d{2}/)\n\n response.body\n end", "def sources\n filter.sources\n end", "def show\n @source = Source.find(params[:id], include: [:events, :venues])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n yield :open_graph_tags \n \"#{yield(:title)} » \".html_safe if content_for?(:title) \n Calagator.title \n Calagator.tagline \n \"#{root_path}opensearch.xml\" \n Calagator.title \n stylesheet_link_tag 'application', :media => :all \n yield :css_insert \n javascript_include_tag *mapping_js_includes \n javascript_include_tag 'application' \n yield :javascript_insert \n auto_discovery_link_tag(:atom, events_url(:format => 'atom'), :title => 'Atom: All Events' )\n edit_source_url(@source) \n image_path(\"site-icon.png\") \n \"#{controller.controller_name}_#{action_name}\" \n \"#{controller.controller_name}_controller\" \n %w[new create edit update].include?(action_name) ? \"#{controller.controller_name}_change\" : \"\" \n link_to Calagator.title, root_path, id: \"project_title\" \nlink_class[:events]\n link_to \"Events\", events_path \nlink_class[:venues]\n link_to \"Venues\", venues_path \n form_tag search_events_path, :method => :get do \n if request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"].include?(\"Safari\") \n @query \n else \n text_field_tag 'query', @query, id: 'search_field', tabindex: 1 \n end \n end \n \n # Pick a subnav \n link_to 'Browse events', root_url,\n :class => subnav_class_for(\"site\", \"index\") \n link_to 'Add an event', new_event_url,\n :class => subnav_class_for(\"events\", \"new\") \n link_to 'Import events', new_source_url,\n :class => subnav_class_for(\"sources\", \"new\") \n \n link_to 'Browse venues', venues_url,\n :class => subnav_class_for(\"venues\", \"index\") \n link_to 'Add a venue', new_venue_url,\n :class => subnav_class_for(\"venues\", \"new\") \n \n \n \n render_flash \n \n source_url_link @source \n render :partial => 'events/list', :locals => { :events => @source.events } \n link_to 'Back', sources_path \n link_to 'Destroy', @source, method: :delete, data: { confirm: 'Are you sure?' } \n \n URI.parse(Calagator.url).host \n source_code_version \n \n \n\nend\n }\n end\n rescue ActiveRecord::RecordNotFound => error\n flash[:failure] = error.to_s if params[:id] != \"import\"\n redirect_to new_source_path\n end" ]
[ "0.70315856", "0.695209", "0.695209", "0.6656253", "0.66518486", "0.64756626", "0.64272195", "0.63835055", "0.63739395", "0.6361889", "0.6335869", "0.63204426", "0.62775093", "0.6235374", "0.61902493", "0.6179728", "0.6164457", "0.6162462", "0.6138677", "0.61130255", "0.61029726", "0.6081522", "0.6065245", "0.6035118", "0.59702146", "0.5937389", "0.5911469", "0.5892092", "0.5882888", "0.5873253", "0.5857742", "0.58367497", "0.5836427", "0.5799386", "0.57909167", "0.5790712", "0.5790712", "0.5790076", "0.5774832", "0.576198", "0.5758042", "0.57429355", "0.5711411", "0.57109725", "0.57066435", "0.57065475", "0.5702437", "0.5665616", "0.564951", "0.56442547", "0.5636766", "0.56342006", "0.5632672", "0.56218535", "0.56197745", "0.56191975", "0.56160426", "0.561275", "0.55859494", "0.5583163", "0.5582412", "0.5581632", "0.5562051", "0.55605555", "0.5558306", "0.55456316", "0.5539058", "0.5524753", "0.55130625", "0.5511832", "0.5511813", "0.55071795", "0.55024505", "0.5497547", "0.5491939", "0.54863816", "0.5483104", "0.5477299", "0.5467764", "0.54612875", "0.54593015", "0.5445172", "0.5444589", "0.5441579", "0.54415584", "0.54409075", "0.5439059", "0.54379576", "0.543535", "0.5430985", "0.54283965", "0.54020274", "0.5400855", "0.53910816", "0.5388925", "0.5384198", "0.5376867", "0.53758705", "0.53757346", "0.5375145", "0.5374863" ]
0.0
-1
GET /sources/new GET /sources/new.xml
def new @source = Source.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @project = Project.new\n @source = params[:source]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @source = Source.new\n \n @source.event_id = params[:ref]\n \n @title = \"Add Source\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def new\n @source_code = SourceCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source_code }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @content_source = ContentSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_source }\n end\n end", "def new\n @rep_source = RepSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rep_source }\n end\n end", "def new\n @rss_source = RssSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rss_source }\n end\n end", "def new\n @source = Source.new\n @sources = current_user.sources\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n respond_with(source)\n end", "def new\n @creator_source = CreatorSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator_source }\n end\n end", "def new\n @bundle_source = BundleSource.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bundle_source }\n end\n end", "def new\n @svn_module = SvnModule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @svn_module }\n end\n end", "def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end", "def new\n @funding_source = FundingSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funding_source }\n end\n end", "def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copy }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end", "def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end", "def new\n @temporary_source = TemporarySource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @temporary_source }\n end\n end", "def new\n @src_gst = SrcGst.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @src_gst }\n end\n end", "def new\n @new_source = Source.new\n @topic = Topic.all\n end", "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def new\n @origin = Origin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @origin }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n @title = \"Source Details\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @git_repo = GitRepo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @git_repo }\n end\n end", "def new\n @source_code_type = SourceCodeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source_code_type }\n end\n end", "def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n @book.source = Source.new( :title => @book.title, :official_url => params[:source_url] )\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n unless params[:source][:categories].blank?\n params[:source][:categories] = params[:source][:categories].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq.collect{|p| Category.new(:name => p)}\n end\n unless params[:source][:feed_urls].blank?\n params[:source][:feed_urls] = params[:source][:feed_urls].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq\n end\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created. We\\'ll be doing an initial fetch of articles shortly.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n # Set variables\n @snop = Snop.new\n @default_uri = params[:uri]\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\r\n @destination = Destination.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @destination }\r\n end\r\n end", "def index\n @sources = Source.paginate(:page => page, :per_page => 10, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def new\n @versioned_jnlp_url = MavenJnlp::VersionedJnlpUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @versioned_jnlp_url }\n end\n end", "def new\n @published_document = PublishedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @published_document }\n end\n end", "def new\n @event_source = EventSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event_source }\n end\n end", "def create\n @lookup_source = LookupSource.new(params[:lookup_source])\n\n respond_to do |format|\n if @lookup_source.save\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully created.') }\n format.xml { render :xml => @lookup_source, :status => :created, :location => @lookup_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_create_xml\n # TODO: Make a real test when it's worth it\n source = Source.new(\"http://www.newstuff.org/my_first\")\n source.types << @test_type\n source.primary_source = false\n source.save!\n source.talia::author << \"napoleon\"\n source.save!\n print source.to_xml\n print source.to_rdf # also check rdf\n end", "def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def create\n flash[:notice] = 'The source was successfully created.' if source.save\n respond_with(source)\n end", "def new\n @subject_source = SubjectSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject_source }\n end\n end", "def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end", "def new\n if params[:parent]\n @parent = Source.find(params[:parent])\n @source = Source.new(parent_id: @parent.id, source_type: @parent.source_type, comment: \"Original name was #{@parent.name}, original author was #{@parent.author.name}\")\n else\n @source = Source.new\n end\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @source }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def new\n \t@feed_source = FeedSource.new\n end", "def new\n @url_search = UrlSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_search }\n end\n end", "def new\n @link = Link.new :long => 'http://'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @stage = Stage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stage }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def newX\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @budget_src = BudgetSrc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @budget_src }\n end\n end", "def new\n @recipesource = Recipesource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipesource }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end", "def new\n @populate_feed_info = PopulateFeedInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @populate_feed_info }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def new\n @source = Source.new\n @userId = session[:user_id]\n @source.ref_type = params[:type]\n @ref_type = params[:type]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def new\n @student_source = StudentSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_source }\n end\n end", "def nltk_sources\n @reviews = Review.all(:limit => 3, :category => \"amazon\", :state => \"to_analyze\")\n respond_to do |format|\n format.html # nltk_sources.html.erb\n format.xml # nltk_sources.xml.builder\n end\n end", "def new\n @twitterfeed = Twitterfeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitterfeed }\n end\n end", "def new\n @config_xml = ConfigXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @config_xml }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @events_by_year = EventsByYear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events_by_year }\n end\n end", "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end", "def create\n @rep_source = RepSource.new(params[:rep_source])\n\n respond_to do |format|\n if @rep_source.save\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully created.') }\n format.xml { render :xml => @rep_source, :status => :created, :location => @rep_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "def new\n @pastor = Pastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pastor }\n end\n end", "def new\n @jargon_file = JargonFile.new\n @source = Source.find(params[:source])\n @jargon_file.source_id = @source.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jargon_file }\n end\n end", "def new\n @statusproject = Statusproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @statusproject }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @licence }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end" ]
[ "0.7374626", "0.7374626", "0.6909008", "0.68649274", "0.6847748", "0.6708436", "0.67030066", "0.66780704", "0.664164", "0.6622738", "0.65624833", "0.6518019", "0.64827365", "0.63327026", "0.63276005", "0.6270805", "0.6270672", "0.62413555", "0.6209693", "0.6183195", "0.6169781", "0.61352444", "0.61352444", "0.6101251", "0.60826725", "0.60826725", "0.6035215", "0.603232", "0.6014471", "0.5971545", "0.5969477", "0.59675795", "0.59633315", "0.5961963", "0.5961963", "0.595824", "0.595665", "0.5952483", "0.59463286", "0.59345716", "0.5933046", "0.59311026", "0.59220076", "0.5914539", "0.58979917", "0.5894094", "0.588733", "0.58851343", "0.5881871", "0.58811414", "0.5879149", "0.587334", "0.587334", "0.587334", "0.58623713", "0.5856347", "0.58542055", "0.58536273", "0.58387023", "0.58344716", "0.5832472", "0.58315885", "0.5806391", "0.58039373", "0.5801834", "0.5801834", "0.5796409", "0.57955354", "0.5791449", "0.57899517", "0.5781608", "0.57781726", "0.5776071", "0.57696205", "0.576601", "0.57611185", "0.5759353", "0.575858", "0.5741452", "0.57374024", "0.57359856", "0.57204115", "0.5717775", "0.5714254", "0.5711975", "0.57090175", "0.5708613", "0.5698778", "0.56982243", "0.56982243", "0.56982243", "0.56982243", "0.56978524", "0.56978524", "0.56978524", "0.56978524", "0.56978524", "0.56978524", "0.56978524", "0.56978524" ]
0.57023495
87
POST /sources POST /sources.xml
def create @source = Source.new(params[:source]) @source.user_id = session[:login_user_id] @source.dz_user_id = session[:login_user].uid @source.username = session[:login_user].username @source.source_type_id = params[:source_type] @source.source_lang_id = params[:source_lang] @source.excredits = params[:excredits].to_i if @source.save source_photo = params[:photo] # 如果有缩略图 if source_photo logger.debug 'source has photo' # 创建路径 # 初始化日期路径 #年月日 year_s = @source.created_at.year.to_s month_s = @source.created_at.month.to_s day_s = @source.created_at.day.to_s # 除去配置文件的路径 file_folder = File.join("photos",year_s, month_s, day_s,@source.id.to_s) source_photo_path = DOWNLOAD_THREAD_PHOTO_ROOT_PATH + "/sources" base_dir = File.join(source_photo_path, file_folder) base_dir_medium = File.join(source_photo_path, file_folder, "medium") base_dir_original = File.join(source_photo_path, file_folder, "original") base_dir_thumb = File.join(source_photo_path, file_folder, "thumb") if not File.exist?(base_dir) File.makedirs(base_dir_medium) File.makedirs(base_dir_original) File.makedirs(base_dir_thumb) end # 重写文件名 ,这里需要从配置文件里读取根路径,然后根据日期创建目录(如果已经存在就不创建), 用uuid重命名 name = source_photo.original_filename # 文件名后缀 ext = File.extname(name) new_name = UUIDTools::UUID.timestamp_create.to_s.gsub('-','') + ext path = File.join(base_dir_original, new_name) medium_path = File.join(base_dir_medium, new_name) thumb_path = File.join(base_dir_thumb, new_name) File.open(path, "wb") { |f| f.write(source_photo.read) } # 开始自动切割 origin_img = Magick::Image.read(path) # 得到了图片的对象 org_img_obj = origin_img[0] # 100x100的 medium = org_img_obj.crop_resized(300,300) medium.write(medium_path) # 300x300的 thumb = org_img_obj.crop_resized(100,100)#org_img_obj.resize(org_img_obj.columns*0.1, org_img_obj.rows*0.1) # 写出一个最小的缩略图 thumb.write(thumb_path) @source.update_attributes({ :photo_file_name => new_name, :photo_content_type => source_photo.content_type, :photo_file_size => source_photo.size }) else logger.debug 'source has no photo' end flash[:message] = "成功发布译文" user_count = UserCount.where("user_id = #{session[:login_user_id].to_s} and app_name = 'source'").first # 更新发布总数 if not user_count user_count = UserCount.new user_count.user_id = session[:login_user_id] user_count.app_name = "source" user_count.uploads = 1 user_count.save else user_count.update_attributes({:uploads => user_count.uploads + 1 }) end # 加积分 和金币 add_discuz_credits @source.dz_user_id, 10 add_discuz_extcredits @source.dz_user_id, 10 # 发全站动态 # 发送全局动态 source_index_url = XMAPP_MAIN_DOMAIN_URL+"/sources" source_thread_url = XMAPP_MAIN_DOMAIN_URL+"/sources/#{@source.id}" title_template = "#{@source.username}在<a href=\"#{source_index_url}\" >译文频道<\/a>发布了一篇文章<a href=\"#{source_thread_url}\" >#{@source.title}<\/a>,并获得了10的金币,翻译此文章将有金币奖励,如果被评选为最佳翻译将额外获取获#{@source.excredits.to_s}的金币,快来<a href=\"#{source_thread_url}/translations/new\" >翻译<\/a>吧" title_data = {} require 'php_serialization' title_data = PhpSerialization.dump(title_data) send_dz_feed 2003, @source.dz_user_id, @source.username, title_template, title_data, '', title_data # end 发送全局动态 # 记录用户操作 user_op_log session[:login_user_id] ,@source.dz_user_id, @source.username, 'all' redirect_to my_sources_path else flash[:error] = "保存错误,请重试" redirect_to new_source_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'The source was successfully created.' if source.save\n respond_with(source)\n end", "def create\n unless params[:source][:categories].blank?\n params[:source][:categories] = params[:source][:categories].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq.collect{|p| Category.new(:name => p)}\n end\n unless params[:source][:feed_urls].blank?\n params[:source][:feed_urls] = params[:source][:feed_urls].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq\n end\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created. We\\'ll be doing an initial fetch of articles shortly.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rep_source = RepSource.new(params[:rep_source])\n\n respond_to do |format|\n if @rep_source.save\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully created.') }\n format.xml { render :xml => @rep_source, :status => :created, :location => @rep_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @feed_source = FeedSource.new(feed_source_params)\n\n respond_to do |format|\n if @feed_source.save\n format.html { redirect_to @feed_source, notice: 'Feed source was successfully created.' }\n format.json { render :show, status: :created, location: @feed_source }\n else\n format.html { render :new }\n format.json { render json: @feed_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def source_params\n params.require(:source).permit(:description, :link, :universe)\n end", "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rss_source = RssSource.new(params[:rss_source])\n @rss_source.user_id = current_user.id;\n respond_to do |format|\n if @rss_source.save\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully created.' }\n format.json { render :json => @rss_source, :status => :created, :location => @rss_source }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @content_source = ContentSource.new(params[:content_source])\n\n respond_to do |format|\n if @content_source.save\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully created.') }\n format.xml { render :xml => @content_source, :status => :created, :location => @content_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(params[:book])\n @book.source = Source.new( :title => @book.title, :official_url => params[:source_url] )\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def source_params\n params.require(:source).permit(:source_name, :url, :type)\n end", "def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n track_activity @source\n format.html { redirect_to @source, notice: 'Source was successfully created.' }\n format.json { render json: @source, status: :created, location: @source }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @source_ref = SourceRef.new(source_ref_params)\n\n respond_to do |format|\n if @source_ref.save\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully created.' }\n format.json { render :show, status: :created, location: @source_ref }\n else\n format.html { render :new }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_source = StudentSource.new(params[:student_source])\n\n respond_to do |format|\n if @student_source.save\n format.html { redirect_to student_sources_path, notice: 'Student source was successfully created.' }\n format.json { render json: @student_source, status: :created, location: @student_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def source_params\n params.fetch(:source, {}).permit(:disabled, :feed_id, :source_type, :url, :name)\n end", "def create\n @source_file = SourceFile.new(source_file_params)\n\n respond_to do |format|\n if @source_file.save\n format.html { redirect_to @source_file, notice: 'Source file was successfully created.' }\n format.json { render :show, status: :created, location: @source_file }\n else\n format.html { render :new }\n format.json { render json: @source_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @source = Source.new(params[:source])\n \n if signed_in?\n @source.user_id = current_user.id \n else\n @source.user_id = 1\n end\n \n @source.reviewed = false\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_create_xml\n # TODO: Make a real test when it's worth it\n source = Source.new(\"http://www.newstuff.org/my_first\")\n source.types << @test_type\n source.primary_source = false\n source.save!\n source.talia::author << \"napoleon\"\n source.save!\n print source.to_xml\n print source.to_rdf # also check rdf\n end", "def create\n @creator_source = CreatorSource.new(params[:creator_source])\n\n respond_to do |format|\n if @creator_source.save\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully created.' }\n format.json { render json: @creator_source, status: :created, location: @creator_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params = clean_authors\n\n @source = Project.find(params[:project_id]).sources.new(source_params)\n @source.user_id = current_user.id\n\n @source.update_image\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to source_path(@source), notice: 'Source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @source }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(source:)\n resp = connection.post do |req|\n req.url workspace_path\n req.params['source'] = source\n end\n raise_exception_based_on_response!(resp, object_identifier) unless resp.success?\n end", "def create\n @source_page = SourcePage.new(source_page_params)\n\n respond_to do |format|\n if @source_page.save\n format.html { redirect_to @source_page, notice: 'Source page was successfully created.' }\n format.json { render :show, status: :created, location: @source_page }\n else\n format.html { render :new }\n format.json { render json: @source_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_source = EventSource.new(params[:event_source])\n\n respond_to do |format|\n if @event_source.save\n format.html { redirect_to @event_source, :notice => 'Event source was successfully created.' }\n format.json { render :json => @event_source, :status => :created, :location => @event_source }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def source_params\n params.require(:source).permit(:title, :authors, :hashtags_copy, annotations_attributes: [:id, :body, :body_source, :is_summary, :is_finding], citations_attributes: [:id, :is_read])\n end", "def new\n @source = Source.new\n \n @source.event_id = params[:ref]\n \n @title = \"Add Source\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def create\n @lookup_source = LookupSource.new(params[:lookup_source])\n\n respond_to do |format|\n if @lookup_source.save\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully created.') }\n format.xml { render :xml => @lookup_source, :status => :created, :location => @lookup_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @source_master = SourceMaster.new(source_master_params)\n\n respond_to do |format|\n if @source_master.save\n format.html { redirect_to @source_master, notice: \"Source master was successfully created.\" }\n format.json { render :show, status: :created, location: @source_master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def nltk_sources\n @reviews = Review.all(:limit => 3, :category => \"amazon\", :state => \"to_analyze\")\n respond_to do |format|\n format.html # nltk_sources.html.erb\n format.xml # nltk_sources.xml.builder\n end\n end", "def index\n respond_with(sources)\n end", "def create\n\n @report = Report.find(params[:report_id]) \n @source = @report.sources.build(name: params[:tname][:title], description: params[:source][:description], \n object_type: params[:source][:object_type], owner: params[:source][:owner])\n if @source.save\n redirect_to report_source_new_source_field_path(@report, @source)\n else\n render action: \"new\"\n end \n end", "def create\n @source_code = SourceCode.new(params[:source_code])\n\n respond_to do |format|\n if @source_code.save\n flash[:notice] = 'SourceCode was successfully created.'\n format.html { redirect_to(@source_code) }\n format.xml { render :xml => @source_code, :status => :created, :location => @source_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @news_source = NewsSource.new(news_source_params)\n\n respond_to do |format|\n if @news_source.save\n format.html { redirect_to @news_source, notice: 'News source was successfully created.' }\n format.json { render :show, status: :created, location: @news_source }\n else\n format.html { render :new }\n format.json { render json: @news_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @annotation_source = AnnotationSource.new(params[:annotation_source])\n\n respond_to do |format|\n if @annotation_source.save\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully created.' }\n format.json { render json: @annotation_source, status: :created, location: @annotation_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def rss_source_params\n params.require(:rss_source).permit(:name, :url, :active, :published)\n end", "def index\n @sources = Source.all\n end", "def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end", "def create\n @subject_source = SubjectSource.new(params[:subject_source])\n\n respond_to do |format|\n if @subject_source.save\n format.html { redirect_to @subject_source, notice: 'Subject source was successfully created.' }\n format.json { render json: @subject_source, status: :created, location: @subject_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subject_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment_source = PaymentSource.new(params[:payment_source])\n\n respond_to do |format|\n if @payment_source.save\n format.html { redirect_to @payment_source, notice: 'Payment source was successfully created.' }\n format.json { render json: @payment_source, status: :created, location: @payment_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sources = Source.paginate(:page => page, :per_page => 10, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\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[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @study_source = StudySource.new(study_source_params)\n\n respond_to do |format|\n if @study_source.save\n format.html { redirect_to @study_source, notice: 'Study source was successfully created.' }\n format.json { render :show, status: :created, location: @study_source }\n else\n format.html { render :new }\n format.json { render json: @study_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @source = Source.new\n @sources = current_user.sources\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def create\n @recipesource = Recipesource.new(params[:recipesource])\n\n respond_to do |format|\n if @recipesource.save\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully created.' }\n format.json { render json: @recipesource, status: :created, location: @recipesource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipesource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_record\n if @email.to_s.empty? or @server.to_s.empty? or @username.to_s.empty? or @port.to_s.empty?\n raise ArgumentError.new(\"Mandatory arguments are not set\")\n end\n \n params = {}\n params['email'] = @email.to_s\n params['server'] = @server.to_s\n params['username'] = @username.to_s\n params['use_ssl'] = @use_ssl.to_s\n params['port'] = @port.to_s\n params['type'] = @source_type.to_s\n\n # Optional parameters\n params['service_level'] = @service_level if @service_level\n params['sync_period'] = @sync_period if @sync_period\n params['password'] = @password if @password\n params['provider_token'] = @provider_token if @provider_token\n params['provider_token_secret'] = @provider_token_secret if @provider_token_secret\n params['provider_consumer_key'] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources\", params)\n response['success']\n end", "def create\n @source_web = SourceWeb.new(source_web_params)\n\n respond_to do |format|\n if @source_web.save\n format.html { redirect_to @source_web, notice: 'Source web was successfully created.' }\n format.json { render :show, status: :created, location: @source_web }\n else\n format.html { render :new }\n format.json { render json: @source_web.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proxy_source = ProxySource.new(params[:proxy_source])\n\n respond_to do |format|\n if @proxy_source.save\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully created.' }\n format.json { render json: @proxy_source, status: :created, location: @proxy_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end", "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def create\n @enquiry_source = EnquirySource.new(params[:enquiry_source])\n\n respond_to do |format|\n if @enquiry_source.save\n format.html { redirect_to @enquiry_source, notice: 'Enquiry source was successfully created.' }\n format.json { render json: @enquiry_source, status: :created, location: @enquiry_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enquiry_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @funding_source = FundingSource.new(params[:funding_source])\n\n respond_to do |format|\n if @funding_source.save\n flash[:notice] = 'FundingSource was successfully created.'\n format.html { redirect_to([:admin, @funding_source]) }\n format.xml { render :xml => @funding_source, :status => :created, :location => @funding_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @funding_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end", "def create\n @cla_source = ClaSource.new(cla_source_params)\n\n respond_to do |format|\n if @cla_source.save\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully created.' }\n format.json { render :show, status: :created, location: @cla_source }\n else\n format.html { render :new }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @founding_source = FoundingSource.new(founding_source_params)\n @founding_source.account = Account.new name: @founding_source.name,\n balance: @founding_source.balance,\n nature: founding_source_params[:nature]\n\n respond_to do |format|\n if @founding_source.save\n format.html { redirect_to @founding_source, notice: 'Founding source was successfully created.' }\n format.json { render :show, status: :created, location: @founding_source }\n else\n format.html { render :new }\n format.json { render json: @founding_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def create\n @city_source = CitySource.new(city_source_params)\n\n respond_to do |format|\n if @city_source.save\n format.html { redirect_to @city_source, notice: 'City source was successfully created.' }\n format.json { render :show, status: :created, location: @city_source }\n else\n format.html { render :new }\n format.json { render json: @city_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_source\n @source = Source.find params[:id]\n end", "def create\n args = params[:bundle_source].merge( :user_id => @user.id )\n @bundle_source = BundleSource.new( args )\n\n respond_to do |format|\n if @bundle_source.save\n flash[:notice] = 'Your bundle source containter was successfully created. You should now add some audio files to it.'\n format.html { redirect_to(@bundle_source) }\n format.xml { render :xml => @bundle_source, :status => :created, :location => @bundle_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bundle_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @source_code = SourceCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source_code }\n end\n end", "def create\n @project = Project.find params[:project_id]\n @file = @project.source_files.create :name=>params[:name], :code=>params[:code]\n\n respond_to do |format|\n if @file.save \n format.html {redirect_to @project}\n format.json {render json: @file}\n end\n end\n end", "def add_sources(sources)\n sources_ready = EventMachine::MultiRequest.new\n\n sources.each do |source|\n sources_ready.add(source)\n end\n\n sources_ready.callback do\n sources.each do |source|\n source.proxies.each do |proxy|\n @proxies << proxy unless @proxies.include? proxy\n end\n end\n end\n\n sources_ready\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def create_d_b_source(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources'\n\t\targs[:query]['Action'] = 'CreateDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :source\n\t\t\targs[:body]['Source'] = optional[:source]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @source = new_source\n respond_to do |format|\n # We must check for manually added errors first, as they\n # are lost when .valid? is called during the callback chain.\n if !@source.errors.any? && @source.save\n format.html { redirect_to url_for(@source.metamorphosize),\n notice: \"#{@source.type} successfully created.\" }\n format.json { render action: 'show', status: :created, location: @source.metamorphosize }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game_source = GameSource.new(params[:game_source])\n\n respond_to do |format|\n if @game_source.save\n format.html { redirect_to @game_source, notice: 'Game source was successfully created.' }\n format.json { render json: @game_source, status: :created, location: @game_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_source = DataSource.new(data_source_params)\n\n respond_to do |format|\n if @data_source.save\n format.html { redirect_to @data_source, notice: 'Data source was successfully created.' }\n format.json { render :show, status: :created, location: @data_source }\n else\n format.html { render :new }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def create\n @source = Source.new\n create_or_update\n end", "def create\n @src_gst = SrcGst.new(params[:src_gst])\n\n respond_to do |format|\n if @src_gst.save\n format.html { redirect_to src_gsts_path, notice: \"#{I18n.t \"html.save_success\"}\" }\n format.json { render json: @src_gst, status: :created, location: @src_gst }\n else\n format.html { render action: \"new\" }\n format.json { render json: @src_gst.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @financial_aid_source = @financial_aid_package.sources.new(params[:financial_aid_source])\n\n respond_to do |format|\n if @financial_aid_source.save\n format.html { redirect_to [@participant, @financial_aid_package], notice: 'Financial aid source was successfully created.' }\n format.json { render json: {\n content: render_to_string(partial: 'source', object: @financial_aid_source, formats: [:html]),\n object: @financial_aid_source,\n breakdown: @financial_aid_source.breakdown(no_cents: true)\n }, status: :created, location: [@participant, @financial_aid_package] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial_aid_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def information_source_params\n params.require(:information_source).permit(:rss)\n end", "def new\n @project = Project.new\n @source = params[:source]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def create\n logger.info('POST Create:')\n logger.info(request_body)\n pub_hash = hashed_request\n fingerprint = Digest::SHA2.hexdigest(request_body)\n existing_record = UserSubmittedSourceRecord.find_by(source_fingerprint: fingerprint)\n if existing_record\n logger.info(\"Found existing record for #{fingerprint}: #{existing_record.inspect}; redirecting.\")\n redirect_to publication_path(existing_record.publication_id), status: :see_other\n else\n unless validate_or_create_authors(pub_hash[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n pub = Publication.build_new_manual_publication(pub_hash, request_body)\n pub.save!\n pub.reload\n logger.debug(\"Created new publication #{pub.inspect}\")\n render json: pub.pub_hash, status: :created\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n \n #if @source.reviewed\n # create blog entry\n # b = Blogpost.new()\n # s = @source.event.id.to_s\n # s2 = @source.name\n # b.header = \"New source added to OSID-ID: \"+s+\" / \"+s2\n # b.user_id = @source.user_id\n # b.save\n\n # create tweet\n # b.tweet!\n # end\n \n end", "def index\n #@sources = Source.all\n \n @sources = Source.search(params[:search], params[:page])\n \n @title = \"Sources\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def create\n @portal_source = PortalSource.new(portal_source_params)\n\n respond_to do |format|\n if @portal_source.save\n format.html { redirect_to @portal_source, notice: 'Portal source was successfully created.' }\n format.json { render :show, status: :created, location: @portal_source }\n else\n format.html { render :new }\n format.json { render json: @portal_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def feed_source_params\n params.require(:feed_source).permit(:title, :link, :feed_type, :num_articles, :description, :category_id)\n end", "def create\n @temporary_source = TemporarySource.new(params[:temporary_source])\n\n respond_to do |format|\n if @temporary_source.save\n format.html { redirect_to @temporary_source, notice: 'Temporary source was successfully created.' }\n format.json { render json: @temporary_source, status: :created, location: @temporary_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @temporary_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_sources(sources)\n\t\treturn if sources.split(',').empty?\n\t\tquake_sources = sources.split(',')\n\t\t\tquake_sources.each do |source|\n\t\t\t\tself.sources << Source.find_or_create_by(code: source)\n\t\t\tend\n\t\tself.save!\n\tend", "def sources_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_put\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def new\n @content_source = ContentSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_source }\n end\n end", "def index\n @source_files = SourceFile.all\n end", "def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end", "def new\n respond_with(source)\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def post_fundingsources_addresses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.post_fundingsources_addresses ...'\n end\n # resource path\n local_var_path = '/fundingsources/addresses'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'CardholderAddressResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.post_fundingsources_addresses\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#post_fundingsources_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @rep_source = RepSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rep_source }\n end\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def source_path\n File.expand_path \"feed.xml\", File.dirname(__FILE__)\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def create\n @historical_source = HistoricalSource.new(historical_source_params)\n\n respond_to do |format|\n if @historical_source.save\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @historical_source }\n else\n format.html { render action: 'new' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.68065745", "0.6458434", "0.6198028", "0.6032349", "0.5934093", "0.58439803", "0.5824321", "0.5771149", "0.5746699", "0.5745752", "0.57402295", "0.5729624", "0.57243955", "0.57214", "0.56978345", "0.5644379", "0.5634924", "0.5625314", "0.5618868", "0.55762357", "0.5572174", "0.55611366", "0.55582875", "0.5537517", "0.5510277", "0.5476892", "0.54760873", "0.54712874", "0.546817", "0.546817", "0.5466061", "0.54450667", "0.54199237", "0.54115266", "0.5402953", "0.53928125", "0.53778267", "0.5375521", "0.5372825", "0.5364334", "0.53474206", "0.5342813", "0.53423005", "0.53365475", "0.5285861", "0.5274719", "0.526173", "0.525697", "0.5241887", "0.5238464", "0.52368075", "0.52354383", "0.52265525", "0.52132505", "0.52010566", "0.51828", "0.5181927", "0.51716226", "0.51632327", "0.5152148", "0.5122315", "0.51210487", "0.5110516", "0.5109775", "0.51063275", "0.51023495", "0.5099379", "0.50961536", "0.50938994", "0.5089053", "0.5083852", "0.507951", "0.50739956", "0.5047317", "0.5046025", "0.5045211", "0.5040238", "0.50382787", "0.50179714", "0.5008503", "0.49935165", "0.4990127", "0.4980303", "0.49729437", "0.49693128", "0.49534824", "0.4950384", "0.4933821", "0.492895", "0.49287522", "0.49278736", "0.49229822", "0.49229822", "0.49229822", "0.49208567", "0.49185836", "0.49136004", "0.4905417", "0.4903555", "0.4903555", "0.490352" ]
0.0
-1
PUT /sources/1 PUT /sources/1.xml
def update @source = Source.find(params[:id]) if params[:excredits] if @source.status != 3 @source.update_attributes({:excredits => params[:excredits]}) return end end if @source.update_attributes(params[:source]) flash[:message] = "成功编辑译文" redirect_to my_sources_path else flash[:error] = "保存错误,请重试" redirect_to new_source_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n create_or_update\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def sources_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_put\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n track_activity(@source, 'update', @source.previous_changes)\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n if @content_source.update_attributes(params[:content_source])\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n if @rss_source.update_attributes(params[:rss_source])\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n \n #if @source.reviewed\n # create blog entry\n # b = Blogpost.new()\n # s = @source.event.id.to_s\n # s2 = @source.name\n # b.header = \"New source added to OSID-ID: \"+s+\" / \"+s2\n # b.user_id = @source.user_id\n # b.save\n\n # create tweet\n # b.tweet!\n # end\n \n end", "def update\n flash[:notice] = 'The source was successfully updated.' if source.update_attributes(params[:source])\n respond_with(source)\n end", "def update\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n if @event_source.update_attributes(params[:event_source])\n format.html { redirect_to @event_source, :notice => 'Event source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bundle_source.user_id = @user.id\n respond_to do |format|\n if @bundle_source.update_attributes(params[:bundle_source])\n flash[:notice] = 'BundleSource was successfully updated. The changes have to published by clicking the button below to make them available within the download section.'\n format.html { redirect_to(@bundle_source) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bundle_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def update\n @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n if @annotation_source.update_attributes(params[:annotation_source])\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rep_source = RepSource.find(params[:id])\n\n respond_to do |format|\n if @rep_source.update_attributes(params[:rep_source])\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n @url = args[:url] if args.key?(:url)\n end", "def update\n respond_to do |format|\n if @source_file.update(source_file_params)\n format.html { redirect_to @source_file, notice: 'Source file was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_file }\n else\n format.html { render :edit }\n format.json { render json: @source_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_source\n @source = Source.find params[:id]\n end", "def update\n respond_to do |format|\n if @kernel_source.update(kernel_source_params)\n format.html { redirect_to @kernel_source, notice: \"Kernel source was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_source }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_source_file\n @source_file = SourceFile.find(params[:id])\n end", "def update\n authorize_user!\n params = clean_authors\n\n @source.update_image\n\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to source_path(@source), notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def update_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'UpdateDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :source\n\t\t\targs[:body]['Source'] = optional[:source]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n @stream = @user.stream\n if @stream.update(stream_params)\n options = {}\n options[:include] = [:sources, :'sources.name', :'sources.api_id', :'sources.url']\n render json: StreamSerializer.new(@stream, options), status: :ok\n else\n render json: @stream.errors, status: :unprocessable_entity\n end\n end", "def update\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n if @creator_source.update_attributes(params[:creator_source])\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update\n @source_code = SourceCode.find(params[:id])\n\n respond_to do |format|\n if @source_code.update_attributes(params[:source_code])\n flash[:notice] = 'SourceCode was successfully updated.'\n format.html { redirect_to(@source_code) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n if @student_source.update_attributes(params[:student_source])\n format.html { redirect_to @student_source, notice: 'Student source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n respond_to do |format|\n if @source_ref.update(source_ref_params)\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_ref }\n else\n format.html { render :edit }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n if @lookup_source.update(params[:lookup_source], :without_protection => true)\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feed_source.update(feed_source_params)\n format.html { redirect_to @feed_source, notice: 'Feed source was successfully updated.' }\n format.json { render :show, status: :ok, location: @feed_source }\n else\n format.html { render :edit }\n format.json { render json: @feed_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @entity_sources = args[:entity_sources] if args.key?(:entity_sources)\n end", "def update_source(name, file=nil, topic=nil)\n\t\t\tfile ||= @node[:source][:file] rescue nil\n\t\t\t@updated_source = {:name => name, :file => file, :topic => topic}\n\t\tend", "def update!(**args)\n @destinations = args[:destinations] if args.key?(:destinations)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update\n respond_to do |format|\n if @source_master.update(source_master_params)\n format.html { redirect_to @source_master, notice: \"Source master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @source_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def update\n source = Source.find params[:id]\n\n if source.update(raw_html: params[:raw_html])\n respond_to do |format|\n format.json { head :ok }\n end\n else\n respond_to do |format|\n format.json { head :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @founding_source.update(founding_source_params)\n format.html { redirect_to @founding_source, notice: 'Founding source was successfully updated.' }\n format.json { render :show, status: :ok, location: @founding_source }\n else\n format.html { render :edit }\n format.json { render json: @founding_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!\n entity_json = [{ name: @source_file.entity_name, entries: expanded_entries }]\n\n response = @api_client.update_entities_request(entity_json)\n\n handle_response(response, :entity)\n end", "def update(source)\n ifolder = get(source.name)\n raise \"No such ifolder: #{source.name}\" unless ifolder.exists?\n ifolder.update(source) \n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end", "def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end", "def set_source_ref\n @source_ref = SourceRef.find(params[:id])\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @recipesource = Recipesource.find(params[:id])\n\n respond_to do |format|\n if @recipesource.update_attributes(params[:recipesource])\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipesource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @streams = args[:streams] if args.key?(:streams)\n @target_stream = args[:target_stream] if args.key?(:target_stream)\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update\n @subject_source = SubjectSource.find(params[:id])\n\n respond_to do |format|\n if @subject_source.update_attributes(params[:subject_source])\n format.html { redirect_to @subject_source, notice: 'Subject source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n if @proxy_source.update_attributes(params[:proxy_source])\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def source_index\n say \"Updating Gem source index for: #{@uri}\"\n begin\n require 'zlib'\n yaml_spec = fetch_path(\"/yaml.Z\")\n yaml_spec = Zlib::Inflate.inflate(yaml_spec)\n rescue\n yaml_spec = nil\n end\n begin\n\tyaml_spec = fetch_path(\"/yaml\") unless yaml_spec\n\tr = convert_spec(yaml_spec)\n rescue SocketError => e\n\traise RemoteSourceException.new(\"Error fetching remote gem cache: #{e.to_s}\")\n end\n end", "def update\n respond_to do |format|\n if @historical_source.update(historical_source_params)\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game_source = GameSource.find(params[:id])\n\n respond_to do |format|\n if @game_source.update_attributes(params[:game_source])\n format.html { redirect_to @game_source, notice: 'Game source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cla_source.update(cla_source_params)\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully updated.' }\n format.json { render :show, status: :ok, location: @cla_source }\n else\n format.html { render :edit }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @src_gst = SrcGst.find(params[:id])\n\n respond_to do |format|\n if @src_gst.update_attributes(params[:src_gst])\n format.html { redirect_to src_gsts_path, notice: \"#{I18n.t \"html.update_success\"}\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @src_gst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n if @enquiry_source.update_attributes(params[:enquiry_source])\n format.html { redirect_to @enquiry_source, notice: 'Enquiry source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enquiry_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params = clean_authors\n\n @source = Project.find(params[:project_id]).sources.new(source_params)\n @source.user_id = current_user.id\n\n @source.update_image\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to source_path(@source), notice: 'Source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @source }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @source_field = args[:source_field] if args.key?(:source_field)\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def put(*args)\n request :put, *args\n end", "def update\n @source_code_type = SourceCodeType.find(params[:id])\n\n respond_to do |format|\n if @source_code_type.update_attributes(params[:source_code_type])\n flash[:notice] = 'SourceCodeType was successfully updated.'\n format.html { redirect_to(@source_code_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source_code_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @filter = Object::Filter.find(params[:id])\n @filter.source = @source\n\n respond_to do |format|\n if @filter.update_attributes(params[:filter])\n flash[:notice] = 'Filter was successfully updated.'\n format.html { redirect_to(@source) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @filter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end", "def update!(**args)\n @source_type_metadata = args[:source_type_metadata] if args.key?(:source_type_metadata)\n end", "def update!(**args)\n @source_type_bitfield = args[:source_type_bitfield] if args.key?(:source_type_bitfield)\n @included_doc = args[:included_doc] if args.key?(:included_doc)\n @link_url = args[:link_url] if args.key?(:link_url)\n @per_doc_data = args[:per_doc_data] if args.key?(:per_doc_data)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @api = args[:api] if args.key?(:api)\n @destination = args[:destination] if args.key?(:destination)\n @extensions = args[:extensions] if args.key?(:extensions)\n @origin = args[:origin] if args.key?(:origin)\n @request = args[:request] if args.key?(:request)\n @resource = args[:resource] if args.key?(:resource)\n @response = args[:response] if args.key?(:response)\n @source = args[:source] if args.key?(:source)\n end", "def test_create_xml\n # TODO: Make a real test when it's worth it\n source = Source.new(\"http://www.newstuff.org/my_first\")\n source.types << @test_type\n source.primary_source = false\n source.save!\n source.talia::author << \"napoleon\"\n source.save!\n print source.to_xml\n print source.to_rdf # also check rdf\n end", "def create(source:)\n resp = connection.post do |req|\n req.url workspace_path\n req.params['source'] = source\n end\n raise_exception_based_on_response!(resp, object_identifier) unless resp.success?\n end", "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def create\n @book = Book.new(params[:book])\n @book.source = Source.new( :title => @book.title, :official_url => params[:source_url] )\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_post. Result: #{result.inspect}\"\n end\n return result\n end", "def connectors_id_connector_sources_id_source_put_with_http_info(id_connector, id_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_id_connector_sources_id_source_put ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.connectors_id_connector_sources_id_source_put\"\n end\n # verify the required parameter 'id_source' is set\n if @api_client.config.client_side_validation && id_source.nil?\n fail ArgumentError, \"Missing the required parameter 'id_source' when calling ConnectionsApi.connectors_id_connector_sources_id_source_put\"\n end\n # resource path\n local_var_path = '/connectors/{id_connector}/sources/{id_source}'.sub('{' + 'id_connector' + '}', id_connector.to_s).sub('{' + 'id_source' + '}', id_source.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['auth_mechanism'] = opts[:'auth_mechanism'] if !opts[:'auth_mechanism'].nil?\n form_params['disabled'] = opts[:'disabled'] if !opts[:'disabled'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectorSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_id_connector_sources_id_source_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.66505885", "0.6490155", "0.6490155", "0.6281938", "0.62671787", "0.61757547", "0.61559135", "0.6146965", "0.608336", "0.60009795", "0.5989421", "0.59857684", "0.59816825", "0.59474546", "0.58372015", "0.5792429", "0.56985694", "0.56742305", "0.56605566", "0.56448853", "0.5630329", "0.55984044", "0.5575674", "0.55565923", "0.5549779", "0.55356866", "0.55305946", "0.55285054", "0.55189055", "0.55189055", "0.55189055", "0.5515073", "0.55074906", "0.55028874", "0.55021966", "0.5502045", "0.5502045", "0.54926217", "0.54883206", "0.54839855", "0.54839855", "0.54820025", "0.54692906", "0.54553443", "0.5439971", "0.5422854", "0.5420093", "0.54180574", "0.5401749", "0.5374393", "0.5360089", "0.5354799", "0.5353155", "0.5353155", "0.5353155", "0.5353155", "0.53524685", "0.53121895", "0.5311249", "0.530744", "0.5298745", "0.5283612", "0.52779675", "0.526964", "0.5269524", "0.5265546", "0.52471685", "0.52441907", "0.522429", "0.52198917", "0.5213727", "0.52113646", "0.5207457", "0.5204911", "0.5201706", "0.52002627", "0.519179", "0.5184292", "0.518283", "0.51696825", "0.5161504", "0.5161504", "0.5161504", "0.5161504", "0.5158202", "0.5156823", "0.51385814", "0.5130464", "0.512711", "0.5121372", "0.5121372", "0.5120259", "0.5117655", "0.51173675", "0.5115056", "0.51116395", "0.5099326", "0.50948614", "0.5090381", "0.5089006", "0.50864404" ]
0.0
-1
DELETE /sources/1 DELETE /sources/1.xml
def destroy @source = Source.find(params[:id]) @source.destroy respond_to do |format| format.html { redirect_to(sources_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rep_source = RepSource.find(params[:id])\n @rep_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(rep_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def destroy\n @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rss_source = RssSource.find(params[:id])\n @rss_source.destroy\n\n respond_to do |format|\n format.html { redirect_to rss_sources_url }\n format.json { head :ok }\n end\n end", "def destroy\n @source_file.destroy\n respond_to do |format|\n format.html { redirect_to source_files_url, notice: 'Source file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @lookup_source = LookupSource.find(params[:id])\n @lookup_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @label = '' if response['success']\n \n response['success']\n end", "def delete_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'DeleteDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def destroy\n @funding_source = FundingSource.find(params[:id])\n @funding_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_funding_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end", "def delete_source_files source\n dir = Conf::directories\n base = File.join(dir.data)\n source.folders.each do |fold|\n url = File.join(dir.store,source.name.to_s,fold)\n delete_files_from url\n url = File.join(dir.backup,source.name.to_s,fold)\n delete_files_from url\n end\n Logger.<<(__FILE__,\"INFO\",\"Deleted files server & backup for #{source.name.to_s}\")\n end", "def destroy\n @jargon_file = JargonFile.find(params[:id])\n @source = @jargon_file.source\n @jargon_file.destroy\n\n respond_to do |format|\n format.html { redirect_to @source }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_ref.destroy\n respond_to do |format|\n format.html { redirect_to source_refs_url, notice: 'Source ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_code = SourceCode.find(params[:id])\n @source_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(source_codes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n if @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: \"Destroyed source #{@source.cached}\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render action: :show, notice: 'failed to destroy the source, there is likely data associated with it' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url, notice: 'Cla source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @creator_source = CreatorSource.find(params[:id])\n @creator_source.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n flash[:notice] = 'The source was successfully removed.' if source.destroy\n respond_with(source)\n end", "def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @historical_source.destroy\n respond_to do |format|\n format.html { redirect_to historical_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n AudioSource.delete( @bundle_source.audio_sources )\n \n corresponding_bundle = @bundle_source.bundle_id\n if( @bundle_source.bundle_id )\n corresponding_bundle = Bundle.find_by_id( @bundle_source.bundle_id )\n if( corresponding_bundle && corresponding_bundle.created_by_user_id == @user.id )\n logger.info(\"****** DESROY invoked ****** \")\n corresponding_bundle.destroy\n end\n end\n\n @bundle_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundle_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @budget_src = BudgetSrc.find(params[:id])\n @budget_src.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_srcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @kernel_source.destroy\n respond_to do |format|\n format.html { redirect_to kernel_sources_url, notice: \"Kernel source was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction_source.destroy\n flash[:notice] = \"Transaction source was successfully deleted\"\n redirect_to transaction_sources_url\n end", "def destroy\n @event_source = EventSource.find(params[:id])\n @event_source.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feed_source.destroy\n respond_to do |format|\n format.html { redirect_to feed_sources_url, notice: 'Feed source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n result = Base.redis.hdel(:sources, name)\n if result == 1\n delete_all_inputs\n Log.info \"Deleting Source object from Redis: #{name}\"\n else\n raise UnknownSource, \"Cannot delete non-existent Source object in Redis: #{name}\"\n end\n result\n end", "def destroy\n @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @founding_source.destroy\n respond_to do |format|\n format.html { redirect_to founding_sources_url, notice: 'Founding source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @annotation_source = AnnotationSource.find(params[:id])\n @annotation_source.destroy\n\n respond_to do |format|\n format.html { redirect_to annotation_sources_url }\n format.json { head :no_content }\n end\n end", "def sources_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_delete\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def destroy\n @student_source = StudentSource.find(params[:id])\n @student_source.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sources_url }\n format.json { head :no_content }\n end\n end", "def test_happy_day\n begin\n src_id = @juxta.obtain_source_from_url( @url )\n assert(src_id.nil? == false, \"Upload source id is nil\" )\n\n status = @juxta.delete_source(src_id)\n assert( status == true, \"File delete failed\")\n rescue Exception => e\n assert( false, \"Unexpected exception (#{e})\")\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @source = params[:source]\n\n ProjectItem.destroy_all(:project_id => @project.id)\n Branch.destroy_all(:project_id => @project.id)\n @project.destroy\n\n respond_to do |format|\n\n if @source == \"dialog_index\"\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n else\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n\n end\n end", "def destroy\n @payment_source = PaymentSource.find(params[:id])\n @payment_source.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subject_source = SubjectSource.find(params[:id])\n @subject_source.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_page.destroy\n respond_to do |format|\n format.html { redirect_to source_pages_url, notice: 'Source page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @src_gst = SrcGst.find(params[:id])\n @src_gst.destroy\n\n respond_to do |format|\n format.html { redirect_to src_gsts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_files_url) }\n format.xml { head :ok }\n end\n end", "def delete(*uris); end", "def destroy\n @game_source = GameSource.find(params[:id])\n @game_source.destroy\n\n respond_to do |format|\n format.html { redirect_to game_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end", "def destroy\n @raw_data_file = RawDataFile.find(params[:id])\n @raw_data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_data_files_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source_web.destroy\n respond_to do |format|\n format.html { redirect_to source_webs_url, notice: 'Source web was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @temporary_source = TemporarySource.find(params[:id])\n @temporary_source.destroy\n\n respond_to do |format|\n format.html { redirect_to temporary_sources_url }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: \"Register was deleted!\" }\n format.json { head :no_content }\n end\n end", "def delete uri\n @change_semaphore.synchronize do\n filename = uri_to_file(uri)\n library.delete filename\n # Remove diagnostics for deleted files\n send_notification \"textDocument/publishDiagnostics\", {\n uri: uri,\n diagnostics: []\n }\n end\n end", "def destroy\n @portal_source.destroy\n respond_to do |format|\n format.html { redirect_to portal_sources_url, notice: 'Portal source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enquiry_source = EnquirySource.find(params[:id])\n @enquiry_source.destroy\n\n respond_to do |format|\n format.html { redirect_to enquiry_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @news_source.destroy\n respond_to do |format|\n format.html { redirect_to news_sources_url, notice: 'News source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @study_source.destroy\n respond_to do |format|\n format.html { redirect_to study_sources_url, notice: 'Study source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @city_source.destroy\n respond_to do |format|\n format.html { redirect_to city_sources_url, notice: 'City source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @copy = Copy.find(params[:id])\n @copy.destroy\n\n respond_to do |format|\n format.html { redirect_to(copies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @filter = Object::Filter.find(params[:id])\n @filter.destroy\n\n respond_to do |format|\n format.html { redirect_to(@source) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def remove_source(*source)\n unless source.blank?\n what.query[:sources] && what.query[:sources] >> source.flatten\n changed\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def destroy\n @heat_source = HeatSource.find(params[:id])\n @heat_source.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @paper_source.destroy\n respond_to do |format|\n format.html { redirect_to paper_sources_url, notice: '成功刪除已選擇的試卷來源' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete(filename); end", "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def destroy\n @yml_file = Cmtool::YmlFile.find(params[:id])\n @yml_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(cmtool.yml_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::YmlFile.model_name.human)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @document.destroy\n save_log({ :action => 'DELETE', :document => { :before => @old_document }})\n #TODO delete the file from disk\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy1\n @compare = Compare.find(params[:id])\n @compare.destroy\n\n respond_to do |format|\n format.html { redirect_to(compares_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source_code_type = SourceCodeType.find(params[:id])\n @source_code_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(source_code_types_url) }\n format.xml { head :ok }\n end\n end", "def delete_collection\n FileUtils.rm_r @src_path\n FileUtils.rm_r @store_path if store_exist?\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cv.destroy\n\n respond_to do |format|\n format.html { redirect_to(cvs_path) }\n format.xml { head :ok }\n end\n end", "def destroyX\n @server = Server.find(params[:id])\n @server.destroy\n\n respond_to do |format|\n format.html { redirect_to(servers_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.73130286", "0.6986069", "0.6858216", "0.6787762", "0.6787762", "0.67873", "0.6654224", "0.6617284", "0.6586534", "0.6504256", "0.64952487", "0.64908856", "0.64877266", "0.64129955", "0.6409706", "0.6380726", "0.63590765", "0.6334079", "0.63039297", "0.62941515", "0.62822366", "0.62797207", "0.6261546", "0.62365705", "0.62291276", "0.61793584", "0.61481744", "0.61336315", "0.61315984", "0.6124449", "0.61190677", "0.6117036", "0.610874", "0.6074614", "0.6068283", "0.6065857", "0.6063778", "0.60514045", "0.60366493", "0.6027373", "0.6019712", "0.60100144", "0.60054296", "0.6000085", "0.5999293", "0.5998885", "0.59718204", "0.5968664", "0.5956208", "0.59453017", "0.59352505", "0.5927547", "0.5922578", "0.59195757", "0.5916417", "0.58941376", "0.5882527", "0.5882527", "0.5863027", "0.58624065", "0.58579934", "0.58515567", "0.58490556", "0.5848698", "0.57866555", "0.57730365", "0.5754235", "0.5752479", "0.57504225", "0.57422805", "0.57359695", "0.57281774", "0.57258254", "0.5721628", "0.5721628", "0.57157767", "0.5710912", "0.5709895", "0.5704459", "0.57041323", "0.57020646", "0.5695524", "0.5693516", "0.568632", "0.5685364", "0.5685075", "0.5678586", "0.56785315", "0.5675112", "0.5674875", "0.5655171", "0.56500244", "0.56500244", "0.56500244", "0.56499106", "0.5641503", "0.56379056" ]
0.737422
3
GET /products GET /products.json
def index @products = Product.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def products\n request :public, :get, :products\n end", "def index\n @products = Product.all\n render json: @products\n end", "def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end", "def index\n \tproducts = Product.all\n \trender json: products\n \tend", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end", "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def show\n @product = Product.find(params[:id])\n json_response(params)\n end", "def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "def show\n render json: @product\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n render json: @product, status: 200\n end", "def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "def show\n render json: @product\n end", "def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def show\n @product = Product.find(params[:id])\n render json: @product, status: :ok\n end", "def index\n @products = Product.all\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end", "def show\n result = Product.find(params[:id])\n render json: {\n status: :ok,\n product: result\n } \n end", "def index\n @food_products = FoodProduct.all\n render json: @food_products\n end", "def index\n #@products = Product.all\n @products = Product.paginate( :page => params[:page],\n :per_page => 40\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n render :json => Producto.all\n end", "def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end", "def show\n render :json => Producto.find(params[:id])\n end", "def index\n products = Product.all\n render json: {message: \"ok\", data: products}\n puts \"hello\"\n\n end", "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end", "def show\n json_response(@api_v1_product)\n end", "def show\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @product }\n end\n end", "def index\n @products = Product.all\n render json: {is_success: true, error_code: 200, message: \"Products Found Successfully\", result: @products}, status: 200\n end", "def index\n @products = Product.order('item_code ASC').page(params[:page]).per(25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @product }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "def index\n #@products = Product.all\n @products = Product.order('created_at ASC').page(params[:page]).per(12)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def show\n @product = @user.products.find(params[:id])\n # was @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n format.json { render :json => @products }\n end\n end", "def index\n\t\t@products = Product.page(params[:page])\n respond_with(@products)\n end", "def show\n @items = cart.items\n @products = @items.collect(&:product)\n \n respond_to do |format|\n format.html { render layout: false } \n format.json { render json: @items }\n end\n end", "def all\n @products = Product.get_list_active_products.page(params[:page]).per(10)\n if @products.present?\n @products\n else\n @object = 'product'\n render \"api/v1/errors/404\", status: 401\n end\n end", "def get_products_by_ids\n products_ids = params[:products_ids]\n products = Array.new\n JSON.parse(products_ids).each do |product_id|\n product = Product.find_by_id(product_id)\n if product\n products.push(product)\n end\n end\n render json: {products: serialized_products(products)}, status: :ok\n end", "def index\n begin\n \n products = Product.all\n render json: {\n success: true,\n totalRecords: products.length,\n data: (ActiveModel::ArraySerializer.new(products, each_serializer: ProductSerializer))\n }, status: 200\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n success: false,\n errors: e.message\n }, status: 404\n rescue Exception => e\n render json: {\n success: false,\n errors: e.message\n }, status: 500\n end\n end", "def index\n @products = get_products\n \n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @products }\n end\n end", "def index\n @user_interactive_products = UserInteractiveProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_interactive_products }\n end\n end", "def show\n @products = Product.find(params[:id])\n end", "def index\n @size_to_products = SizeToProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @size_to_products }\n end\n end", "def show\n render json: @product_management\n end", "def show\n @shopifyproduct = Shopifyproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopifyproduct }\n end\n end", "def index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end", "def products\n run(:get,\"/school_products\", [200])\n end", "def show\n puts \"the params are #{params}\" \n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def get_product\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def show\n render json: @food_product\n end", "def index\n @products = Spree::Product.not_deleted.includes(:variants).page(params[:page]).per(Spree::Config[:orders_per_page])\n respond_with @products\n end", "def show\n @ordered_product = OrderedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordered_product }\n end\n end", "def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end", "def show\n respond_to do |format|\n format.html {render \"products/show\"}\n format.json {\n product = Product.where(id: params[:id]).includes(:category).first\n render json: product.as_json(include: [:category, :photo])\n }\n end\n end", "def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']\n product[:pricing_list_id] = pricing_list.id\n attributes = value['attributes']\n product[:service_code] = attributes['servicecode']\n product[:location] = attributes['location']\n product[:location_type] = attributes['locationType']\n product[:usage_type] = attributes['usagetype']\n product[:operation] = attributes['operation']\n product[:request_description] = attributes['requestDescription']\n product[:request_type] = attributes['requestType']\n product[:service_name] = attributes['servicename']\n product[:pricing_list_id] = pricing_list.id\n product[:created_at] = Time.zone.now.utc\n product[:updated_at] = Time.zone.now.utc\n products_ops << product\n end\n products_ops\n end", "def products\n Product.all\n end", "def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def index\n @products = Product.order(\"created_at desc\").paginate(page: params[:page], per_page: 21)\n\n respond_with @products\n end" ]
[ "0.79500145", "0.7929853", "0.79054135", "0.77477723", "0.76619905", "0.7622153", "0.762195", "0.762195", "0.762195", "0.76070404", "0.75873625", "0.75828224", "0.7578298", "0.75750685", "0.7565435", "0.7565435", "0.7565435", "0.7565435", "0.7530454", "0.7523024", "0.75097287", "0.7499573", "0.7487295", "0.7482803", "0.74772465", "0.74246985", "0.73933035", "0.7385907", "0.73813003", "0.73782736", "0.73618764", "0.7335821", "0.7328304", "0.73217475", "0.73007965", "0.72724617", "0.7266115", "0.72368836", "0.7231302", "0.721976", "0.72012275", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72004086", "0.72003204", "0.7183106", "0.71770364", "0.7171277", "0.71676934", "0.7161769", "0.71389854", "0.7132392", "0.7132392", "0.7132392", "0.71277475", "0.7067359", "0.7058764", "0.7054275", "0.7054204", "0.704872", "0.7037476", "0.70290595", "0.702411", "0.70170933", "0.7006176", "0.69928014", "0.6987985", "0.69775224", "0.69533277", "0.6952554", "0.6949972", "0.694733", "0.69457495", "0.69448644", "0.69414043", "0.6925035", "0.69248766", "0.69231015", "0.6913877", "0.6913619", "0.6897382", "0.68753684", "0.68670917", "0.68639797" ]
0.0
-1
GET /products/1 GET /products/1.json
def show @product_images = @product.product_images.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end", "def show\n @product = Product.find(params[:id])\n json_response(params)\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def show\n @product = Product.find(params[:id])\n render json: @product, status: :ok\n end", "def show\n result = Product.find(params[:id])\n render json: {\n status: :ok,\n product: result\n } \n end", "def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "def index\n @products = Product.all\n render json: @products\n end", "def show\n render json: @product, status: 200\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def show\n json_response(@api_v1_product)\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def show\n render :json => Producto.find(params[:id])\n end", "def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end", "def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n render json: @product\n end", "def index\n \tproducts = Product.all\n \trender json: products\n \tend", "def products\n request :public, :get, :products\n end", "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "def show\n render json: @product\n end", "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "def show\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end", "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @product }\n end\n end", "def index\n @products = Product.all\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end", "def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end", "def index\n render :json => Producto.all\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "def show\n puts \"the params are #{params}\" \n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end", "def show\n @product_item = ProductItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_item }\n end\n end", "def index\n @food_products = FoodProduct.all\n render json: @food_products\n end", "def index\n #@products = Product.all\n @products = Product.paginate( :page => params[:page],\n :per_page => 40\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end", "def index\n products = Product.all\n render json: {message: \"ok\", data: products}\n puts \"hello\"\n\n end", "def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end", "def show\n @shopifyproduct = Shopifyproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopifyproduct }\n end\n end", "def show\n @product = @user.products.find(params[:id])\n # was @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n @ordered_product = OrderedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordered_product }\n end\n end", "def show\n @products = Product.find(params[:id])\n end", "def index\n @products = Product.order('item_code ASC').page(params[:page]).per(25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "def get_product\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def show\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onecompany_product }\n end\n end", "def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end", "def index\n begin\n \n products = Product.all\n render json: {\n success: true,\n totalRecords: products.length,\n data: (ActiveModel::ArraySerializer.new(products, each_serializer: ProductSerializer))\n }, status: 200\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n success: false,\n errors: e.message\n }, status: 404\n rescue Exception => e\n render json: {\n success: false,\n errors: e.message\n }, status: 500\n end\n end", "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n format.json { render :json => @products }\n end\n end", "def index\n @products = Product.all\n render json: {is_success: true, error_code: 200, message: \"Products Found Successfully\", result: @products}, status: 200\n end", "def show\n render json: @product_management\n end", "def show\n @product2 = Product2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product2 }\n end\n end", "def index\n #@products = Product.all\n @products = Product.order('created_at ASC').page(params[:page]).per(12)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def show\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prod }\n end\n end", "def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end", "def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end", "def getProduct( product_id)\n params = Hash.new\n params['product_id'] = product_id\n return doCurl(\"get\",\"/product\",params)\n end", "def show\n respond_to do |format|\n format.html {render \"products/show\"}\n format.json {\n product = Product.where(id: params[:id]).includes(:category).first\n render json: product.as_json(include: [:category, :photo])\n }\n end\n end", "def show\n @items = cart.items\n @products = @items.collect(&:product)\n \n respond_to do |format|\n format.html { render layout: false } \n format.json { render json: @items }\n end\n end", "def show\n @star_product = Star::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @star_product }\n end\n end", "def show\n render json: @food_product\n end", "def show\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producto }\n end\n end", "def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end", "def show\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_product }\n end\n end", "def show\n @magento_product = MagentoProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magento_product }\n end\n end", "def show\n @product_price = ProductPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_price }\n end\n end", "def show\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @prod }\n end\n end" ]
[ "0.7721764", "0.7633201", "0.76317674", "0.76065314", "0.75760347", "0.75513494", "0.75068873", "0.7484816", "0.7455574", "0.745028", "0.74380666", "0.7421378", "0.73614496", "0.73191535", "0.7318936", "0.7318936", "0.7318936", "0.7315924", "0.7311919", "0.73092216", "0.7294271", "0.7292124", "0.72897124", "0.727674", "0.7273055", "0.7273055", "0.7273055", "0.7273055", "0.7270166", "0.72559935", "0.7233927", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.72331494", "0.7233081", "0.7211885", "0.7192356", "0.71732736", "0.71732736", "0.71732736", "0.7170771", "0.7158278", "0.7141279", "0.70842445", "0.70711786", "0.706726", "0.70643896", "0.70391935", "0.700334", "0.69846225", "0.69694436", "0.6968081", "0.69648385", "0.6960666", "0.69524115", "0.69429076", "0.6941388", "0.69392645", "0.69281566", "0.6901795", "0.6888329", "0.6846095", "0.68384594", "0.6838019", "0.6822577", "0.6821858", "0.6817218", "0.6814498", "0.68108326", "0.67923254", "0.67883664", "0.6788209", "0.6786107", "0.67766386", "0.6769235", "0.6763418", "0.6760246", "0.6751365", "0.6751081", "0.67476207", "0.6746544", "0.6746198", "0.674109", "0.67341495" ]
0.0
-1
POST /products POST /products.json
def create @product = Product.new(name: product_params[:name], description: product_params[:description], product_type: product_params[:product_type], dimensions: product_params[:dimensions], weight: product_params[:weight], material: product_params[:material], product_code: product_params[:product_code], is_new_release: product_params[:is_new_release], collection_id: product_params[:collection_id], sub_collection_id: product_params[:sub_collection_id]) respond_to do |format| if product_params[:product_images_attributes] product_params[:product_images_attributes].each do |pia| @product_image = ProductImage.new(product_image: pia[:product_image], product_id: Product.last.id+1) if not @product_image.valid? format.html { render :new } format.json { render json: @product_image.errors, status: :unprocessable_entity } break end end end if @product.save # if product_params[:product_images_attributes] # product_params[:product_images_attributes].each do |pi| # @product.product_images.create(product_image: pi[:product_image]) # end # end format.html { redirect_to @product, notice: 'Product was successfully created.' } format.json { render :show, status: :created, location: @product } else format.html { render :new } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n price: product[:price],\n desc: product[:desc])\n if !@product.save\n render json: @product.errors.full_messages, status: 422\n end\n end\n render 'api/products/index'\n else\n @product = Product.new(product_params)\n if @product.save\n render 'api/products/show'\n else\n render json: @product.errors.full_messages, status: 422\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end", "def create\n newProduct = Product.new(products_params)\n if newProduct.save\n msg = { status: 201 , product: newProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end", "def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n product = Product.new(product_params)\n if product.save\n render json: ProductSerializer.new(product).serialized_json\n end\n end", "def create\n @product = Product.new(product_params)\n if @product.save\n render json: {id: @product.id}\n else\n render json: {msg: @product.errors.full_messages.first}, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.create(product_params)\n if @product.save\n # Respond to html with a redirect and json\n respond_to do |format|\n format.html do\n flash[:notice] = 'Product added'\n redirect_to products_path\n end\n format.json do\n render json: product.to_json\n end\n end\n else\n # Respond to html with a redirect and json\n respond_to do |format|\n format.html do\n flash.now[:error] = 'Error adding product'\n render :new\n end\n format.json do\n render json: { errors: @product.errors.full_messages }, status: 422\n end\n end\n end\n end", "def create\n @product = Product.new(product_params)\n @product.user = current_api_v1_user\n respond_to do |format|\n if @product.save\n params[:product][:properties].try(:each) do |k,v|\n @product.product_properties.create(property: Property.find(k), value: v)\n end\n params[:product][:colors].try(:each) do |c|\n @product.colors.create(name: c[:name].downcase, code: c[:code])\n end\n params[:product][:photos].try(:each) do |c|\n @product.photos.create(image: c)\n end\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product,\n :notice=> 'Product was successfully created.' }\n format.json { render :json=> @product, :status=> :created,\n :location=> @product }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end", "def create\n if @product.save\n render :show, status: :created, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_path, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t(:product_created) }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n return unless product_params\n render json: Product.create_product(\n @product_params,\n category_list,\n @current_user.id\n ).simple_info, status: :created\n rescue => e\n render json: { error: e }, status: :bad_request\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: products_url }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n current_user.user_info.products.push @product\n Shopify.create @product\n format.html { redirect_to :action => 'index' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end", "def create\n @product = Product.new(product_params)\n \n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n begin\n @api_v1_product = Product.create!(api_v1_product_params)\n\n json_response @api_v1_product, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n raise ActiveRecord::Rollback\n end\n end\n end", "def create\n\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product,\n notice: 'Product was successfully created.' }\n format.json { render :show, status: :created,\n location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def addProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.new(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id], picture_list: '[]')\n status = p.save\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def create\n @product = Product.new(params[:product])\n\n if @product.save\n \n respond_with(@product, :location=>products_url)\n else\n respond_with(@product, :head=>:bad_request)\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product }\n format.js { render status: :ok }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n format.js { render status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(product)\n validate_type!(product)\n\n attributes = sanitize(product)\n _, _, root = @client.post(\"/products\", attributes)\n\n Product.new(root[:data])\n end", "def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status: :bad_request\n return\n end\n\n @product = Product.find_by_name_and_size_id(product[:product], product[:size]) \n if @product.nil?\n # Handle case when order invalid products\n render json: \"\", status: :not_found\n return\n end \n total = total + @product.price * product[:quantity].to_f \n @order.orders_products << OrdersProduct.new(:product => @product, :hot => product[:hot], :quantity => product[:quantity]) \n end \n\n @order.total = total\n\n if @order.save\n render json: @order, status: :created, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.new(params[:product])\n @product.shop = Shop.find_by_uuid params[:shop_id]\n\n respond_to do |format|\n if @product.save!\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully created.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @product = Product.new\n\n render json: @product\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Продукт успешно создан.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_product = Admin::Product.new(admin_product_params)\n\n respond_to do |format|\n if @admin_product.save\n format.html { redirect_to admin_products_url }\n format.json { render :show, status: :created, location: @admin_product }\n else\n format.html { render :new }\n format.json { render json: @admin_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t('.message') }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to admin_products_url, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else # save fails due to validation error -> show errors\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = @person.products.build(params[:model])\n\n respond_to do |format|\n if @product.save\n format.json { render :json => @product, :status => :created}\n else\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Изделие успешно создано.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html {redirect_to @product, notice: 'Producto creado.'}\n format.json {render :show, status: :created, location: @product}\n\n else\n format.html {render :new}\n format.json {render json: @product.errors, status: :unprocessable_entity}\n end\n\n end\n end", "def create\n @add_product = AddProduct.new(params[:add_product])\n\n respond_to do |format|\n if @add_product.save\n format.html { redirect_to @add_product, notice: 'Add product was successfully created.' }\n format.json { render json: @add_product, status: :created, location: @add_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product].merge :user_id => current_user.id)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to root_url, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product\n @user = User.find_by(id: params['user'])\n products = params['products'].split(',')\n products.each do |product_id|\n @user.cart.products << Product.find_by(id: product_id)\n end \n render json: {data: @user.cart.products }\n end", "def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7674954", "0.7589692", "0.756074", "0.7531862", "0.7531213", "0.7507928", "0.7420413", "0.7391407", "0.7374718", "0.7355908", "0.73231804", "0.72869605", "0.7144144", "0.7050259", "0.7047559", "0.70415026", "0.7037288", "0.7037288", "0.7037288", "0.70322204", "0.70255643", "0.6992655", "0.69766444", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.69545984", "0.6945448", "0.6941314", "0.69375795", "0.69284433", "0.6927765", "0.6926225", "0.6924957", "0.68977845", "0.68903667", "0.6888921", "0.6884899", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.6881634", "0.68810374", "0.6880909", "0.6875918", "0.68446535", "0.68419653", "0.6827102", "0.6825376", "0.68205744", "0.6810749", "0.6810749", "0.6810749", "0.6810749", "0.6801166", "0.67984277", "0.67804384", "0.67599255", "0.6741211", "0.6736925", "0.6734706", "0.67305225", "0.6714831", "0.6688717", "0.66845196", "0.66810054", "0.6675035", "0.6662443", "0.66591614" ]
0.0
-1
PATCH/PUT /products/1 PATCH/PUT /products/1.json
def update respond_to do |format| if @product.update(product_params) # if product_params[:product_images_attributes] # product_params[:product_images_attributes].each do |pi| # # @product.product_images.create(product_image: pi[:product_image]) # product_image_aux = ProductImage.new(product_image: pi[:product_image], product: @product) # byebug # product_image_aux.save # end # end format.html { redirect_to @product, notice: 'Product was successfully updated.' } format.json { render :show, status: :ok, location: @product } else format.html { render :edit } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n updateProduct = Product.find_by_id(params[:id])\n updateProduct.update(products_params)\n if updateProduct != nil\n msg = { status: 200 , product: updateProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end", "def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.update!(@product_params)\n rescue => e\n render json: { error: e }, status: :ok\n end", "def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n head :no_content\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n @product.assign_attributes object_params.reject{|_, v| v.blank?}\n # In a normal app we have a pre filled form of the object to update,\n # so when we do a PATCH (or PUT) we send all the attributes again,\n # in the API we permit to send any field to update, so we need to remove\n # all the blank params of the object to prevent validations triggers of\n # attributes that we don't send to update\n if @product.save\n render json: @product.to_json\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "def update\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @record = Product.find(params[:id])\n @record.update_attributes(params[:product])\n \n respond_to do |format|\n format.json {\n render json: {}\n }\n end\n end", "def update\n respond_to do |format|\n if @product.update!(product_params)\n format.html { redirect_to products_url, notice: 'Product was successfully updated.' }\n format.json { render json: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: t(:product_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product,\n :notice=> 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n if @product.update_attributes(params[:product])\n respond_to do |format|\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\t\trespond_to do |format|\n\t\t if @product.update_attributes(params[:product])\n\t\t\tif @product.photo.nil?\n\t\t\t\tphoto = Photo.find_by_product_id(@product.id)\n\t\t\t\t@product.update_attributes(:photo_id => photo.id) if !photo.nil?\n\t\t\tend\n\t\t\tformat.html { redirect_to @product, :notice => 'Успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @product.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n end", "def update\n @product = Product.find(params[:id])\n @product.name_prefix = @product.name.first.upcase\n respond_to do |format|\n if @product.update_attributes(params[:product])\n\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to edit_product_path(@product), notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product.update(product_params)\n set_products\n end", "def update\n if @product.update(product_params)\n render :show, status: :ok, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n respond_to do |format|\n @product.edit\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to action: 'show', notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def update\n @product = Product.eager_loading.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully updated.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Find product by productID\n @product = Product.find_by(productID: params[:id])\n \n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to products_path, notice: 'Product has been updated.' }\n format.json { render :index, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @angular = Product.find(params[:id])\n \n @angular.update_attributes(title: params[:products][:title], description: params[:products][:description])\n respond_to do |format|\n if @angular.valid?\n format.html { redirect_to store_index_path, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @angular.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n if @product\n if @product.update(price: params[:price])\n render 'api/products/show'\n else\n render json: [\"Can only update price\"], status: 422\n end\n else\n render json: [\"Product not found\"], status: 422\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: t('.message') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n respond_to do |format|\n if @product1.update(product1_params)\n format.html { redirect_to @product1, notice: \"Product1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Your product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: t('update_success') }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_spec.update(product_spec_params)\n format.html { redirect_to @product_spec, notice: 'Product spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_spec }\n else\n format.html { render :edit }\n format.json { render json: @product_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:model])\n flash[:notice] = 'Product was successfully updated.'\n format.json { render :json=>nil }\n else\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7269931", "0.6935652", "0.68690825", "0.6846676", "0.68126076", "0.67678404", "0.6749974", "0.6741848", "0.67151767", "0.6700884", "0.6686023", "0.66597176", "0.6654553", "0.66536564", "0.664067", "0.664067", "0.66382414", "0.6631012", "0.6631012", "0.6627257", "0.6620688", "0.6603794", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6603763", "0.6602732", "0.65937763", "0.6593595", "0.6587338", "0.65602255", "0.6557081", "0.6557081", "0.6557081", "0.6557081", "0.6557081", "0.65562665", "0.6540051", "0.65274733", "0.6498262", "0.6490972", "0.6485979", "0.6477706", "0.6475468", "0.6473973", "0.6454957", "0.6453377", "0.6441549", "0.643574", "0.64351535", "0.642971", "0.64243215", "0.6420181", "0.6415268", "0.64094204", "0.64077", "0.6406827", "0.6405912", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632", "0.6403632" ]
0.0
-1
DELETE /products/1 DELETE /products/1.json
def destroy @product.destroy respond_to do |format| format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end", "def destroy\n @product.destroy\n render json: {}\n end", "def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end", "def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end", "def destroy\n product = Product.find(params[:id])\n product.destroy\n render json: {id: product.id}\n end", "def destroy\n @product = Product.find(params[:id])\n @product.delete!\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end", "def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n @api_v1_product.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\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 puts(\"you are in destroy \")\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n render json: {is_success: true, error_code: 200, message: \"Deleted Successfully\", result: @product}, status: 200\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to root_url(:item => 3), notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record = Product.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def deleteProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.destroy\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end", "def destroy\n @product1.destroy\n respond_to do |format|\n format.html { redirect_to product1s_url, notice: \"Product1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: t('destroy_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: t('.message') }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\nend", "def destroy \n @product = current_user.user_info.products.find(params[:id])\n Shopify.delete @product\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id]).delete\n respond_to do |format|\n if @product.delete\n format.html {redirect_to @product, notice: \"Product was successfully deleted.\" }\n else\n format.json {render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Your product was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shopifyproduct = Shopifyproduct.find(params[:id])\n @shopifyproduct.destroy\n\n respond_to do |format|\n format.html { redirect_to shopifyproducts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = @person.products.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.json { render :json=>true }\n end\n end", "def destroy\n #@product = Product.find(params[:id]) #하단에서 미리 선언\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(products_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n\n head :no_content\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Продукт успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n head :no_content\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: \"Product was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: \"Product was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: \"Product was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @prod = Prod.find(params[:id])\n @prod.destroy\n\n respond_to do |format|\n format.html { redirect_to prods_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7716767", "0.7593029", "0.7548404", "0.75026053", "0.7501899", "0.74741083", "0.7439505", "0.7417943", "0.74088925", "0.7370336", "0.73533446", "0.73478407", "0.73357344", "0.73357344", "0.73357344", "0.73308176", "0.73308176", "0.73308176", "0.73308176", "0.73308176", "0.73308176", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73131037", "0.73128766", "0.7298978", "0.72794706", "0.72660655", "0.72653663", "0.72591215", "0.7252877", "0.72510946", "0.7229449", "0.7225607", "0.7220503", "0.7214769", "0.7203778", "0.72025377", "0.72025377", "0.7202368", "0.7188758", "0.7188758", "0.7188758", "0.7185647", "0.7184467", "0.71706766", "0.7168625", "0.7157", "0.71518564", "0.714569", "0.7142502", "0.7135933", "0.7130445", "0.71281785", "0.7125609", "0.7125322", "0.7111335", "0.7109879", "0.7078997", "0.7078997", "0.7078997", "0.70781606" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_product @product = Product.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def 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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def product_params params.require(:product).permit(:name, :description, :product_type, :dimensions, :weight, :material, :product_code, :is_new_release, :collection, :collection_id, :sub_collection, :sub_collection_id, product_images_attributes: [:product_image, :product, :product_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
TODO: Need to test this!
def build(nested_params, name, options, &block) klass_name = name.to_s.split('_').collect(&:capitalize).join name_symbol = name.to_sym Class.new(nested_params).tap do |klass| @parent.send(:remove_const, klass_name) if @parent.const_defined?(klass_name) @parent.const_set(klass_name, klass) klass.instance_eval <<-DEF def parent_class #{@parent} end def name_symbol :#{name_symbol} end DEF klass.class_eval('extend ActiveModel::Naming') klass.class_eval(&block) klass.class_eval("self.options = #{options}") if klass.parent_class.using_rails_helpers? klass.instance_eval("with_rails_helpers") end # define a _destroy param (Boolean, default: false) if klass.using_rails_helpers? klass.send(:define_attribute, :_destroy, {type: :boolean, default: false}) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def weber; end", "def implementation; end", "def implementation; end", "def identify; end", "def spec; end", "def spec; end", "def sitemaps; end", "def from; end", "def from; end", "def from; end", "def from; end", "def custom; end", "def custom; end", "def formation; end", "def terpene; end", "def berlioz; end", "def suivre; end", "def operations; end", "def operations; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def stderrs; end", "def who_we_are\r\n end", "def verdi; end", "def internal; end", "def intensifier; end", "def wrapper; end", "def offences_by; end", "def strategy; end", "def reflector; end", "def reflector; end", "def isolated; end", "def isolated; end", "def original_result; end", "def internship_passed; end", "def init; end", "def init; end", "def init; end", "def init; end", "def loc; end", "def loc; end", "def loc; end", "def used?; end", "def villian; end", "def trd; end", "def initialize\n\n end", "def initialize\n\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 r; end", "def r; end", "def returns; end", "def anchored; 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 setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end" ]
[ "0.7605122", "0.65433544", "0.65433544", "0.65433544", "0.65433544", "0.6514919", "0.63611645", "0.60728747", "0.605367", "0.60287654", "0.60287654", "0.60279983", "0.5926429", "0.5926429", "0.58493704", "0.5841001", "0.5841001", "0.5841001", "0.5841001", "0.5787723", "0.5787723", "0.5778111", "0.57584906", "0.5740339", "0.57380015", "0.57276684", "0.57276684", "0.5718668", "0.5718668", "0.5718668", "0.5718668", "0.5718668", "0.5718668", "0.5718668", "0.5718668", "0.5718668", "0.5714775", "0.57105523", "0.57028687", "0.5691227", "0.56868494", "0.5680052", "0.56768584", "0.5637831", "0.56374365", "0.56374365", "0.56193954", "0.56193954", "0.56171376", "0.5602392", "0.5593024", "0.5593024", "0.5593024", "0.5593024", "0.55720776", "0.55720776", "0.55720776", "0.55458945", "0.55342996", "0.5512374", "0.5494635", "0.5494635", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5485326", "0.5484276", "0.5484276", "0.548383", "0.54823244", "0.5472984", "0.5472984", "0.5472984", "0.5472984", "0.5472984", "0.5472984", "0.5472984", "0.5472984", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783", "0.5443783" ]
0.0
-1
bookings made on my rooms
def your_reservations @rooms = current_user.rooms @reservations = Reservation.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_room(type, number)\n select_room_flag = false\n @rooms.each_with_index do |room, i|\n if room[:type].downcase == type.downcase\n select_room_flag = true\n if room[:avilable].to_i < (room[:booked].to_i + number.to_i)\n puts \"Sorry we have only #{room[:avilable].to_i - room[:booked].to_i} room/s avilavle for the room type #{room[:type]}\"\n else\n puts \"Congratulation we have sccesfully booked #{number} #{room[:type]} for you\"\n @rooms[i][:booked] = room[:booked].to_i + number.to_i\n end\n end\n end\n puts \"Sorry Please enter the correct room type\" if select_room_flag === false\n end", "def add_bookings!(bookings, user, date)\n grid.unfilled.each do |empty|\n grid.fill(empty.slot.from, empty.slot.court_id, select_booking(bookings, user, date, empty.slot))\n end\n end", "def assign_room\n total_rooms, available_rooms = [], []\n room_type = RoomType.find(self.room_type_id)\n total_rooms = room_type.rooms.pluck(:id)\n booked_rooms = Booking.where('(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', self.start_date, self.end_date, self.start_date, self.end_date).pluck(:room_id)\n available_rooms = total_rooms - booked_rooms\n self.update_column(:room_id, available_rooms.first)\n end", "def create\n @booking = Booking.new(booking_params)\n Room.where(:room_type_id => @booking.room_type_id).each do |room| \n @booking.room = room \n if (Booking.overlapping(@booking)).size == 0\n respond_to do |format|\n if @booking.save\n format.html {\n redirect_to \"/bookings/#{@booking.id}/payment\", notice: 'Booking was successfully created.' \n return;\n }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { \n render :new \n return\n }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end\n \n end\n\n end", "def booking(room, params)\n if @browser.element(css: '#ajaxRoomList > div.listDiv.initialized > table > tbody > tr:nth-child(' + room.to_s + ')').present?\n @browser.element(css: '#ajaxRoomList > div.listDiv.initialized > table > tbody > tr:nth-child(' + room.to_s + ')').click\n else\n @browser.element(css: '#ajaxRoomList > div:nth-child(2) > div.PageSelectorControls > div.imgNextArrow').click\n room = room.to_i - 30\n @browser.element(css: '#ajaxRoomList > div.listDiv.initialized > table > tbody > tr:nth-child(' + room.to_s + ')').click\n end\n @browser.select_list(:id, 'cboDuration').select(params[:duration].to_s)\n @browser.element(css: '#btnAnyDate').click\n BookRoom.search_day(@browser, params[:day], BookRoom.search_month(@browser, params[:month]))\n page_html = ScraperModule.parse_html(@browser)\n i = 1\n acum = 1\n while i < 29\n date = page_html.xpath('//*[@id=\"roomavailability\"]/div/div/div[2]/table/tbody/tr[' + i.to_s + ']/td[1]').text\n if page_html.at_css('#roomavailability > div > div > div.listDiv.initialized.RoomAvailabilityList.NoPadding.NoEntityType.TableLayoutAuto > table > tbody > tr:nth-child(' + i.to_s + ') > td:nth-child(2) > input')\n puts i.to_s + ') ' + date.to_s + ' >> Room is available'\n @time[i.to_s] = @browser.element(css: '#roomavailability > div > div > div.listDiv.initialized.RoomAvailabilityList.NoPadding.NoEntityType.TableLayoutAuto > table > tbody > tr:nth-child(' + i.to_s + ') > td:nth-child(2) > input')\n else\n puts i.to_s + ') ' + date.to_s + ' >> Room is unavailable'\n acum += 1\n end\n i += 1\n end\n if acum == 28\n return false\n else\n return true\n end\n end", "def bookings()\n sql = \"SELECT bookings.*\n FROM bookings\n WHERE bookings.schedule_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql,values)\n bookings = Booking.map_items(result)\n return bookings\n end", "def room_index\n @bookings = @room.bookings.where.not('is_canceled').order(start_date: :asc)\n end", "def index\n @room_bookings = RoomBooking.all\n end", "def make_booking!(start_time, end_time)\n starthour = Time.parse(start_time).strftime(\"%k:%M\")\n endhour = Time.parse(end_time).strftime(\"%k:%M\")\n startmonth = Time.parse(start_time).strftime(\"%B\" )\n endmonth = Time.parse(end_time).strftime(\"%B\")\n startday = Time.parse(start_time).strftime(\"%d\")\n endday = Time.parse(end_time).strftime(\"%d\")\n \n if is_available?(start_time, end_time)\n @parking_space[:bookings].push({start_time: start_time, end_time: end_time})\n puts \"Your parking has been booked for €#{calculate_price(start_time, end_time)}\"\n else\n if days_between(start_time, end_time) == 0\n puts \"There are no spaces available on #{startday}#{ordinal(startday)} #{startmonth} from #{starthour} to #{endhour}.\"\n else \n puts \"There are no spaces available from #{startday}#{ordinal(startday)}, #{startmonth} - #{endday}#{ordinal(endday)}, #{endhour}.\"\n end\n end\n\n puts \"\"\nend", "def available_rooms\n @booking = current_user.bookings.new(booking_params)\n @hotel_rooms = @hotel_category.hotel_rooms.available_rooms(params[:booking][:check_in], params[:booking][:check_out])\n end", "def booked_room\n start_date = Date.parse(params[:start_date])\n end_date = Date.parse(params[:end_date])\n (start_date..end_date).each do |date|\n booked_room = BookingStatus.new(\n start_date: date,\n user_id: current_user.id,\n room_id: params[:room_id]\n )\n\n booked_room.save\n end\n end", "def show\n @bookings = Booking.all\n @rooms = Room.all\n end", "def show\n @booking = @boat.bookings.build(user: current_user)\n @booking.start_time = Time.zone.tomorrow + 9.hours\n @booking.end_time = Time.zone.tomorrow + 18.hours\n @booking.people_on_board = 1\n #TODO disable also booked(accepted) days\n end", "def all_bookings\n Booking.none\n end", "def create\n invalid_booking = false\n duration = params[:booking][:duration].to_i\n quantity = params[:booking][:quantity].to_i\n bk_day = params[:booking][:booking_day]\n bk_day = Date.strptime(bk_day, '%Y-%m-%d')\n last_day = bk_day + duration.days\n room = params[:booking][:room_id]\n @bookings = []\n @availability_update = []\n\n #Check Availability for room on each day and given quantity.\n #If all available for all days, create bookings and save.\n #Reduce Availability quantity for each day.\n\n (bk_day..last_day).each {|day|\n available = Availability.where(available_day:day).where(room_id:room).where(\"quantity>?\",quantity).first\n\n if available\n #build on params and given date.\n #then add to array of bookings/\n @booking = current_user.bookings.build(booking_params)\n @booking.booking_day = day\n @bookings << @booking\n available.quantity = available.quantity - quantity\n @availability_update << available\n else\n invalid_booking = true\n break\n end\n }\n\n if !invalid_booking\n @bookings.each(&:save!)\n @availability_update.each(&:save!)\n render :json => current_user.bookings, status: :created\n else\n puts 'invalid booking'\n render :json => current_user.bookings, status: :unprocessable_entity\n end\n\n end", "def create\n\n @booking = Booking.new(booking_params)\n @room = Room.where(\"roomno = ?\", @booking.roomno)\n if @room.nil? or @room.empty?\n flash[:notice] = \"Room not found !\"\n render 'bookings/new' and return\n end\n if current_user.usertype != \"Admin\" and current_user.usertype != 'Super Admin'\n @user = User.where(\"email LIKE ?\", @booking.booked_user)\n else\n @user = User.where(\"email LIKE ?\", @booking.booked_user)\n if @user.nil? or @user.empty?\n flash[:notice] = \"User not found !\"\n render 'bookings/new' and return\n end\n end\n if @booking.starttime.past?\n flash[:notice] = \"You cannot book for the day before today !\"\n render 'bookings/new' and return\n end\n if (@booking.starttime-7.days).future?\n flash[:notice] = \"You cannot book for a day i.e 7 days after today !\"\n render 'bookings/new' and return\n end\n @current_bookings = Booking.where(\"roomno = ? and ? <= endtime and starttime <= ? \", @booking.roomno,\n @booking.starttime, @booking.endtime)\n if not @current_bookings.nil? and not @current_bookings.empty?\n puts @current_bookings.first.starttime\n puts @current_bookings.first.roomno\n flash[:notice] = \"This room is not available at this time. There is another booking which starts at #{@current_bookings.first.starttime} \"\n render 'bookings/new' and return\n end\n if @booking.starttime > @booking.endtime\n flash[:notice] = \"Booking start time can't be greater than end time\"\n render 'bookings/new' and return\n end\n\n if @booking.starttime + 2.hours < @booking.endtime\n flash[:notice] = \"Booking can be made only for 2 hours at a time\"\n render 'bookings/new' and return\n end\n @booking.room_id = @room.first.id\n @booking.user_id = @user.first.id\n flash[:notice] = \"#{@booking.user_id}\"\n @newroom = Room.find(@booking.room_id)\n BookingMailer.booking_email(@booking.starttime,@booking.endtime,@booking.booked_user,@booking.roomno,@newroom.building).deliver_now!\n emails=params[:emails]\n values=emails.split(\",\")\n values.each do |value|\n BookingMailer.booking_email(@booking.starttime,@booking.endtime,value,@booking.roomno,@newroom.building).deliver_now!\n end\n respond_to do |format|\n\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def set_bookings\n @bookings = Campground.find(params[:campground_id]).bookings\n end", "def add_booking(gymclass)\n numofbookings = gymclass.count_num_of_bookings()\n if gymclass.check_space(numofbookings) == true\n save()\n else\n return \"We can't book it!\"\n end\n end", "def bookings()\n sql = \"SELECT * FROM bookings WHERE bookings.gymclass_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|booking| Booking.new(booking)}\n end", "def create\n puts params[:date]\n @room = Room.find(params[:id])\n respond_to do |format|\n if @room.histories.create(user: current_user, created_at: Time.now, date: params[:date], slot: params[:slot])\n # @room.histories.update_attribute(date:, para)\n @room.update(status: \"Booked\")\n ###Send email functionality\n UserNotifierMailer.send_signup_email(current_user.email).deliver\n #@emails = params[\"booking\"][\"members\"].split(',')\n format.html { redirect_to @room, notice: 'Room Booked Successfully!!' }\n else\n format.html { render @room, notice: 'Unable to Room' }\n end\n end\n end", "def find_booked(date)\n rooms_booked = []\n @reservations.each do |reservation|\n if reservation.reservation_date_range.start_date == date.start_date && reservation.reservation_date_range.end_date == date.end_date\n rooms_booked << reservation\n end\n end\n return rooms_booked\n end", "def book_it\n unclaimed_reservation = rooms_available\n \n unclaimed_reservation.first.change_block_status\n \n return unclaimed_reservation.first\n end", "def list_reserved_rooms\n unless @rooms.empty?\n @rooms.each do |key, room|\n puts room.report_lister\n end\n end\n end", "def book_rooms\n @room_category= RoomCategory.all\n end", "def show\n Time.use_zone(@meetingroom.location.timezone) do\n @bookings = @meetingroom.bookings.where(\"ending >= ?\", Time.now.in_time_zone(@meetingroom.location.timezone)).order(\"starting asc\").all\n end\n end", "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "def create\n @booking = Booking.new(booking_params)\n @current_room_bookings = Booking.where('room_id=?', @booking.room_id);\n overlap = false;\n @current_room_bookings.each do |old_booking|\n endTime = old_booking.booking_start_time + 2*60*60;\n currentEndTime = @booking.booking_start_time + 2*60*60;\n if(@booking.booking_start_time...currentEndTime).overlaps?(old_booking.booking_start_time...endTime)\n respond_to do |format|\n format.html { redirect_to new_booking_path, notice: \"Booking for that time slot already exists!\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n overlap = true;\n break;\n end\n end\n if(!overlap)\n respond_to do |format|\n if @booking.save\n format.html { redirect_to home_path, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking}\n UserMailer.welcome_email(@booking).deliver!\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def index\n @bookings = @hairdresser.bookings\n end", "def availability_of_room\n room_type = RoomType.find(self.room_type_id) rescue nil\n errors.add(:room_type_id, \"Pleass select room type\") if room_type.blank?\n return if room_type.blank?\n total_rooms = room_type.rooms.pluck(:id)\n booked_rooms = Booking.where('(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', self.start_date, self.end_date, self.start_date, self.end_date).pluck(:room_id)\n available_rooms = total_rooms - booked_rooms\n errors.add(:start_date, \"unavailable for given time period\") if available_rooms.count == 0\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend", "def create\n @status = \"Booked\"\n @status_notice = 'booking was successfully created.'\n @bookings = Booking.where(:conference_room_id => params[:conference_room_id])\n @bookings.each do |booking| \n if (booking.start_time..booking.end_time).cover?(params[:booking][:start_time]) || (booking.start_time..booking.end_time).cover?(params[:booking][:end_time]) || (params[:booking][:start_time]..params[:booking][:end_time]).cover?(booking.start_time) || (params[:booking][:start_time]..params[:booking][:end_time]).cover?(booking.end_time)\n @status = \"Pending\"\n @status_notice = \"Sorry, Your requested slot is already Booked. so your requestis Pending state.\"\n end\n end\n\n respond_to do |format|\n if params[:booking][:start_time].to_date.wday == 0 || params[:booking][:end_time].to_date.wday == 0 || params[:booking][:start_time].to_date.wday == 6 || params[:booking][:end_time].to_date.wday == 6\n format.html { redirect_to portal_conference_room_bookings_url, alert: 'Sorry!, Bookings are not allowed on Weekend.' }\n else \n if Time.now < params[:booking][:start_time] && params[:booking][:start_time] < params[:booking][:end_time]\n @booking = Booking.new(:conference_room_id => params[:conference_room_id], :status => @status, :user_id => current_user.id, :start_time => params[:booking][:start_time], :end_time => params[:booking][:end_time], :created_at => Time.now)\n if @booking.save!\n \n @user = User.find(@booking.user_id)\n if @status == \"Booked\"\n ExampleMailer.booking_email(@user, @booking).deliver\n elsif @status == \"Pending\"\n ExampleMailer.pending_email(@user, @booking).deliver\n end\n\n format.html { redirect_to portal_conference_room_bookings_url, notice: @status_notice }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to portal_conference_room_bookings_url, alert: 'Please Book Conference Room for future date.' }\n end \n end\n end\n end", "def book_tickets\n ask_for_show_number\n if show_number_valid? \n ask_for_seat_numbers \n book_seats_if_available\n else\n print_show_number_error\n end \n end", "def overlap(existing_reservations)\n booked_rooms = []\n existing_reservations.each do |reservation|\n if @check_out >= reservation.check_in && @check_out < reservation.check_out ||\n @check_in >= reservation.check_in && @check_in < reservation.check_out ||\n @check_in > reservation.check_in && @check_out < reservation.check_out\n if reservation.class == BookingSystem::Block\n reservation.avail_block_rooms.map { |block_room_num| booked_rooms << block_room_num }\n else\n booked_rooms << reservation.room_num\n end\n end\n end\n return booked_rooms\n end", "def booked?\n if self.appointments.count == 0\n return false # It is not booked.\n elsif self.appointments.count == 2\n return true # It is booked.\n elsif self.appointments.count == 1 and !self.appointments.last.closed?\n return false # It is not booked.\n else\n return true # It is booked.\n end\n end", "def booked_in\n message = I18n.t('notify.booking.booked_in', course_name: booking.course.name, booker: booking.booker.name)\n BookingMailer.delay.booking_confirmation_to_non_chalkler(booking)\n Chalkler.invite!({email: booking.pseudo_chalkler_email, name: booking.name}, booking.booker) if booking.invite_chalkler\n end", "def get_bookings\n hotel_id = params[\"id\"]\n number_of_adults1 = params[\"number_of_adults1\"] || \"1\"\n child_ages1 = params[\"child_ages1\"] || \"\"\n @room_info1 = number_of_adults1.to_s + ',' + child_ages1.to_s\n number_of_adults2 = params[\"number_of_adults2\"] || \"1\"\n child_ages2 = params[\"child_ages2\"] || \"\"\n @room_info2 = number_of_adults2.to_s + ',' + child_ages2.to_s\n\n params[\"room_info1\"] = @room_info1\n params[\"room_info2\"] = @room_info2\n\n booking_hotel_response = hotel_service.get_bookings(params)\n service_reponse = process_response(booking_hotel_response, 'HotelRoomAvailabilityResponse')\n if service_reponse[\"status\"] == OK\n response = JSON.parse(service_reponse[\"response\"])\n bookings = response[\"HotelRoomAvailabilityResponse\"]\n @book_info = response[\"HotelRoomAvailabilityResponse\"]\n @hotel_info = {\"hotelId\" => hotel_id}\n @hotel_amenities = response[\"HotelRoomAvailabilityResponse\"][\"PropertyAmenities\"]\n\n if bookings[\"@size\"].to_i == 1 && !@book_info.nil?\n @rooms = []\n room_image = bookings[\"HotelRoomResponse\"][\"RoomImages\"]\n unless room_image.nil?\n if room_image[\"@size\"].to_i == 1\n bookings[\"HotelRoomResponse\"][\"image_urls\"] = []\n bookings[\"HotelRoomResponse\"][\"image_urls\"] << room_image[\"RoomImage\"][\"url\"]\n elsif room_image[\"@size\"] > 1\n bookings[\"HotelRoomResponse\"][\"image_urls\"] = []\n room_image[\"RoomImage\"].each do |url|\n bookings[\"HotelRoomResponse\"][\"image_urls\"] << url\n end\n end\n end\n @rooms << bookings[\"HotelRoomResponse\"]\n elsif bookings[\"@size\"].to_i > 1 && !@book_info.nil?\n bookings[\"HotelRoomResponse\"].each do |room|\n room_image = room[\"RoomImages\"]\n room[\"image_urls\"] = []\n unless room_image.nil?\n if room_image[\"@size\"].to_i == 1\n room[\"image_urls\"] = []\n room[\"image_urls\"] << room_image[\"RoomImage\"][\"url\"]\n elsif room_image[\"@size\"] > 1\n room[\"image_urls\"] = []\n room_image[\"RoomImage\"].each do |url|\n room[\"image_urls\"] << url\n end\n end\n end\n end\n @rooms = bookings[\"HotelRoomResponse\"]\n else\n @rooms = []\n @book_info = nil\n end\n\n ## get Payment Types\n locale = params[\"locale\"] || 'en_US'\n currencyCode = params[\"currencyCode\"] || DEFAUL_CURRENCY\n payment_types_reponse = hotel_service.get_payment_types(locale, currencyCode)\n service_reponse = process_response(payment_types_reponse, 'HotelPaymentResponse')\n\n respond_to do |format|\n format.html # get_bookings.html.erb\n format.xml { render :xml => @bookings }\n end\n else\n ##TODO: handle Errors here\n @error = service_reponse[\"error\"]\n respond_to do |format|\n format.html { render :template => \"shared/error\"}\n format.json { render :json => @error }\n end\n end\n end", "def index\n @bookings = current_user.bookings\n end", "def bookings_requested\n # select * from bookings where patient_id = current_user.id\n @bookings_requested = current_user.bookings\n end", "def index\n @bookings = @user.bookings\n end", "def create\n @booking = Booking.new(booking_params)\n @tour = Tour.find(booking_params[:tour_id])\n @booking_waitlisted = Booking.new(booking_params)\n if (@tour.seats.to_i >= booking_params[:seats_booked].to_i)\n seats = @tour.seats.to_i - booking_params[:seats_booked].to_i\n @tour.seats = seats\n @tour.save\n @booking.status = 1\n else\n if (booking_params[:preference] == \"Book available seats\" && @tour.seats.to_i > 0)\n @booking.seats_booked = @tour.seats\n seats = 0\n @tour.seats = seats\n @tour.save\n @booking.status = 1\n elsif (booking_params[:preference] == \"Book Available seats and add remaining to waitlist\")\n @booking.seats_booked = @tour.seats\n @tour.seats = 0\n @tour.save\n @booking.status = 1\n\n # to handle waitlist seats\n @booking_waitlisted.seats_booked = @booking_waitlisted.seats_booked - @booking.seats_booked\n @booking_waitlisted.status = 0\n @booking_waitlisted.save\n elsif (booking_params[:preference] == \"Book only if all seats are available\")\n @booking.status = 0\n end\n end\n respond_to do |format|\n if @booking.save\n format.html { redirect_to bookings_url, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = Booking.all\n end", "def create\n check = 0\n @booking_history = BookingHistory.new(booking_history_params)\n # @booked_list = BookingHistory.all\n #@booked_entry = @booked_list.select do |bh|\n # bh.room_num == @booking_history.room_num && bh.date == Date.today + 7.days\n #end\n @room_details = LibraryRoom.find_by_number(@booking_history.room_num)\n @booking_history.building = @room_details.building\n @booking_history.size = @room_details.size\n @booked_entry = BookingHistory.where(\"room_num = ? AND date = ?\",@booking_history.room_num,@booking_history.date ).order(:start_t)\n\n @booked_entry.each do |entry|\n if entry != nil\n then\n\n if (((@booking_history.end_t <= entry.start_t)\\\n || (@booking_history.start_t >= entry.end_t))\\\n && ((@booking_history.start_t == @booking_history.end_t - 1) || (@booking_history.start_t == @booking_history.end_t - 2 )))\n then\n check = 0\n else\n check = 1\n end\n end\n end\n\n\n\n respond_to do |format|\n if check ==0\n if (@booking_history.save)\n flash[:notice] = \"Booking was successfully created. Booking id #{@booking_history.id}\"\n format.html { redirect_to booking_histories_path}\n # format.json { render :show, status: :created, location: @booking_history }\n else\n flash[:notice] = \"Booking was failed. Booking id #{@booking_history.id}\"\n format.html { redirect_to booking_histories_path }\n # format.json { render json: @booking_history.errors, status: :unprocessable_entity }\n end\n else\n if((@booking_history.start_t == @booking_history.end_t - 1) || (@booking_history.start_t == @booking_history.end_t - 2 ))\n flash[:notice] = \"Cannot book for more than 2 hours\"\n else\n flash[:notice] = \"Booking failed due to time conflict. Booking id #{@booking_history.id}\"\n end\n format.html { redirect_to booking_histories_path }\n end\n\n end\n end", "def chalkler_bookings\n h = Hash.new {|h, c| h[c] = @booking_set.bookings.select{|b| b.chalkler == c } }\n @booking_set.bookings.collect(&:chalkler).uniq.compact.map {|c| h[c] }\n h\n end", "def available_rooms\n available_rooms = reservations.select do |reservation|\n reservation.status == :HOLD\n end\n \n return available_rooms\n end", "def checkIfBooked\n booking_start_time = Time.parse(get_booking[\"date\"].to_s)\n hours_booked = get_booking[\"hours_booked\"].to_i\n booking_stop_time = booking_start_time + (3600 * hours_booked)\n dates_booked = get_tutor[\"dates_booked\"]\n lesson_block = 14400\n bookings_array = []\n dates_booked.each do |date|\n start_time = Time.parse(date[\"date\"].to_s)\n stop_time = start_time + lesson_block\n if(booking_start_time >= start_time && booking_start_time <= stop_time)\n bookings_array.push(date)\n elsif(start_time >= booking_start_time && start_time <= booking_stop_time)\n bookings_array.push(date)\n end\n \n end\n if(bookings_array.length >= 1)\n return true\n else\n return false\n end\n end", "def past\n @bookings = Booking.completed(current_user)\n end", "def show\n @booking_history = BookingHistory.find(params[:room_num])\n end", "def create\n # Check for dates/times overlapping\n puts current_user[:id], \"CURRENT USER\"\n overlap = Booking.where('end_date > ? AND start_date < ?', booking_params[:start_date], booking_params[:end_date])\n\n # If room is free, create booking\n if overlap.length.zero? \n booking = Booking.create!(booking_params)\n render json: { status: 'SUCCESS', message: 'Booking created', data: booking }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Cannot create booking, date already booked' }, status: :unprocessable_entity\n end\n end", "def show_booking_screen\n @arrival_date = params[\"arrival_date\"] || \"12/25/2012\" \n @departure_date = params[\"departure_date\"] || \"12/30/2012\"\n rooms = JSON.parse(params[\"rooms\"])\n params[\"number_of_rooms\"] = rooms.size\n room_info1 = params[\"room_info1\"]\n room_info2 = params[\"room_info2\"]\n room_detail = JSON.parse(params[\"room_detail\"])\n hotel_id = params[\"id\"]\n # reconvert into hash\n @room = JSON.parse(params[\"room\"])\n @money_sign = params[\"money_sign\"]\n @room_detail = room_detail[\"descriptionLong\"].to_s\n @room_detail_short = room_detail[\"description\"].to_s\n @cancellationPolicy = params[\"cancellation_policy\"].to_s\n book_room = JSON.parse(params[\"book_info\"])\n @number_of_rooms = rooms.size\n @noti_fee = book_room[\"checkInInstructions\"]\n @hotel_name = book_room[\"hotelName\"]\n @hotel_id = book_room[\"hotelId\"]\n @room_info = params[\"room_info\"]\n @hotel_rating = params[\"hotel_rating\"]\n @address = params[\"address\"]\n @city = params[\"city\"]\n @stateProvinceCode = params[\"stateProvinceCode\"]\n @countryCode = params[\"countryCode\"]\n @bed_types = hotel_service.get_bed_type(@room[\"BedTypes\"])\n @smoking_preferences = SMOKING_PREFERRNCES\n @credit_card_types = CREDIT_CARD_TYPES\n @check_in_time = params[\"check_in_time\"]\n @check_out_time = params[\"check_out_time\"]\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def set_room_booking\n @room_booking = RoomBooking.find(params[:id])\n end", "def index\n @bookings = current_user.coach_bookings\n @future_bookings = @bookings.booked.where(\"start_time > ?\", Time.now).order(:start_time)\n @past_bookings = @bookings.booked.where(\"end_time < ?\", Time.now).order(start_time: :DESC)\n @booking = Booking.new\n @review = Review.new\n end", "def book(booking)\n @booking = booking\n\n mail(from: \"#{@booking.user.first_name} via Lovely Hood <contact@lovely-hood.com>\", to: @booking.offer.user.email, bcc: \"edward.schults@gmail.com\", subject: \"Félicitations ! Vous avez une demande de réservation ! \")\n end", "def set_room_booking\n @room_booking = RoomBooking.find(params[:id])\n end", "def index\n # @bookings = Booking.all\n @booking = Booking.new\n @room = Room.new\n @rooms = Room.all\n @selected_date = DateTime.now\n @bookings = Booking.where(:start_time => @selected_date.beginning_of_day..@selected_date.end_of_day)\n @timeNow = Time.now\n @startTime = @timeNow.beginning_of_day() + (8*60*60)\n @endTime = @timeNow.beginning_of_day() + (18*60*60)\n\n end", "def set_booking\n @booking = @hairdresser.bookings.find(params[:id])\n end", "def is_slot_alloted?\n\t\tif self.company.bookings.find_by_date_of_booking(self.date_of_booking)\n\t\t\tif self.new_record?\n\t\t\t\tdays_booking = self.company.bookings.where(date_of_booking: self.date_of_booking)\n\t\t\telse\n\t\t\t\tdays_booking = self.company.bookings.where(date_of_booking: self.date_of_booking).where.not(id: self.id)\n\t\t\tend\n\t\t\tdays_booking.each do |x|\n\t\t\t\tunless x.slot != self.slot\n\t\t\t\t\tself.errors[:allocated_slot] << \"=> This slot is already alloted\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def create\n @tool = Tool.friendly.find(params[:tool_id])\n @booking = @tool.bookings.build(booking_params)\n if @booking.save\n cont = 0 #this variable and the following loop have the same purpose that in 'avaiable' method\n @tool.bookings.where('end_date >= ? AND confirmed = ? AND lab_id = ?', Time.now, true, @booking.lab_id).each do |b| # for simplify the procedure, the system check only reservations that are already confirmed\n if (@booking.start_date..@booking.end_date).overlaps?(b.start_date..b.end_date)\n cont = cont + b.quantity\n end\n end\n cont = cont + @booking.quantity\n quantity_tool = @tool.labs_tools.where(\"lab_id = ?\", @booking.lab_id).first.quantity\n if cont > quantity_tool\n max = quantity_tool - cont + @booking.quantity\n if max == 1\n flash[:danger]=\"#{t('.looking')} #{max} #{t('bookings.avaiable.tool')}\"\n else\n flash[:danger]=\"#{t('.lookings')} #{max} #{t('bookings.avaiable.tools')}\"\n end\n @booking.destroy\n redirect_to tool_path(@tool)\n else #if the booking are not in conflict with other confirmated resarvations, the system create a new booking entity\n\n BookingControlJob.set(wait_until: @booking.start_date.to_datetime).perform_later(@booking) #if the booking are not confirmed before the start date, is unuseful store it in the database\n if @tool.fast_booking == true\n flash[:success]=t('.fast_booking_true')\n @booking.confirmed = true\n @booking.save\n LabMailer.new_booking(@booking).deliver_now #this email notify at the prof that his booking was confirmed\n ProfMailer.confirmed_booking(@booking.prof, @booking).deliver_later\n else\n flash[:success]=t('.fast_booking_false')\n AdminMailer.with(booking: @booking, prof: @booking.prof).new_booking.deliver_later #this email notify at the admin that a new booking was created\n end\n redirect_to tool_path(@tool)\n end\n else\n flash[:danger] = @booking.errors.full_messages\n redirect_to tool_path(@tool)\n end\n end", "def rooms_around(room)\n # Get the person's rooms in alphabetical order\n rooms = memberships.unarchived.alpha\n\n # If there are 5 or fewer we don't need to do anything fancy\n return rooms if rooms.length <= 5\n\n # Get the index for the current room\n room_idx = rooms.index(Membership.joining(self,room).first)\n\n # By default, show two rooms on either side\n lower = room_idx-2 < 0 ? 0 : room_idx-2\n upper = room_idx+2 > rooms.length-1 ? rooms.length-1 : room_idx+2\n\n # If this room is near the bottom of the list, fill in from the top\n if lower < 2\n upper += 2-lower\n rooms = rooms[lower..upper][0,5]\n\n # If this room is near the top of the list, fill in from the bottom\n elsif rooms.length-upper < 2\n lower -= rooms.length-upper+1\n logger.debug(\"__NOW__ LENGTH: #{rooms.length}, LOWER: #{lower}, UPPER: #{upper}, IDX: #{room_idx}\")\n rooms = rooms[lower..upper][-5,5]\n\n # No need to fill, just show that subset\n else\n rooms = rooms[lower..upper]\n end\n\n rooms\n end", "def show\n if !@booking.present?\n @booking = @item.bookings.new\n end\n end", "def available_rooms(check_in, check_out)\n check_in = Date.parse(check_in)\n check_out = Date.parse(check_out)\n\n if check_in == check_out\n booking_dates = [check_in]\n else\n booking_dates = (check_in..check_out).to_a\n end\n\n # returns a list of all rooms, if no reservations have been made\n return rooms if reservations.empty?\n\n available = []\n availability = \"yes\"\n\n # searches through each room's reservation dates and if they don't include\n # any of the dates being inquired about adds the room to the available\n # list\n rooms.each do |room|\n room.reservations.each do |reservation|\n reservation.all_dates.each do |date|\n availability = \"no\" if booking_dates.include?(date)\n end\n end\n available << room if availability == \"yes\"\n availability = \"yes\"\n end\n\n return available\n end", "def set_booking\n #@booking = Booking.find(params[:id])\n #@booking = Booking.using(CURRENT_LOCATION.to_sym).find(params[:id])\n @booking = Booking.using(get_random_location.to_sym).find(params[:id])\n end", "def available_time_slot date_of_booking\n\t\tif date_of_booking.gsub(/[-]+/,\"\").to_i != Time.zone.now.strftime(\"%Y%m%d\").to_i\n\t\t\tresource_slot = self.timeslots\n\t\t\tif self.bookings.where(date_of_booking:date_of_booking).where(status:1)\n\t\t\t\tbookings_of_day = self.bookings.where(date_of_booking: date_of_booking).where(status:1)\n\t\t\t\tbookings_of_day.each do |x|\n\t\t\t\t\tresource_slot.delete_at(x.slot)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tresource_slot = next_time_slots\n\t\tend\n\t\tresource_slot\n\tend", "def book(params)\n Ciirus::Commands::Booking.new(credentials).call(params)\n end", "def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end", "def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end", "def create\n @reservation = Reservation.new(reservation_params)\n \n @emailroom = Room.all.find(@reservation.room_id)\n @emaillibrary = Library.select(\"name\").find(@emailroom.library_id)\n @emailemailid = User.all.find(session[:user_id])\n @emailslot = Slot.all.find(@reservation.slot_id)\n if (@emailslot.id >= 4 && @emailslot.id <=45)\n checkslot = [(@emailslot.id - 3),(@emailslot.id - 2),(@emailslot.id - 1),(@emailslot.id),(@emailslot.id + 1),(@emailslot.id + 2), (@emailslot.id + 3)]\n else if (@emailslot.id == 1)\n checkslot = [1, 2, 3, 4, 48, 47, 46]\n else if (@emailslot.id == 2)\n checkslot = [1, 2, 3, 4, 48, 47, 5]\n if (@emailslot.id == 3)\n checkslot = [1, 2, 3, 4, 48, 6, 5]\n if (@emailslot.id == 48)\n checkslot = [1, 2, 3, 45, 48, 47, 46]\n if (@emailslot.id == 47)\n checkslot = [1, 2, 44, 45, 48, 47, 46]\n if (@emailslot.id == 46)\n checkslot = [1, 43, 44, 45, 48, 47, 46]\n end\n end\n end\n end\n end\n end\n end\n if logged_student?\n @anyres = Reservation.select('id').where('reservation_date=?', @reservation.reservation_date).where('user_id=?',@reservation.user_id)\n if (@anyres.count > 0)\n flash[:danger] = \"You already have a booking for #{@reservation.reservation_date}\"\n redirect_to new_reservation_path and return\n end\n end\n @availres = Reservation.select('id').where('room_id=?', @emailroom.id).where('reservation_date=?', @reservation.reservation_date).where(slot_id: checkslot)\n if (@availres.count > 0)\n flash[:danger] = \"room is not available for requested time\"\n redirect_to new_reservation_path\n else\n respond_to do |format|\n if @reservation.save\n \n ReservationMailer.notify_email(@emailroom.room_number, @emaillibrary.name, @emailemailid.email,\n @reservation.reservation_date,\n @emailslot.start_time).deliver_now!\n \n emails=params[:emails]\n values=emails.split(\",\")\n values.each do |value|\n ReservationMailer.notify_email(@emailroom.room_number, @emaillibrary.name, value,\n @reservation.reservation_date,\n @emailslot.start_time).deliver_now!\n end\n \n format.html { redirect_to afterlogin_path, notice: 'Reservation was successfully created.' }\n #format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n \n end\n end", "def index\n @bookings = current_user.bookings\n binding.pry\n #@bookingsegregator = Booking.segregator\n end", "def build_reservations\n # IMPORTANT: .take_matching_resell should be called before validations\n reservations = @bookings.map { |booking| Reservation.new(booking).take_matching_resell }\n all_valid = reservations.all? { |reservation| reservation.valid? }\n all_valid ? group_bookings.map { |booking| Reservation.new(booking).take_matching_resell } : reservations\n end", "def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end", "def booking_history\n @bookings = Booking.where(:user_id => current_user.id).paginate(:page => params[:page], :per_page => 10)\n\tend", "def booking_output(booking)\n\t {:id=>booking.id,:size=>booking.tickets,:timeslot_id=>booking.timeslot_id}\n\tend", "def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end", "def create\n @roomtype = Roomtype.new(roomtype_params)\n if roomtype_params[:basechildren] && roomtype_params[:baseadults]\n @roomtype.extrabed = roomtype_params[:maximumguests].to_i - roomtype_params[:basechildren].to_i - roomtype_params[:baseadults].to_i\n end\n respond_to do |format|\n if @roomtype.save\n hotel = current_user.hotel\n if hotel.bookinglog\n if hotel.id == @roomtype.hotel_id\n bookinglog = Bookinglog.where(hotel_id: hotel.id).first\n booking = Hash.new\n booking = bookinglog.booking\n room = @roomtype.id.to_i\n booking[room] = []\n booking[room].push({start: Date.today,end: Date.today+36524,frequency: 0,typename: @roomtype.typename,total: @roomtype.rooms})\n bookinglog.booking = booking\n bookinglog.save\n end\n else\n if hotel.id == @roomtype.hotel_id\n bookinglog = Bookinglog.new\n bookinglog.hotel_id = hotel.id\n book = Hash.new\n room = @roomtype.id.to_i\n book[room] = []\n book[room].push({start: Date.today,end: Date.today+36524,frequency: 0})\n bookinglog.booking = book\n bookinglog.save\n end\n end\n format.html { redirect_to '/pricings/new?room_id='+@roomtype.id.to_s, notice: 'room type has been defined.' }\n format.json { render :show, status: :created, location: @roomtype }\n else\n format.html { render :new }\n format.json { render json: @roomtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def booked_appointments\n booked_appointment = []\n self.carts.each do |cart|\n booked_appointment.push(cart.potential_appointments.where(booked_status?: true ))\n end\n return booked_appointment.flatten\n end", "def check_conflicts_with_room(booking, room, devices, capacity, recurring_days)\n\n if devices != room.devices\n if devices != 0\n return true\n end\n end\n\n logger.info \"capacity is #{capacity.to_i} and rooms capacity is #{room.capacity}\"\n if !capacity.nil?\n\n if capacity.to_i > room.capacity\n return true\n end\n end\n\n dates = split_booking booking.startdate,recurring_days\n\n splited_bookings = Array.new\n dates.each do |date|\n tmp_booking = Booking.new\n tmp_booking.enddate = booking.enddate\n tmp_booking.starttime = booking.starttime\n tmp_booking.endtime = booking.endtime\n tmp_booking.recurring = booking.recurring\n tmp_booking.startdate = date\n splited_bookings << tmp_booking\n end\n\n bookings = Booking.find_all_by_room_id room.id\n\n\n\n bookings.each do |booking_at_room|\n\n splited_bookings.each do |splited_booking|\n if check_conflicts_with_specific splited_booking,booking_at_room\n hour_bits_1 = build_hour_bits splited_booking\n hour_bits_2 = build_hour_bits booking_at_room\n if hour_bits_1 & hour_bits_2 != 0\n return true\n end\n end\n end\n\n end\n\n return false\n\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "def parse_booking_details_and_store(response, property)\n new_bookings = []\n bookings_data = response.xpath(\"//agoda:BookingDetailData\", 'agoda' => AgodaChannel::XMLNS)\n bookings_data.each do |booking_data|\n puts booking_data\n new_booking = AgodaBooking.new\n new_booking.property = property\n new_booking.channel = channel\n\n # set pool that this current channel currently belongs to\n new_booking.pool = PropertyChannel.find_by_property_id_and_channel_id(property.id, channel.id).pool\n\n room_type_data = booking_data.xpath('./agoda:RoomType', 'agoda' => AgodaChannel::XMLNS)\n\n # find the chanelink room type that this booking correspond to\n room_type_map = RoomTypeChannelMapping.find_by_ota_room_type_id(room_type_data.attr('RoomTypeID').value)\n\n puts room_type_data.attr('RoomTypeID').value\n if room_type_map and room_type_map.active?\n new_booking.room_type = room_type_map.room_type\n end\n\n # set all the data into our own booking object\n new_booking.guest_name = booking_data.xpath('./agoda:Guests/agoda:Guest/agoda:Name', 'agoda' => AgodaChannel::XMLNS).text\n new_booking.date_start = booking_data.xpath('./agoda:DateRange', 'agoda' => AgodaChannel::XMLNS).attr('Start').value\n new_booking.date_end = booking_data.xpath('./agoda:DateRange', 'agoda' => AgodaChannel::XMLNS).attr('End').value\n new_booking.booking_date = booking_data.xpath('./agoda:BookingDate', 'agoda' => AgodaChannel::XMLNS).text\n\n new_booking.total_rooms = booking_data.xpath('./agoda:NoOfRoom', 'agoda' => AgodaChannel::XMLNS).text\n new_booking.amount = booking_data.xpath('./agoda:Rates', 'agoda' => AgodaChannel::XMLNS).attr('inclusive').value\n\n new_booking.agoda_booking_id = booking_data.xpath('./agoda:BookingID', 'agoda' => AgodaChannel::XMLNS).text\n\n if new_booking.save\n new_bookings << new_booking\n else\n new_bookings << AgodaBooking.find_by_agoda_booking_id(new_booking.agoda_booking_id)\n end\n end\n new_bookings\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def book_flight\n system('clear')\n puts \"Please enter your destination (e.g. 'Paris, France'): \"\n destination = gets.chomp\n puts \"Please enter the departure location, or press enter for all flights to #{destination}.\"\n start_location = gets.chomp\n start_location.empty? ? matched_flights = Flight.all.where(destination: destination) : matched_flights = Flight.all.where(destination: destination, origin: start_location)\n matched_flights.each_with_index do |flight, idx|\n puts \"All Available Flights: \"\n puts \"#{idx + 1}.) \\nAirline: #{flight.airline} \\nOrigin: #{flight.origin} \\nDestination: #{flight.destination} \\nDeparture Time: #{flight.departure_time}\\n Arrival Time: #{flight.arrival_time}\"\n end\n puts \"Please enter the number associated with the flight to continue booking a reservation.\"\n res_num = gets.chomp.to_i\n puts \"Please enter the number of passenger in your party (PLEASE DO NOT include yourself in this count, if there are no additional passengers please press enter to continue.): \"\n party_num = gets.chomp.to_i\n self.current_person.update(party_count: party_num)\n 0.upto(party_num) do |int|\n Ticket.create({user_id: self.current_person.id, flight_id: (matched_flights[res_num - 1]).id, class_status: 'economy', round_trip?: false, price: rand(100..5000).to_f})\n end\n puts \"Thank you for your purchase. Your reservation is booked. You can access your flight information from either the menu or from your purchase receipt sent to your email address.\"\n\n return_to_menu\n end", "def create\n flag=0\n @@bookinfomail = Booking.new(booking_params)\n @booking = Booking.new(booking_params)\n @user=User.find(session[:user_id])\n if not @user.Admin\n # debugger\n @booking.name = User.find(session[:user_id]).email\n flag=1\n end\n #name is in fact the email of the person who books the room (By Lei Zhang)\n @booking.bookday=Time.new\n #<begin> edit by Lei Zhang\n starttime_string = booking_params[:starttime]\n if starttime_string.length == 4\n starttime_string = \"0\" + starttime_string\n end\n endtime_string = booking_params[:endtime]\n if endtime_string.length == 4\n endtime_string = \"0\" + endtime_string\n end\n \n @booking.endtime = Time.parse(\"%04d-%02d-%02d %s:00\" %[booking_params[\"date(1i)\"], booking_params[\"date(2i)\"], booking_params[\"date(3i)\"], endtime_string])\n @booking.starttime = Time.parse(\"%04d-%02d-%02d %s:00\" %[booking_params[\"date(1i)\"], booking_params[\"date(2i)\"], booking_params[\"date(3i)\"], starttime_string])\n #debugger\n #<end> edited by Lei Zhang\n #--------------\n @bookingrecord=Booking.where(\"room_id= ? and date = ?\",booking_params[:room_id],@booking.date)\n @record=Booking.where(\"name=? and date = ?\", @booking.name,@booking.date)\n #-------------\n #<begin> edited by Lei Zhang\n #debugger\n duration = @booking.endtime - @booking.starttime\n if ((duration/1800 > 4) || (duration<=0))\n flash[:danger] = \"Cannot book for more that 2 hours or less than 0 hours\"\n redirect_to bookings_path\n elsif not (timeconstrain(@bookingrecord,@booking))\n flash[:danger] = \"The room is booked during that period. Try another room or another time\"\n redirect_to bookings_path\n elsif (@booking.starttime <= Time.new) ||((Time.parse(@booking.date.strftime('%Y-%m-%d'))-Time.parse(Time.new.strftime('%Y-%m-%d'))).round/(3600*24)>7)\n flash[:danger] = \"The time period is not correct\"\n redirect_to bookings_path\n elsif (flag==1)&&( not (bookroom_constrain(@record,@booking.starttime,@booking.endtime)))\n flash[:danger] = \"A library member can reserve only one room at a particular date and time\"\n redirect_to bookings_path\n else\n # respond_to do |format|\n # if @booking.save\n # format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n # format.json { render :show, status: :created, location: @booking }\n # else\n # format.html { render :new }\n # format.json { render json: @booking.errors, status: :unprocessable_entity }\n # end\n # end\n if @booking.save\n #debugger\n flash[:success] = \"Room successfully booked\"\n # redirect_to bookings_path\n # redirect_to bookings_path\n redirect_to send_mail_path\n else\n flash[:danger] = \"Cannot book room now. Please try again later\"\n redirect_to bookings_path\n end\n end\n end", "def release_room(type, number)\n select_room_flag = false\n @rooms.each_with_index do |room, i|\n if room[:type].downcase == type.downcase\n select_room_flag = true\n if room[:booked].to_i < number.to_i\n puts \"Sorry Wrong Input\"\n else\n puts \"Congratulation you have sccesfully checked out #{number} #{room[:type]}\"\n @rooms[i][:booked] = room[:booked].to_i - number.to_i\n end\n end\n end\n puts \"Sorry Please enter the correct room type\" if select_room_flag === false\n end", "def room\n end", "def create\n puts \"------params create #{params.inspect}\"\n # @booking = current_user.bookings.create(booking_params)\n # redirect_to @booking.item, notice: \"Your booking has been created...\"\n @item = Item.find(params[:item_id])\n @booking = @item.bookings.build(booking_params)\n\n @booking.user = current_user\n\n if params[:commit] == 'Book'\n puts @booking.start_date.strftime(\"%Y-%m-%d\").inspect\n @start_date = @booking.start_date.strftime(\"%Y-%m-%d\")\n @end_date = @booking.end_date.strftime(\"%Y-%m-%d\")\n\n found = false\n @all_bookings = Booking.all\n\n @all_bookings.each do |booking|\n if booking.has_paid == TRUE\n start_date= booking.start_date.strftime(\"%Y-%m-%d\")\n end_date = booking.end_date.strftime(\"%Y-%m-%d\")\n if @start_date.between?(start_date, end_date) || @end_date.between?(start_date, end_date)\n if booking.item_id == @booking.item_id\n found = true\n end\n end\n end\n end\n\n if found == true\n redirect_to request.referrer, notice: \"This dress is already booked for this period.\"\n else\n @booking.save!\n redirect_to edit_item_booking_url(@item,@booking), notice: \"You have booked the dress successfully. Please contact owner to fix a time for trial or directly proceed with payment.\"\n end\n end\n\n if params[:commit] == 'Pay'\n respond_to do |format|\n if @booking.save && params[:commit] == 'Pay'\n format.html { redirect_to item_booking_url(@item,@booking), notice: 'Invoice' }\n format.json { render :show, status: :created, location: @booking }\n # f.json { render action: 'show', status: :created, location: @step }\n else\n format.html { render action: 'new' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n\n end\n end\n\n end", "def create\n \n @booking = Booking.new(params[:booking])\n params[:booking][:end_time] = @booking.end_time\n \n\n \n @booking = Booking.new(params[:booking])\n if @booking.weights == 1\n @booking.no_ergs = 0\n end\n \n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Your booking was successfully created.'\n format.html { redirect_to bookings_path }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def all_rooms\n @rooms.each do |room|\n puts \"Room Number: #{room.number} | Nightly Rate: #{room.cost}\"\n end \n end", "def pickup_list(from, to, rental_location_code=nil, include_journal=false)\n\n # Get reservations\n\n conditions = {:date_from.gte => from,\n :date_from.lte => to,\n :status => [:confirmed, :in_progress, :done]}\n conditions.store(:rental_location_code, rental_location_code) if rental_location_code\n \n data = BookingDataSystem::Booking.all(\n :conditions => conditions,\n :order => [:date_from.asc, :time_from.asc]).map do |item|\n product = item.booking_lines.inject('') do |result, b_l|\n result << b_l.item_id\n b_l.booking_line_resources.each do |b_l_r|\n result << ' - '\n result << (b_l_r.booking_item_reference.nil? ? 'NO ASIGNADO' : b_l_r.booking_item_reference)\n result << ' '\n end\n result\n end\n extras = item.booking_extras.inject('') do |result, b_e|\n result << b_e.extra_description\n result << \"(#{b_e.quantity}) \"\n result\n end\n {id: item.id, date_from: item.date_from.to_date.to_datetime, time_from: item.time_from, pickup_place: item.pickup_place, product: product,\n status: item.status, customer: \"#{item.customer_name} #{item.customer_surname}\", customer_phone: item.customer_phone, customer_mobile_phone: item.customer_mobile_phone,\n customer_email: item.customer_email, flight: \"#{item.flight_airport_origin} #{item.flight_company} #{item.flight_number} #{item.flight_time}\",\n total_pending: item.total_pending, extras: extras, notes: item.notes, days: item.days, rental_location_code: item.rental_location_code}\n end\n \n # Include journal\n \n if include_journal\n journal_calendar = ::Yito::Model::Calendar::Calendar.first(name: 'booking_journal')\n event_type = ::Yito::Model::Calendar::EventType.first(name: 'booking_pickup')\n journal_events = ::Yito::Model::Calendar::Event.all(\n :fields => [:id, :from, :description],\n :conditions => {:from.gte => from, :from.lt => to+1, event_type_id: event_type.id,\n :calendar_id => journal_calendar.id},\n :order => [:from.asc]).map.each do |journal_event|\n {id: '.', date_from: journal_event.from.to_date.to_datetime,\n time_from: journal_event.from.strftime('%H:%M'), pickup_place: '', product: journal_event.description,\n status: '', customer: '', customer_phone: '', customer_mobile_phone: '',\n customer_email: '', flight: '', total_pending: 0, extras: '', notes: '', days: 0}\n end\n data.concat(journal_events)\n end\n\n data.sort! do |x, y|\n comp = x[:date_from] <=> y[:date_from]\n if comp.zero?\n begin\n Time.parse(x[:time_from]) <=> Time.parse(y[:time_from])\n rescue\n comp\n end\n else\n comp\n end\n end\n\n return data\n\n end" ]
[ "0.6921091", "0.68915206", "0.6840275", "0.6808785", "0.68030566", "0.67906773", "0.6740227", "0.67316204", "0.66916287", "0.66754675", "0.6671842", "0.6665861", "0.6619604", "0.66143066", "0.65822005", "0.65603197", "0.65576744", "0.64798486", "0.64718807", "0.64704436", "0.6432485", "0.6408865", "0.6376577", "0.6334072", "0.6333002", "0.63328815", "0.6321446", "0.63179773", "0.6278829", "0.6271405", "0.62673974", "0.62497526", "0.6229547", "0.6213899", "0.62079287", "0.6207683", "0.6195769", "0.61645746", "0.6162663", "0.6157026", "0.61409396", "0.6135888", "0.613029", "0.6107903", "0.607723", "0.6070014", "0.6066037", "0.6060189", "0.60540843", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6048582", "0.6042535", "0.60236084", "0.60211945", "0.600559", "0.6004531", "0.6000525", "0.5994588", "0.59913826", "0.5990174", "0.59703076", "0.5956862", "0.59430367", "0.59263146", "0.5916803", "0.5915809", "0.59154236", "0.5910852", "0.5904286", "0.58925563", "0.5891762", "0.5884297", "0.5878487", "0.58782536", "0.5877662", "0.5858509", "0.58583283", "0.5854772", "0.58537704", "0.5852661", "0.5850809", "0.58500075", "0.58393097", "0.58372307", "0.583364", "0.5831855", "0.5830828", "0.58249986", "0.58152586", "0.5803166" ]
0.0
-1
Some details about the helper method that might be picked up in the documentation.
def a_helper_method puts "performs some operation" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helpers; end", "def helpers; end", "def helpers; end", "def helper_method(*methods); end", "def define_helpers; end", "def helper\n @helper\n end", "def helper\n @helper\n end", "def helper(_method)\n ActionController::Base.helpers.method(_method)\n end", "def display_method_info\n end", "def dataset_helper_method\n :\"_#{self[:name]}_dataset_helper\"\n end", "def extract_method_details; end", "def secret_method_2 # :nodoc:\n end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def base_docstring; end", "def helper_methods\n members - PREDICATE_FIELDS + PREDICATE_FIELDS.map { |f| \"#{f}?\".to_sym }\n end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def docstring; end", "def docstring; end", "def link_documentation; end", "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def define_helper(scope, method, *args, **kwargs, &block); end", "def define_name_helpers; end", "def text_help\n Helper.instance\nend", "def helper(*args, &block); end", "def __list_helper_methods\n # avoiding '__self__' and '__id__' symbols with last regex part\n methods.grep(/^#{@@helper_start_with}.*?[^__]$/) do |method|\n method.to_s\n end\n end", "def helpers &blk\n @helpers = blk\n end", "def helpers_path=(_arg0); end", "def help\n Helper.instance\n end", "def help\n Helper.instance\n end", "def help\n Helper.instance\n end", "def help\n Helper.instance\n end", "def need_help \n end", "def what_is\n end", "def define_action_helpers; end", "def secret_method #:nodoc:\n end", "def how_it_works\r\n end", "def helper\n @helper ||= Helpers.new\n end", "def method_help(method_name)\n index[method_name][:help]\n end", "def who_we_are\r\n end", "def internal_methods; end", "def method_name\n\n end", "def method_name\n\n end", "def method_name\n\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def path_helpers_module; end", "def _here_\n 'here'\nend", "def helpers_paths; end", "def helpers_paths; end", "def helpers_paths; end", "def helpers_paths; end", "def method_symbol; end", "def desc; end", "def content_methods; end", "def instance_helper\n\tend", "def define_action_helpers?; end", "def url_helpers_module; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def expected_method; end", "def method_help(method)\n method.comment.gsub(/^#\\s/m, '').strip\n end", "def display_method_list\n end" ]
[ "0.7692924", "0.7692924", "0.7692924", "0.68851626", "0.66039", "0.6559716", "0.6559716", "0.6462119", "0.6350121", "0.63115746", "0.62891185", "0.62449414", "0.62195504", "0.62195504", "0.62195504", "0.62195504", "0.6145554", "0.61398965", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.61136436", "0.6107884", "0.6107884", "0.60569745", "0.605503", "0.605503", "0.605503", "0.605503", "0.6048715", "0.6044668", "0.6036713", "0.602767", "0.6023605", "0.6011424", "0.59976447", "0.59825", "0.59825", "0.59825", "0.59825", "0.59763896", "0.5971271", "0.59496444", "0.59444284", "0.5938671", "0.5934743", "0.592", "0.590212", "0.58959097", "0.58785015", "0.58785015", "0.58785015", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.5873601", "0.586905", "0.586905", "0.586905", "0.586905", "0.586662", "0.5860208", "0.5860051", "0.5860051", "0.5860051", "0.5860051", "0.585377", "0.58502114", "0.58406264", "0.5838259", "0.582906", "0.58193046", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5807182", "0.5799539", "0.5794994", "0.57694435" ]
0.0
-1
bomb in the 2D gridlike field in front of you. Write a function mineLocation/MineLocation that accepts a 2D array, and returns the location of the mine. The mine is represented as the integer 1 in the 2D array. Areas in the 2D array that are not the mine will be represented as 0s. The location returned should be an array (Tuple in C) where the first element is the row index, and the second element is the column index of the bomb location (both should be 0 based). All 2D arrays passed into your function will be square (NxN), and there will only be one mine in the array. Examples: mineLocation( [ [1, 0, 0], [0, 0, 0], [0, 0, 0] ] ) => returns [0, 0] mineLocation( [ [0, 0, 0], [0, 1, 0], [0, 0, 0] ] ) => returns [1, 1] mineLocation( [ [0, 0, 0], [0, 0, 0], [0, 1, 0] ] ) => returns [2, 1]
def mineLocation field coords = [] field.each_index do | i | field[i].each_index do | j | if field[i][j] == 1 coords << i coords << j end end end coords end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end", "def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end", "def mine_locations\n mine_array = []\n until mine_array.length == 9\n row = (0..9).to_a.sample\n column = (0..9).to_a.sample\n unless mine_array.include?([row,column])\n mine_array << [row, column]\n end\n end\n mine_array\n end", "def contains_mine?(row, col)\n @mines[row][col]\n end", "def mineLocation(field)\n row = 0\n column = 0\n field.each_with_index do |array, index|\n row = index if array.include?(1)\n end\n\n field[row].each_with_index do |num, index|\n column = index if num.eql?(1)\n end\n [row, column]\nend", "def locate_mine\n is_game = true\n cell_flagged = false\n index1,index2 = @option[2].to_i,@option[4].to_i\n choose = @option[0]\n @layout.each do | layoutVal |\n layoutVal.split(\"\").each do | value |\n if @layout[index1][index2] == 'm' and choose == 'o'\n puts \"Opened the mine -- You are OUT!!\"\n is_game = false\n elsif @layout[index1][index2] == 'x' and choose == 'o'\n puts \"You have opened the cell\"\n @layout[index1][index2] = '0'\n elsif @layout[index1][index2] == 'm' and choose == 'f'\n @layout[index1][index2] = 'f'\n elsif @layout[index1][index2] == 'x' and choose == 'f'\n puts \"You have flagged the cell\"\n @layout[index1][index2] = 'f'\n cell_flagged = true\n end\n end\n end\n=begin if value != \"f\" or value == '0' \n\n else\n if cell_flagged\n puts \"You have flagged some cells, GAME OVER!!\"\n else\n puts \"Congrats!!! You have won the Game!\"\n end\n=end\n @layout\n end", "def contains_mine?(row, col)\n @board[row][col].has_bomb\n end", "def contains_mine?(row, col)\n @board[row][col].mined\n end", "def isMine(x,y)\n @squares[x][y] == MINE_MARKER\n end", "def contains_mine?(row, col)\n cell = @grid[row][col]\n cell.contains_mine\n end", "def mineLocation field\n location=[]\n field.each_with_index do |row,index|\n if row.include?(1)\n location << index\n row.each_with_index do |col, idx|\n if col==1\n location << idx\n end\n end\n end\n end\n return location\nend", "def contains_mine?(row, col)\n grid[row][col].fill == 1\n end", "def contains_mine?(row, col)\n @mine_field[[row,col]]\n end", "def contains_mine?(row, col)\n @grid[row][col].fill == \"mine\"\n end", "def contains_mine?(row, col)\n if @mine_field[:bombs][col][row] == true && @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end", "def get_cell_at_xy(input_array)\n input_array.map do |coord|\n x = coord[0]\n y = coord[1]\n at_coord(x, y)\n end\n end", "def contains_mine?(row, col)\n @field[row][col].contains_mine?\n end", "def contains_mine?(row, col)\n @value_grid[[row, col]][:mine]\n end", "def solve(minemap, miner, exit, answer = [])\n# this block sets variables for dimension max indexes\n# declares variables for the current miner position\n# declares variables for the exit position\n# I did this for easier manipulation of the values\n# than referring to and changing a hash constantly\n# it also sets up an array possible values the map\n# can take on, with the direction a miner should travel\n# replacing true, which signals to the miner that he\n# should not return to that position (probably not necessary\n# because false would work just as well unless two branches\n# are both valid, but right, left, up, down could probably\n# be eliminated\n\n x_max = minemap.size - 1\n y_max = minemap[0].size - 1\n x = miner['x']\n y = miner['y']\n ex = exit['x']\n ey = exit['y']\n walls = %w(right left up down branch)\n walls.push(false)\n\n# copying the map so it can be manipulated (again, probably\n# not necessary and, even if it is, my copy_array should be\n# expanded to multi dimensional arrays)\n\n copy = Array.new(x_max+1){Array.new(y_max+1)}\n (0..x_max).each do |x|\n (0..y_max).each do |y|\n copy[x][y] = minemap[x][y]\n end\n end\n\n# loops while not at exit\n\n while x != ex || y != ey\n\n# sets a boolean array to 4 trues, then checks\n# each possible move to false if unavailable\n\n rlud = [true, true, true, true]\n rlud[0] = false if x == x_max || walls.include?(copy[x+1][y])\n rlud[1] = false if x == 0 || walls.include?(copy[x-1][y])\n rlud[2] = false if y == 0 || walls.include?(copy[x][y-1])\n rlud[3] = false if y == y_max || walls.include?(copy[x][y+1])\n\n# if there is nowhere to turn, the answer array is set to an array \n# of size equal to thenumber of elements in the map, because this \n# number is more than the possible number of steps the miner could\n# take in an actual solution, then returns this array as answer\n# this signals the previous call of solve that the branch was a \n# dead end (this will not happen on the first iteration by if\n# the initial conditions are valid)\n\n answer = Array.new((x_max + 1) * (y_max + 1)) if rlud.count(true) == 0 \n return answer if rlud.count(true) == 0\n\n# if there is only one path (only one true in the boolean array)\n# then the position is updated, the step is pushed to the answer\n# array and the copy of the original position is set to a string\n# indicating the miner must travel\n\n if rlud.count(true) == 1 \n if rlud[0] == true\n copy[x][y] = \"right\" \n answer.push('right')\n x += 1\n elsif rlud[1] == true\n copy[x][y] = \"left\" \n answer.push('left')\n x -= 1\n elsif rlud[2] == true\n copy[x][y] = \"up\" \n answer.push('up')\n y -= 1\n else\n copy[x][y] = \"down\"\n answer.push('down')\n y += 1 \n end \n\n# if there is more than one possible move, this section\n# calls the branch explore with the direction to explore\n# as one parameter and a copy of the answer to be appended \n# to in case a valid path is found, if a dead end is reached\n# branch_explore will mark the initial branch position as false\n\n else\n copy[x][y] = false\n if rlud[0] == true\n r = copy_array(answer)\n r = branch_explore(copy, 'right', exit, r, x, y, x_max, y_max)\n end \n if rlud[1] == true\n l = copy_array(answer)\n l = branch_explore(copy, 'left', exit, l, x, y, x_max, y_max)\n end\n if rlud[2] == true\n u = copy_array(answer) \n u = branch_explore(copy, 'up', exit, u, x, y, x_max, y_max)\n end\n if rlud[3] == true\n d = copy_array(answer)\n d = branch_explore(copy, 'down', exit, d, x, y, x_max, y_max)\n end\n\n# this section pushes the answer arrays that are valid paths to\n# a branch array \n\n branch_array = [] \n branch_array.push(r.size) if x != x_max && copy[x+1][y].to_s == \"branch\"\n branch_array.push(l.size) if x != 0 && copy[x-1][y].to_s == \"branch\"\n branch_array.push(u.size) if y != 0 && copy[x][y-1].to_s == \"branch\"\n branch_array.push(d.size) if y != y_max && copy[x][y+1].to_s == \"branch\"\n\n# this determines which of the potential valid paths is shorts and \n# set the answer to that array\n \n min = branch_array.min\n answer = copy_array(r) if r != nil && r.size == min\n answer = copy_array(l) if l != nil && l.size == min\n answer = copy_array(u) if u != nil && u.size == min\n answer = copy_array(d) if d != nil && d.size == min\n end\n end\n\n# return the answer\n\n answer\nend", "def find_neighbors(tile_loc)\n neighbors = []\n possible_neighbors = [[-1,-1],[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1]]\n\n\n possible_neighbors.each do |neighbor|\n possible_neighbor = [neighbor.first + tile_loc.first, neighbor.last + tile_loc.last]\n neighbors << possible_neighbor if valid?(possible_neighbor)\n end\n possible_neighbors\n end", "def find_ones\n ones_locations = []\n # => finding index of ROW and COL for each 1 in grid and storing as row/col array pairs\n @image_array.each_index do |row|\n @image_array[row].each_index do |col|\n if @image_array[row][col] == 1\n puts \"#{row}, #{col}\" # <---this is just to display that it's working, can be removed\n ones_locations << [row, col]\n end\n end\n end\n return ones_locations\n end", "def contains_mine?(row, col)\n @field[row][col].mined\n end", "def loc2(x,y)\n TwoDGridLocation.new x, y\nend", "def mine_sweeper(bombs, num_rows, num_cols)\n rows = []\n\n # 1) build the array\n for i in 0...num_rows\n cols = []\n for j in 0...num_cols\n cols << 0\n end\n rows << cols\n end\n\n # 2) assign bumbs\n for bomb in bombs\n i = bomb[0]\n j = bomb[1]\n rows[i][j] = -1\n end\n\n # 3) assign numbers in minesweeper\n for i in 0...num_rows\n for j in 0...num_cols\n if rows[i][j] == -1\n rows = assign_numbers(i, j, rows)\n end\n end\n end\n\n return rows\nend", "def adjacent_mines(row, col)\n mine_count = 0\n #check the 3 squares above if we're not in the top row\n if row > 0\n if col > 0\n if @mines[row-1][col-1] == true\n mine_count += 1\n end\n end\n if @mines[row-1][col] == true\n mine_count += 1\n end\n if col < column_count-1\n if @mines[row-1][col+1] == true\n mine_count += 1\n end\n end\n end\n\n #check the 3 squares below if we're not in the bottom row\n if row < row_count - 1\n if col > 0\n if @mines[row+1][col-1] == true\n mine_count += 1\n end\n end\n if @mines[row+1][col] == true\n mine_count += 1\n end\n if col < column_count-1\n if @mines[row+1][col+1] == true\n mine_count += 1\n end\n end\n end\n\n #check the square to the left\n if col > 0\n if @mines[row][col-1] == true\n mine_count += 1\n end\n end\n\n #check the square to the right\n if col < column_count-1\n if @mines[row][col+1] == true\n mine_count += 1\n end\n end\n mine_count\n end", "def find_hole\n @tiles.size.times do |x|\n @tiles.size.times do |y|\n return [x,y] if @tiles[y][x].nil?\n end\n end\n end", "def reveal_location(loc: [0,0])\n x = loc[0]\n y = loc[1]\n puts \"Revealing location: [#{x}, #{y}]\" if Settings.debug_mode\n puts \"Revealed Map: #{@map}\" if Settings.debug_mode\n @map[x][y] = 1\n end", "def tile_at x,y\n return nil if x < 0 || y < 0 || x >= @width || y >= @height\n return @map[x][y] \n end", "def nearest_mine\n src = @pos\n shortest_dst = 63\n nearest = [0,0]\n unowned_mines = @game.mines_locs.reject { |pos, hero_id| hero_id == @hero_id }\n unowned_mines.each do |pos, hero_id|\n build_branching_paths(src, pos)\n path = find_path(pos)\n if path.length < shortest_dst\n shortest_dst = path.length\n nearest = pos\n end\n end\n nearest\n end", "def place_mines\n\t\t(0...@size).to_a.shuffle.slice(0,@total_mines).each do |rand|\n\t\t\tmine_row = rand / @width\n\t\t\tmine_col = rand % @width\n\t\t\t@cell_at[mine_row][mine_col].risk = :mine\n\t\t\t@cells_with_mines << [mine_row, mine_col]\n\t\tend\n\tend", "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def know_neighbors\n bomb_neighbors = 0\n neighbor_coords = []\n rel_neighbor_coords = [[0, 1], [1, 1], [-1, 0], [-1, 1], [1, 0], [1, -1], [0, -1], [-1, -1]]\n rel_neighbor_coords.each do | coord |\n neighbor_coords << [@coords[0] + coord[0], @coords[1] + coord[1]]\n end\n neighbor_coords.select! {|pos| pos.all? { |coord| (0..8).cover? coord }}\n neighbor_coords\n end", "def cell(pos_x, pos_y)\n @board[pos_y][pos_x]\n end", "def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end", "def drawBoard() \n #1. prepare the default board\n @height.times do |y|\n @width.times do |x|\n print EMPTY_MARKER\n end\n puts\n end\t\n @squares = []\n @width.times do |x|\n column = []\n @height.times do |y|\n column << EMPTY_MARKER\n end\n @squares << column\n end\t\n # 2. fill the mine marker\n @mines.each do |mine|\n x,y = mine\n @squares[x][y] = MINE_MARKER\n end\t\t\n #puts @squares;\n\n end", "def verify_small_ship_location(row,column)\n if out_of_board(row,column)\n raise 'Location out of board!'\n elsif !is_empty(row,column)\n raise 'There is another ship already!'\n end\n end", "def get_surrounding_tiles(row, column, cell)\n surrounding_tiles = []\n index = GAME_BOARD[column-1].index(cell)\n if column == 1 \n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n end\n elsif column == 12\n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n elsif index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n\n surrounding_tiles\n end", "def life_in_cell row_index, col_index\n row_index = 0 if row_index == @size\n col_index = 0 if col_index == @size\n row_index = @size-1 if row_index == -1\n col_index = @size-1 if col_index == -1\n return @universe[row_index][col_index] || 0\n end", "def get_empty_coords\n good_coords = false\n curr_world = get_world_array\n objects = all_objects\n number_of_objects = all_objects[\"Strawberries\"].size + all_objects[\"Persons\"].size + all_objects[\"Monsters\"].size + all_objects[\"Mushrooms\"].size\n if number_of_objects == @total_length\n puts 'INPUT BIGGER MATRIX'\n exit\n end\n while !good_coords\n x_coord = rand(@x_size)\n y_coord = rand(@y_size)\n if curr_world[Matrix.two_to_one(x_coord, y_coord, @x_size)].empty?\n good_coords = true\n end\n end\n [x_coord, y_coord]\n end", "def plant_mines\n row_count = @field.length\n cell_count = @field[0].length\n @mine_count.times do |plant|\n row_index = rand(row_count)\n cell_index = rand(cell_count)\n if @field[row_index][cell_index].mine = false\n @field[row_index][cell_index].place_mines\n else\n @field[rand(row_count)][rand(cell_count)].place_mines\n end\n end\n @field\n end", "def near_miss(arr,x,y) #Checks if a ship is near\n if x > 0 && arr[x-1][y] != 0 ||\n x < 9 && arr[x+1][y] != 0 ||\n y > 0 && arr[x][y-1] != 0 ||\n y < 9 && arr[x][y+1] != 0\n 'That was a near miss.'\n end\nend", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end", "def verify_large_ship_location(row,column)\n if out_of_board(row,column) || out_of_board(row,column+1)\n raise 'Location out of board!'\n elsif (!is_empty(row,column)) || (!is_empty(row,column+1))\n \traise 'There is another ship already!'\n end\n end", "def draw_person_map(locations_for_same_time)\n if locations_for_same_time.empty?\n return\n end\n\n # Create a 2D array and then draw from that array\n array = Array.new(SIZE_OF_WORLD) {Array.new(SIZE_OF_WORLD, \" \")}\n locations_for_same_time.each do |location|\n array[location.x][location.y] = location.person\n end\n\n x = 0\n y = 0\n puts \"#{cyan(' 0123456789')} #{blue('t = ')}#{locations_for_same_time[0].time}\"\n (0..9).each do |y|\n puts \"#{cyan(y.to_s)}#{array[0][y]}#{array[1][y]}#{array[2][y]}#{array[3][y]}#{array[4][y]}#{array[5][y]}#{array[6][y]}#{array[7][y]}#{array[8][y]}#{array[9][y]}\"\n end\n puts \" \"\nend", "def place_mine_indicators\n @board.each_with_index do |r, row|\n r.each_with_index do |_c, col|\n unless @board[row][col].is_a_mine\n count = 0\n if row - 1 >= 0\n count += 1 if col - 1 >= 0 && @board[row - 1][col - 1].is_a_mine\n count += 1 if @board[row - 1][col].is_a_mine\n count += 1 if col + 1 < @board.size && @board[row - 1][col + 1].is_a_mine\n end\n count += 1 if col - 1 >= 0 && @board[row][col - 1].is_a_mine\n count += 1 if col + 1 < @board.size && @board[row][col + 1].is_a_mine\n if row + 1 < @board.size\n count += 1 if col - 1 >= 0 && @board[row + 1][col - 1].is_a_mine\n count += 1 if @board[row + 1][col].is_a_mine\n count += 1 if col + 1 < @board.size && @board[row + 1][col + 1].is_a_mine\n end\n @board[row][col].set_value(count)\n end\n end\n end\n end", "def winning_location board \n\tif board[0][0] == 1 && board[0][1] ==1 && board[0][2] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[0][0] == 2 && board[0][1] ==2 && board[0][2] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[1][0] == 1 && board[1][1] ==1 && board[1][2] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[1][0] == 2 && board[1][1] ==2 && board[1][2] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[2][0] == 1 && board[2][1] ==1 && board[2][2] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[2][0] == 2 && board[2][1] ==2 && board[2][2] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[0][0] == 1 && board[1][0] ==1 && board[2][0] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[0][0] == 2 && board[1][0] ==2 && board[2][0] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[0][1] == 1 && board[1][1] ==1 && board[2][1] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[0][1] == 2 && board[1][1] ==2 && board[2][1] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[0][2] == 1 && board[1][2] ==1 && board[2][2] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[0][2] == 2 && board[1][2] ==2 && board[2][2] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[0][0] == 1 && board[1][1] ==1 && board[2][2] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[0][0] == 2 && board[1][1] ==2 && board[2][2] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\n\n\tif board[2][0] == 1 && board[1][1] ==1 && board[0][2] == 1\n\t\tputs \"X Wins\"\n\t\t@gameon = false\n\tend\n\n\tif board[2][0] == 2 && board[1][1] ==2 && board[0][2] == 2\n\t\tputs \"O Wins\"\n\t\t@gameon = false\n\tend\n\nend", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end", "def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements in 'line' array match the human marker\n # or computer marker, if so return that marker, if no match return nil\n WINNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n markers = squares.map(&:marker)\n return markers[0] if markers.uniq.size == 1 && squares[0].marked?\n end\n nil\n end", "def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end", "def pieces_at(x, y)\n @board[x][y]\n end", "def init_mines(row_count, column_count, mine_count)\n field = []\n until field.length == row_count*column_count\n field << false\n end\n\n rand_num = (0...row_count*column_count).to_a.shuffle.first(mine_count)\n rand_num.each do |num|\n field[num] = true\n end\n\n minefield=[]\n field.each_slice(column_count) do |sub|\n minefield << sub\n end\n minefield\n #double array to represent row, column of the minefield\n # mine is true [[false, true, true], [false, false, true], [false, false, true]]\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if identical_markers?(3, squares)\n return squares.first.marker\n end\n end\n nil\n end", "def location(size)\n valid = false\n while !valid\n if rand(2) == 0 #Horizontal ship\n valid = true\n row = rand(10)\n start_col = rand(11 - size)\n for i in 0...size\n if $field[row][start_col + i] != \"_\"\n valid = false\n end\n end\n if valid\n for i in 0...size\n $field[row][start_col + i] = size.to_s\n end\n end\n else #Vertical ship\n valid = true\n col = rand(10)\n start_row = rand(11 - size)\n for i in 0...size\n if $field[start_row + i][col] != \"_\"\n valid = false\n end\n end\n if valid\n for i in 0...size\n $field[start_row + i][col] = size.to_s\n end\n end\n end\n end\nend", "def [](x, y)\n return nil unless (0...FIELD_SIZE).cover?(x)\n return nil unless (0...FIELD_SIZE).cover?(y)\n @battle_field[x][y]\n end", "def located_here?(x,y)\n self.location == [x,y]\n end", "def mine_sweeper(bombs, num_rows, num_cols)\n result = Array.new(num_rows) {[0] * num_cols}\n\n for a,b in bombs do\n row_i, col_i = a, b \n result[row_i][col_i] = -1\n \n for i in (row_i - 1..row_i + 1) do\n for j in (col_i - 1..col_i + 1) do\n if (i >= 0 and i < num_rows) and (j >= 0 and j < num_cols) and result[i][j] != -1\n result[i][j] += 1\n end\n end\n end\n \n end\n result\nend", "def winning_marker\n WINNING_COMBOS.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def [](x,y)\n return nil unless (0...size).cover?(x)\n return nil unless (0...size).cover?(y)\n @squares[y][x]\n end", "def generateMap difficulty\r\n width = 12\r\n height = 100\r\n map = Array.new(height)\r\n i = 0\r\n previousCutterYPos = 0\r\n noCuttterForFirst10Block = 0\r\n while i < height-1\r\n map[i] = Array.new(width)\r\n if(i%3==0) #if the coloumn consist plank then draws the wooden plank on the random position and fills the left space with 0\r\n posX = rand(1..6) #6 randomply decides the position where to draw the wooden plank\r\n plankWithBomb = rand(30)\r\n width.times do |x| \r\n if(x < posX || (posX+4) < x) # fills the coordinate with space i.e 0\r\n map[i][x] = 0\r\n else # fills the coordinate with wooden plank i.e 1 \r\n if(plankWithBomb % (5-difficulty)==0) \r\n map[i][x] = 3\r\n else\r\n map[i][x] = 1 \r\n end\r\n end\r\n end\r\n else #else then just draw the space i.e 0 or cutters \r\n posX = -1\r\n if(previousCutterYPos!=(i-1) && rand(15) % (10-difficulty)==0 && i < 90) # i > 10 denotes that there are no cutter for first 10 blocks or jumps\r\n posX = [0,11].sample \r\n previousCutterYPos = i\r\n end\r\n \r\n 12.times do |x|\r\n if(posX==x)\r\n map[i][posX] = 2\r\n else\r\n map[i][x] = 0\r\n end\r\n end\r\n end\r\n i+=1\r\n end\r\n\r\n # map[height-1] = Array.new()\r\n map[height-1] = [1,1,1,1,1,1,1,1,1,1,1,1] # just making the last block as platform for player to move around\r\n\r\n map # return the map to the calling function\r\nend", "def find_ones\n ones = []\n # This line will start at the beginning (upper left corner of the 2D array) so the first value, and the index of that value (i.e. [value: 0, index: 0]).\n # This will then continue on to line 17\n # Line 14 will grab the row item (0) and work along the columns. After first itiretaion (same as above since its the first index), the loop will continue until the\n # last number of the columns on that row item completes. So in this case, the three zeroes at underneath the first zero.\n # Afterwards, it will go back up to the rows line (16) and jump on to the next index and item on that row. This will continue until the entire array has been checked through.\n @image_blur_array.each_with_index do | row_item, row_index| \n row_item.each_with_index do |col_item, col_index|\n if col_item == 1 # If the col_item (since it is the last number we checked) equals to '1', the coordinates of that number will be added onto the array 'ones'\n ones << [row_index, col_index]\n end\n end\n end\n # Returns the 'ones' array to the blur method\n return ones\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n return squares.first.marker if three_identical_markers?(squares)\n end\n nil\n end", "def cell_at(x, y)\n return nil if (x < 0 || y < 0)\n @cells[y][x] if @cells[y]\n end", "def [](x, y)\n return @tiles[x][y] if within? x, y\n end", "def pos(tilew, tileh, hmul, x,y)\n r = $map[y] || []\n my = 0\n tile = \"grass\"\n if r.is_a?(Array)\n my = r[x] || 0\n else\n # I apply a factor of 0.7 here, as pure\n # integer multiples of the tile height looks\n # odd. In a proper map representation I may\n # make the height much more granular.\n my = r[x*2].to_i * hmul.to_f * 0.7\n tile = $tiletypes[r[x*2+1]]\n end\n return (x-y)*tilew + 600, -(x+y)*tileh +540 + my*tileh, my, tile\nend", "def get_start_position(floor_array) \r\n floor_array.index(\"*\") \r\nend", "def adjacent_mines(row, col)\n adjacent_list = adjacent_cells(row, col)\n mine_count = 0\n adjacent_list.each do |cell|\n if cell.has_bomb\n mine_count = mine_count + 1\n end\n end\n mine_count\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n\n nil\n end", "def locate_place(coords)\n return nil if out_of_bounds?(coords)\n\n @board[coords[0]][coords[1]]\n end", "def get_all_mines\n\t\tall_mines = []\n\t\t@board.flatten.each do |square|\n\t\t\tall_mines << square.coords if square.mine == true\n\t\tend\n\t\tall_mines\n\tend", "def neighbor_cell_coordinates\n NEIGHBOR_OFFSETS.map { |coordinates| [row + coordinates[0], col + coordinates[1]] }\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def find_at_risk_square(line, board, marker)\n if board.values_at(*line).count(marker) == 2\n board.select { |k, v| line.include?(k) && v == INITIAL_MARKER }.keys.first\n else\n nil\n end\nend", "def get_cell(x, y)\n grid[x][y]\n end", "def locate_place(pos, board)\n board[pos[0]][pos[1]]\n end", "def generateBoard(row, col, num_mines)\n# Step 1 create board\n board = Array.new(row) { Array.new(col) {-1}}\n# Step 2 place random mines on board\n until num_mines < 1\n temp_x = rand(row)\n temp_y = rand(col)\n \n if board[temp_x][temp_y] != \"*\"\n board[temp_x][temp_y] = \"*\" \n num_mines -= 1 \n end\n end\n \n# Step 3 Iterate each tile skipping mines\n board.each_index do |x|\n board.each_index do |y|\n next if board[x][y] == \"*\"\n count = 0\n \n # Step 3a\n # check within bounds and count mines\n min_x = x - 1\n max_x = x + 1\n min_y = y - 1\n max_y = y + 1\n \n (min_x..max_x).each do |x|\n (min_y..max_y).each do |y|\n if (x >= 0 && x < row) && (y >= 0 && y < col)\n count += 1 if board[x][y] == \"*\"\n end\n end\n end\n \n board[x][y] = count\n end\n end\n \n # return board\n board\nend", "def print_cell(x,y)\n puts @maze[x][y]\n end", "def calculate_neighbor_mines\n @board.each_with_index do |row, row_index|\n row.each_with_index do |element, index|\n neighbor_bomb_count = 0\n if element != \"*\" && index == 0 && row_index == 0\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n elsif element != \"*\" && row_index == 0\n neighbor_bomb_count += 1 if @board[row_index][index - 1] && @board[row_index][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index - 1] && @board[row_index + 1][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n elsif element != \"*\" && index == 0\n neighbor_bomb_count += 1 if @board[row_index - 1][index] && @board[row_index - 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index + 1] && @board[row_index - 1][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n elsif element != \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index - 1] && @board[row_index - 1][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index] && @board[row_index - 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index - 1][index + 1] && @board[row_index - 1][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index - 1] && @board[row_index][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index][index + 1] && @board[row_index][index + 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index - 1] && @board[row_index + 1][index - 1] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index] && @board[row_index + 1][index] == \"*\"\n neighbor_bomb_count += 1 if @board[row_index + 1] && @board[row_index + 1][index + 1] && @board[row_index + 1][index + 1] == \"*\"\n neighbor_bomb_count == 0 ? @board[row_index][index] = \" \" : @board[row_index][index] = neighbor_bomb_count\n end\n end\n end\n end", "def winning_marker\n WINNING_LINES.each do |line|\n line_squares = squares.values_at(*line)\n next if line_squares.any?(&:unmarked?)\n markers = line_squares.map(&:marker)\n return markers.first if winner?(markers)\n end\n nil\n end", "def find_ones\n # => Establish an empty array to hold the index positions of all the 1s\n ones_ary = []\n # => Finding the index of ROW and COL for each 1 in the grid and storing\n # => them as row/col array pairs\n\n # => |row| denotes the top-level array (could be named anything)\n @image_array.each_index do |row|\n # => |col| is the chosen variable name for the inner array\n @image_array[row].each_index do |col|\n if @image_array[row][col] == 1\n puts \"#{row}, #{col}\"\n ones_ary << [row, col]\n end\n end\n end \n return ones_ary\n end", "def [](pos)\n row, col = pos\n raise \"Invalid coordinate\" unless (0..7).include?(row) && (0..7).include?(col)\n @board[row][col]\n end", "def at(x, y)\n @codeGrid[y][x]\n end", "def piece_at(square)\n if square.is_a?(Array)\n board_2d[square.first][square.last]\n else\n rank = RANKS.index(square[-1].to_i)\n file = FILES.index(square[0])\n board_2d[rank][file]\n end\n end", "def marker_coords(marker)\n row = @grid.find_index { |x| x.include?(marker) }\n col = @grid[row].index(marker)\n\n [col, row]\n end", "def lookup(x, y, coordinate_system=:row_col)\n @board[index_for(x, y, coordinate_system)]\n end", "def winning_marker\r\n WINNING_LINES.each do |line|\r\n winning_marker = check_for_winning_marker(@squares.values_at(*line))\r\n return winning_marker if winning_marker\r\n end\r\n nil\r\n end", "def valid_locations(r, c)\n positions = []\n #top row\n positions << [r - 1, c - 1]\n positions << [r - 1, c]\n positions << [r - 1, c + 1]\n\n #center row\n positions << [r, c-1]\n positions << [r, c + 1]\n\n #bottom row\n positions << [r + 1, c - 1]\n positions << [r + 1, c]\n positions << [r + 1, c + 1]\n \n #array boundry Check on the list of positions to find those that are on the board\n positions.delete_if {|v| v[0] < 0 || v[0] >= row}.delete_if{|v| v[1] < 0 || v[1] >= column}\n return positions\n end", "def at_index(x,y)\n @board[x][y]\n end", "def contains_mine?(row, col)\n @field[row][col].mine[:exists] == true\n end", "def matrix_find(row, column)\n self[row*9 + column]\n end", "def [](pos)\n x, y = pos\n grid[x][y]\n end", "def get_position(x, y)\r\n\t\treturn maze[y][x]\r\n\tend" ]
[ "0.68042094", "0.67441136", "0.6648272", "0.6566782", "0.6532259", "0.65184504", "0.63955855", "0.6298916", "0.6191949", "0.608033", "0.6029884", "0.6006745", "0.598417", "0.5980205", "0.5951131", "0.58934844", "0.58675253", "0.5850481", "0.5830921", "0.5801239", "0.5793308", "0.5776455", "0.5774282", "0.5745874", "0.5743675", "0.5723717", "0.5719169", "0.56149167", "0.5598505", "0.558906", "0.5566492", "0.5566492", "0.5555463", "0.5536933", "0.551934", "0.5513621", "0.55122924", "0.5509643", "0.5503421", "0.5488876", "0.54836893", "0.5464095", "0.54528975", "0.54502046", "0.543906", "0.54221475", "0.5420914", "0.54194945", "0.540955", "0.5400762", "0.53995603", "0.53962624", "0.53933644", "0.5392131", "0.53875965", "0.5384877", "0.53847986", "0.5380861", "0.53806967", "0.5368614", "0.53617847", "0.53611606", "0.5341251", "0.5336471", "0.5333109", "0.53295046", "0.5316939", "0.5314136", "0.5310937", "0.53033", "0.52995336", "0.5299288", "0.5288721", "0.5288721", "0.5288721", "0.5288721", "0.5288721", "0.5288721", "0.5288721", "0.5288721", "0.52799106", "0.52783906", "0.5275357", "0.52697253", "0.5257807", "0.52562284", "0.52554464", "0.5253468", "0.52514744", "0.52509725", "0.524874", "0.5247244", "0.5240075", "0.52302504", "0.52289104", "0.52274346", "0.5217874", "0.521757", "0.5217189", "0.52158165" ]
0.6766224
1
Get PgVersion that is released at the given date. Return nil if not have.
def get_released_version(date) @minor_versions.each do |pv| if pv.release_date == date then return pv end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_date\n release_dates.first[:date] rescue nil\n end", "def release_date(version = Origen.app.version.prefixed)\n time = release_time(version)\n time ? time.to_date : nil\n end", "def release_date\n document[\"release\"][\"releaseDate\"] rescue nil\n end", "def prerelease_tag\n prerelease_regex = if commits_since_tag > 0\n /^\\d+\\.\\d+\\.\\d+(?:-|\\.)([0-9A-Za-z.-]+)-\\d+-g[0-9a-f]+$/\n else\n /^\\d+\\.\\d+\\.\\d+(?:-|\\.)([0-9A-Za-z.-]+)$/\n end\n match = prerelease_regex.match(git_describe)\n match ? match[1] : nil\n end", "def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end", "def release_date\n sanitize_release_date(document.search('h5[text()*=Release Date]').first.next_sibling.innerHTML.to_s) rescue nil\n end", "def date_released=(date)\n date = Date.parse(date) unless date.is_a?(Date)\n\n @fields['date-released'] = date\n end", "def release_date\n read_attribute(:release_date) || write_attribute(:release_date, default_release_date)\n end", "def released_on=date\n super DateTime.strptime(date, '%m/%d/%Y')\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def get_release(project)\n info = get_github_api(project, \"releases\")\n release = 'master'\n if info.length > 0\n unpublishedDraftLimit = 5\n x = 0\n release = info[x]['tag_name']\n # Unpublished drafts need to be skipped.\n while (unpublishedDraftLimit > x) && info[x]['draft']\n release = info[x]['tag_name']\n x += 1\n end\n end\n release\n end", "def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end", "def released_on=date\n super Date.strptime(date, '%m/%d/%Y') #Converts the string entered in the form to be formatted to a date\n end", "def release_date\n @ole.ReleaseDate\n end", "def release_time(version = Origen.app.version.prefixed)\n version = VersionString.new(version)\n version = version.prefixed if version.semantic?\n capture = false\n File.readlines(\"#{Origen.root}/doc/history\").each do |line|\n line = line.strip\n if capture\n if capture && line =~ /^#+ by .* on (.*(AM|PM))/\n return Time.parse(Regexp.last_match(1))\n end\n else\n if line =~ /Tag:/\n line = line.gsub('\\\\', '')\n if line =~ /^#+ Tag: #{version}$/ ||\n line =~ />Tag: #{version}</\n capture = true\n end\n end\n end\n end\n nil\n end", "def release_date\n # If no release delays allowed, return today's date as release date\n return Time.zone.today if release_no_delay?\n\n # If this isn't an embargo, just return release_date from database\n return self[:release_date] unless release_max_embargo?\n\n # Otherwise (if an embargo), return latest embargo date by adding specified months to today's date\n Time.zone.today + RELEASE_EMBARGO_PERIODS.fetch(release_period).months\n end", "def lastest_package_release\n self.packages.where(:latest => 1).order(:release_date => :desc).first\n end", "def prerelease?\n unless instance_variable_defined? :@prerelease\n @prerelease = !!(@version =~ /[a-zA-Z]/)\n end\n @prerelease\n end", "def check_before_date_requirements(date)\n return true unless release_before_date? && release_date.present?\n date <= release_date\n end", "def display_release\n return _('Unspecified') if @research_output.release_date.blank?\n\n @research_output.release_date.localtime.to_date\n end", "def check_fixed_date_requirements(date)\n return true unless release_fixed_date? && release_date.present?\n date == release_date\n end", "def get_version_build\n version = self.peers_version\n if version[\"success\"]\n return version[\"build\"]\n else\n return nil\n end\n end", "def latest_published_version\n\t\tpub_vers = versions.where('published = ?', true).order('updated_at DESC')\n if pub_vers.any?() then\n return pub_vers.first\n else\n return nil\n end\n\tend", "def current_version\n versions.first\n end", "def current_releases(release_type, is_pdc:)\n if is_pdc\n release_type.current.enabled.pdc\n else\n release_type.current.enabled.legacy\n end\n end", "def dev_pod_or_released(name, version, dev_path)\n\tif dev_path != nil && (File.exists? File.expand_path(dev_path)) then\n\t\tpod name, :path => dev_path\n\t\tputs \"Using #{name} located at #{dev_path}\"\n\telse\n\t\tpod name, \"~> #{version}\"\n\t\tputs \"Using latest released version of #{name}\"\n\tend\nend", "def release_year\n document.search(\"//h5[text()^='Release Date']/..\").innerHTML[/\\d{4}/]\n end", "def version\n exec(:version).readline =~ /^gpg \\(GnuPG\\) (.*)$/ ? $1 : nil\n end", "def own_version(version)\n version.release_type == :final\n end", "def get_version(project)\n branch = get_release(project)\n build_file = get_github_file(project, branch, \"build-dkan.make\")\n version = build_file.scan(/\\[tag\\] = (.+)/)\n if version.to_a.length == 0\n version = build_file.scan(/\\[branch\\] = (.+)/)\n end\n version\n end", "def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end", "def latest_version\n (Release.where(:manifest_id => manifest_id).max(:version) || 0)\n end", "def latest\n releases.first\n end", "def prerelease?\n @prerelease ||= @version =~ /[a-zA-Z]/\n end", "def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend", "def published_version\n Rails.cache.fetch(\"published_version_for_#{name}\", expires_in: 10.minutes) do\n f = open(\"http://download.opensuse.org/factory/repo/oss/media.1/build\")\n matchdata = %r{openSUSE-(.*)-i586-.*}.match(f.read)\n matchdata[1]\n end\n end", "def card_version(version_no)\n to_find = if version_no == :latest\n latest_version\n else\n version_no\n end\n card_versions.find_by!(version: to_find)\n end", "def formated_release_date_for(game)\n return \"\" if game.nil?\n formated_date(game.date)\n end", "def get_rem_ver(app_name)\n app_url = get_app_url(app_name)\n if $verbose == 1\n puts \"Getting version (or date) of latest release from #{app_url}\"\n end\n rem_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_rem_ver(app_name,app_url)\")\n if rem_ver.to_s !~ /[0-9]/\n puts \"Remote build version (or date) not found\"\n exit\n end\n if !rem_ver.class.to_s.match(/Date/)\n rem_ver = rem_ver.gsub(/\\.$/,\"\")\n end\n return rem_ver\nend", "def get_cache_version\n data = get_from_cdn('version', {t: Time.now.to_i}, {public: true, uncompressed: true})\n\n unless data\n Tml.logger.debug('No releases have been published yet')\n return '0'\n end\n\n data['version']\n end", "def version\n get_scm_data if @_version.nil?\n @_version\n end", "def available_version(package_name, arch = nil)\n version(package_name, arch, true, false)\n end", "def latest_tag\n releases_url = 'https://github.com/david942j/one_gadget/releases/latest'\n @latest_tag ||= url_request(releases_url).split('/').last\n end", "def current_version\n version_number rev\n end", "def version\n return @version if defined?(@version)\n \n @version = JSON.parse(File.read('package.json'))['version']\nend", "def latest_version\n self.versions.order(\"revision_date DESC\").first\n end", "def released? # for readability\n released\n end", "def current\n @current ||=\n begin\n # Need to account for anniversaries at the beginning of next year\n week = Week.current\n year = if @release_date.month == week.start.month\n week.start.year\n else\n week.end.year\n end\n\n @release_date.dup.change(year: year)\n rescue StandardError => e\n Rollbar.error(e, release_date: @release_date)\n end\n end", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def get_latest_release_tag\n\trooturl = get_svn_repo_root()\n\treleaseurl = rooturl + \"/#{SVN_RELEASES_DIR}\"\n\t\n\ttags = svn_ls( releaseurl ).grep( RELEASE_VERSION_PATTERN ).sort_by do |tag|\n\t\ttag[RELEASE_VERSION_PATTERN].split('.').collect {|i| Integer(i) }\n\tend\n\treturn nil if tags.empty?\n\n\treturn releaseurl + '/' + tags.last\nend", "def valid_release_date?(date)\n # Validate date against all release date requirements\n check_no_delay_requirements(date) && check_before_date_requirements(date) && check_fixed_date_requirements(date)\n end", "def get_release_version(storage: :ebs, arch: :amd64)\n fail ArgumentError, \"storage can only be one of #{STORAGE}\" unless STORAGE.include? storage\n fail ArgumentError, \"arch can only be one of #{ARCH}\" unless ARCH.include? arch\n fetch_versions\n .select { |r| r.root_storage == storage && r.arch == arch }\n .map { |v| v.version.to_s }.uniq.first\n .gsub(/[-][\\w\\d]/, '')\n end", "def option_release_date\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.release_date\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end", "def release\n @release ||= ENV[\"RELEASE\"] || \"1\"\n end", "def auto_update_release_date\n if update_release_date\n self.release_date = default_release_date\n end\n end", "def datacite_available_date\n res = resources.files_published.order(created_at: :asc).first\n return nil unless res.present?\n\n res.publication_date || res.updated_at\n end", "def released?\n !!released_at && (released_at < Time.current)\n end", "def find_stemcell_release(version, product_name)\n version = OpsManager::Semver.new(version)\n releases = stemcell_releases(product_name).collect do |r|\n {\n release_id: r['id'],\n version: OpsManager::Semver.new(r['version']),\n }\n end\n releases.keep_if{ |r| r[:version].major == version.major }\n exact_version = releases.select {|r| r[:version] == version }\n return exact_version.first[:release_id] unless exact_version.empty?\n releases_sorted_by_version = releases.sort_by{ |r| r[:version].minor }.reverse\n return releases_sorted_by_version.first[:release_id] unless releases_sorted_by_version.empty?\n end", "def released_at_with_default\n released_at || default_released_at\n end", "def last_updated(version = nil)\n version ||= current_version\n return @last_update[version] if @last_update[version]\n\n metadata = JSON.parse(json_pathname(version).read)['metadata']\n @last_update[version] = Date.parse(metadata['release_date'])\n end", "def scm_date(ref)\n return nil unless File.exist?(git_dir)\n\n # Get the date in epoch time\n date = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:\"%ct\" -s`\n Time.at(date.to_i) if date =~ /\\d+/\n rescue RuntimeError\n nil\n end", "def published_version\n Rails.cache.fetch(\"published_version_for_#{name}\", expires_in: 10.minutes) do\n strategy.published_version\n end\n end", "def latest_matching(dep)\n version = latest_version_matching(dep)\n raise RuntimeError, \"no version found\" if version.nil?\n retrieve dep.name, version\n end", "def get_current_version(package)\n command = \"apt-cache policy #{package} | grep --color=never 'Installed'\"\n raw = `#{command}`.strip\n return nil if raw == ''\n\n version = raw.gsub('Installed: ', '')\n return nil if version == '(none)'\n\n version\n end", "def get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end", "def latest_version\n link = data.xpath(\"at:link[@rel = 'current-version']/@href\", NS::COMBINED)\n if link.first\n entry = conn.get_atom_entry(link.first.text)\n self_or_new(entry)\n else\n # FIXME: should somehow return the current version even for opencmis\n self\n end\n end", "def prerelease?\n comparable.prerelease?\n end", "def fetch_release_dates\n qualities = [\"Unknown\", \"Digital HD\", \"Blu-ray\", \"4K UHD\"]\n struct = Struct.new(:release_date, :release_type, :quality)\n\n release_dates.delete_all\n\n data = Services::N8n::Api.new.release_dates(title)\n\n data.map do |item|\n type = if item.type.include? \"4K UHD\"\n \"4K UHD\"\n elsif item.type.include? \"Blu-ray\"\n \"Blu-ray\"\n elsif item.type.include? \"Digital HD\"\n \"Digital HD\"\n end\n\n next nil unless type.present?\n\n quality = qualities.index(type)\n\n struct.new(item.release_date, type, quality)\n end.compact.uniq.group_by(&:release_date).flat_map do |_type, group|\n group.max_by(&:quality)\n end.each do |item|\n release_dates.create(release_date: item.release_date, release_type: item.release_type)\n end\n\n update available_date: release_dates.minimum(:release_date)\n end", "def price_at(date)\n found_stock = @stocks.select { |stock| stock.date == date }.first\n return nil if found_stock.nil?\n found_stock.opening unless found_stock.opening.nil?\n found_stock.closing if found_stock.opening.nil?\n end", "def latest\n output = aurget \"-Si\", @resource[:name]\n\n if output =~ /Version\\s+:\\s+(\\S+)$/\n return $1\n else\n self.err \"Could not find latest version\"\n return nil\n end\n end", "def _fetch_version(key)\r\n\t\tversioned = get(key)\r\n\t\tif versioned.length > 0\r\n version = versioned[0][1]\r\n else\r\n begin\r\n version = VectorClock.new\r\n\t\t\tversion.timestamp = Time.new.to_i * 1000\r\n end\r\n end\r\n\t\treturn version\r\n end", "def version(arg = nil)\n set_or_return(:version,\n arg,\n kind_of: String,\n default: 'latest',\n callbacks: {\n \"Valid versions are 'latest' or 'x.y.z'\" =>\n ->(a) { valid_version?(a) }\n })\n end", "def get_release( dbh, name )\n\tstmta = \"SELECT id, COUNT(id) AS count FROM releases WHERE name = '#{name}'\"\n\trsa = dbh.query( stmta )\n\tif rsa.any?\n\t rsa.each do |release|\n\t c = release['count']\n\t return release['id'] unless c == 0\n\t end\n\tend\n\treturn nil\nend", "def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end", "def release\n release_data = EventDate.data_for_release(params[:date_id])\n render json: release_data.to_json\n end", "def initialize(release_date)\n @release_date = release_date\n end", "def next_release_number\n latest_samson_number = project.releases.last&.number || \"0\"\n next_samson_number = next_number(latest_samson_number)\n return next_samson_number if commit.blank?\n\n return next_samson_number unless fuzzy_tag = project.repository.fuzzy_tag_from_ref(commit)&.split('-', 2)\n return next_samson_number unless latest_github_number = fuzzy_tag.first[VERSION_REGEX, 1]\n next_github_number = (fuzzy_tag.size == 1 ? latest_github_number : next_number(latest_github_number))\n\n if Gem::Version.new(next_samson_number) > Gem::Version.new(next_github_number)\n next_samson_number\n else\n next_github_number\n end\n end", "def determine(distro, release)\n return distro_releases[[distro, release]] if distro_releases.has_key? [distro, release]\n return distros[distro] if distros.has_key? distro\n default\n end", "def current_version\n versions.current_versions.first\n end", "def release\n case new_resource.version\n when 'latest'\n require 'octokit'\n Octokit.releases(repo).first[:tag_name]\n else\n \"v#{new_resource.version}\"\n end\n end", "def version\n return last_version if versionable?\n version_number\n end", "def get_version()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getVersion', 'string', 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 unstableRelease?(node)\n return getRelease(node)['type'] != 'stable'\n end", "def version(arg = nil)\n set_or_return(:version, arg, kind_of: String, default: 'latest')\n end", "def version(arg = nil)\n set_or_return(:version, arg, kind_of: String, default: 'latest')\n end", "def date_present(date)\n return unless date.is_a?(Date) || date.is_a?(String)\n\n date.present? ? format_bgs_date(date) : nil\n end", "def version\n response = get('/getVersion', {}, false)\n ApiVersion.new(response.body['version'], response.body['builddate'])\n end", "def check_version_or_latest_version(version = nil)\n version ||= latest_version\n raise Ajaxlibs::Exception::VersionNotFound unless self.class::Versions.include?(version)\n version\n end", "def version value = nil\n return @version if value.nil?\n @version = value\n end", "def el_version\n if File.exists?('/etc/fedora-release')\n nil\n elsif File.exists?('/etc/redhat-release')\n rpm = Pkg::Util::Tool.find_tool('rpm', :required => true)\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{rpm} -q --qf \\\"%{VERSION}\\\" $(#{rpm} -q --whatprovides /etc/redhat-release )\")\n stdout\n end\n end", "def version\n\t\treturn @version ||= self.find_version\n\tend", "def test_prerelease?(version)\n !@version.stable? && @version.major == version.major && @version.minor == version.minor && @version.patch == version.patch\n end", "def released?\n released\n # errors[:release_year] << \"Release Year can't be blank.\"\n # end\n end", "def version_number\n @version ||= nil\n end", "def scm_version(ref)\n return nil unless File.exist?(git_dir)\n\n version = `git --git-dir=#{safe_git_dir} describe --tags #{ref}`\n\n if $CHILD_STATUS.to_i.positive?\n # HEAD is not a tagged version, get the short SHA1 instead\n version = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:\"%h\" -s`\n else\n # HEAD is a tagged version, if version is prefixed with \"v\" it will be stripped off\n version.gsub!(/^v/, \"\")\n end\n\n version.strip!\n rescue RuntimeError\n nil\n end", "def price(date)\n if self.show_prices().any? {|price| price[\"date\"] == date}\n selected_price = @prices.map {|price| return price[\"val\"] if price[\"date\"] == date}\n else\n return false\n end\n end", "def released?\n scheduled? && !!released_at && (released_at < Time.current)\n end", "def prerelease?\n @prerelease || requirement.prerelease?\n end", "def release_date_is_in_the_past\n if release_date.present?\n errors.add(:release_date, \"should be in the past\") if release_date > Date.today\n end\n end", "def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end" ]
[ "0.69371414", "0.679275", "0.63974357", "0.5946498", "0.59137017", "0.5878385", "0.579597", "0.5723556", "0.57207483", "0.57120687", "0.5627439", "0.5588903", "0.55780953", "0.55757266", "0.5521762", "0.5470397", "0.5386423", "0.53670657", "0.5330954", "0.53030103", "0.5302598", "0.52871585", "0.5277974", "0.52578425", "0.52500093", "0.52202344", "0.5211937", "0.5208668", "0.51988864", "0.51962274", "0.51939607", "0.5185728", "0.5170329", "0.5162857", "0.5161667", "0.51479733", "0.5142844", "0.51382107", "0.51196504", "0.51188207", "0.5115224", "0.51088244", "0.5092522", "0.50853425", "0.5064619", "0.5055691", "0.5055675", "0.505176", "0.5032747", "0.50245786", "0.5024544", "0.5013708", "0.5009795", "0.49951205", "0.49925116", "0.4985008", "0.4958701", "0.49555373", "0.49554482", "0.49549243", "0.49416035", "0.49382323", "0.49323356", "0.49319538", "0.49299344", "0.49123594", "0.49054036", "0.49052456", "0.48942304", "0.4891658", "0.48904154", "0.4880959", "0.48774344", "0.48766455", "0.4874125", "0.48741034", "0.48737732", "0.48644954", "0.48633695", "0.4860798", "0.48549363", "0.4850143", "0.48493728", "0.4841011", "0.4841011", "0.4837033", "0.48363274", "0.4830618", "0.48215094", "0.4814984", "0.4809247", "0.4807563", "0.4806963", "0.48053798", "0.47959673", "0.47931793", "0.47883308", "0.47686532", "0.4766875", "0.47634313" ]
0.85417295
0
Already release note file exists?
def exist?() return File.exist?(@r_note_filepath) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkReleaseNotes(iReleaseDir, iReleaseInfo)\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.html\"))\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.txt\"))\n end", "def is_new?\n !File.exists? @filename\n end", "def file_exists\n end", "def already_stored?\n !file_uniqueness\n end", "def generateReleaseNote_TXT\r\n rSuccess = true\r\n\r\n logOp('Generating release note in TXT format') do\r\n lStrWhatsNew = ''\r\n if (@ReleaseComment != nil)\r\n lStrWhatsNew = \"\r\n== What's new in this release\r\n\r\n#{@ReleaseComment}\r\n\r\n\"\r\n end\r\n File.open(\"#{@DocDir}/ReleaseNote.txt\", 'w') do |oFile|\r\n oFile << \"\r\n= Release Note for #{@ReleaseInfo.project_info[:name]} - v. #{@ReleaseVersion}\r\n\r\n== Development status: #{@ReleaseInfo.project_info[:dev_status]}\r\n\r\n#{lStrWhatsNew}\r\n== Detailed changes with previous version\r\n\r\n#{getLastChangeLog.join}\r\n\r\n== Useful links\r\n\r\n* Project web site: #{@ReleaseInfo.project_info[:web_page_url]}\r\n* Download: https://sourceforge.net/projects/#{@ReleaseInfo.project_info[:project_unix_name]}/files/#{@ReleaseVersion}/#{@GemName}/download\r\n* Author: #{@ReleaseInfo.author_info[:name]} (#{@ReleaseInfo.author_info[:web_page_url]}) (Mail: #{@ReleaseInfo.author_info[:email]})\r\n* Browse RDoc: #{@ReleaseInfo.project_info[:web_page_url]}rdoc/#{@ReleaseVersion}\r\n* Browse source: #{@ReleaseInfo.project_info[:browse_source_url]}\r\n* View complete ChangeLog: #{@ReleaseInfo.project_info[:browse_source_url]}ChangeLog?view=markup\r\n* View README file: #{@ReleaseInfo.project_info[:browse_source_url]}README?view=markup\r\n\"\r\n end\r\n end\r\n\r\n return rSuccess\r\n end", "def exist; File.exist?(@fname); end", "def file_exists?(file)\n false\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def verify_existing_release_metadata\n return false if existing_files.empty?\n msg \"Verifying cached release metadata\"\n @invalid_metadata_files = existing_files.select {|f| !f.quick_verify}\n msg \"invalid_metadata_files: #{@invalid_metadata_files.size}\"\n end", "def save_release_note()\n puts \"Saving the release note of \" + @version + \" ...\"\n r_note = Nokogiri::HTML(open(@release_note_url))\n File.open(@r_note_filepath, \"w\") do |f|\n f.puts(r_note)\n end\n end", "def file_exists?\n !!file_path\n end", "def file_exists?\n !!file_path\n end", "def new_file?\n @new_file\n end", "def file?\n not identifier.blank?\n end", "def check_new\n if File.exist?(@new_file_path)\n #TODO: error properly\n abort\n end\n end", "def base_file_exists\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n uri = \"/notebooks/#{course}_#{file}\"\n if File.exist?(uri)\n render json: { result: true }\n else\n render json: { result: false }\n end\n end", "def exists?\n persistent? && (filename && filename.exist?)\n end", "def track_info_check(track_info)\n if(!File.exists?(track_info))\n File.new(track_info,'w+')\n store = YAML::Store.new(track_info)\n store.transaction do\n store[\"history\"] = []\n store[\"song_list\"] = {}\n store[\"reverse_song_list\"] = {}\n end\n end\n end", "def file_does_not_exist\n if self.xml_updated_at.present? && self.xml_content_type.present?\n file = self.xml.queued_for_write[:original]\n if file.present?\n doc = Nokogiri::XML(file)\n conf = doc.at_css('Conference')\n if conf.present?\n already_exists = Conference.not_deleted.where(:start_date => conf.at_css('StartDate').text[0..9])\n\n if already_exists.present? && !self.id.present?\n errors.add(:xml, I18n.t('activerecord.messages.agendas.cannot_be_public', :file_name => self.xml_file_name))\n end\n end\n file.rewind\n end\n end\n end", "def isNew()\n if !File.file?(getConfigFilePath()) || ! File.file?(getMyIDFilePath())\n return true\n end\n return false\n end", "def ok_to_create?(filepath)\n File.exist?(filepath) ? prompt_to_overwrite?(filepath) : true\n end", "def changelog_may_contain_anchor?( file_name )\n %w( .md .rdoc .textile ).include?( File.extname( file_name ) )\n end", "def file_new?(file)\n MTIMES[file].nil?\n end", "def createiOSChangeLogFile(org, release_notes)\n UI.important(\"Setting up changelogs: #{org}\")\n Dir.foreach(Dir.pwd + \"/metadata/#{org}/\") do |local|\n next if (local == '.') || (local == '..')\n\n if Dir.exist?(Dir.pwd + \"/changelogs/#{local}\")\n UI.important(\"Folder exists: #{local}. Copying ...\")\n FileUtils.cp(Dir.pwd + \"/changelogs/#{local}/changelog_template.txt\",\n Dir.pwd + \"/metadata/#{org}/#{local}/release_notes.txt\")\n open(Dir.pwd + \"/metadata/#{org}/#{local}/release_notes.txt\", 'a') do |f|\n f.puts(release_notes)\n end\n end\n end\nrescue StandardError => e\n # display the system generated error message\n puts(e)\nend", "def existing_files; end", "def _pid_file_exists?\n File.exist?(_pid_filename) \n end", "def touch_if_not_exist(file)\n FileUtils.touch(file) unless File.exist?(file)\n file\n end", "def file_exists?(path)\n end", "def is_up?\n\t\tFile.exists?(@file)\n\tend", "def entry_exists?(entry)\n File.exist?(entry)\n end", "def lockfile_exists?\n File.exist?(lockfile_name)\n end", "def check_for_file(format)\n File.exists?(\"#{@work.download_basename}.#{format}\")\n end", "def document_exists? path_to_document\n File.exists? path_to_document\n end", "def exists\n if @file && @mp3\n return true\n else\n return false\n end\n end", "def release_note(version = Origen.app.version.prefixed)\n version = VersionString.new(version)\n version = version.prefixed if version.semantic?\n capture = false\n note_started = false\n note = []\n File.readlines(\"#{Origen.root}/doc/history\").each do |line|\n line = line.strip\n if capture\n if note_started\n if line =~ /^<a class=\"anchor release_tag/ || line =~ /^#+ Tag/\n note.pop while note.last && note.last.empty?\n return note\n end\n if line.empty? && note.empty?\n # Don't capture preceding blank lines\n else\n note << line\n end\n elsif line =~ /^#+ by/\n note_started = true\n end\n else\n if line =~ /Tag:/\n line = line.gsub('\\\\', '')\n if line =~ /^#+ Tag: #{version}$/ ||\n line =~ />Tag: #{version}</\n capture = true\n end\n end\n end\n end\n note.pop while note.last && note.last.empty?\n note\n end", "def rerun_needed?\n\t\t\t@document.primary.file(\"log\", true).rerun_needed?\n\t\tend", "def pdf_present?\n self.filespec && File.exists?(self.filespec)\t\nend", "def add_stored(entry, src_path, &continue_on_exists_proc); end", "def check_new?(rname, new_slides, send_email)\n Helpers::log(\"Checking to see if this is a new SE..\")\n dir = File.dirname(new_slides)\n if !File.directory?(dir) || !File.exist?(new_slides)\n FileUtils.mkdir_p(dir)\n File.new(new_slides, \"w\")\n end\n known = File.open(new_slides).readlines.map!{ |e| e.chomp }\n if !known.include?(rname)\n Helpers::log(\"New SE: #{rname}\")\n if email? && send_email != 0\n msg = \"New SE on #{@machine}: #{rname}\"\n Emailer::send_email(EMAIL_FROM, @email_to, msg, msg)\n end\n add_line_to_file(new_slides, rname)\n return TRUE\n end\n return FALSE\n end", "def watched_file?(filename)\n false\n end", "def watched_file?(file)\n archive_file == file\n end", "def foot_print_exist?(filename)\n test_file_existence(filename, Pokedex_FootPrints_Path, @foot_print_data)\n end", "def file_exists?\r\n File.file?(full_path)\r\n end", "def add(entry, src_path, &continue_on_exists_proc); end", "def needed?\n return true if snapshot? && File.exist?(name) && (update_snapshot? || old?)\n super\n end", "def path_is_unique\n return true if self.mp3.file.blank?\n\n # Guess what the audio path will be before it's actually saved there.\n # This is predictable for uploaded audio.\n # This could potentially fail if someone was uploading audio at exactly\n # midnight and some audio already existed for the next day.\n path = File.join(\n AUDIO_PATH_ROOT,\n self.store_dir,\n self.filename\n )\n\n if File.exist?(path)\n self.errors.add(:mp3, \"A file with that name already exists; \" \\\n \"please rename your local audio file and try again. \" \\\n \"If you are trying to replace the audio file, first delete the \" \\\n \"old audio.\")\n end\n end", "def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end", "def Check_File(_Filename)\r\n unless File.exist?(\"#{_Filename.to_s}.yml\")\r\n File.open(\"#{_Filename.to_s}.yml\", 'w')\r\n end\r\nend", "def ensure_exists(sketch)\n puts \"Couldn't find: #{sketch}\" and exit unless FileTest.exist?(sketch)\n end", "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend", "def lock_file_present?(lfname)\n begin\n # TODO check lock file age and send a warning if it is older than a\n # given threshold.\n File.exists?(lfname)\n rescue => e\n logger.error \"checking lock file '#{lfname}' presence:\"\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n Mailer.notify_admins(self, 'lock_file_check', e)\n end\n end", "def ensure_exists(file)\n File.exist?(file) ? file : nil\n end", "def artist_info_check(artist_info)\n if(!File.exists?(artist_info))\n File.new(artist_info,'w+')\n store_a = YAML::Store.new(artist_info)\n store_a.transaction do\n store_a[\"directory\"] = {}\n store_a[\"reverse_directory\"] = {}\n end\n end\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def has_journal_entry?\n false\n end", "def attached?(filename); end", "def create_release_meta_file!(current_commits, new_version)\n release_meta_path = \"#{RELEASE_META_DIR}/#{new_version}.toml\"\n\n # Grab all existing commits\n existing_commits = get_existing_commits!\n\n # Ensure this release does not include duplicate commits. Notice that we\n # check the parsed PR numbers. This is necessary to ensure we do not include\n # cherry-picked commits made available in other releases.\n #\n # For example, if we cherry pick a commit from `master` to the `0.8` branch\n # it will have a different commit sha. Without checking something besides the\n # sha, this commit would also show up in the next release.\n new_commits =\n current_commits.select do |current_commit|\n existing_commits.select do |existing_commit|\n existing_commit.fetch(\"sha\") == current_commit.fetch(\"sha\") ||\n existing_commit.fetch(\"pr_number\") == current_commit.fetch(\"pr_number\")\n end\n end\n if new_commits.any?\n if File.exists?(release_meta_path)\n words =\n <<~EOF\n I found #{new_commits.length} new commits since you last generated:\n\n #{release_meta_path}\n\n So I don't erase any other work in that file, please manually add the\n following commit lines:\n\n #{new_commits.to_toml.indent(4)}\n\n Done? Ready to proceed?\n EOF\n\n if Printer.get(words, [\"y\", \"n\"]) == \"n\"\n Printer.error!(\"Ok, re-run this command when you're ready.\")\n end\n else\n File.open(release_meta_path, 'w+') do |file|\n file.write(\n <<~EOF\n [releases.\"#{new_version}\"]\n date = #{Time.now.utc.to_date.to_toml}\n commits = #{new_commits.to_toml}\n EOF\n )\n end\n\n words =\n <<~EOF\n I've created a release meta file here:\n\n #{release_meta_path}\n\n I recommend reviewing the commits and fixing any mistakes.\n\n Ready to proceed?\n EOF\n\n if Printer.get(words, [\"y\", \"n\"]) == \"n\"\n Printer.error!(\"Ok, re-run this command when you're ready.\")\n end\n end\n end\n\n true\nend", "def check_file_exist(_Filename)\r\n unless File.exist?(\"#{_Filename.to_s}.yml\")\r\n File.open(\"#{_Filename.to_s}.yml\", 'w')\r\n end\r\n end", "def fetch_new_release_metadata\n return false if new_files.empty?\n msg \"Caching metadata for new releases\"\n new_files.each {|f| f.fetch}\n end", "def create_note\n trap('SIGINT') do\n warn \"\\nCanceled\"\n exit!\n end\n # First make sure there isn't already a buildnotes file\n filename = find_note_file\n if filename\n system 'stty cbreak'\n fname = \"\\e[1;33m#{filename}\\e[1;37m\"\n yn = color_single_options(%w[y N])\n $stdout.syswrite \"#{fname} exists and appears to be a build note, continue anyway #{yn}\\e[1;37m? \\e[0m\"\n res = $stdin.sysread 1\n res.chomp!\n puts\n system 'stty cooked'\n\n unless res =~ /y/i\n puts 'Canceled'\n Process.exit 0\n end\n end\n\n title = File.basename(Dir.pwd)\n printf \"\\e[1;37mProject name \\e[0;32m[#{title}]\\e[1;37m: \\e[0m\"\n input = gets.chomp\n title = input unless input.empty?\n\n summary = ''\n printf \"\\e[1;37mProject summary: \\e[0m\"\n input = gets.chomp\n summary = input unless input.empty?\n\n ext = 'md'\n printf \"\\e[1;37mChoose build notes file extension \\e[0;32m[md]\\e[1;37m: \\e[0m\"\n input = gets.chomp\n ext = input unless input.empty?\n\n note = <<~EOBUILDNOTES\n # #{title}\n\n #{summary}\n\n ## File Structure\n\n Where are the main editable files? Is there a dist/build folder that should be ignored?\n\n ## Build\n\n What build system/parameters does this use?\n\n @run(./build command)\n\n ## Deploy\n\n What are the procedures/commands to deploy this project?\n\n ## Other\n\n Version control notes, additional gulp/rake/make/etc tasks...\n\n EOBUILDNOTES\n\n note_file = \"buildnotes.#{ext}\"\n\n if File.exist?(note_file)\n system 'stty cbreak'\n yn = color_single_options(%w[y N])\n file = \"\\e[1;33m#{filename}\"\n $stdout.syswrite \"\\e[1;37mAre you absolutely sure you want to overwrite #{file} #{yn}\\e[1;37m? \\e[0m\"\n res = $stdin.sysread 1\n res.chomp!\n puts\n system 'stty cooked'\n\n unless res =~ /y/i\n puts 'Canceled'\n Process.exit 0\n end\n end\n\n File.open(note_file, 'w') do |f|\n f.puts note\n puts \"Build notes for #{title} written to #{note_file}\"\n end\n end", "def file?\n repos.stat(fs_path, revision).file?\n end", "def create_file_with_blog_metadata(title)\n filename = generate_filename(title)\n filepath = \"_posts/#{filename}\"\n\n raise 'The file already exists.' if File.exists?(filepath)\n\n blog_metadata = generate_metadata_for(title)\n File.write(filepath, blog_metadata)\n\n filepath\nend", "def find_or_create_note(opts)\n\t\treport_note(opts.merge({:wait => true}))\n\tend", "def add_if_not_exists()\n\tif record_exists()\n\t\tprintf(\"EXISTS %s\\n\",self.digest)\n\t\treturn 0\n\tend\n\tsave()\n\treturn 1\nend", "def save_exists?(index)\n File.exists?(DataManager.make_filename(index-1))\n end", "def check_physical_product_file_exists\n f = File.expand_path('simple_store/lib/products/physical_product.rb', @work_dir)\n mark_file_exists(f)\n end", "def exists(files)\r\n files.each do |f|\r\n if f.name == 'Code Review Report'\r\n return f.id\r\n end\r\n end\r\n false\r\nend", "def exists?\n file.exists?\n end", "def exists?\n File.exist? file_path\n end", "def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end", "def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end", "def create_dummy_receipt(receipt)\n File.new(\"/Library/Application\\ Support/JAMF/Receipts/#{receipt}\", \"w\") {}\n end", "def has_doc?\n File.exist?(doc_path)\n end", "def exists?\n File.exists?(filename)\n end", "def feed_exists?(path)\n File.exist?(path)\n end", "def overwrite?(path)\n if File.exist?(path)\n return yes? \"A file already exists at '#{ path }'. Do you want to overwrite? [y/n]\"\n end\n true\n end", "def check_file_exists(file_name)\n \tif File.exist?(file_name)\n logger.fatal \"#{file_name} already exists.\"\n \t\tabort\n \tend\n end", "def add_sentence_to_catalogue_if_unique(template) # <= String\n all_sentences = File.readlines(\"sentences.txt\")\n unless all_sentences.include? \"#{template}\\n\"\n File.open(\"sentences.txt\", \"a+\") do |file|\n file << \"#{template}\\n\"\n end\n end\nend", "def exists_file?(key)\n # sanitize the name\n key = safe_file_name(key)\n key = add_namespace(key)\n\n boolify(redis.exists?(key))\n end", "def exists?\n File.exists?(@resource[:name])\n end", "def note?\n return true unless Settings.note.blank?\n return false\n end", "def create_at_launch?\n volume_id.to_s.empty? && (not snapshot_id.to_s.empty?)\n end", "def exists!\n @exists = true\n end", "def cry_exist?(filename)\n return File.exist?(filename)\n end", "def storage_exists?\n File.exists?(file_path)\n end", "def gentle_touch\n @@log.d(\"Gentle touch #{@path}\");\n if !self.exists?(@path) then\n self.open('w').close();\n end\n end", "def marshalized_text_file_exist?(filename)\n if PSDK_CONFIG.release?\n vdfilename = VD_TEXT_FILENAME\n ::Kernel::Loaded[vdfilename] = Yuki::VD.new(vdfilename, :read) unless ::Kernel::Loaded.key?(vdfilename)\n return ::Kernel::Loaded[vdfilename].exists?(File.basename(filename))\n end\n return File.exist?(filename)\n end", "def process_script\n if all_available_notes.grep(/#{current_date_stamp}/)[0]\n # we found a current-dated file, so write to it\n current_file = all_available_notes.grep(/#{current_date_stamp}/)[0]\n begin\n File.open(current_file, \"a+\") do |f|\n # append our note text to the file\n add_note(f, \"- #{note_text}\")\n end\n STDOUT.puts \".. finished appending to #{current_file}\"\n rescue => e\n # something went horribly wrong with writing to our file..\n STDOUT.puts \"Unable to open current dated file for appending -- #{e}\"\n end\n else\n # we don't have a file for the current date, so create it and add our date-\n # stamp for the current date\n new_file = \"#{default_file_path}/#{current_date_stamp}-notes.md\"\n begin\n File.open(new_file, \"w+\") do |f|\n add_date(f, current_date)\n add_note(f, \"- #{note_text}\")\n end\n STDOUT.puts \".. finished writing to #{new_file}\"\n rescue => e\n # something went horribly wrong with writing to our file..\n STDOUT.puts \"Unable to open newly created file for writing -- #{e}\"\n end\n end\nend", "def exist?\n File.exist? fullpath\n end", "def fcReady?(fcName)\n if File::exist?(@instrDir + \"/\" + fcName + \"/.rsync_finished\")\n return true\n end\n \n if fcName.match(/SN601/) || fcName.match(/SN166/) \n puts \"Flowcell \" + fcName + \" is not configured for automatic analysis\"\n return false\n end\n\n # If the marker file RTAComplete.txt was written more than 1 hour ago, then\n # add the new marked file and return.\n if File::exist?(@instrDir + \"/\" + fcName + \"/RTAComplete.txt\")\n cmd = \"touch \" + @instrDir + \"/\" + fcName + \"/.rsync_finished\"\n `#{cmd}`\n end\n return false\n end", "def remove_release_from_history(release, release_file)\n release_history = capture(\"cat #{release_file}\").split\n\n # Remove release if it exists\n release_history.delete_at release_history.index(release) unless release_history.index(release).nil?\n\n # Save\n first_rel = true\n release_history.each do |rel|\n if first_rel\n try_sudo \"echo '#{rel}' > #{release_file}\"\n first_rel = false\n else\n try_sudo \"echo '#{rel}' >> #{release_file}\"\n end\n end\nend", "def file_exist?\n return FileTest.exist?(@fileurl)\n end", "def exist\n\treturn true\n end", "def sound_exist?(filename)\n return File.exist?(filename)\n end", "def osx_version_txt t\n create_version_file t\nend", "def osx_version_txt t\n create_version_file t\nend", "def ensure_exists\n create unless Dir.exist? path\n end" ]
[ "0.65962934", "0.64236635", "0.6143156", "0.6142977", "0.60162115", "0.5997049", "0.5989373", "0.5959471", "0.5959471", "0.5952987", "0.59493744", "0.59235567", "0.59226215", "0.58932346", "0.585563", "0.5837311", "0.5826832", "0.58176714", "0.58006704", "0.5791112", "0.57897246", "0.57700324", "0.5754106", "0.5736253", "0.57320106", "0.5722768", "0.56901866", "0.56778145", "0.566825", "0.5656867", "0.565166", "0.5647924", "0.56265897", "0.56258655", "0.5622688", "0.56197727", "0.56147677", "0.56097984", "0.5605215", "0.5605178", "0.5600261", "0.55995923", "0.5597975", "0.55747575", "0.55718595", "0.5557031", "0.5556692", "0.5553787", "0.5540903", "0.55198187", "0.55097127", "0.5508873", "0.5503408", "0.54873466", "0.54860765", "0.54860765", "0.54860765", "0.5473868", "0.54706883", "0.54668087", "0.54581296", "0.54501605", "0.5447924", "0.54368496", "0.54366046", "0.54351085", "0.5431148", "0.5420755", "0.5417965", "0.5404969", "0.539923", "0.5391006", "0.538899", "0.5388779", "0.53876245", "0.5382204", "0.5381731", "0.5381531", "0.53742695", "0.5369774", "0.53688496", "0.53609", "0.5354604", "0.5353967", "0.53511584", "0.53491455", "0.5346042", "0.5343335", "0.53405625", "0.53373057", "0.53332776", "0.5325806", "0.53211254", "0.532062", "0.5316518", "0.5316483", "0.53110796", "0.5308589", "0.5308589", "0.5307348" ]
0.7161358
0
Save release note html file into ReleaseNoteDir
def save_release_note() puts "Saving the release note of " + @version + " ..." r_note = Nokogiri::HTML(open(@release_note_url)) File.open(@r_note_filepath, "w") do |f| f.puts(r_note) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateReleaseNote_HTML\r\n rSuccess = true\r\n\r\n logOp('Generating release note in HTML format') do\r\n lLastChangesLines = []\r\n getLastChangeLog.each do |iLine|\r\n lLastChangesLines << iLine.\r\n gsub(/\\n/,\"<br/>\\n\").\r\n gsub(/^=== (.*)$/, '<h3>\\1</h3>').\r\n gsub(/^\\* (.*)$/, '<li>\\1</li>').\r\n gsub(/Bug correction/, '<span class=\"Bug\">Bug correction</span>')\r\n end\r\n lStrWhatsNew = ''\r\n if (@ReleaseComment != nil)\r\n lStrWhatsNew = \"\r\n<h2>What's new in this release</h2>\r\n#{@ReleaseComment.gsub(/\\n/,\"<br/>\\n\")}\r\n \"\r\n end\r\n File.open(\"#{@DocDir}/ReleaseNote.html\", 'w') do |oFile|\r\n oFile << \"\r\n<html>\r\n <head>\r\n <link rel=\\\"shortcut icon\\\" href=\\\"#{@ReleaseInfo.project_info[:favicon_url]}%>\\\" />\r\n <style type=\\\"text/css\\\">\r\n body {\r\n background: #fdfdfd;\r\n font: 14px \\\"Helvetica Neue\\\", Helvetica, Tahoma, sans-serif;\r\n }\r\n img {\r\n border: none;\r\n }\r\n h1 {\r\n text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;\r\n color: #6C8C22;\r\n }\r\n h2 {\r\n padding: 2px 8px;\r\n background: #ccc;\r\n color: #666;\r\n -moz-border-radius-topleft: 4px;\r\n -moz-border-radius-topright: 4px;\r\n -webkit-border-top-left-radius: 4px;\r\n -webkit-border-top-right-radius: 4px;\r\n border-bottom: 1px solid #aaa;\r\n }\r\n h3 {\r\n padding: 2px 32px;\r\n background: #ddd;\r\n color: #666;\r\n -moz-border-radius-topleft: 4px;\r\n -moz-border-radius-topright: 4px;\r\n -webkit-border-top-left-radius: 4px;\r\n -webkit-border-top-right-radius: 4px;\r\n border-bottom: 1px solid #aaa;\r\n }\r\n .Bug {\r\n color: red;\r\n font-weight: bold;\r\n }\r\n .Important {\r\n color: #633;\r\n font-weight: bold;\r\n }\r\n ul {\r\n line-height: 160%;\r\n }\r\n li {\r\n padding-left: 20px;\r\n }\r\n </style>\r\n </head>\r\n <body>\r\n <a href=\\\"#{@ReleaseInfo.project_info[:web_page_url]}\\\"><img src=\\\"#{@ReleaseInfo.project_info[:image_url]}\\\" align=\\\"right\\\" width=\\\"100px\\\"/></a>\r\n <h1>Release Note for #{@ReleaseInfo.project_info[:name]} - v. #{@ReleaseVersion}</h1>\r\n <h2>Development status: <span class=\\\"Important\\\">#{@ReleaseInfo.project_info[:dev_status]}</span></h2>\r\n#{lStrWhatsNew}\r\n <h2>Detailed changes with previous version</h2>\r\n#{lLastChangesLines.join}\r\n <h2>Useful links</h2>\r\n <ul>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:web_page_url]}\\\">Project web site</a></li>\r\n <li><a href=\\\"https://sourceforge.net/projects/#{@ReleaseInfo.sf_info[:project_unix_name]}/files/#{@ReleaseVersion}/#{@GemName}/download\\\">Download</a></li>\r\n <li>Author: <a href=\\\"#{@ReleaseInfo.author_info[:web_page_url]}\\\">#{@ReleaseInfo.author_info[:name]}</a> (<a href=\\\"mailto://#{@ReleaseInfo.author_info[:email]}\\\">Contact</a>)</li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:web_page_url]}rdoc/#{@ReleaseVersion}\\\">Browse RDoc</a></li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:browse_source_url]}\\\">Browse source</a></li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:browse_source_url]}ChangeLog?view=markup\\\">View complete ChangeLog</a></li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:browse_source_url]}README?view=markup\\\">View README file</a></li>\r\n </ul>\r\n </body>\r\n</html>\r\n\"\r\n end\r\n end\r\n\r\n return rSuccess\r\n end", "def generateReleaseNote_TXT\r\n rSuccess = true\r\n\r\n logOp('Generating release note in TXT format') do\r\n lStrWhatsNew = ''\r\n if (@ReleaseComment != nil)\r\n lStrWhatsNew = \"\r\n== What's new in this release\r\n\r\n#{@ReleaseComment}\r\n\r\n\"\r\n end\r\n File.open(\"#{@DocDir}/ReleaseNote.txt\", 'w') do |oFile|\r\n oFile << \"\r\n= Release Note for #{@ReleaseInfo.project_info[:name]} - v. #{@ReleaseVersion}\r\n\r\n== Development status: #{@ReleaseInfo.project_info[:dev_status]}\r\n\r\n#{lStrWhatsNew}\r\n== Detailed changes with previous version\r\n\r\n#{getLastChangeLog.join}\r\n\r\n== Useful links\r\n\r\n* Project web site: #{@ReleaseInfo.project_info[:web_page_url]}\r\n* Download: https://sourceforge.net/projects/#{@ReleaseInfo.project_info[:project_unix_name]}/files/#{@ReleaseVersion}/#{@GemName}/download\r\n* Author: #{@ReleaseInfo.author_info[:name]} (#{@ReleaseInfo.author_info[:web_page_url]}) (Mail: #{@ReleaseInfo.author_info[:email]})\r\n* Browse RDoc: #{@ReleaseInfo.project_info[:web_page_url]}rdoc/#{@ReleaseVersion}\r\n* Browse source: #{@ReleaseInfo.project_info[:browse_source_url]}\r\n* View complete ChangeLog: #{@ReleaseInfo.project_info[:browse_source_url]}ChangeLog?view=markup\r\n* View README file: #{@ReleaseInfo.project_info[:browse_source_url]}README?view=markup\r\n\"\r\n end\r\n end\r\n\r\n return rSuccess\r\n end", "def save! target=\"./Notes\"\n filename = File.join(target, \"#{@title}.txt\")\n\n Faceoff.safe_save(filename) do |file|\n file.write self.to_s\n end\n end", "def save_page(file_name = nil)\r\n file_name ||= Time.now.strftime(\"%Y%m%d%H%M%S\") + \".html\"\r\n puts \"about to save page: #{File.expand_path(file_name)}\" if $DEBUG\r\n File.open(file_name, \"w\").puts page_source\r\n end", "def save_thank_you_letters(id,form_letter)\n Dir.mkdir(\"output\") unless Dir.exists?(\"output\")\n filename = \"output/thanks_#{id}.html\"\n File.open(filename,'w') do |file|\n file.puts form_letter\n end\nend", "def save_wiki_body( filename, url )\n page = get( url )\n file_put_contents( filename, page.body )\n end", "def write_file\n\n File.open(\"rebuild.html\", \"w\") do |file|\n @write_array.each do |tags_and_text|\n file.write tags_and_text\n end\n end\n\n end", "def save_thank_you_letters(id, form_letter)\n Dir.mkdir(\"output\") unless Dir.exists? \"output\"\n\n filename = \"output/thanks_#{id}.html\"\n\n File.open(filename, 'w') do |file|\n file.puts form_letter\n end\nend", "def save\n receipt = File.new(@save_path, 'w')\n receipt.write(render)\n receipt.close\n end", "def saveScreenHTML(filepath)\n File.open(filepath, 'w') do |f|\n f.write @browser.html\n end\n end", "def save_content(title, content)\n\tFile.open(\"pages/#{title}.txt\" , \"w\") do |file|\n\t file.print(content)\n end \t\t\nend", "def write_the_html_file(mdpath, name)\n DbgMgr.put \"out_html\", \"writing #{name}html\"\n file = File.join @doc, (name + \"html\")\n VersionedFile.new_version file, true, bak: @doc_bak, keep: @keep\n cmd = \"pandoc -p -s -S -f markdown -t html5 --toc --toc-depth=4 \" +\n \"--self-contained --css #{@css} -o #{file} #{mdpath}\"\n DbgMgr.put \"out_html\", cmd\n output = %x[#{cmd}]\n [$?.exitstatus, output]\n\n end", "def draft(draft_name, tags: ['ruby'])\n time = nil\n file_name = Slugify.(draft_name) + '.md'\n\n File.write(DRAFTS_PATH + file_name, FileContent.(draft_name, time, tags))\nend", "def save_wiki_source( page, filename )\n f = page.form_with( id: 'dw__editform' )\n wikitext = f.field_with( name: 'wikitext' ).value.delete( \"\\r\" )\n file_put_contents( filename, wikitext )\n button = f.button_with( name: 'do[draftdel]' )\n @agent.submit( f, button )\n end", "def save_instructions\n file = 'TODO'\n text = \"### TO-DO for #{name.upcase} feature:\\n\\n#{instructions}\\n\\n\\n\"\n\n in_root do\n create_file file unless File.exists? file\n append_to_file file, text\n end\n end", "def write\n filename = \"#{@directory}/label.html\"\n File.open(filename, 'w') do |fp|\n fp.puts(self.to_s)\n end\n puts \"Wrote #{filename}\"\n end", "def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end", "def save_plagiarism_html(match_link, html)\n File.open(path_to_plagarism_html(match_link), 'w') do |out_file|\n out_file.puts html\n end\n end", "def save(filename=@filename)\n backup_filename = filename + '~'\n File.delete(backup_filename) if File.exist? backup_filename\n FileUtils.mv(filename, backup_filename)\n File.open(filename, 'w') do |f|\n f.puts @header\n f.puts @body\n f.puts @gem_dependencies\n f.puts @dev_dependencies\n f.puts @footer\n end\n end", "def save_file path, content\n\t\t\t\tif @fix\n\t\t\t\t\tcontent = content.gsub \"url('/\", \"url('\"\n\t\t\t\t\tcontent = content.gsub 'src=\"/', 'src=\"'\n\t\t\t\t\tcontent = content.gsub 'href=\"/', 'href=\"'\n\t\t\t\tend\n\t\t\t\tFile.open(path, 'w+') { |f| f.puts content }\n\t\t\tend", "def write_index_file(html)\n index = File.open('/home/matt/Documents/programming/ruby/dmsw/index.html', 'w')\n index.write(html)\n index.close\n $log.info(\"Successfully created new index.html.\")\nend", "def save_content(title, content)\n File.open(\"pages/#{title}.txt\", \"w\") do |file|\n file.print(content)\n end\nend", "def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end", "def save_thank_you_letters(id,form_letter)\r\n\tDir.mkdir(\"output\") unless Dir.exist?(\"output\")\r\n\r\n\tfilename = \"output/thanks_#{id}.html\"\r\n\r\n\tFile.open(filename, \"w\") do |file|\r\n\t\tfile.puts form_letter\r\n\tend\r\nend", "def save_locally(dir)\n FileUtils.mkdir_p(dir) unless File.exists? dir\n \n # remove HTML BASE tag if it exists\n @contents.xpath('//base').each { |t| t.remove }\n # remove head tag\n @contents.xpath('//head').each { |t| t.remove }\n # remove link tags\n @contents.xpath('//link').each { |t| t.remove }\n # remove script tags\n @contents.xpath('//script').each { |t| t.remove }\n # remove comments\n @contents.xpath('//comment()').each { |t| t.remove }\n # remove mediawiki meta tag\n @contents.xpath('//meta').each { |t| t.remove if t['name'] == \"generator\" }\n # remove sitesub h3 tag\n @contents.xpath('//h3').each { |t| t.remove if t['id'] == \"siteSub\" }\n\n # get lastmod/viewcount values\n @contents.xpath('//li').each do |t|\n if t['id'] == \"lastmod\"\n @lastmod = t.text.strip\n end\n if t['id'] == \"viewcount\"\n @viewcount = t.text.strip\n end\n end\n\n # remove unneeded divs\n @contents.xpath('//div').each do |t|\n t.remove if t['id'] == \"column-one\"\n t.remove if t['id'] == \"footer\"\n t.remove if t['id'] == \"catlinks\"\n t.remove if t['id'] == \"contentSub\"\n t.remove if t['id'] == \"jump-to-nav\"\n t.remove if t['class'] == \"printfooter\"\n t.remove if t['class'] == \"visualClear\"\n end\n\n if @main_page == true\n save_path = File.join(dir, \"index\")\n title = 'Dublin Core Metadata Initiative Media-Wiki Archive'\n else\n save_path = File.join(dir, File.basename(uri.to_s))\n title = File.basename(uri.to_s).gsub(\"_\", \" \")\n end\n save_path += '.html' if save_path !~ /\\.((html?)|(txt))$/\n File.open(save_path, 'w') { |f| f.write(\"<!DOCTYPE html>\\n<html>\\n<head>\\n<meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=UTF-8\\\">\\n<meta http-equiv=\\\"Content-Language\\\" content=\\\"en-us\\\">\\n<title>#{title}</title>\\n</head>\\n<body>\\n<p><b>This is an archived MediaWiki page.</b><br />#{@lastmod}<br />#{@viewcount}</p>\\n#{@contents.xpath('//div[@id=\"bodyContent\"]').to_html}\\n</body>\\n</html>\") }\n # File.open(save_path, 'w') { |f| f.write(\"---\\nlayout: page\\ntitle: #{title}\\n---\\n\\n#{@contents.xpath('//div[@id=\"bodyContent\"]').to_html}\") }\n end", "def save_html(directory_path, file_name, body, charset)\n # Starting directory path must public path(Rails.public_path) for security\n public_and_under_directory_path = \"#{Rails.public_path}/#{directory_path}\"\n directory_full_path = \"#{Rails.public_path}/#{directory_path}/#{file_name}\"\n\n if FileTest.exist?(public_and_under_directory_path)\n body.force_encoding(charset) if charset # For 2 byte chars.\n File.open(directory_full_path, \"w\") do |f|\n f.puts( body.gsub(/\\r\\n|\\r|\\n|\\t/, '') ) # Get response data with deleted empty lines).\n end\n end\n end", "def save_file\n\t\t\tfile_hash = Digest::MD5.hexdigest(File.read(@file))\n\t\t\tif file = @db.find_html_file(@filename)\n\t\t\t\t@file_changed = @db.check_or_update_if_file_changed(file, @filename, file_hash)\n\t\t\telse\n\t\t\t\t@db.create_html_file(@filename, file_hash)\n\t\t\tend\n\t\tend", "def save_page(page, name)\n f = File.new(name,'w')\n f.puts page\n f.close\n end", "def saveFile(saveTag)\n aFile = File.new(\"config.version\", \"w+\")\n if aFile\n aFile.syswrite(\"version=#{saveTag}\")\n aFile.close\n else\n puts \"Unable to write a config.version file!\"\n end\n end", "def write_to_html filename = \"#{title}.html\", options = {}\n File.open(filename, \"w\") { |f| f.write(to_html(options)) }\n filename\n end", "def save(filename, content)\n\t\t# FIXME - if the file exists, this should bail out\n\t\t\n\t\t# write the contents into the file\n\t\tfile = dir + '/' + filename + '.md'\n\t\tf = File.new(file, \"w\")\n\t\tf.write(content)\n\t\tf.close\n\t\t\n\t\t# return the new file\n\t\treturn page(filename)\n\tend", "def save(filename, content)\n\t\t# FIXME - if the file exists, this should bail out\n\t\t\n\t\t# write the contents into the file\n\t\tfile = dir + '/' + filename + '.md'\n\t\tf = File.new(file, \"w\")\n\t\tf.write(content)\n\t\tf.close\n\t\t\n\t\t# return the new file\n\t\treturn page(filename)\n\tend", "def save_and_open\n return unless File.exist?(session.saved_page_dir)\n\n filename = \"#{session.saved_page_dir}/webrat-#{Time.now.to_i}.html\"\n \n File.open(filename, \"w\") do |f|\n f.write rewrite_css_and_image_references(session.response_body)\n end\n\n open_in_browser(filename)\n end", "def save(data: content, name: subject + '.html')\n filename = 'tmp/' + name\n\n File.open(filename, 'w+') do |f|\n f.write(data)\n end\n end", "def save_to_file\n File.open(@output, 'w+') do |file|\n file.puts HEADER if @additional_html\n file.puts @data_for_output.join(\"\\n\")\n file.puts FOOTER if @additional_html\n end\n end", "def checkReleaseNotes(iReleaseDir, iReleaseInfo)\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.html\"))\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.txt\"))\n end", "def XOsavePage()\n\t\tbegin\n\n\t\t\tfileName= $gcfd.logPath+@wwBrws.url.tr(\" =%?*/\\\\:\",'_')+Time.now.to_i.to_s+'.html'\n\t\t\tFile.open(fileName, 'w') do |file|\n\t\t\t\tfile.write(@wwBrws.html)\n\t\t\tend\n\t\t\t$alog.lwrite('HTML page saved in '+ fileName, 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems saving page '+ fileName, 'ERR_') \t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend", "def write_html_file(name, type, html)\n if ENV['WRITE_HTML_FILE'] != 'false'\n file_name = \"#{File.dirname(__FILE__)}/results/#{name.gsub('.xml', '')}-#{Time.now.strftime(\"%d%b\")}_#{type}.html\"\n file = File.open(file_name, 'w+')\n file.puts html\n file.close\n end\nend", "def generate_webpage(file_name)\n text=File.open(file_name).read\n text.gsub!(/\\r\\n?/, \"\")\n\n page = File.open(\"version.html\",\"w\")\n\n page.puts('<body style=\"padding-right:10%;padding-left:10%;margin-right:auto;margin-left:auto\">')\n\n text.each_line do |line|\n hs = JSON.parse(line)\n if ! hs[\"version\"].empty?\n page.puts \"<h2>\" + \"version\" + hs[\"version\"] + \"</h2>\"\n page.puts '<span style=\"font-size: 10pt\">Release Date:' + hs[\"release_date\"] + \"</span>\"\n page.puts '<hr>'\n else\n page.puts '<span style=\"font-size: 10pt\">Date:' + hs[\"release_date\"] + \"</span>\"\n end\n page.puts \"<h3>features</h3>\"\n page.puts '<ul>'\n hs[\"features\"].each do |feature|\n page.puts '<li>' + feature.to_s + '</li>'\n end\n page.puts '</ul>'\n\n page.puts \"<h3>issues</h3>\"\n page.puts '<ul>'\n hs[\"fix_issue\"].each do |issue|\n page.puts '<li>' + issue.to_s + '</li>'\n end\n page.puts '</ul>'\n end\n\n page.puts('</body>')\n\n page.close\n\nend", "def write_nav\n File.write(\"epub/OEBPS/#{nav_filename}\", nav_html)\n end", "def write_to_file(data)\n\t\t\tref = File.join(@root, \"tarrifs_\" + @page[:name])\n\n\t\t\tif File.exists?(ref)\n\t\t\t\tdiff = \"\"\n\t\t\t\tstatus = Open4::popen4(\"diff #{ref} -\") do |pid, stdin, stdout, stderr|\n\t\t\t\t\tstdin.puts data\n\t\t\t\t\tstdin.close\n\t\t\t\t\tdiff = stdout.read\n\t\t\t\tend\n\t\t\t\t#sent mail if content is different\n\t\t\t\tif status != 0\n\t\t\t\t\twrite \"change detected.\"\n\t\t\t\t\tnotify_changed_site(url, diff)\n\t\t\t\tend\n\t\t\tend\n\t\t\tFile.open(ref, \"w\") do |f|\n\t\t\t\tf.puts data\n\t\t\tend\n\t\tend", "def add_to_file entry, content\n path = repo_path.join entry\n File.write path, content, :mode => \"a\"\n end", "def write_new_draft()\n filename = get_unique_filename\n full_path = File.join(@post_dir, filename)\n File.open(full_path, 'w') do |f|\n f.puts \"---\"\n f.puts \"title: \\\"#{@title}\\\"\"\n f.puts \"layout: default\"\n f.puts @yaml_cat if @yaml_cat != nil\n f.puts \"date: #{@date}\"\n f.puts \"---\"\n f.puts \"\"\n f.puts \"\\# #{@title}\" # Make the heading and title the same as a default\n f.puts @content if @content != nil\n end \n puts \"Post created under \\\"#{full_path}\\\"\"\n full_path\n end", "def mark\n \"(echo #{revision} > #{configuration[:release_path]}/REVISION)\"\n end", "def save_thank_you_letters(id,form_letter)\n\tDir.mkdir(\"output\") unless Dir.exists?(\"output\")\n\tfilename = \"output/thanks_#{id}.html\"\n\n\tFile.open(filename, 'w') do |file|\n\t\tfile.puts form_letter\n\tend\nend", "def save_to(path)\n File.open(path, \"w\") do |file|\n I18n.with_locale(meta.locale) do\n file << render\n end\n end\n end", "def save_thank_you_letter(id, form_letter)\n # Creates an output directory if there isn't one\n Dir.mkdir(\"output\") unless Dir.exists?(\"output\")\n \n # File name created by specific id's\n filename = \"output/thanks_#{id}.html\"\n \n # Create the file and write the personalized form letter to it\n File.open(filename, 'w') do |file|\n file.puts(form_letter)\n end \nend", "def savePage(fileName = \"testPage.yml\")\n\t\t#File.open(\"file.rb\") if File::exists?( \"file.rb\" )\n\t\tfile = File.new(@@pageDirectory + fileName, \"w+\")\n\t\tserializedPage = YAML::dump(@currentHTMLPage)\n\t\tfile.puts(serializedPage)\n\t\tfile.close\n\t\t#puts(\"saved page: #{fileName}\")\n\tend", "def write(out=nil)\n out ||= project.path(:output, path)\n FileUtils.mkdir_p File.dirname(out)\n\n if tilt?\n File.open(out, 'w') { |f| f.write to_html({}, :build => true) }\n else\n FileUtils.cp file, out\n end\n end", "def save!\n Powirb.log.debug(\"[#{wid}] saving on #{@filename}\")\n File.open(@filename, 'w+') {|io| io.puts @doc}\n end", "def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end", "def createiOSChangeLogFile(org, release_notes)\n UI.important(\"Setting up changelogs: #{org}\")\n Dir.foreach(Dir.pwd + \"/metadata/#{org}/\") do |local|\n next if (local == '.') || (local == '..')\n\n if Dir.exist?(Dir.pwd + \"/changelogs/#{local}\")\n UI.important(\"Folder exists: #{local}. Copying ...\")\n FileUtils.cp(Dir.pwd + \"/changelogs/#{local}/changelog_template.txt\",\n Dir.pwd + \"/metadata/#{org}/#{local}/release_notes.txt\")\n open(Dir.pwd + \"/metadata/#{org}/#{local}/release_notes.txt\", 'a') do |f|\n f.puts(release_notes)\n end\n end\n end\nrescue StandardError => e\n # display the system generated error message\n puts(e)\nend", "def output(contents, filename = \"output.html\")\n out_file = File.new(filename, \"w\")\n out_file.puts(contents)\n out_file.close\n end", "def write_page_to_fs(page, filepath, locale)\n # puts filepath.inspect\n _filepath = \"#{filepath}.liquid\"\n _filepath.gsub!(/.liquid$/, \".#{locale}.liquid\") if locale\n\n _filepath = File.join('app', 'views', 'pages', _filepath)\n\n self.replace_content_asset_urls(page.source)\n\n self.open_file(_filepath) do |file|\n file.write(page.to_yaml)\n end\n end", "def save_pages\n path = SAVED_PAGES_DIR\n\n # prepare dir\n FileUtils.mkdir(path) unless File.directory?(path)\n\n # prepare filename\n url = @page.current_url\n url = url.sub(/#{Regexp.quote(Testing.base_url)}\\//, '') # remove base url\n url = url.gsub(/\\//, '_') # change / to _\n url = 'homepage' if url.empty? # that's homepage left\n filename = \"#{path}/#{url}.html\"\n\n # save page\n File.open(filename, 'w') { |f| f.write(@page.html) }\n puts \"Saved page to #{filename}\"\n end", "def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end", "def post(post_name, tags: ['ruby'])\n time = Time.now\n file_name = time.to_date.to_s + '-' + Slugify.(post_name) + '.md'\n\n File.write(POSTS_PATH + file_name, FileContent.(post_name, time, tags))\nend", "def write(issue)\r\n @issue = issue\r\n @dirs[:tmp] = File.join(@dirs[:tmp_base], issue.id)\r\n @dirs[:content] = File.join(@dirs[:tmp], \"OEBPS\")\r\n @dirs[:images] = File.join(@dirs[:tmp], \"OEBPS\", Image.rel_path_prefix)\r\n @dirs[:meta_inf] = File.join(@dirs[:tmp], \"META-INF\")\r\n @files = [\r\n { :template => \"container.xml.erb\", :path => File.join(@dirs[:meta_inf], \"container.xml\") },\r\n { :template => \"content.opf.erb\", :path => File.join(@dirs[:content], \"content.opf\") },\r\n { :template => \"toc.html.erb\", :path => File.join(@dirs[:content], \"toc.html\") },\r\n { :template => \"toc.ncx.erb\", :path => File.join(@dirs[:content], \"toc.ncx\") },\r\n { :template => \"style.css.erb\", :path => File.join(@dirs[:content], \"style.css\") }\r\n ]\r\n @epub = File.join(@dirs[:issues], @issue.id)+'.epub'\r\n @mobi = File.join(@dirs[:issues], @issue.id)+'.mobi'\r\n\r\n make_dirs\r\n download_images\r\n write_articles\r\n write_meta_files\r\n zipIt\r\n convert_to_mobi\r\n\r\n if File.exists?(@mobi)\r\n @mobi\r\n else\r\n @epub\r\n end\r\n end", "def save_revision(child, revision, dl, new_path)\n modified_date = \"#{revision['modifiedDate'].to_s.gsub(/:/, '_')}\"\n output_file = \"#{new_path}/#{child.title}_\"\\\n \"#{modified_date}_\"\\\n \"#{revision['lastModifyingUserName']}\"\\\n \".#{retrieve_download_url(revision, child.mimeType)[-4, 4]}\"\n\n # Save downloaded file\n # puts \"Creating #{child.title} revision: ID #{revision.id}\"\n IO.binwrite output_file, dl.body\n end", "def write_file(content, title, directory, filename)\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content)\n puts \"#{filename} was created in '#{directory}'.\"\nend", "def writeFile(content, title, directory, filename)\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content)\n puts \"#{filename} was created in '#{directory}'.\"\nend", "def readme_file\n if @package.readme and @package.readme != \"\"\n tfile = Tempfile.new('readme') \n File.open(tfile, 'w') { |f| f.puts @package.readme }\n tfile.path\n else\n nil\n end\n end", "def write(data)\n begin\n File.open(@filename, \"w\") { |file| file.puts data.to_html }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end", "def save\n File.open(@test_name, \"w+\") do |file|\n file.write(render)\n end\n end", "def export_to_file\n path = File.join(File.dirname(File.dirname(File.absolute_path(__FILE__))))\n File.open(\"#{path}/playlist.md\", 'w') do |f|\n f.puts(\"# #{@user.username}'s Playlist\")\n @playlist.each do |track|\n link = \"[Listen on Spotify](https://open.spotify.com/track/#{track['id']})\"\n f.puts(\"1. #{track['name']} by #{track['artist']} #{link}\")\n end\n end\n copy_to_desktop(path)\n end", "def write_html(html, section)\n filename = \"section-#{section.to_s.rjust(3, '0')}.html\"\n @contents_sections << %Q{<documentation relative-path=\"#{filename}\"/>}\n\n html = html[0, html.length - 2]\n html = erb(@data_dir + '/section.html.erb', { title: filename, content: html })\n File.write(@doc_dir + \"/#{filename}\", html)\n end", "def save\n File.open(@path, \"w\") do |file|\n Psych.dump({version: VERSION}, file)\n doc = {}\n @stats.each_pair do |article_path, article_stat|\n doc[article_path] = {\n stat: article_stat,\n related: @related[article_path] || [],\n }\n end\n Psych.dump(doc, file)\n end\n end", "def create_HTML_file(loc_name, content, out_dir)\n File.open(\"#{out_dir}/#{loc_name}.html\", 'w') do |f|\n f.write(HEADER_TEXT)\n f.write(\"<h1>Lonely Planet: #{loc_name}</h1>\")\n f.write(NAV_TITLE)\n f.write($navigation_html)\n f.write(BLOCK_TITLE)\n f.write(\"<h1><li class='first'><a href='#'>#{loc_name}</a></li></h1>\")\n f.write(MAIN_BLOCK)\n f.write(content)\n f.write(CLOSE_HTML)\n end\nend", "def checkout(revision)\n str = content revision\n\n # write str to current directory\n File.open(@fname, \"w\") do |f|\n f.write str\n end\n end", "def save_thank_you_letters(id, form_letter)\n\tDir.mkdir \"output\" unless Dir.exists? \"output\"\n\n\tfilename = \"output/thanks_#{id}.html\"\n\n\tFile.open(filename, 'w') do |file|\n\t\tfile.puts form_letter\n\tend\nend", "def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://github.com/kryszan/cloudy]cloudy[/url]\\\\m/ [/sup][/align]\"\n\t\tend\n\tend", "def copyright_file\n if @package.copyright and @package.copyright != \"\"\n tfile = Tempfile.new('copyright') \n File.open(tfile, 'w') { |f| f.puts @package.copyright }\n tfile.path\n else\n nil\n end\n end", "def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end", "def to_html_file(path)\n J2R.to_file(path, html_output)\n end", "def write_content\n File.open(absolute_path,'w') do |file|\n file << content if content\n end\n # TODO git functionality\n end", "def write_file(content, title, directory, filename)\r\n #parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\r\n\r\n File.write(\"#{directory}/#{filename}\", content)\r\n puts \"#{filename} was created in '#{directory}'.\"\r\nend", "def overwriteHtml(path, filecontents, logkey='')\n\tMcmlln::Tools.overwriteFile(path, filecontents)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def overwriteHtml(path, filecontents, logkey='')\n\tMcmlln::Tools.overwriteFile(path, filecontents)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def overwriteHtml(path, filecontents, logkey='')\n\tMcmlln::Tools.overwriteFile(path, filecontents)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def publish\n raise \"Can't publish if doc/ exists\" if File.exists?('doc')\n `git checkout gh-pages`\n FileUtils.cp_r 'website/.', '.'\n `git add doc index.html`\n system \"git commit -am 'Updated files.'\"\n system \"git push origin gh-pages\"\n `git checkout master`\n \"Published website.\"\n end", "def save_wiki_media( filename, url )\n path =\n if @media_dir.nil?\n filename\n else\n \"#{@media_dir}/#{filename}\"\n end\n save_wiki_body( path, url )\n end", "def save\n save_to_file(@output_file, @contents)\n end", "def save_page( title )\n base_url='https://en.wikipedia.org/w/index.php?title={title}&action=raw'\n\n ## todo/check: use %20 for encoding space (or +) - why? why not?\n ## https://en.wikipedia.org/w/index.php?title=South%20Georgia%20and%20the%20South%20Sandwich%20Islands&action=raw\n ## https://en.wikipedia.org/w/index.php?title=South+Georgia+and+the+South+Sandwich+Islands&action=raw\n\n ##\n ## URI.encode_www_form_component(string, enc=nil)\n ## This method will percent-encode every reserved character,\n ## leaving only *, -, ., 0-9, A-Z, _, a-z intact.\n ## Note: It also substitues space with +.\n title_encoded = URI.encode_www_form_component( title )\n url = base_url.gsub( '{title}', title_encoded )\n\n path = \"#{title.gsub( ' ', '_' )}.txt\"\n puts \" >#{title}<, >#{title_encoded}< path=>#{path}<, try url=>#{url}<\"\n\n ## note: change path (used for disk cache)!!\n response = Webget.text( url, path: path )\n ## note: exit on get / fetch error - do NOT continue for now - why? why not?\n exit 1 if response.status.nok? ## e.g. HTTP status code != 200\nend", "def write_output_file(output_file, body)\n File.open(output_file, 'w:UTF-8') do |file|\n file.puts $HTML_header\n file.puts body\n file.puts $HTML_footer\n end\nend", "def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end", "def save\n require 'git'\n git = Git.open('.', :log => Logger.new($stdout))\n git.pull # origin master\n write_version_to_file\n git.add(Version.path)\n git.commit(\"Bump version to #{self}.\")\n git.add_tag(self.to_s)\n git.push('origin', 'master', true) # including tags\n notify_campfire(git)\n rescue LoadError\n raise LoadError, \"You must have the git gem installed to make a release.\"\n end", "def save_revision(revision)\n if revision.save\n revision.page.body = revision.contents\n revision.page.file_path = revision.file_path\n flash[:success] = 'Revision created.'\n redirect_to revision.page and return if revision.page.save\n else\n flash[:danger] = 'Revision failed.'\n redirect_to revision.page\n end\n end", "def save_as(name)\n File.open(name, \"wb\") { |f| f.write self.render }\n end", "def save_file \n Grit.debug = true\n contents = params[:contents]\n message = params[:commit_message]\n @node = Node.new(:name => params[:name], :git_repo_id => params[:git_repo_id], :git_repo_path => params[:git_repo_path])\n save_file_to_disk(contents, @node.abspath)\n stage_and_commit_file(@node.repo_base_path, @node.git_repo_path, message)\n flash[:notice] = \"Created New Version\"\n render :action => :file\n end", "def html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end", "def save_current_page(options = {})\r\n default_options = {:replacement => true}\r\n options = default_options.merge(options)\r\n to_dir = options[:dir] || default_dump_dir\r\n\r\n if options[:filename]\r\n file_name = options[:filename]\r\n else\r\n file_name = Time.now.strftime(\"%m%d%H%M%S\") + \".html\"\r\n end\r\n\r\n Dir.mkdir(to_dir) unless File.exists?(to_dir)\r\n file = File.join(to_dir, file_name)\r\n\r\n content = page_source\r\n base_url = @web_browser.context.base_url\r\n current_url = @web_browser.url\r\n current_url =~ /(.*\\/).*$/\r\n current_url_parent = $1\r\n if options[:replacement] && base_url =~ /^http:/\r\n File.new(file, \"w\").puts absolutize_page_nokogiri(content, base_url, current_url_parent)\r\n else\r\n File.new(file, \"w\").puts content\r\n end\r\n\r\n end", "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end", "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end", "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end", "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end", "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end", "def save(path)\n File.open(path, \"w\") { |outfile| outfile.print self.render }\n end", "def html_version\n File.open(path,'wb'){|f| f.write code_html}\n `open -a '#{BROWSER_APP}' #{path}`\n end", "def save_as(filename)\n document.render_file(filename)\n end", "def release(tag_name, include_todays_date)\n lines = File.open(@file,'r').readlines\n\n # Supported case: Common\n header_idx = lines.index{|x| x =~ /^#+ \\[Unreleased\\]/ }\n fail \"ERROR: No [Unreleased] header to release!\" unless header_idx\n lines[header_idx].sub!(/Unreleased/, tag_name)\n\n if include_todays_date\n require 'date'\n lines[header_idx].sub!(/$/, \" - #{DateTime.now.strftime('%Y-%m-%d')}\")\n end\n\n reflink_idx = lines.index{|x| x =~ %r{^\\[Unreleased\\]: .*/compare/.*\\.\\.\\.} }\n if reflink_idx\n unrel_reflink_txt = lines[reflink_idx].dup\n lines.delete_at(reflink_idx)\n lines.insert( reflink_idx, unrel_reflink_txt.sub(%r{[^/]+...HEAD$}, \"#{tag_name}...HEAD\"))\n puts \"Updated `[Unreleased]` reflink to start tracking from `[#{tag_name}]`\"\n lines.insert( reflink_idx, unrel_reflink_txt.sub('Unreleased',tag_name).sub(/HEAD$/, tag_name))\n puts \"Changed `[Unreleased]` section + reflink to `[#{tag_name}]`\"\n lines.insert(header_idx, \"\\n<!--\\n\" + NEW_UNRELEASED_MARKUP + \"-->\\n\\n\")\n end\n File.open(@file,'w'){|f| f.puts lines.join }\n puts \"Rewrote #{@file} with new content\"\n end" ]
[ "0.6573925", "0.61920804", "0.61546034", "0.60735035", "0.6034229", "0.6020748", "0.60170573", "0.5995989", "0.59736466", "0.59657705", "0.5914977", "0.58825105", "0.588186", "0.58807033", "0.5863057", "0.58536613", "0.5851847", "0.58517694", "0.58483016", "0.5839252", "0.5838562", "0.58266103", "0.58230686", "0.58193314", "0.57513744", "0.57417816", "0.57209134", "0.5712972", "0.5712772", "0.5706205", "0.5705539", "0.5705539", "0.56915396", "0.56780356", "0.5671207", "0.5671097", "0.5643886", "0.56291497", "0.56178105", "0.5572238", "0.55689526", "0.55601555", "0.5559804", "0.5548914", "0.5546282", "0.5539771", "0.55341434", "0.55328536", "0.55221695", "0.551732", "0.5515553", "0.55122936", "0.55107576", "0.54794496", "0.54789007", "0.5474651", "0.5466136", "0.54336566", "0.5427113", "0.54236174", "0.5416464", "0.54108113", "0.5406376", "0.53984797", "0.5392658", "0.5392291", "0.5389071", "0.5387831", "0.5380242", "0.5365482", "0.5362182", "0.53573775", "0.5355751", "0.5339824", "0.53370446", "0.53287745", "0.52958345", "0.52958345", "0.52958345", "0.529015", "0.5288497", "0.5280396", "0.5266647", "0.52606684", "0.52511144", "0.5246093", "0.5244591", "0.5244031", "0.52355075", "0.5233186", "0.5231363", "0.5227755", "0.5227755", "0.5227755", "0.5227755", "0.5227755", "0.52223855", "0.5220514", "0.5216629", "0.5216467" ]
0.82210606
0
then feeds the words into the shift method"
def caesar_cipher(string, s_num) i = 1 n_words = [] words = string.split(" ") words.each do |w| n_words.push(shift(w, s_num)) end n_words.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift\n ret = @tokens.shift\n get_next_tokens\n ret\n end", "def shift() end", "def shift() end", "def shiftl(word)\n word[1..-1] << word[0]\nend", "def puts_first_word(words)\n word = words.shift() #Error 11: Again, no such method as 'poop', using inbuilt string method shift on words.\n puts word\nend", "def shift; end", "def shift; end", "def shift\n end", "def shift\n end", "def shift\n end", "def puts_first_word(words)\r\n word = words.shift()\r\n puts word\r\nend", "def puts_first_word(words)\n word = words.shift()\n puts word\nend", "def scream(words) \n\t\twords = words + \"!!!!\" \n\t\treturn\n\t\tputs words \n\tend", "def shift\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 57 )\n return_value = ShiftReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal259 = nil\n string_literal260 = nil\n string_literal261 = nil\n add258 = nil\n add262 = nil\n\n tree_for_string_literal259 = nil\n tree_for_string_literal260 = nil\n tree_for_string_literal261 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 622:5: add ( ( '<<' | '>>' | '>>>' ) add )*\n @state.following.push( TOKENS_FOLLOWING_add_IN_shift_4106 )\n add258 = add\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, add258.tree )\n end\n # at line 622:9: ( ( '<<' | '>>' | '>>>' ) add )*\n while true # decision 62\n alt_62 = 2\n look_62_0 = @input.peek( 1 )\n\n if ( look_62_0 == RSHIFT || look_62_0 == RSHIFT3 || look_62_0 == LSHIFT )\n alt_62 = 1\n\n end\n case alt_62\n when 1\n # at line 622:12: ( '<<' | '>>' | '>>>' ) add\n # at line 622:12: ( '<<' | '>>' | '>>>' )\n alt_61 = 3\n case look_61 = @input.peek( 1 )\n when LSHIFT then alt_61 = 1\n when RSHIFT then alt_61 = 2\n when RSHIFT3 then alt_61 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 61, 0 )\n end\n case alt_61\n when 1\n # at line 622:14: '<<'\n string_literal259 = match( LSHIFT, TOKENS_FOLLOWING_LSHIFT_IN_shift_4113 )\n if @state.backtracking == 0\n\n tree_for_string_literal259 = @adaptor.create_with_payload( string_literal259 )\n root_0 = @adaptor.become_root( tree_for_string_literal259, root_0 )\n\n end\n\n when 2\n # at line 622:22: '>>'\n string_literal260 = match( RSHIFT, TOKENS_FOLLOWING_RSHIFT_IN_shift_4118 )\n if @state.backtracking == 0\n\n tree_for_string_literal260 = @adaptor.create_with_payload( string_literal260 )\n root_0 = @adaptor.become_root( tree_for_string_literal260, root_0 )\n\n end\n\n when 3\n # at line 622:30: '>>>'\n string_literal261 = match( RSHIFT3, TOKENS_FOLLOWING_RSHIFT3_IN_shift_4123 )\n if @state.backtracking == 0\n\n tree_for_string_literal261 = @adaptor.create_with_payload( string_literal261 )\n root_0 = @adaptor.become_root( tree_for_string_literal261, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_add_IN_shift_4129 )\n add262 = add\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, add262.tree )\n end\n\n else\n break # out of loop for decision 62\n end\n end # loop for decision 62\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 57 )\n\n end\n \n return return_value\n end", "def scream(words)\n\twords = words + \"!!!!\"\n\tputs words\n\treturn\nend", "def puts_first_word(words)\n word = words.shift() # 'poop' replaced with 'pop'\n puts word\nend", "def scream(words)\n\twords = words + \"!!!!\"\n\treturn\n\tputs words\nend", "def print_first_word(words)\n word = words.shift\n puts wor\n end", "def scream(words)\n\twords = words + \"!!!!\"\nend", "def movingShift(s, shift)\nres = ''\n s.chars.each do |x|\n ord = x.ord\n if x.ord > 64 && x.ord < 91\n ord = ((ord - 65 + shift) % 26) + 65\n else\n if x.ord > 96 && x.ord < 123\n ord = ((ord - 97 + shift) % 26) + 97\n end\n end\n shift+=1\n res += ord.chr\n end\n l = (res.length/5.0).ceil\nputs l\nputs res\n [res[0..l-1], res[l..2*len-1],res[2*l..3*l-1],res[3*l..4*len-1],res[4*l..-1]]\nend", "def smash(words)\n sentence = \"\"\n words.each do |w|\n sentence = sentence + \"#{w} \"\n end\n sentence[0..-2]\nend", "def shiftr(word)\n word[-1] << word[0..-2]\nend", "def shift_out\n end", "def shift(str)\n cap_vowels = \"AEIOUA\"\n lower_vowels = \"aeioua\"\n cap_consonants = \"BCDFGHJKLMNPQRSTVWXYZB\"\n lower_consonants = \"bcdfghjklmnpqrstvwxyzb\"\n letter_array = []\n shifted_string = \"\"\n\n str = str.split\n letter_array += str[0].split(\"\")\n letter_array += [\" \"]\n letter_array += str[1].split(\"\")\n letter_array.each do |letter|\n if cap_vowels.include? letter\n shifted_string += cap_vowels[cap_vowels.index(letter) + 1]\n elsif lower_vowels.include? letter\n shifted_string += lower_vowels[lower_vowels.index(letter) + 1]\n elsif cap_consonants.include? letter\n shifted_string += cap_consonants[cap_consonants.index(letter) + 1]\n elsif lower_consonants.include? letter\n shifted_string += lower_consonants[lower_consonants.index(letter) + 1]\n elsif letter == \" \"\n shifted_string += \" \"\n end\n end\n shifted_string\n end", "def scream(words)\n\twords = words + \"!!!!\"\n return\n puts words\nend", "def encoder(text, shift)\n \n #first we convert the shift factor to an equivalent upshift if it happens to be negative:\n \n shift = shift.to_i\n \n until (shift >= 0)\n \n shift = shift + 26\n \n end\n \n #then we shift each letter, keeping the case and ignoring any non-letter characters:\n \n newtext = \"\"\n \n text.to_s.each_char do |letter|\n \n case letter\n when /[A-Z]/\n newtext << char_shift(letter, \"A\".ord, shift)\n when /[a-z]/\n newtext << char_shift(letter, \"a\".ord, shift)\n else\n newtext << letter\n end\n \n end\n \n puts newtext\n \nend", "def reverser\nwords=yield.split(\" \")\noutpt=\"\"\nwords.map do\n |w|\noutpt= outpt + w.reverse + \" \"\n end\noutpt [0...-1]\nend", "def solve_cipher(input, shift)\n words = input.split(\"\")\n \n string_container = \"\" \n words.each do | letter|\n \tif letter == \" \"\n \t\tstring_container += \" \"\n\n \telse\n \tstring_container += (letter.ord + shift).chr\n\tend\n end\n\tstring_container\n\t#your code goes here\nend", "def cipher(sentence, shift)\n # Funtion to cipher the word given a specific shift value to change the letter\n lowercase = 'abcdefghijklmnopqrstuvwxyz'\n uppercase = lowercase.upcase\n\n ciphered_word = []\n\n sentence.each_char.with_index do |char, idx|\n\n if lowercase.include?(char)\n index = lowercase.index(char)\n ciphered_word << lowercase[(index + shift) % 26]\n elsif uppercase.include?(char)\n index = uppercase.index(char)\n ciphered_word << uppercase[(index + shift) % 26]\n else\n ciphered_word << char\n end\n end\n\n return ciphered_word.join('')\n\nend", "def rshift!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n type = RSHIFT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 145:10: '>>'\n match( \">>\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 24 )\n\n end", "def scream(words)\n words = words + \"!!!!\"\n puts words\n end", "def scream(words)\n words = words + \"!!!!\"\n puts words\n end", "def shift(text, shift_num)\n\t\t\tClassicalCrypto::Utils::Text.substitute(text) do |ch| \n\t\t\t\tClassicalCrypto::Utils::Text.shift_alpha ch, shift_num\n\t\t\tend\n\t\tend", "def shift; self.sections.each(&:shift); end", "def scream(words)\n\twords = words + \"!!!!\"\n puts words\nend", "def scream(words) # Edited to output to STDOUT, returns nil (the last statement is 'puts words')\n words = words + \"!!!!\"\n puts words\nend", "def insertions\n new_words = []\n @words.each do |word|\n @word = word || '' \n (length + 1).times do |i|\n ('a'..'z').each { |c| new_words << \"#{@word[0...i]}#{c}#{@word[i..-1]}\" }\n end\n end\n new_words\n end", "def rl_transpose_words(count, key)\r\n orig_point = @rl_point\r\n\r\n return if (count==0)\r\n\r\n # Find the two words.\r\n rl_forward_word(count, key)\r\n w2_end = @rl_point\r\n rl_backward_word(1, key)\r\n w2_beg = @rl_point\r\n rl_backward_word(count, key)\r\n w1_beg = @rl_point\r\n rl_forward_word(1, key)\r\n w1_end = @rl_point\r\n\r\n # Do some check to make sure that there really are two words.\r\n if ((w1_beg == w2_beg) || (w2_beg < w1_end))\r\n rl_ding()\r\n @rl_point = orig_point\r\n return -1\r\n end\r\n\r\n # Get the text of the words.\r\n word1 = rl_copy_text(w1_beg, w1_end)\r\n word2 = rl_copy_text(w2_beg, w2_end)\r\n\r\n # We are about to do many insertions and deletions. Remember them\r\n # as one operation.\r\n rl_begin_undo_group()\r\n\r\n # Do the stuff at word2 first, so that we don't have to worry\r\n # about word1 moving.\r\n @rl_point = w2_beg\r\n rl_delete_text(w2_beg, w2_end)\r\n rl_insert_text(word1)\r\n\r\n @rl_point = w1_beg\r\n rl_delete_text(w1_beg, w1_end)\r\n rl_insert_text(word2)\r\n\r\n # This is exactly correct since the text before this point has not\r\n # changed in length.\r\n @rl_point = w2_end\r\n\r\n # I think that does it.\r\n rl_end_undo_group()\r\n word1 = nil\r\n word2 = nil\r\n\r\n 0\r\n end", "def scream(words)\n words = words + \"!!!!\"\n puts words\n end", "def scream(words)\n words = words + \"!!!!\"\n puts words\n\t#words\nend", "def shift_in\n end", "def \n \n using_shift(array)\n #-X- (arg_of_array) // empalm //\n \n array.shift()\n \nend", "def lshift!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 43 )\n\n type = LSHIFT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 164:10: '<<'\n match( \"<<\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 43 )\n\n end", "def scream(words)\n words = words + '!!!!'\nend", "def encode_word(word, shift)\n # we create an array of all 26 letters in the alphabet\n alphabet = (\"a\"..\"z\").to_a\n\n # the entire alphabet is now shifted over properly, with the earlier\n # letters, now appearing at the back\n shifted_alphabet = (alphabet[shift]..alphabet[-1]).to_a +\n (alphabet[0]...alphabet[shift]).to_a\n encoded = [] # and an empty array to place each letter into later\n\n word.each_char do |letter|\n if alphabet.include?(letter.downcase)\n # find where the orignal letter's index should be\n letter_idx = alphabet.find_index(letter.downcase)\n\n # if the original letter was lower case, the shifted letter straight\n # in; otherwise, we capitalize the shifted letter and place it in\n\n letter == letter.downcase ? encoded.push(shifted_alphabet[letter_idx]) :\n encoded.push(shifted_alphabet[letter_idx].upcase)\n else\n encoded.push(letter)\n end\n end\n\n encoded.join(\"\")\nend", "def \n \n shift_with_args(array) #XX- arg_of_array)\n #{...}(shift_x_times)\n\n\n array.shift(2)\n \nend", "def ceaser_word(str, shift)\n alphabet = ('a'..'z').to_a\n arr = str.split('')\n result = \"\"\n arr.each do |letter|\n pos = alphabet.index(letter) + shift\n result += alphabet[pos%26]\n end\n result\nend", "def scream(words)\n words = words + \"!!!!\"\nend", "def scream(words)\n words = words + \"!!!!\"\nend", "def scream(words)\n words = words + \"!!!!\"\nend", "def scream(words)\n words = words + \"!!!!\"\nend", "def scream(words)\n words = words + \"!!!!\"\nend", "def shift(arg0, arg1, *rest)\n end", "def shifting_letters(s, shifts)\n letters = ('a'..'z').to_a\n \n shifts = shifts.reverse\n \n shifts.each_with_index do |shift, index|\n next if index == 0\n \n shifts[index] = shifts[index] + shifts[index - 1]\n end\n \n shifts = shifts.reverse\n s = s.split('')\n \n s.each_with_index do |char, index|\n total_rotation_in_num = shifts[index] + letters.index(char)\n \n s[index] = letters[total_rotation_in_num % 26]\n end\n \n s.join('')\nend", "def scream(words)\n\n\twords = words + \"!!!\"\n\n puts words\n\nend", "def shout(words)\n\twords.upcase\nend", "def flip_words (first_word, second_word)\n puts second_word + first_word\nend", "def shift(ndigits)\n #This is a stub, used for indexing\n end", "def scream(words)\n words = words + \"!!!!\"\n puts words\n return\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n puts words + \"!!!!\"\nend", "def scream(words)\n words += \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!\"\n puts words \nend", "def construct(w)\n @word = \"~#{w}\" # Assimilate!\n @length = @word.length - 1 # Do not count the ~.\n @back = Array.new\n @back << 0 \n @back << 0\n s = 0\n (2..@length).each do |i|\n s = step(s,@word[i - 1])\n @back << s\n end\n end", "def shift\n if letter = left.shift || right.shift\n @length -= 1\n letter\n else\n nil\n end\n end", "def ceasar_cipher(phrase, shift)\n phrase.downcase!\n words = phrase.split(\" \")\n words.each do |word| #for each word in the sentence\n word.split(\"\").each_with_index do |letter, index| #for each letter in the word\n asciiValue = letter.ord\n if(asciiValue >= 97 && asciiValue <= 122) #if the value is a letter and not a character or digit\n\n newValue = asciiValue + shift\n \n if newValue > 122 #if it goes beyond z, loop around back to a\n difference = newValue - 122\n offset = 96+difference\n letter = offset.chr\n word[index] = letter\n else\n letter = newValue.chr \n word[index] = letter\n end\n end \n end\n end\n puts words.join(\" \")\nend", "def scream(words)\n words = words + \"!!!!!\"\n words\nend", "def scream(words)\n words = words + \"!!!!\"\n return puts words\nend", "def shift\n raise \"index out of bounds\" if (@length == 0)\n\n first = @store[0]\n (1...@length).each do |i|\n #slide everything to the left\n @store[i - 1] = @store[i]\n end\n @length -= 1\n first\n\n end", "def scream(words)\n words = words + '!!!!'\n puts words\nend", "def scream(words)\n words = words + '!!!!'\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n return puts words\nend", "def unshift(token); end", "def using_shift(array)\n array.shift()\nend", "def caesar_cipher(str, shift)\n shifted = \"\"\n words = str.split(\" \")\n words.each do |word|\n word.each_char do |char|\n shifted += shift_char(char, shift)\n end\n shifted += \" \"\n end\n shifted[0...-1]\nend", "def scream(words)\n words = words + \"!!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend", "def scream(words)\n words = words + \"!!!!\"\n puts words\nend" ]
[ "0.6929532", "0.68239164", "0.68239164", "0.68040204", "0.67875063", "0.6692798", "0.6692798", "0.6514204", "0.6514204", "0.6514204", "0.6488341", "0.6347762", "0.62729573", "0.62341136", "0.61902374", "0.619012", "0.6167596", "0.61621195", "0.6130978", "0.6125852", "0.6102498", "0.6099445", "0.6090567", "0.60502577", "0.60494107", "0.60386044", "0.60118115", "0.60008574", "0.59903353", "0.5986701", "0.59812057", "0.59812057", "0.59723485", "0.59682864", "0.5959457", "0.5942734", "0.5927858", "0.591555", "0.59125733", "0.5895281", "0.58868676", "0.58758163", "0.5871512", "0.5871376", "0.58713096", "0.5846771", "0.5841782", "0.58217186", "0.58217186", "0.58217186", "0.58217186", "0.58217186", "0.5810778", "0.5808089", "0.57922137", "0.57920575", "0.57628113", "0.5755461", "0.57531875", "0.5739207", "0.5739207", "0.5739207", "0.5739207", "0.5739207", "0.5739207", "0.5739207", "0.5739207", "0.57324976", "0.57245284", "0.5723461", "0.5718844", "0.57161814", "0.570981", "0.5709595", "0.5703794", "0.5702001", "0.5700838", "0.5700838", "0.56981623", "0.5668491", "0.56674105", "0.56644225", "0.5664196", "0.5663455", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164", "0.566164" ]
0.0
-1
questID should be the symbolic name of the quest, e.g. :Quest1
def activateQuest(quest,color,story) if !quest.is_a?(Symbol) raise _INTL("The 'quest' argument should be a symbol, e.g. ':Quest1'.") end for i in 0...@active_quests.length if @active_quests[i].id == quest pbMessage("You have already started this quest.") return end end for i in 0...@completed_quests.length if @completed_quests[i].id == quest pbMessage("You have already completed this quest.") return end end for i in 0...@failed_quests.length if @failed_quests[i].id == quest pbMessage("You have already failed this quest.") return end end @active_quests.push(Quest.new(quest,color,story)) pbMessage(_INTL("\\se[{1}]<ac><c2=#{colorQuest("red")}>New quest discovered!</c2>\nCheck your quest log for more details!</ac>",QUEST_JINGLE)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quest(quest_id); $game_party.quests[quest_id]; end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def setup_quest(quest_id)\n return if @data[quest_id]\n @data[quest_id] = Game_Quest.new(quest_id)\n # Open to this quest next time the QJ is opened\n $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST\n # Save sorting order in separate arrays to avoid re-sorting every time\n @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }\n end", "def quest\n @quest ||= Quest.find(params[:id])\n end", "def [](quest_id)\n reset_quest(quest_id) if !@data[quest_id]\n @data[quest_id]\n end", "def quest(id) \n\tsys('quest')\n\t$progress.add_quest(id) \n\tpop_quest(id)\n\t$scene.hud.quest_sparkle(\"misc/profile\")\nend", "def activateQuest(questID)\n if questID.is_a?(String)\n questID = $quest_data.getIDFromName(questID)\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id==questID\n Kernel.pbMessage(\"You have already started this quest\")\n return\n end\n end\n for i in 0...@completed_quests.length\n if @completed_quests[i].id==questID\n Kernel.pbMessage(\"You have already complete this quest\")\n return\n end\n end\n for i in 0...@failed_quests.length\n if @failed_quests[i].id==questID\n Kernel.pbMessage(\"You have already failed this quest\")\n return\n end\n end\n @active_quests.push(Quest.new(questID))\n end", "def set_quest_item\n @quest_item = QuestItem.find(params[:id])\n end", "def call_quest_journal(quest_id = nil)\n return if $game_party.in_battle\n $game_system.last_quest_id = quest_id if quest_id\n SceneManager.call(Scene_Quest)\n Fiber.yield\n end", "def reset_quest(quest_id)\n delete_quest(quest_id)\n setup_quest(quest_id)\n end", "def add_quest(dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs)\n\t\t\t@player_data_db.execute \"insert into quests values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs\n\t\tend", "def set_teamquest\n @teamquest = Teamquest.find(params[:id])\n end", "def set_quest_stat\n @quest_stat = QuestStat.find(params[:id])\n end", "def init_quest\n @quest = Quest.find_by_id(params[:id])\n @quest ||= Quest.draft(params[:id])\n end", "def []=(quest_id, value)\n @data[quest_id] = value\n end", "def quest; end", "def index\n @questid = params[:questionnaire_id]\n end", "def quest_params\n params.require(:quest).permit(:quest_name, :description, :req, :day, :quest_type, :money_output, :inf_type, :inf_output, :clue_output, :item_output, :notes, :dependent_on, :unlocks)\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def quest_params\n params.require(:quest).permit(:user_id, :quest, :result)\n end", "def set_questao\n @questao = Questao.find(params[:id])\n end", "def quest_params\n params.require(:quest).permit(:nome_quest, :nivels_id, :valor_pontos)\n end", "def delete_quest(quest_id)\n @data.delete(quest_id)\n @sort_arrays.values.each { |ary| ary.delete(quest_id) }\n end", "def quest_selection(input, difficulty)\n quest_id = self.get_recommended_quests(difficulty)[input.to_i-1].id\n CharacterQuest.new_character_quest(self.id, quest_id)\n end", "def quest_revealed?(quest_id)\n $game_party.quests.revealed?(quest_id)\n end", "def quest_params\n params.require(:quest).permit(:name, :description, :imgurl)\n end", "def update\n @quest = Quest.find(params[:id])\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para editar esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para editar esta quest!'\n end\n end", "def quest_name_colour(quest = @quest)\n return if !quest\n quest = $game_party.quests[quest] if quest.is_a?(Integer)\n s = [:failed, :complete, :active].find { |status| quest.status?(status) }\n text_color(QuestData::COLOURS[s])\n end", "def general_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => true).where.not(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end", "def manually_complete_quest(quest_id)\n quest(quest_id).prime_objectives.clear\n quest(quest_id).manual_status = :complete\n end", "def completed_quests; $game_variables[17]; end", "def initialize(quest_id)\n @id = quest_id\n @concealed = default_value_for(:concealed)\n @reward_given = default_value_for(:reward_given)\n reset\n end", "def quest=(value)\n return if @quest == value\n @quest = value\n @layout = (@quest && @quest.layout) ? @quest.layout : @default_layout\n refresh\n end", "def create_quest_tbl\n\t\t\tq_rows = @player_data_db.execute <<-SQL\n\t\t\t\tCREATE TABLE IF NOT EXISTS quests (\n\t\t\t\t\tid INTEGER PRIMARY KEY,\n\t\t\t\t\tdb_name varchar(30),\n\t\t\t\t\tname varchar(30),\n\t\t\t\t\tdescrip varchar(255),\n\t\t\t\t\tk_g_goal int,\n\t\t\t\t\tk_g_name varchar(30),\n\t\t\t\t\texp_reward int,\n\t\t\t\t\tsilver_reward int,\n\t\t\t\t\tgold_reward int,\n\t\t\t\t\tloot_reward varcar(30),\n\t\t\t\t\tk_g_count int,\n\t\t\t\t\tq_status varchar(5)\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\tSQL\n\t\tend", "def completeQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.completeQuest(quest,color,story)\nend", "def update_quest_tbl\n\t\t\tbegin\n\t\t\t\t@player_data_db.execute (\"DELETE from quests\")\n\t\t\trescue\n\t\t\t\tputs \"Searching for jobs\"\n\t\t\tend\n\t\t\t# Execute inserts\n\t\t\t#[ db_name, quest_name, descrip, k_g_goal, k_g_name, exp_reward, silver_reward, gold_reward, loot_reward, k_g_count, q_status] ** q_tatus A = Active, C = Completed, D = Dropped\n\t\n\t\t\t[\t\t\t\t\n\t\t\t\t#[\"kill_rats\", \"eRATicate\", \"Kill 10 small rats\",1, \"small_rat\",25,0,3,\"apple_basket\",0,\"A\"],\n\t\t\t\t[\"get_wood\", \"Woody\", \"Gather 15 soft wood\",1, \"soft_wood\",25,0,3,\"none\",0,\"A\"]\n\t\t\t\t\n\t\t\t].each do |dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs|\n\t\t\t\t@player_data_db.execute \"insert into quests values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs\n\t\t\tend\n\t\tend", "def getQuestDescription(quest)\n return \"#{QuestModule.const_get(quest)[:QuestDescription]}\"\n end", "def getQuestGiver(quest)\n return \"#{QuestModule.const_get(quest)[:QuestGiver]}\"\n end", "def set_sidequest\n @sidequest = Sidequest.find(params[:id])\n end", "def set_gpsquest\n @gpsquest = Gpsquest.find(params[:id])\n end", "def destroy\n @quest = Quest.find(params[:id])\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para destruir esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para destruir esta quest!'\n end\n end", "def get_quest\n\t\tget_data\n\n\t\t$finish = false\n\t\tunless $finish == true\n\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\twhile $quiz_arr.include?(@data[$randId]['id'])\n\t\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\tend\n\t\t\t$quiz_arr.push(@data[$randId]['id'])\n\t\t\t$i += 1\n\n\t\t\tif $i == 7\n\t\t\t\t$finish = true\n\t\t\tend\n\n\t\t\t@quest = @data[$randId]['question_name']\n\t\t\t@c_answer = @data[$randId]['c_answer']\n\t\t\t@alt1 = @data[$randId]['alt1']\n\t\t\t@alt2 = @data[$randId]['alt2']\n\t\t\t@alt3 = @data[$randId]['alt3']\n\t\t\t@imgurl = @data[$randId]['imgurl']\n\t\t\t@url = @data[$randId]['news_url']\n\t\t\t@cat = @data[$randId]['category_id']\n\t\t\t@hex = @data[$randId]['category_hex_code']\n\t\t\tget_descriptions(@url)\n\t\t\t@image = @desc_data['image']\n\n\t\t\t$answer_array = Array.new()\n\t \tend\n\tend", "def activateQuest(quest,color=colorQuest(nil),story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.activateQuest(quest,color,story)\nend", "def update\n hash = params[:quest]\n # flash[:warning] = []\n # flash[:warning] << \"Title cannot be left blank\" if hash[:title].blank?\n # redirect_to edit_quest_path and return if flash[:warning].count > 0\n Quest.update(params[:id], params.require(:quest).permit(:title, :description, :due_date,:bounty, :assign_to))\n quest = Quest.find_by_id(params[:id])\n if not quest.gid.blank?\n Quest.update_calendar_event quest, @current_user\n end\n redirect_to quest_path(params[:id])\n end", "def init_maqj_data\n @quests = Game_Quests.new # Initialize @quests\n end", "def set_computers_quest\n @computers_quest = ComputersQuest.find(params[:id])\n end", "def create\n @quest = Quest.new(params[:quest])\n @quest.creator_id=Profile.where(:users_id=>current_user.id)[0].id\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render json: @quest, status: :created, location: @quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para crear esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para crear esta quest!'\n end\n end", "def quest_interface\n\n#obtain the difficulty level for the given player\n difficulty = self.get_difficulty\n\n#see if the player has any quests left to complete\n if self.get_recommended_quests(difficulty).size == 0\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"You have completed all recommended quests!!!\".bold\n puts \"=====================================\".red\n puts \"=====================================\".red\n\n#show the player the available quests\n else\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"Recommended Quests for Player Attack: #{self.power}\".blue.on_light_green.bold\n puts \"\"\n self.print_quests(difficulty)\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"Select a quest number\".bold.white.on_light_blue\n puts \"Number:\".bold.white.on_light_blue\n\n#selection prompt the player to actually choose a quest\n selection = gets.chomp\n\n#check for invalid input\n if selection.to_i > self.get_recommended_quests(difficulty).size || selection.to_i < 1\n puts \"Invalid input, please try again!\".red.bold\n\n#if input is valid, show the player that he has completed the quest\n else\n puts\"*******************************************\"\n puts \"You have completed: #{self.get_recommended_quests(difficulty)[selection.to_i-1].title}\".bold\n puts\"*******************************************\"\n puts \" \"\n puts\"#####################################\".blink\n puts \"Time For Your Reward Adventurer!!!\".bold.blue.on_light_yellow\n\n #obtain the available weapons based on player difficulty\n available_weapons = self.get_available_weapons(difficulty)\n\n #create the new characterquest instance to show that player has completed the quest\n self.quest_selection(selection, difficulty)\n\n #run the weapon_reward method to get reward for the quest\n self.weapon_reward(available_weapons)\n end\n end\n end", "def ask_question(num = @trivia[:cur_quest])\n self.say \"\\0036 #{@questions[num][:question]}\"\n STDOUT.puts \"\\n :#{@questions[@trivia[:cur_quest]][:answer]}: \\n\"\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def therapist_quest; end", "def get_question(form_name, id)\n get_form(form_name)[:questions][id]\n end", "def skier_quest; end", "def quest_status_changed\n $game_party.quests.add_to_sort_array(:change, @id) \n $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST\n end", "def update\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def mechanic_quest; end", "def fence_quest; end", "def getCompletedQuests\n completed = []\n $PokemonGlobal.quests.completed_quests.each do |s|\n completed.push(s.id)\n end\n return completed\nend", "def call_quest_journal\n @quest_journal_calling = false\n Sound.play_ok\n SceneManager.call(Scene_Quest)\n end", "def print_quests(difficulty)\n self.get_recommended_quests(difficulty).each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def quest_rewarded?(quest_id)\n quest_revealed?(quest_id) && quest(quest_id).status?(:reward)\n end", "def update\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to(@quest, :notice => 'Quest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def quest_item_params\n params.require(:quest_item).permit(:name, :session_length, :quest_status_id)\n end", "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 update\n respond_to do |format|\n if @quest.update(quest_params)\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { render :show, status: :ok, location: @quest }\n else\n format.html { render :edit }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quest = Quest.new(quest_params)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render :show, status: :created, location: @quest }\n else\n format.html { render :new }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def generateQuestTree (quest)\n if (!quest.is_a?(Quest))\n raise 'Expected argument to be a campaign'\n end\n data = generateChildTree(quest)\n\n return data.to_json\n end", "def question\n Question.find_by_id(questions_id)\n end", "def create\n return\n @quest = Quest.new(quest_params)\n\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quest }\n else\n format.html { render action: 'new' }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def pending_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n by_me_quests = UsersQuest.where(:assignor_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @by_me_quests = Quest.where(:id => by_me_quests).order('due_date')\n end", "def show\n @quest = Quest.find(params[:id])\n quest_objectives = @quest.locations\n completed_objectives = []\n quest_objectives.each do |obj|\n if @current_user.locations.exists?(obj)\n completed_objectives << obj\n end\n end\n if completed_objectives.length == quest_objectives.length\n unless @quest.winner_id\n @quest.update(winner_id: @current_user.id)\n end\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n end\n\n if(@quest.owner_id == @current_user.id)\n redirect_to edit_quest_path(@quest)\n elsif @quest.start_date > DateTime.current\n flash[:warning] = \"Quest has not yet begun!\"\n redirect_to user_path(@current_user) and return\n elsif @quest.end_date < DateTime.current\n flash[:warning] = \"Quest has ended. Womp womp\"\n\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n elsif @quest.users.exists?(@current_user.id)\n gon.track = true\n locations = @quest.locations\n gon.remaining_locations = []\n gon.completed_locations = []\n locations.each do |loc|\n if loc.users.exists?(@current_user.id)\n gon.completed_locations << loc\n else\n gon.remaining_locations << loc\n end\n end\n @remaining_locations = gon.remaining_locations\n @completed_locations = gon.completed_locations\n else\n gon.track = false\n flash[:danger] = \"You are not a member of this quest! Please contact the quest owner for an invite.\"\n redirect_to quests_path and return\n end\n end", "def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\nend", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end", "def initialize( quests_set )\n super()\n @quests_set = quests_set.to_sym\n end", "def create\n @quest = Quest.new(params[:quest])\n\n respond_to do |format|\n if @quest.save\n format.html { redirect_to(@quest, :notice => 'Quest was successfully created.') }\n format.xml { render :xml => @quest, :status => :created, :location => @quest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\r\n @quest = @kingdom.quests.find(params[:id])\r\n unless verify_quest_not_in_use(@quest)\r\n redirect_to :action => 'index', :page => params[:page]\r\n return\r\n end\r\n \r\n @quest.reqs.each{|r| r.destroy} \r\n flash[:notice] = 'Deleted all requirements.<br/>'\r\n \r\n if @quest.destroy\r\n flash[:notice] += 'Destroyed the quest.'\r\n redirect_to :action => 'index', :page => params[:page]\r\n else\r\n flash[:notice] += 'Failed to destroy the quest.'\r\n redirect_to :action => 'show', :id => params[:id]\r\n end\r\n end", "def find_question_by_id(question_id)\n question = Pairwise::Question.find question_id\n return question #if question.local_identifier == @local_identifier.to_s\n end", "def quest_book\n GamePlay::QuestBookMenu.new.main\n Graphics.transition\n @wait_count = 2\n end", "def find_completed\n completed = self.user_quests.where(complete: true)\n completed.map do |x|\n x.quest_id\n end\n end", "def create_main_quest_tbl\n\t\t\tl_rows = @quest_data_db.execute <<-SQL\n\t\t\t\tCREATE TABLE IF NOT EXISTS quest_data (\n\t\t\t\t\tid INTEGER PRIMARY KEY,\n\t\t\t\t\tdb_name varchar(30),\n\t\t\t\t\tname varchar(30),\n\t\t\t\t\tdecrip varchar(255),\n\t\t\t\t\tk_g_goal int,\n\t\t\t\t\tk_g_name varchar(30),\n\t\t\t\t\texp_reward int,\n\t\t\t\t\tsilver_reward int,\n\t\t\t\t\tgold_reward int,\n\t\t\t\t\tloot_reward varcar(30),\n\t\t\t\t\tlevel int,\n\t\t\t\t\tloc varchar(30),\n\t\t\t\t\ttod int\n\t\t\t\t);\n\t\t\tSQL\n\t\tend", "def find_selected\n selected_quests = self.user_quests.where(complete: false)\n selected_quests.map do |x|\n x.quest_id\n end\n end", "def failQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.failQuest(quest,color,story)\nend", "def name=(new_name)\n @name = new_name\n $game_party.quests.add_to_sort_array(:alphabet, @id) if $game_party && \n $game_party.quests\n end", "def review\n @user_quest = UsersQuest.find(params[:id])\n end", "def set_question\n @question = Discovery::Question.find(params[:id])\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quest }\n end\n end", "def quest_duration\n Objective.find_by_id(self.objective_id).duration.capitalize\n end", "def afficherQuestionParId(id_question)\n question = GroupeQuestion.find_by(id_question: id_question, etat: false);\n end", "def set_game_question\n @game_question = GameQuestion.find(params[:id])\n end", "def ragman_quest; end", "def update\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n if @completed_quest.update_attributes(params[:completed_quest])\n format.html { redirect_to @completed_quest, notice: 'Completed quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @completed_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def generateChildTree(quest)\n\n data = {:id => quest.id, :attr => { :name => quest.name, :description => quest.description, :url => '/quests/' + quest.id.to_s, :status => quest.status}}\n if(quest.quests.size == 0)\n return data\n else\n data[:children] = children = []\n quest.quests.each {|quest|\n children << generateChildTree(quest)\n }\n end\n return data\n end", "def question(n)\n send \"question_#{n}\"\n end", "def question\n Question.find_by_id(self.question_id)\n end", "def getFailedQuests\n failed = []\n $PokemonGlobal.quests.failed_quests.each do |s|\n failed.push(s.id)\n end\n return failed\nend" ]
[ "0.81825674", "0.7392934", "0.7392934", "0.7392934", "0.7392934", "0.7389347", "0.7315458", "0.7190625", "0.7122943", "0.6913735", "0.6656532", "0.6647309", "0.65953064", "0.6494504", "0.6426543", "0.64225906", "0.6405718", "0.6343753", "0.62924314", "0.6264734", "0.62425", "0.62115324", "0.62028366", "0.61013824", "0.6061018", "0.604537", "0.5996312", "0.59753996", "0.59744", "0.59701395", "0.59201866", "0.5905144", "0.5890599", "0.58701366", "0.5862367", "0.58407444", "0.58275545", "0.5799796", "0.57878196", "0.5761515", "0.57382834", "0.5731708", "0.57275647", "0.57240844", "0.56998146", "0.56765014", "0.56554985", "0.5655156", "0.5639641", "0.56335515", "0.5615845", "0.5607374", "0.56062025", "0.5602402", "0.56012034", "0.55966663", "0.55963755", "0.5577635", "0.5566733", "0.55530393", "0.5542381", "0.5537943", "0.55078876", "0.5505038", "0.549169", "0.549021", "0.5485456", "0.54853547", "0.54618186", "0.54557097", "0.5441843", "0.543721", "0.54285204", "0.5409785", "0.54073954", "0.5398281", "0.5394783", "0.5389463", "0.5369636", "0.5363179", "0.5359615", "0.5349531", "0.53480107", "0.53473556", "0.5346933", "0.53417957", "0.53186053", "0.531724", "0.5303521", "0.5298305", "0.52944183", "0.5276078", "0.52705336", "0.5266398", "0.5252814", "0.52512985", "0.5244484", "0.52396846", "0.52296954", "0.52279097" ]
0.6187569
23
=============================================================================== Helper and utility functions for managing quests =============================================================================== Helper function for activating quests
def activateQuest(quest,color=colorQuest(nil),story=false) return if !$PokemonGlobal $PokemonGlobal.quests.activateQuest(quest,color,story) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quest; end", "def activateQuest(quest,color,story)\n if !quest.is_a?(Symbol)\n raise _INTL(\"The 'quest' argument should be a symbol, e.g. ':Quest1'.\")\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id == quest\n pbMessage(\"You have already started this quest.\")\n return\n end\n end\n for i in 0...@completed_quests.length\n if @completed_quests[i].id == quest\n pbMessage(\"You have already completed this quest.\")\n return\n end\n end\n for i in 0...@failed_quests.length\n if @failed_quests[i].id == quest\n pbMessage(\"You have already failed this quest.\")\n return\n end\n end\n @active_quests.push(Quest.new(quest,color,story))\n pbMessage(_INTL(\"\\\\se[{1}]<ac><c2=#{colorQuest(\"red\")}>New quest discovered!</c2>\\nCheck your quest log for more details!</ac>\",QUEST_JINGLE))\n end", "def activateQuest(questID)\n if questID.is_a?(String)\n questID = $quest_data.getIDFromName(questID)\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id==questID\n Kernel.pbMessage(\"You have already started this quest\")\n return\n end\n end\n for i in 0...@completed_quests.length\n if @completed_quests[i].id==questID\n Kernel.pbMessage(\"You have already complete this quest\")\n return\n end\n end\n for i in 0...@failed_quests.length\n if @failed_quests[i].id==questID\n Kernel.pbMessage(\"You have already failed this quest\")\n return\n end\n end\n @active_quests.push(Quest.new(questID))\n end", "def quest_interface\n\n#obtain the difficulty level for the given player\n difficulty = self.get_difficulty\n\n#see if the player has any quests left to complete\n if self.get_recommended_quests(difficulty).size == 0\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"You have completed all recommended quests!!!\".bold\n puts \"=====================================\".red\n puts \"=====================================\".red\n\n#show the player the available quests\n else\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"Recommended Quests for Player Attack: #{self.power}\".blue.on_light_green.bold\n puts \"\"\n self.print_quests(difficulty)\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"Select a quest number\".bold.white.on_light_blue\n puts \"Number:\".bold.white.on_light_blue\n\n#selection prompt the player to actually choose a quest\n selection = gets.chomp\n\n#check for invalid input\n if selection.to_i > self.get_recommended_quests(difficulty).size || selection.to_i < 1\n puts \"Invalid input, please try again!\".red.bold\n\n#if input is valid, show the player that he has completed the quest\n else\n puts\"*******************************************\"\n puts \"You have completed: #{self.get_recommended_quests(difficulty)[selection.to_i-1].title}\".bold\n puts\"*******************************************\"\n puts \" \"\n puts\"#####################################\".blink\n puts \"Time For Your Reward Adventurer!!!\".bold.blue.on_light_yellow\n\n #obtain the available weapons based on player difficulty\n available_weapons = self.get_available_weapons(difficulty)\n\n #create the new characterquest instance to show that player has completed the quest\n self.quest_selection(selection, difficulty)\n\n #run the weapon_reward method to get reward for the quest\n self.weapon_reward(available_weapons)\n end\n end\n end", "def quest(id) \n\tsys('quest')\n\t$progress.add_quest(id) \n\tpop_quest(id)\n\t$scene.hud.quest_sparkle(\"misc/profile\")\nend", "def quest_book\n GamePlay::QuestBookMenu.new.main\n Graphics.transition\n @wait_count = 2\n end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def call_quest_journal\n @quest_journal_calling = false\n Sound.play_ok\n SceneManager.call(Scene_Quest)\n end", "def activate\r\n @quest = @kingdom.quests.find(params[:id])\r\n \r\n if @kingdom.quests.where(quest_status: '1').size > 16\r\n flash[:notice] = 'A kingdom can have only 16 active quests at a time.'\r\n elsif @quest.reqs.size == 0\r\n flash[:notice] = \"Quest must have at least one requirement in order to be activated\"\r\n else\r\n @quest.quest_status = SpecialCode.get_code('quest_status','active')\r\n quest_status_change_update\r\n end\r\n redirect_to :action => 'index', :page => params[:page]\r\n end", "def run_quest\n original_power = @todays_hero.power\n system \"clear\"\n subtitle_print('Start Quest')\n power_update = Quest.find_new\n @todays_hero.increase_power_by(power_update)\n system \"clear\"\n if @todays_hero.power > original_power\n puts \"Congrats! Your power increased by #{power_update}.\"\n puts \"Your power is now #{@todays_hero.power}.\"\n elsif @todays_hero.power == original_power\n puts \"Evil doesn't wait for the slow and idle.\"\n puts \"Your power remains at #{@todays_hero.power}.\"\n elsif @todays_hero.power < original_power\n puts \"The world weeps for the strong and courageous.\"\n puts \"Your power has decreased to #{@todays_hero.power}.\"\n end\n @todays_hero.save\n end", "def mechanic_quest; end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def set_quest\n @quest = Quest.find(params[:id])\n end", "def setup_quest(quest_id)\n return if @data[quest_id]\n @data[quest_id] = Game_Quest.new(quest_id)\n # Open to this quest next time the QJ is opened\n $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST\n # Save sorting order in separate arrays to avoid re-sorting every time\n @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }\n end", "def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def set_quest_item\n @quest_item = QuestItem.find(params[:id])\n end", "def quest\n @quest ||= Quest.find(params[:id])\n end", "def update_quest_tbl\n\t\t\tbegin\n\t\t\t\t@player_data_db.execute (\"DELETE from quests\")\n\t\t\trescue\n\t\t\t\tputs \"Searching for jobs\"\n\t\t\tend\n\t\t\t# Execute inserts\n\t\t\t#[ db_name, quest_name, descrip, k_g_goal, k_g_name, exp_reward, silver_reward, gold_reward, loot_reward, k_g_count, q_status] ** q_tatus A = Active, C = Completed, D = Dropped\n\t\n\t\t\t[\t\t\t\t\n\t\t\t\t#[\"kill_rats\", \"eRATicate\", \"Kill 10 small rats\",1, \"small_rat\",25,0,3,\"apple_basket\",0,\"A\"],\n\t\t\t\t[\"get_wood\", \"Woody\", \"Gather 15 soft wood\",1, \"soft_wood\",25,0,3,\"none\",0,\"A\"]\n\t\t\t\t\n\t\t\t].each do |dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs|\n\t\t\t\t@player_data_db.execute \"insert into quests values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs\n\t\t\tend\n\t\tend", "def completeQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.completeQuest(quest,color,story)\nend", "def therapist_quest; end", "def fence_quest; end", "def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\n end", "def add_quest(dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs)\n\t\t\t@player_data_db.execute \"insert into quests values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs\n\t\tend", "def on_category_ok; @quest_list_window.activate; end", "def init_quest\n @quest = Quest.find_by_id(params[:id])\n @quest ||= Quest.draft(params[:id])\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def completed_quests; $game_variables[17]; end", "def call_quest_journal(quest_id = nil)\n return if $game_party.in_battle\n $game_system.last_quest_id = quest_id if quest_id\n SceneManager.call(Scene_Quest)\n Fiber.yield\n end", "def skier_quest; end", "def update_call_quest_journal\n if $game_map.interpreter.running?\n @quest_journal_calling = false\n else\n if Input.trigger?(QuestData::MAP_BUTTON)\n $game_system.quest_access_disabled || $game_party.quests.list.empty? ?\n Sound.play_buzzer : @quest_journal_calling = true\n end\n call_quest_journal if @quest_journal_calling && !$game_player.moving?\n end\n end", "def advanceQuestToStage(quest,stageNum,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.advanceQuestToStage(quest,stageNum,color,story)\nend", "def add_question\n @event.respond('Enter a new question: ')\n ques = @event.user.await!(timeout: 60)\n return open_channel if ques.nil?\n\n ques = ques.content\n @event.respond('Enter the answer: ')\n ans = @event.user.await!(timeout: 60)\n return open_channel if ans.nil?\n\n ans = ans.content.gsub(/\\W/, '').downcase # Clean up the answer by removing caps and non [a-z] [0-9] chars\n @event.respond('Commit to database? (y/n): ')\n prompt = @event.user.await!(timeout: 60)\n unless prompt.nil? || prompt.content != 'y'\n begin\n @@trivia_db.prepare('INSERT INTO trivia(question, answer, addedby) VALUES(?, ?, ?)').execute(ques, ans, @event.user.id)\n rescue SQLite3::Exception\n @event.respond('Unable to write to database!')\n else\n @event.respond('Changes saved')\n end\n end\n open_channel\n end", "def manually_complete_quest(quest_id)\n quest(quest_id).prime_objectives.clear\n quest(quest_id).manual_status = :complete\n end", "def quest_selection(input, difficulty)\n quest_id = self.get_recommended_quests(difficulty)[input.to_i-1].id\n CharacterQuest.new_character_quest(self.id, quest_id)\n end", "def phase3_command_skill\r\n # Set action\r\n @active_battler.current_action.kind = 1\r\n # Start skill selection\r\n start_skill_select\r\n end", "def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end", "def ask(question, context, to, jid_user)\n puts \"Bot: #{question}\"\n @questions[to]=context\n end", "def update_help\n @help_window.quest = item\n end", "def general_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => true).where.not(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end", "def create\n @quest = Quest.new(params[:quest])\n @quest.creator_id=Profile.where(:users_id=>current_user.id)[0].id\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render json: @quest, status: :created, location: @quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para crear esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para crear esta quest!'\n end\n end", "def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\nend", "def create_quest_tbl\n\t\t\tq_rows = @player_data_db.execute <<-SQL\n\t\t\t\tCREATE TABLE IF NOT EXISTS quests (\n\t\t\t\t\tid INTEGER PRIMARY KEY,\n\t\t\t\t\tdb_name varchar(30),\n\t\t\t\t\tname varchar(30),\n\t\t\t\t\tdescrip varchar(255),\n\t\t\t\t\tk_g_goal int,\n\t\t\t\t\tk_g_name varchar(30),\n\t\t\t\t\texp_reward int,\n\t\t\t\t\tsilver_reward int,\n\t\t\t\t\tgold_reward int,\n\t\t\t\t\tloot_reward varcar(30),\n\t\t\t\t\tk_g_count int,\n\t\t\t\t\tq_status varchar(5)\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\tSQL\n\t\tend", "def on_skill_ok\n @skill = @skill_window.item\n BattleManager.actor.input.set_skill(@skill.id)\n action = BattleManager.actor.input\n BattleManager.actor.last_skill.object = @skill\n if @skill.target_type[0] == :one then select_target_selection\n else\n case @skill.target_type[0]\n when :all\n BattleManager.actor.input.set = SES::TargetManager.make_targets(action)\n when :rand\n targets, set = [], SES::TargetManager.make_targets(action)\n (@skill.target_type[1][0] + rand(@skill.target_type[1][1])).times do\n targets << set[rand(set.size)]\n end\n BattleManager.actor.input.set = set\n end\n @skill_window.hide\n next_command\n end\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def update\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n \n attributes_sent = params[:tutorial_quest]\n attributes_to_update = {}\n \n raise ForbiddenError.new (\"Access to quest state forbidden.\") unless admin? || staff? || @tutorial_quest.tutorial_state.owner == current_character\n \n if admin? || staff?\n attributes_to_update = attributes_sent\n else\n attributes_to_update[:status] = attributes_sent[:status] if attributes_sent.has_key?(:status)\n end\n \n if attributes_to_update.has_key?(:status) && attributes_to_update[:status] == Tutorial::Quest::STATE_DISPLAYED.to_s\n attributes_to_update[:displayed_at] = Time.now\n\n # Send Mail if required\n #quest_message = @tutorial_quest.quest[:message]\n #\n #if !quest_message.nil? && @tutorial_quest.status < Tutorial::Quest::STATE_DISPLAYED\n # Messaging::Message.create_tutorial_message(current_character, quest_message[I18n.locale][:subject], quest_message[I18n.locale][:body])\n #end\n end\n \n if attributes_sent.has_key?(:reward_displayed)\n attributes_to_update[:reward_displayed_at] = Time.now\n end\n\n respond_to do |format|\n if @tutorial_quest.update_attributes(attributes_to_update)\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully updated.' }\n format.json { render json: {}, status: :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_questao\n @questao = Questao.find(params[:id])\n end", "def start_bridge_quest\n slowly do\n\"\"\"\nWhat should Duncan do? \n There's bacon!! Dash across that bridge and hunt! -- Press 1\n Carefully approach and investigate the scenario. -- Press 2\n Use special power! -- Press 3\n\"\"\" \n end\n end", "def save!\n quest = Quest.new\n quest.parent_id = @parent_id\n quest.main_quest_slides = @main_quest_slides.try(:join, \",\")\n quest.rewards = @achievement ? nil : @rewards\n quest.achievement = @achievement\n quest.id = @quest_id\n quest.save!\n\n @objectives.each do |klass, options|\n objective = klass.new(options)\n objective.quest = quest\n objective.save!\n end\n\n quest\n end", "def complete_quests(options={})\n options.reverse_merge!(:count => 1)\n\n @objectives.push([\n Objective::CompleteQuests,\n {:key => Objective::CompleteQuests::KEY, :count => options[:count]}\n ])\n end", "def reset_quest(quest_id)\n delete_quest(quest_id)\n setup_quest(quest_id)\n end", "def create\n @quest = Quest.new(params[:quest])\n\t@categories = find_all_categories\n\n respond_to do |format|\n if @quest.save\n\t\tcurrent_user.join!(@quest)\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render json: @quest, status: :created, location: @quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @quest = Quest.find(params[:id])\n quest_objectives = @quest.locations\n completed_objectives = []\n quest_objectives.each do |obj|\n if @current_user.locations.exists?(obj)\n completed_objectives << obj\n end\n end\n if completed_objectives.length == quest_objectives.length\n unless @quest.winner_id\n @quest.update(winner_id: @current_user.id)\n end\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n end\n\n if(@quest.owner_id == @current_user.id)\n redirect_to edit_quest_path(@quest)\n elsif @quest.start_date > DateTime.current\n flash[:warning] = \"Quest has not yet begun!\"\n redirect_to user_path(@current_user) and return\n elsif @quest.end_date < DateTime.current\n flash[:warning] = \"Quest has ended. Womp womp\"\n\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n elsif @quest.users.exists?(@current_user.id)\n gon.track = true\n locations = @quest.locations\n gon.remaining_locations = []\n gon.completed_locations = []\n locations.each do |loc|\n if loc.users.exists?(@current_user.id)\n gon.completed_locations << loc\n else\n gon.remaining_locations << loc\n end\n end\n @remaining_locations = gon.remaining_locations\n @completed_locations = gon.completed_locations\n else\n gon.track = false\n flash[:danger] = \"You are not a member of this quest! Please contact the quest owner for an invite.\"\n redirect_to quests_path and return\n end\n end", "def peacekeeper_quest; end", "def set_teamquest\n @teamquest = Teamquest.find(params[:id])\n end", "def ask_questions\n super\n print \"What was your reason for joining? \"\n self.reason_for_joining = gets.strip.chomp\n end", "def pending_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n by_me_quests = UsersQuest.where(:assignor_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @by_me_quests = Quest.where(:id => by_me_quests).order('due_date')\n end", "def quest_params\n params.require(:quest).permit(:quest_name, :description, :req, :day, :quest_type, :money_output, :inf_type, :inf_output, :clue_output, :item_output, :notes, :dependent_on, :unlocks)\n end", "def quest_params\n params.require(:quest).permit(:user_id, :quest, :result)\n end", "def ragman_quest; end", "def update\n @quest = Quest.find(params[:id])\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para editar esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para editar esta quest!'\n end\n end", "def failQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.failQuest(quest,color,story)\nend", "def quest_revealed?(quest_id)\n $game_party.quests.revealed?(quest_id)\n end", "def init_maqj_data\n @quests = Game_Quests.new # Initialize @quests\n end", "def prapor_quest; end", "def dictator_Iraq\n puts \"Saddam formally rose to power in 1979, although he had been the de facto head\n of Iraq for several years prior. Within his own country, he suppressed\n his own citizens, particularly the Shi'a and Kurdish people. He also maintained\n power during the Iran–Iraq War and the Gulf War, and was accused of using\n chemical weapons. To alleviate the threat of revolution, Saddam afforded\n certain benefits to the potentially hostile population. Membership in the\n Ba'ath Party remained open to all Iraqi citizens regardless of background.\n However, repressive measures were taken against its opponents. The major\n instruments for accomplishing this control were the paramilitary and police\n organizations. Saddam was notable for using terror against his own people.\n Saddam's regime was responsible for the deaths of at least 250,000\n Iraqis and committed war crimes in Iran, Kuwait, and Saudi Arabia. Human\n Rights Watch and Amnesty International issued regular reports of widespread\n imprisonment and torture.\"\n\n crazy_acts\n\nend", "def ask_question\n question = Question.new\n puts \"\\nPlayer 1: #{question.text}\"\n end", "def test_NewQuestionText \n randomName = SecureRandom.hex(4)\n randomReq = SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n #Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n \n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n Common.displayed(RequisitionsDetail::REQUISITIONS_DETAIL_NAME_XPATH)\n \n # 1 - Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # 2 - Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # 3 - Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n \n # 4 - Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n\n # 5 - Check \"Text\" box\n unless $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_TEXT_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_TEXT_XPATH).click\n end\n \n # 6 - Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n \n #RESULTS\n # 6 - You will be redirected to the \"Question\" page.\n assert $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH + \"//*[text()[contains(.,'\" + QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH + \"')]]\")\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_TEXT_XPATH + \"//*[@title='Checked']\") \n }\n \n # 7 - Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # 8 - Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # 9 - Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n \n # 10 - Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_2_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH\n\n # 11 - Uncheck \"Text\" box\n if $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_TEXT_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_TEXT_XPATH).click\n end\n \n # 12 - Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH).displayed?\n } \n \n #RESULTS\n # 12 - You will be redirected to the \"Question\" page.\n assert $wait.until {\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH + \"//*[text()[contains(.,'\" + QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH + \"')]]\")\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_TEXT_XPATH + \"//*[@title='Not Checked']\") \n }\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n #JobBoard without login \n CustomSettings.JobBoardLogin(false)\n \n # 13 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n \n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n }\n \n #14 - Verify that questions from question set are shown correctly, check their order.\n \n assert $wait.until {\n $browser.find_element(:xpath, JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_1_TR_XPATH + \"//textarea\").displayed?\n $browser.find_element(:xpath, JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_2_TR_XPATH + \"//select\").displayed?\n } \n #Check order\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_NAME_1_XPATH).text\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_NAME_2_XPATH).text\n \n end", "def update_phase3_skill_select\r\n # Make skill window visible\r\n @skill_window.visible = true\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End skill selection\r\n end_skill_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the skill window\r\n @skill = @skill_window.skill\r\n # If it can't be used\r\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.skill_id = @skill.id\r\n # Make skill window invisible\r\n @skill_window.visible = false\r\n @skill_window.active = false\r\n # If effect scope is single enemy\r\n if @skill.scope == 1\r\n # Start enemy selection\r\n start_enemy_select\r\n # If effect scope is single ally\r\n elsif @skill.scope == 3 or @skill.scope == 5\r\n # Start actor selection\r\n start_actor_select\r\n # If effect scope is not single\r\n else\r\n # End skill selection\r\n end_skill_select\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n return\r\n end\r\n end", "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end", "def on_list_ok\n @quest_category_window.deactivate if @quest_category_window\n @quest_data_window.activate\n end", "def ask_question(num = @trivia[:cur_quest])\n self.say \"\\0036 #{@questions[num][:question]}\"\n STDOUT.puts \"\\n :#{@questions[@trivia[:cur_quest]][:answer]}: \\n\"\n end", "def each_quest(&block)\r\n @quests.each(&block)\r\n end", "def quest=(value)\n return if @quest == value\n @quest = value\n @layout = (@quest && @quest.layout) ? @quest.layout : @default_layout\n refresh\n end", "def update_phase3_skill_select\n # Make skill window visible\n @skill_window.visible = true\n # Update skill window\n @skill_window.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End skill selection\n end_skill_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the skill window\n @skill = @skill_window.skill\n # If it can't be used\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.skill_id = @skill.id\n # Make skill window invisible\n @skill_window.visible = false\n # If effect scope is single enemy\n if @skill.scope == 1\n # Start enemy selection\n start_enemy_select\n # If effect scope is single ally\n elsif @skill.scope == 3 or @skill.scope == 5\n # Start actor selection\n start_actor_select\n # If effect scope is not single\n else\n # End skill selection\n end_skill_select\n # Go to command input for next actor\n phase3_next_actor\n end\n return\n end\n end", "def set_quest_stat\n @quest_stat = QuestStat.find(params[:id])\n end", "def quest_params\n params.require(:quest).permit(:name, :description, :imgurl)\n end", "def ask_questions\n until game_over?\n ask_question\n end\n end", "def process_enchant_scene\n Sound.play_ok\n $game_temp.item_selected = @item.id\n SceneManager.call(Scene_Enchant)\n end", "def test_NewQuestionOptional \n randomName = SecureRandom.hex(4)\n randomReq = SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n #Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_LIST_TITLE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n \n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n Common.displayed(RequisitionsDetail::REQUISITIONS_DETAIL_NAME_XPATH)\n \n # 1 - Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # 2 - Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # 3 - Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n \n # 4 - Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n\n # 5 - Check \"Optional\" box\n unless $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).click\n end\n \n # 6 - Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n \n #RESULTS\n # 6 - You will be redirected to the \"Question\" page.\n assert $wait.until {\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH + \"//*[text()[contains(.,'\" + QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH + \"')]]\").displayed?\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH + \"//*[@title='Checked']\").displayed?\n }\n \n \n # 7 - Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # 8 - Click on previously created Question Set's name from the list\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\").click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # 9 - Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n \n # 10 - Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_2_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH\n\n # 11 - Uncheck \"Optional\" box\n if $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).click\n end\n \n # 12 - Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH).displayed?\n } \n \n #RESULTS\n # 12 - You will be redirected to the \"Question\" page.\n assert $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH + \"//*[text()[contains(.,'\" + QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH + \"')]]\").displayed?\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH + \"//*[@title='Not Checked']\").displayed? \n }\n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # 13 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n \n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n \n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n }\n \n #14 - Verify that questions from question set are shown correctly, check their order.\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH)\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_ERROR_BLOCK_XPATH).displayed?\n }\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_ERROR_BLOCK_XPATH).text\n \n #Check order\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_NAME_1_XPATH).text\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_NAME_2_XPATH).text\n \n end", "def index\n # TODO: Find personal quests\n quests = UsersQuest.where(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end", "def ask(question)\n ui.ask question\n end", "def test_AnswerQuestionsFromQuestionSet\n randomName = SecureRandom.hex(4)\n randomReq = SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n current_url = $browser.current_url\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).displayed?\n } \n \n # Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n elementText = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_TEXT_XPATH)\n if elementText.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH).click\n end\n elementOptional = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH)\n if elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n #Add Answers\n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n Common.click_and_load(QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH) \n \n Common.displayed(AnswerEditPage::ANSWER_EDIT_NAME_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ORDER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_SCORE_XPATH) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_1_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_1_INT\n Common.click_and_load(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_NEW_XPATH)\n Common.displayed(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH) \n \n Common.displayed(AnswerEditPage::ANSWER_EDIT_NAME_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ORDER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_SCORE_XPATH) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_2_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_2_INT\n \n Common.click_and_load(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH)\n Common.displayed(AnswerDetailPage::ANSWER_DETAIL_BACK_TO_QUESTION_XPATH)\n \n # Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n \n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # Go to Job Board\n $browser.get(HomePage::JOB_BOARD_URL)\n \n # 1 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n } \n \n \n # 2 - Answer questions\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select\").send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n \n # 3 - Click on Submit\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_BTN_SUBMIT_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n \n $browser.get(current_url)\n # Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n } \n \n assert $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_XPATH).displayed?\n }\n \n Common.click_and_load(QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_APPLICATION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n }\n assert $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_JOB_TEXT_XPATH + \"[//*[text()[contains(.,'\" + randomReq + \"')]]]\").displayed?\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n } \n \n end", "def ask_question\n @question = Question.new\n puts \"#{@current_player.name}: #{@question.show}\"\n end", "def ai_action()\n # sleep 3\n player = get_player(self.current_player)\n action_info = ai_one_logic(player)\n if player.ai == \"2\"\n action_info = ai_two_logic(player)\n end\n action(action_info[0], action_info[1], player.id) # this progresses current player and may progress round\n self.save\n end", "def create\n return\n @quest = Quest.new(quest_params)\n\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quest }\n else\n format.html { render action: 'new' }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def authorize_admin_manage_quests\n unless current_user.permission.manage_quests\n redirect_back fallback_location: root_path\n end\n end", "def phase3_command_item\r\n # Set action\r\n @active_battler.current_action.kind = 2\r\n # Start item selection\r\n start_item_select\r\n end", "def activate\n if player.location.has_items?\n # set inventory index being considered for get\n @index = 0\n @item = player.location.inventory[@index]\n if player.inventory.can_fit?(@item)\n if player.location.inventory.size == 1 && @item.quantity == 1\n # a single item at the location so just get it\n player.get(@item)\n game.change_state(Map.new)\n else\n game.messages << \"Do you want to pick up #{@item}? Y/N\"\n end\n else\n game.messages << 'Your inventory is full.'\n game.change_state(Map.new)\n end\n else\n # no items at location\n game.change_state(Map.new)\n end\n end", "def draw_item(index)\n quest = @data[index]\n if quest\n rect = item_rect_for_text(index)\n if QuestData::SHOW_QUEST_ICONS\n draw_icon(quest.icon_index, rect.x, rect.y, enable?(quest))\n rect.x += 24\n rect.width -= 24\n end\n change_color(quest_name_colour(quest), enable?(quest))\n draw_text(rect, quest.name)\n end\n end", "def equip_selected\n item = @equip_window.item\n if @equip_window.item.nil?\n Sound.play_buzzer\n return\n end\n @enchant_window.item = item\n Sound.play_ok\n @equip_window.active = false\n @enchant_window.state = 2\n end", "def save!\n if @debug\n puts \"Saving quest DSLs:\"\n @dsls.each do |dsl|\n puts \" #{dsl.to_s}\"\n end\n end\n\n ActiveRecord::Base.transaction do\n @dsls.each { |dsl| dsl.save! }\n end\n @dsls.clear\n\n @quests_started_count, @quests_started_players = start_newborn_parents!\n\n true\n end", "def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end", "def questions\n \n end", "def trivia_start\n @config[:mode] = \"trivia\"\n @trivia[:start] = Time.now\n self.say \"\\00310Trivia mode is starting.\"\n self.ask_question(@trivia[:cur_quest])\n end", "def ask_question\n\n end", "def using_skill?\n return false if @use_spell.empty? or @using_skill\n casting = @use_spell[0][1]\n pos = casting[1]\n target = casting[2]\n if target != nil\n pos = [target[0].x+target[1][0], target[0].y+target[1][1]]\n end\n @cursor.moveto( pos) \n return true if update_screen\n @using_skill = true\n @active_battler = @use_spell.shift[0]\n @spell = casting[0]\n \n @active_battler.current_action.set_skill(@spell.id)\n #@active_battler.current_action.item_id = 0\n draw_ranges(@active_battler, 5)\n update_target_cursor\n @targets = @active_battler.get_targets\n activate_immediat_skill\n return true\n end", "def begin_mission_text\n typing_tabbed(\"txt/caveats.txt\")\n tab; \"We recommend avoiding the latter\".typing; \"...\".typing(0.75)\n line; line; sleep 2\n\n tab; \"We'll reach the LZ in just a moment\".typing; line\n tab; \"Godspeed, Agent #{codename}. We're counting on you...\".typing; line\n\n press_enter { %Q(Press 'ENTER' to begin your mission and start the timer.) }\n end" ]
[ "0.72086614", "0.7181531", "0.7138753", "0.7120502", "0.7077674", "0.7058291", "0.6826155", "0.6770229", "0.65837616", "0.65448", "0.6452135", "0.6424945", "0.6424945", "0.6424945", "0.6424945", "0.642236", "0.6414558", "0.6372918", "0.62991464", "0.6292872", "0.6277443", "0.62392396", "0.6227959", "0.6166", "0.615483", "0.60650176", "0.6058562", "0.603379", "0.60336787", "0.59420615", "0.5938976", "0.59361625", "0.5908685", "0.5906394", "0.58570313", "0.5838599", "0.5824489", "0.57692885", "0.5746289", "0.57418376", "0.5738579", "0.5731521", "0.57301384", "0.57252276", "0.571948", "0.57089984", "0.56839275", "0.56807053", "0.56796086", "0.5679466", "0.5663658", "0.56627893", "0.5632091", "0.5610453", "0.56035316", "0.55935496", "0.5593292", "0.5571224", "0.55597395", "0.5556214", "0.55465645", "0.5532011", "0.5527207", "0.5493255", "0.5479098", "0.54786605", "0.54723394", "0.5439607", "0.5434985", "0.54286057", "0.5425836", "0.54254377", "0.5424878", "0.54159945", "0.54158014", "0.5414778", "0.5411645", "0.5391743", "0.5390099", "0.5372931", "0.53697497", "0.5349691", "0.5334647", "0.53336483", "0.5330026", "0.53267926", "0.53265566", "0.5326121", "0.5310009", "0.5303028", "0.53027827", "0.53014296", "0.52980477", "0.52840114", "0.52820915", "0.52771735", "0.5275667", "0.5268792", "0.52600926", "0.5249681" ]
0.73231465
0
Helper function for marking quests as completed
def completeQuest(quest,color=nil,story=false) return if !$PokemonGlobal $PokemonGlobal.quests.completeQuest(quest,color,story) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markDone\n if @complete == \"Item incomplete\"\n @complete = \"Item complete\"\n else\n @complete = \"Item complete\"\n end\n end", "def mark_as_completed!\n mark_state_complete!\n end", "def completed\n end", "def completed\n @status = 'complete'\n end", "def complete!\n self.is_completed = true\n self.save\n end", "def complete!\n self.update_attribute(:is_completed, true)\n # TODO: send an email to teacher about taks completion\n end", "def check_completed\n\t\tend", "def mark_as_completed\n completed_at.nil? ? self.completed = true : errors.add(:completed, '- This task has already been completed!')\n end", "def mask_as_done!\n @completed = true\n end", "def manually_complete_quest(quest_id)\n quest(quest_id).prime_objectives.clear\n quest(quest_id).manual_status = :complete\n end", "def complete!\n @completed = true\n @completed_at = Time.now\n end", "def completed_it\n self.complete = true\n end", "def mark_completed\n puts 'Enter task number(ID), please'\n\n entered_id = get_id_input\n\n if @tasks[entered_id]\n\n @tasks[entered_id].status = 'completed'\n\n else\n\n no_entry_message\n\n end\n\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def mark_complete\n self.complete = true\n self.save\n end", "def completed\n @completed ||= count('completed')\n end", "def completed()\n end", "def completed()\n @completed=true\n @tCompleted=Time.now\n end", "def mark_as_done!\n @status = :finished\n end", "def complete!\n self.status = 'completed'\n self.save\n end", "def completed?\n completed\n end", "def complete!\n self.completed = true\n self.completed_at = Time.now.utc\n save! # TODO: With a bang?\n end", "def update_completed? ; false ; end", "def mark_as_finished \n if self.used_quantity + self.scrapped_quantity == self.quantity\n self.is_finished = true \n end\n self.save\n end", "def mark_as_finished \n if self.used_quantity + self.scrapped_quantity == self.quantity\n self.is_finished = true \n end\n self.save\n end", "def completed?\n completed == '1'\n end", "def complete(to_do_item)\n response = to_do_item\n response[:complete] = true\n response\n end", "def complete!\n @completed_at = Time.now\n end", "def complete!\n @completed_at = Time.now\n end", "def mark_as_complete_and_save\n self.complete = true\n save\n end", "def mark_task_complete\n system \"clear\"\n # If task was set\n\n loop do\n task = get_task_choice(\"mark complete\")\n if task && task != :back\n task.status = :completed\n\n system \"clear\"\n display_tasks(:completed)\n display_tasks(:failed)\n\n # Cancel notifications\n task.cancel_reminder_notification\n task.cancel_failed_notification\n\n puts \"Congratulations on completing this task!\".light_white\n break unless CLI.agree(\"\\nMark another task complete? (y/n)\".light_white)\n else\n break\n end\n end\n end", "def find_completed\n completed = self.user_quests.where(complete: true)\n completed.map do |x|\n x.quest_id\n end\n end", "def became_completed?\n completed_changed? && completed\n end", "def set_as_complete\n mark_as_complete_and_save\n end", "def update_done\n self.done = true if COMPLETE_STATUSES.include? self.detailed_status\n end", "def completed?(item)\n state_group(item) == :done\n end", "def completed?\n !!completed\n end", "def completed\n proptime 'COMPLETED'\n end", "def selectComplete\n @to_do_items.select {|item| item.done? == 'Item complete'}\n end", "def mark_as_done\n @is_done = true\n end", "def mark_done\n @done = true\n end", "def mark_as_done!\n @done = true\n end", "def mark_complete\n if self.completed\n self.progress = \"COMP\"\n self.progress_percentage = \"100\"\n elsif self.progress and !self.progress.eql?('COMP') and self.progress_percentage\n self.progress = self.progress\n self.progress_percentage = self.progress_percentage\n else\n self.progress = \"INPR\"\n self.progress_percentage = \"0\"\n end\n end", "def toggle_completed\n update completed: !completed\n completed\n end", "def complete?\n status == \"Completed\"\n end", "def update_completed\n uncompleted_items = todo_list_items.select { |e| !e.completed? }\n update(completed: true) if uncompleted_items.zero?\n end", "def complete?\n\tstatus == \"Completed\"\n end", "def mark_program_as_completed_if_it_is\n if self.passed? and !self.program_player.completed? and self.program_budge.level >= self.program_player.program.last_level\n self.program_player.update_attributes(:completed => true, :victorious => (self.program_player.victorious == false ? nil : self.program_player.victorious))\n # self.program_player.user.contact_them(:email, :completed_program_congrats, self.program_player)\n Mailer.message_for_habit_labbers(\"#{self.program_player.user.name} completed #{self.program_player.program.name}!\",\n \"One of you Labbers should take a look at their progress through the program and \"+\n \"congratulate them on Twitter! \\n\\nhttp://#{DOMAIN}/dash/user/#{self.program_player.user.id}\").deliver rescue nil\n end\n end", "def completed?\n @completed\n end", "def completed?\n @completed\n end", "def possibly_set_as_completed\n # this is a guard against setting something completed that isn't and that will make this method fail\n return false unless available_in_merritt? # this also sets @mrt_results member variable so we don't have to redo the query again\n\n merritt_id = \"#{APP_CONFIG[:repository][:domain]}/d/#{@mrt_results['ark']}\"\n StashEngine.repository.harvested(identifier: resource.identifier, record_identifier: merritt_id)\n\n if StashEngine::RepoQueueState.where(resource_id: resource_id, state: 'completed').count < 1\n StashEngine.repository.class.update_repo_queue_state(resource_id: resource_id, state: 'completed')\n end\n\n update_size!\n ::StashEngine.repository.cleanup_files(resource)\n true\n end", "def incomplete!\n self.update_attribute(:is_completed, false)\n # TODO: send an email to teacher about tasks reopening\n end", "def finalize!\n update_attribute(:completed_at, Time.now)\n end", "def completion_aspect\n true_value = \"Completed\"\n false_value = \"Incomplete\"\n self.complete ? true_value : false_value\n end", "def completed?\n\t\t@completed\n\tend", "def completed?\n @completed\n end", "def completed?\n self.status_sym == :completed\n end", "def mark_as_complete(options)\n self.is_complete = options[:is_complete]\n self.is_applicable = true # if item.is_complete\n self.save_with_validation(false)\n end", "def finish!\n update_attributes!(:status => :done)\n self\n end", "def set_complete(name)\n\t\tif index = find_index(name)\n\t\t\ttodo_items[index].set_complete!\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def complete!\n update_attributes(completed_at: Time.now)\n pause! if running?\n end", "def run_completed\n end", "def completed\n candidate_events.select(&:completed?)\n end", "def completed?\n attributes['percentDone'] >= 1\n end", "def complete\n if @todo_item.update_attribute(:completed, 1)\n flash[:success] = \"todo item marked as completed\"\n redirect_to todo_path(@todo)\n else\n flash[:error] = \"failed to mark item as completed\"\n render 'todos/show'\n end\n end", "def finish\n question = 'Are you done with this task? [yes/no] :'\n if ret = !! Readline.readline(question).match(/^yes/i)\n @issue.mark_finished!\n @issue.save\n end\n ret end", "def mark_all_todos_as_completed(list_id)\n sql = \"UPDATE todos SET completed = true WHERE list_id = $1\"\n query(sql, list_id)\n end", "def done?\n if @complete == \"Item complete\"\n return \"Item complete\"\n else\n return \"Item incomplete\"\n end\n end", "def completed?\n self.is_completed\n end", "def mark_complete(task)\n users = Project.find_by_id(@task.projectid).allshares.split(\",\")\n task.datecomplete = DateTime.now\n task.save!\n users.each do |user|\n us = User.find_by_id(user)\n if us && us.id != session[:userid]\n message = \"The task \" + task.name + \" has been marked complete.\"\n subject = task.name + \" is complete\"\n Notification.send_notifications_to_user(subject, message, @task.projectid, us.id)\n\n end\n end\n end", "def set_complete_incomplete\n @tasks_incomplete = @tasks.where(\"completed = 'f'\").order('tasks.created_at DESC')\n @tasks_complete = @tasks.where(\"completed = 't'\").order('tasks.created_at DESC')\n end", "def complete!\n # this should change the boolean to true\n self.complete = true\n self.save!\n end", "def incomplete?\n !completed\n end", "def complete_todo\n cli.die \"That task is already completed!\" if @todo.completed?\n @todo.complete!\n puts \"#{@todo.label}: '#{@todo.todo}' marked as completed at #{@todo.stop}\"\n end", "def became_incompleted?\n completed_changed? && !completed\n end", "def completed?\n self.state == :completed\n end", "def mark_complete(db, complete, name)\n\tcomplete = \"complete\"\n\tdb.execute(\"UPDATE upper_body SET complete=? WHERE name=?\", [complete, name])\n\tdb.execute(\"UPDATE lower_body SET complete=? WHERE name=?\", [complete, name])\n\tputs \"set #{name} to complete\"\nend", "def iscompleted?\n status == \"completed\"\n end", "def completed?\n @completed\n end", "def completed?\n if self.completed == true\n true\n end\n\n if( self.user_quiz_answers.count == self.quiz.quiz_phases.collect{ |p| p.quiz_questions }.size )\n self.completed = true\n true\n else\n false\n end\n end", "def setCompleted(completed)\r\n\t\t\t\t\t@completed = completed\r\n\t\t\t\tend", "def setCompleted(completed)\r\n\t\t\t\t\t@completed = completed\r\n\t\t\t\tend", "def done!(status = 0)\n @completed_at = Time.now\n @exitstatus = status\n save\n end", "def mark_done\n self.done_at = Time.now\n end", "def mark_todo\n puts \"Which todo have you finished?\"\n action = get_input.to_i\n arr_index = 0\n @todos.each do |x|\n if x[\"completed\"] == \"no\"\n arr_index = arr_index + 1\n if arr_index == action\n x[\"completed\"] = \"yes\"\n save!\n break\n end\n end\n end\n end", "def done\n completed + dead\n end", "def update_task_if_children_tasks_are_completed\n if type == EducationDocumentSearchTask.name && children.last.completed?\n update!(status: Constants.TASK_STATUSES.completed)\n else\n update!(status: Constants.TASK_STATUSES.assigned)\n end\n end", "def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end", "def on_completed?\n @kind == :on_completed\n end", "def complete\n case self.completed\n when EVENT_COMPLETED\n self.make_done_event if self.event.event_rep_type != SpecialCode.get_code('event_rep_type','unlimited')\n self.event.completes(self.player_character)\n LogQuestExplore.complete_req(self.player_character_id, event_id) #probably should happen through \n when EVENT_FAILED\n return [nil,nil]\n #when EVENT_SKIPPED\n when EVENT_INPROGRESS\n return [self.priority, self.event]\n end\n return self.next_event\n end", "def completed?\n !completed_at.blank?\n end", "def completed?\n status.completed?\n end", "def all_complete\n self.tasks.count == self.tasks.done.count\n end", "def completed?\n completed_at ? true : false\n end", "def completed?\n completed_at ? true : false\n end", "def completed?\n return @completed\n end", "def set_mission_as_done\n mission = Mission.find(params[:id].to_i)\n entr_missions = mission.entr_mission_users\n\n # No users attached to the mission\n if entr_missions.empty?\n flash[:success] = \"<h2>La mission < #{mission.title} > <span style='color:red'>ne peut pas être terminée (aucun utilisateur)</span></h2>\".html_safe\n redirect_to :back\n return\n end\n \n # Set each user link as done\n entr_missions.each do |entr|\n # If the user was doing the mission\n if entr.state == EntrMissionUser::Status::CONFIRMED\n # Credit him\n entr.user.credit_user mission\n MissionMailer.delay.mission_finished(entr.user, mission)\n end\n entr.state = EntrMissionUser::Status::DONE\n entr.save\n end\n \n # Set mission state as finished\n mission.state = Mission::Status::FINISHED\n mission.save\n\n # End\n flash[:success] = \"<h2>La mission < #{mission.title} > a bien été terminée</h2>\".html_safe\n redirect_to :back\n end", "def quest_status_changed\n $game_party.quests.add_to_sort_array(:change, @id) \n $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST\n end", "def completed?\n !completed_at.blank?\n end", "def completed_quests; $game_variables[17]; end" ]
[ "0.74331534", "0.7159824", "0.69868654", "0.6976418", "0.69690347", "0.69168", "0.68974924", "0.6866751", "0.685567", "0.68422735", "0.68111753", "0.6794352", "0.6789346", "0.6775018", "0.67507005", "0.6741173", "0.67223877", "0.66876227", "0.66868323", "0.6685593", "0.6626196", "0.6615465", "0.65785724", "0.6568979", "0.6568979", "0.65570277", "0.65474695", "0.6544778", "0.6544778", "0.65273404", "0.6522672", "0.65209883", "0.65202934", "0.6513983", "0.650439", "0.6489616", "0.6484524", "0.64738363", "0.64568675", "0.64542484", "0.6423234", "0.6412614", "0.6412569", "0.6411633", "0.6409779", "0.6407681", "0.6406814", "0.6397703", "0.639543", "0.639543", "0.638843", "0.6371634", "0.6366322", "0.6366167", "0.63497454", "0.63483024", "0.6332741", "0.63190055", "0.63182485", "0.63147974", "0.6314014", "0.62986815", "0.6298176", "0.62959397", "0.62936723", "0.62792885", "0.6260332", "0.62591016", "0.6249289", "0.6248192", "0.62399185", "0.62382954", "0.6237978", "0.6236106", "0.6229522", "0.6229485", "0.62262076", "0.622491", "0.6224896", "0.6221674", "0.61987674", "0.61987674", "0.61907613", "0.61893505", "0.618196", "0.61657673", "0.6127126", "0.61169857", "0.61127436", "0.61125094", "0.6110458", "0.61103165", "0.60957444", "0.6081477", "0.6081477", "0.6072434", "0.6056767", "0.60456884", "0.6042765", "0.60419995" ]
0.65183604
33
Helper function for marking quests as failed
def failQuest(quest,color=nil,story=false) return if !$PokemonGlobal $PokemonGlobal.quests.failQuest(quest,color,story) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failed?; state == 'failed'; end", "def failed?; state == 'failed'; end", "def mark_failure\n self.failure_occurred = true\n end", "def mark_failure\n self.failure_occurred = true\n end", "def failed?; failed_to_start? || (@success == false) end", "def failed!\n @success = false\n end", "def post_fail_message; end", "def failures; end", "def failures; end", "def failures; end", "def fail\n now = Time.now\n update_attributes(failed_at: now, completed_at: now)\n end", "def fail\n @failed = true\n end", "def fail!\n return if state == 'FAILED'\n JobTracker.transaction do\n update_attribute(:state, 'FAILED')\n Delayed::Job.destroy_failed_jobs ? delayed_jobs.each(&:destroy) : delayed_jobs.each do |dj|\n dj.update_attribute(:failed_at, Time.now)\n end\n end\n end", "def getFailedQuests\n failed = []\n $PokemonGlobal.quests.failed_quests.each do |s|\n failed.push(s.id)\n end\n return failed\nend", "def failed?\n @failTag == \"failure\"\n end", "def custom_failure!\n @custom_failure = true\n end", "def fail!\n @failed = true\n end", "def failure_has_not_occurred!\r\n @failure_has_occurred = false\r\n end", "def failed?\n failed\n end", "def failed?\n @passed == false\n end", "def failed?\n status == 'failed'\n end", "def failed?\n status == 'failed'\n end", "def failure!\n @count += 1\n end", "def failure\n !success\n end", "def failed?\n true\n end", "def record_failed_test(example)\n failed_tests << Quarantine::Test.new(\n example.id,\n example.full_description,\n example.location,\n buildkite_build_number\n )\n end", "def failure_message_when_negated; end", "def failure_message_when_negated; end", "def failure_message_when_negated; end", "def failure_has_occurred!\r\n @failure_has_occurred = true\r\n end", "def failed?\n @failed\n end", "def failed\n @failed ||= all.select { |rule| rule.status == \"FAIL\" }\n end", "def failed?\n @state == :failed\n end", "def failed?\n state == :failed\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def something_should_fail!\n @should_fail = true\n end", "def example_failed(example, counter, failure)\n end", "def fail\n @counts.fails += 1\n puts_failure_data(header: FAIL_HEADER)\n end", "def failed?\n status === 'failed'\n end", "def failed?\n status === 'failed'\n end", "def build_failed_test_case_records(question, auto_grading)\n messages = {\n error: I18n.t('course.assessment.answer.programming_auto_grading.grade.evaluation_failed_syntax')\n }\n remaining_test_cases = question.test_cases - auto_grading.test_results.map(&:test_case)\n remaining_test_cases.map do |test_case|\n auto_grading.test_results.build(\n auto_grading: auto_grading, test_case: test_case,\n passed: false,\n messages: messages\n )\n end\n end", "def mark_contract_event_as_failed\n @contract_event_obj.status = GlobalConstant::ContractEvent.failed_status\n @contract_event_obj.save!\n end", "def failed?\n status === \"failed\"\n end", "def failed?\n @failed\n end", "def fail(check)\n update_check_status(check, 'fail')\n end", "def do_failure; end", "def failure!\n end", "def fail!\n @success = false\n end", "def fail!\n @success = false\n end", "def failed?\n !success?\n end", "def fail!\n @success = false\n end", "def run_failed; end", "def fail!(msg = nil)\r\n @success = false\r\n @misses.push msg unless msg.nil?\r\n end", "def fail_student(student_name, test_name)\n boating_tests.map do |test|\n test.boating_test_status = \"Failed\"\n end\n end", "def failed?\n not @ok\n end", "def fail_student(student, test_name)\n BoatingTest.all.select{|bt| bt.instructor == self }.select{|bt| bt.student == student && bt.test_name == test_name}.each{|bt| bt.test_status = 'failed'}\n end", "def failure\n end", "def failed?\n status == :failed or tasks_have_failed?\n end", "def failed?\n @is_failed\n end", "def mark_failed_with_reason(failed_reason)\n Rails.logger.info(\"user_kyc_whitelist_log - #{self.id} - mark as failed.\")\n self.status = GlobalConstant::KycWhitelistLog.failed_status\n self.failed_reason = failed_reason\n self.save! if self.changed?\n end", "def failed?\n self == Failed\n end", "def failure(job)\n self.successful = true\n self.complete = true\n self.state = 'Failed'\n update_sync_job\n end", "def add_failure field_name:\n @failures << field_name\n end", "def after_failed\n end", "def failed_text\n 'Failed: %d' % failed\n end", "def fail_after(y, m, d, msg); end", "def failed(error = { base: ['lesson.unknown'] })\n return false if deactivated?\n self.status = 'failed'\n self.last_error = error\n notify_observers :after_fail if (suc = save)\n suc\n end", "def failures=(_arg0); end", "def failures=(_arg0); end", "def fail(reason)\n end", "def fail_objective(*obj)\n valid_obj = obj.select {|x| x < objectives.size && !@failed_objectives.include?(x) }\n reveal_objective(*valid_obj)\n uncomplete_objective(*valid_obj)\n was_failed = status?(:failed)\n valid_obj.each {|i| @failed_objectives.maqj_insert_sort(i) }\n quest_status_changed unless valid_obj.empty?\n $game_party.quests.add_to_sort_array(:failed, @id) if status?(:failed) && !was_failed\n end", "def fail\n _redis_lua_run(\n 'batch_fail',\n keys: [_batch_key])\n end", "def failed(event)\n failed_events.push(event)\n end", "def failed\n total - successful\n end", "def step_fails(response, failure)\n @step_failed = true\n flow = @flow_steps.keys.last\n step_no = @flow_steps[flow].size\n step_key = @flow_steps[flow].last\n failure = %{deploy faild on #{flow}(#{step_no}):#{step_key}\\n} + failure\n response.reply(failure)\n end", "def fail_student(test_name, student)\n fail_test = BoatingTest.all.find {|test| student == test.student && test_name == test.name}\n\n if fail_test == nil\n student.add_boating_test(test_name, \"failed\", self)\n else\n fail_test.status=\"failed\"\n end\n\n end", "def unsuccessful\n end", "def incorrect_answer(text)\n answer = Answer.new(text, false)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def pending_executed_by_failed(agent, tasks)\n tasks.each do |t|\n t.failed_to_start!(agent.failure_reason || agent.terminal_event)\n end\n end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def errored_answers(current_answer)\n attempts = current_answer.submission.answers.from_question(current_answer.question_id)\n attempts.select do |attempt|\n attempt&.auto_grading&.job&.errored?\n end\n end", "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n end", "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n end", "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n end", "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n end", "def find_all_failed_questions\n # loose checking to prevent the function twice at the same time\n return if @find_all_failed_questions\n @find_all_failed_questions = true\n new_questions = 0\n @tables.each do |t,f|\n q = \"SELECT path, abstract_form, #{f.join(\", \")} FROM #{t} WHERE #{f.join(\"=-1 OR \")}=-1\"\n res = RT.custom_query(q)\n res.each do |q|\n # skip all files that have already been processed\n next if @all_processed_paths.include?(q[\"path\"])\n @all_processed_paths << q[\"path\"]\n form = Marshal.load(Base64.decode64(q[\"abstract_form\"]))\n # use the database result to check if a question is failed.\n # AbstractForm is never changed, so already fixed questions need\n # to be excluded.\n form.questions.select { |qq| q[qq.db_column].to_i == -1 }.each do |qq|\n ident = \"#{q[\"path\"]}_#{qq.db_column}\"\n # skip existing entries\n next unless @all_failed_questions.assoc(ident).nil?\n data = {}\n data[\"path\"] = q[\"path\"]\n data[\"table\"] = t\n form.pages.each_with_index do |p,i|\n data[\"page\"] = i if p.questions.include?(qq)\n end\n data[\"question\"] = qq\n @all_failed_questions << [ident, data]\n new_questions += 1\n end\n end\n end\n debug \"Found #{new_questions} new question(s)\"\n @find_all_failed_questions = false\n end", "def failed?\n #FIXME: this should probably be refactored\n warnings_to_display.any?\n end", "def failure\n @status = FAILURE_FLAG if @status == SUCCESS_FLAG\n end", "def miss_reason; end", "def failed?\n (scenarios_results.include?\"failed\") || (steps_results.include?\"failed\")\n end", "def failed(event)\n @failed_events.push(event)\n end", "def failed_asserts\n asserts.select { |a| !a[:value] }\n end", "def fail(message)\n $marathon.fail(message)\nend", "def failed_tasks\n each_task.select do |task|\n task.status == :failed\n end\n end" ]
[ "0.64380085", "0.64380085", "0.63974255", "0.63974255", "0.6386845", "0.6324332", "0.62693053", "0.625873", "0.625873", "0.625873", "0.6201395", "0.619108", "0.61764365", "0.61525196", "0.6132045", "0.6125698", "0.6119402", "0.61165553", "0.6100646", "0.6072988", "0.6069385", "0.6069385", "0.60624903", "0.60176873", "0.60021377", "0.5997642", "0.5989053", "0.5989053", "0.5989053", "0.5987779", "0.5983515", "0.5958364", "0.59577185", "0.5951865", "0.5951606", "0.593731", "0.5933227", "0.5926852", "0.5914159", "0.5914159", "0.58998847", "0.5897407", "0.58958656", "0.58931285", "0.5871954", "0.58677524", "0.58572346", "0.585095", "0.585095", "0.5838725", "0.5819464", "0.5819246", "0.58118236", "0.58101904", "0.58077157", "0.5803157", "0.5798799", "0.57966185", "0.57949334", "0.57948095", "0.57809955", "0.57706577", "0.5764707", "0.576413", "0.5761625", "0.5761511", "0.57554793", "0.57471716", "0.57471716", "0.5734644", "0.57297266", "0.5715115", "0.5704918", "0.5696478", "0.56868184", "0.56838197", "0.5680521", "0.5679373", "0.5674621", "0.566679", "0.566679", "0.566679", "0.566679", "0.566679", "0.566679", "0.566679", "0.56535286", "0.56476104", "0.56476104", "0.56476104", "0.56476104", "0.5647197", "0.5632365", "0.5629746", "0.5616638", "0.55989534", "0.5591894", "0.5589629", "0.5577464", "0.5566901" ]
0.68772
0
Helper function for advancing quests to given stage
def advanceQuestToStage(quest,stageNum,color=nil,story=false) return if !$PokemonGlobal $PokemonGlobal.quests.advanceQuestToStage(quest,stageNum,color,story) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activateQuest(quest,color=colorQuest(nil),story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.activateQuest(quest,color,story)\nend", "def quest; end", "def calculate_stage(game, stage)\n game.cycle = self\n game.result.each { |result| stage[result - 1] += 1 }\n stages << stage\n end", "def add_questions_from_stage(stage)\n stage.stage_questions.each do |question|\n questions << Question.new(\n :category => question.category,\n :question => question.question,\n :answer => question.answer,\n :points => question.points\n )\n end\n\n self.save\n end", "def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\n end", "def fence_quest; end", "def add_stages_to_transaction\n org_stages = self.organization.deal_statuses.where(\"name NOT IN (?)\", ['Won', 'Lost']).order(\"original_id\") \n org_stages.each do |stage|\n if stage.id == self.deal_status_id\n break\n else\n stage = self.organization.deal_statuses.where(\"id=?\",stage.id).first\n if stage.present? && stage.name.downcase != \"won\"\n begin\n DealTransaction.create({:organization_id => self.organization_id, :deal_id => self.id, :deal_status_id => stage.id, :user => User.current, :is_activity_display => false, :assigned_to => self.assigned_to.present? ? self.assigned_to : User.current.id})\n rescue\n end\n end\n end\n end\n end", "def quest_book\n GamePlay::QuestBookMenu.new.main\n Graphics.transition\n @wait_count = 2\n end", "def advance_applicant(cmd, email, stage = ''.freeze)\n applicant = find_applicant(email)\n if !applicant\n output MSG_NO_SELECTED_APPLICANT\n elsif [stage, @stages.last].include? applicant.stage\n output MSG_ALREADY_IN + applicant.stage\n elsif stage.empty?\n stage_index = @stages.index(applicant.stage) || -1\n applicant.stage = @stages[stage_index + 1]\n output cmd\n elsif !@stages.include?(stage)\n output MSG_INVALID_STAGE\n else\n applicant.stage = stage\n output cmd\n end\n end", "def entered(player)\n actions.each { |action| action.entered(player) }\n end", "def activateQuest(quest,color,story)\n if !quest.is_a?(Symbol)\n raise _INTL(\"The 'quest' argument should be a symbol, e.g. ':Quest1'.\")\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id == quest\n pbMessage(\"You have already started this quest.\")\n return\n end\n end\n for i in 0...@completed_quests.length\n if @completed_quests[i].id == quest\n pbMessage(\"You have already completed this quest.\")\n return\n end\n end\n for i in 0...@failed_quests.length\n if @failed_quests[i].id == quest\n pbMessage(\"You have already failed this quest.\")\n return\n end\n end\n @active_quests.push(Quest.new(quest,color,story))\n pbMessage(_INTL(\"\\\\se[{1}]<ac><c2=#{colorQuest(\"red\")}>New quest discovered!</c2>\\nCheck your quest log for more details!</ac>\",QUEST_JINGLE))\n end", "def stage_by_thrust\n loop do \n if vessel.thrust == 0 \n ctrl.activate_next_stage\n sleep(0.1)\n break\n end \n end \n end", "def stage; end", "def stage; end", "def call_quest_journal\n @quest_journal_calling = false\n Sound.play_ok\n SceneManager.call(Scene_Quest)\n end", "def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end", "def stage_by_thrust\n loop do \n if vessel.thrust == 0 \n ctrl.activate_next_stage\n break\n end \n end \n end", "def inside(player)\n acttions.each { |action| action.inside(player) }\n end", "def completeQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.completeQuest(quest,color,story)\nend", "def add_goals\n end", "def decisions_that_will_move_to_next_stage\n return @decisions_that_will_move_to_next_stage\n end", "def completed_quests; $game_variables[17]; end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def next_phase\n\t\t@current = Iteration.get_current\n\t\t@current.status = case @current.status\n\t\t\t\twhen \"ideas\" then \"proposals\"\n\t\t\t\twhen \"proposals\" then \"voting\"\n\t\t\t\telse \"voting\"\n\t\t\tend\n\t\t@current.save\n\t\trender json: {:status => @current.status}\n\tend", "def nextStage\n @currentStageIndex += 1\n createMap(@stages[@currentStageIndex])\n @finalStage = true if @stages.length == @currentStageIndex + 1\n end", "def update_phase3_enemy_select\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End enemy selection\r\n end_enemy_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.target_index = @enemy_arrow.index\r\n # End enemy selection\r\n end_enemy_select\r\n # If skill window is showing\r\n if @skill_window != nil\r\n # End skill selection\r\n end_skill_select\r\n end\r\n # If item window is showing\r\n if @item_window != nil\r\n # End item selection\r\n end_item_select\r\n end\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n end", "def next_phase\n if phase == 'Action'\n reset_action_variables\n update_attributes(phase: \"Buy\") \n elsif phase == 'Buy'\n reset_player_balances\n current_player.discard.add_deck_to_top( current_player.played )\n current_player.discard.add_deck_to_top( current_player.hand )\n current_player.draw_card(5)\n next_turn\n update_attributes(phase: \"Action\")\n end\n end", "def adventuring() skill(:adventuring) end", "def short_assessment_next_step(arg_next_step)\n self.current_step = arg_next_step\n end", "def activateQuest(questID)\n if questID.is_a?(String)\n questID = $quest_data.getIDFromName(questID)\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id==questID\n Kernel.pbMessage(\"You have already started this quest\")\n return\n end\n end\n for i in 0...@completed_quests.length\n if @completed_quests[i].id==questID\n Kernel.pbMessage(\"You have already complete this quest\")\n return\n end\n end\n for i in 0...@failed_quests.length\n if @failed_quests[i].id==questID\n Kernel.pbMessage(\"You have already failed this quest\")\n return\n end\n end\n @active_quests.push(Quest.new(questID))\n end", "def update_phase3_enemy_select\n # Update enemy arrow\n @enemy_arrow.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End enemy selection\n end_enemy_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.target_index = @enemy_arrow.index\n # End enemy selection\n end_enemy_select\n # If skill window is showing\n if @skill_window != nil\n # End skill selection\n end_skill_select\n end\n # If item window is showing\n if @item_window != nil\n # End item selection\n end_item_select\n end\n # Go to command input for next actor\n phase3_next_actor\n end\n end", "def next_stage\n stages = project.stages.to_a\n stages[stages.index(self) + 1]\n end", "def advance_step\n @step += 1\n @scheduling.step\n end", "def start_phase3\n @phase = 3\n actor=@actors[@actor_actions.size]\n #>Test du forçage de lutte\n if(BattleEngine::_lutte?(actor))\n @actor_actions.push([0,nil,util_targetselection_automatic(actor, phase3_struggle_move),actor])\n update_phase2_next_act\n return\n elsif(actor.battle_effect.has_encore_effect?)\n @actor_actions.push([0,actor.skills_set.index(actor.battle_effect.encore_skill).to_i,\n util_targetselection_automatic(actor, actor.battle_effect.encore_skill),actor])\n end\n @mega_evolve_window.show if BattleEngine.can_pokemon_mega_evolve?(actor, $bag)\n\n #>Récupération de l'index d'une attaque \"valide\"\n @atk_index = 0\n if USE_ALPHA_25_UI\n @skill_choice_ui.reset(@actors[@actor_actions.size])\n @skill_choice_ui.visible = true\n @message_window.visible = false\n else\n 4.times do |i|\n skill=actor.skills_set[i]\n @atk_index=i if skill and skill.id==actor.last_skill.to_i.abs\n end\n @skill_selector.update_text(@atk_index, @actors[@actor_actions.size])\n @skill_selector.visible = true\n end\n #@message_window.visible = false\n 0 while get_action\n\n launch_phase_event(3, true)\n end", "def advance!(opts = {})\n @session.update_meta_store!\n\n log \"advancing to the next transition\"\n\n # Bail and log when we are dry run testing of a particular state\n if opts[:dry].present? and Rails.env.development?\n log \"advance! -> dry run triggered\"\n @advanced_state = true\n return\n end\n\n mark_state_complete!\n @advanced_state = @session.state.transition_next!\n end", "def command_333\n iterate_enemy_index(@params[0]) do |enemy|\n already_dead = enemy.dead?\n if @params[1] == 0\n enemy.add_state(@params[2], enemy) # changed here\n else\n enemy.remove_state(@params[2])\n end\n enemy.perform_collapse_effect if enemy.dead? && !already_dead\n end\n end", "def quest_status_changed\n $game_party.quests.add_to_sort_array(:change, @id) \n $game_system.last_quest_id = @id if QuestData::OPEN_TO_LAST_CHANGED_QUEST\n end", "def start_phase4\n @a_remaining_pk.visible = false\n @e_remaining_pk.visible = false if $game_temp.trainer_battle\n @phase = 4\n $game_temp.battle_turn += 1\n for index in 0...$data_troops[@troop_id].pages.size\n page = $data_troops[@troop_id].pages[index]\n if page.span == 1\n $game_temp.battle_event_flags[index] = false\n end\n end\n @enemy_actions.clear\n @actor_actions.clear\n #Test IA\n @seed = @magneto.get_action\n @actor_actions += @magneto.get_action\n @enemy_actions += @magneto.get_action\n pc \"New seed : #{@seed}\"\n srand(@seed)\n #>Sécurité\n BattleEngine::set_actors(@actors)\n BattleEngine::set_enemies(@enemies)\n @actions = BattleEngine::_make_action_order(@actor_actions, @enemy_actions, @actors, @enemies)\n @phase4_step = 0\n launch_phase_event(4,true)\n end", "def get_stage(point_winner, point_loser)\n if point_loser.stage == \"Points\"\n point_winner.stage = \"Game\"\n elsif point_loser.stage == \"Deuce\"\n point_loser.stage = \"Points\"\n point_winner.stage = \"Advantage\"\n else\n point_winner.stage = \"Deuce\"\n point_loser.stage = \"Deuce\"\n end\n end", "def activate\r\n @quest = @kingdom.quests.find(params[:id])\r\n \r\n if @kingdom.quests.where(quest_status: '1').size > 16\r\n flash[:notice] = 'A kingdom can have only 16 active quests at a time.'\r\n elsif @quest.reqs.size == 0\r\n flash[:notice] = \"Quest must have at least one requirement in order to be activated\"\r\n else\r\n @quest.quest_status = SpecialCode.get_code('quest_status','active')\r\n quest_status_change_update\r\n end\r\n redirect_to :action => 'index', :page => params[:page]\r\n end", "def quest(id) \n\tsys('quest')\n\t$progress.add_quest(id) \n\tpop_quest(id)\n\t$scene.hud.quest_sparkle(\"misc/profile\")\nend", "def here\n if @zone_cur == 0\n narrate(\"you are currently at the #{self.name} entrance\")\n elsif @zone_cur == 10\n narrate(\"you are currently at the #{self.name} exit!\")\n else\n narrate(\"you are currently in the #{self.name}\")\n end\n actions\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def contest_complete\n contest = pet_contests.where(workflow_state: 'in_arena').last\n apply_experience!(contest)\n end", "def start_play(actor, stage)\n @parent = actor\n @stage = stage\n self.screen_x = @parent.x\n self.screen_y = @parent.y\n\n @game_info = stage.create_actor :game_info, x: self.screen_x + self.width + 40, y: self.screen_y + 240, score: 0, current_level: 1\n\n next_tetromino\n new_piece\n end", "def process_enchant_scene\n Sound.play_ok\n $game_temp.item_selected = @item.id\n SceneManager.call(Scene_Enchant)\n end", "def place_goal(loc)\n place_object(3, loc)\n end", "def ai_action()\n # sleep 3\n player = get_player(self.current_player)\n action_info = ai_one_logic(player)\n if player.ai == \"2\"\n action_info = ai_two_logic(player)\n end\n action(action_info[0], action_info[1], player.id) # this progresses current player and may progress round\n self.save\n end", "def phase_1(player)\r\n puts \" ----------------------- \"\r\n puts \" -- SANTE / ARME -- \"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n player.show_state\r\n puts \"\"\r\nend", "def tsbs_action_pre(targets, item, subj)\n # Show preparation sequence ~\n if !item.prepare_key.empty?\n subj.target = targets[0] if targets.size == 1\n subj.battle_phase = :prepare\n wait_for_sequence\n end \n end", "def tsbs_action_post(targets, item, subj)\n # Determine if item has no return sequence\n subj.break_action = false if subj.break_action\n unless item.no_return? || subj.battle_phase == :forced\n subj.battle_phase = :return \n else\n subj.battle_phase = :idle\n end\n wait_for_sequence\n end", "def show\n @quest = Quest.find(params[:id])\n quest_objectives = @quest.locations\n completed_objectives = []\n quest_objectives.each do |obj|\n if @current_user.locations.exists?(obj)\n completed_objectives << obj\n end\n end\n if completed_objectives.length == quest_objectives.length\n unless @quest.winner_id\n @quest.update(winner_id: @current_user.id)\n end\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n end\n\n if(@quest.owner_id == @current_user.id)\n redirect_to edit_quest_path(@quest)\n elsif @quest.start_date > DateTime.current\n flash[:warning] = \"Quest has not yet begun!\"\n redirect_to user_path(@current_user) and return\n elsif @quest.end_date < DateTime.current\n flash[:warning] = \"Quest has ended. Womp womp\"\n\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n elsif @quest.users.exists?(@current_user.id)\n gon.track = true\n locations = @quest.locations\n gon.remaining_locations = []\n gon.completed_locations = []\n locations.each do |loc|\n if loc.users.exists?(@current_user.id)\n gon.completed_locations << loc\n else\n gon.remaining_locations << loc\n end\n end\n @remaining_locations = gon.remaining_locations\n @completed_locations = gon.completed_locations\n else\n gon.track = false\n flash[:danger] = \"You are not a member of this quest! Please contact the quest owner for an invite.\"\n redirect_to quests_path and return\n end\n end", "def play()\n current_scene = @scene_map.opening_scene()\n last_scene = @scene_map.next_scene('finished')\n=begin Why do we need to define the last scene when each scenario says return?\nBecause what follows is a check. While you're alive, play, when you die and or move to a new room\n=end\n\n while current_scene != last_scene\n #While this current scenario isn't having died somehow\n next_scene_name = current_scene.enter()\n #Run the room you're in\n current_scene = @scene_map.next_scene(next_scene_name)\n #While each scenario says what scene it returns, it still needs to configure before we can go there? \n end\n\n # be sure to print out the last scene\n current_scene.enter()\n end", "def update_phase3_actor_select\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End actor selection\r\n end_actor_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.target_index = @actor_arrow.index\r\n # End actor selection\r\n end_actor_select\r\n # If skill window is showing\r\n if @skill_window != nil\r\n # End skill selection\r\n end_skill_select\r\n end\r\n # If item window is showing\r\n if @item_window != nil\r\n # End item selection\r\n end_item_select\r\n end\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def update_exp_gain()\n if !@complete\n total_remaining = 0\n \n for i in 0 .. $game_party.members.size-1\n actor = $game_party.members[i]\n actor_exp = @actor_remaining_exp[i]\n \n if actor.dead? && !VICTORY_CONFIG::EXP_ON_DEATH\n actor_exp.remaining_exp = 0\n end\n \n total_remaining += actor_exp.remaining_exp\n \n if actor_exp.remaining_exp > 0\n last_level = actor.level\n last_skills = actor.skills\n \n if !@skipped\n \n if actor_exp.remaining_exp > actor_exp.tick_exp\n \n if actor_exp.tick_exp > actor.needed_exp && actor.needed_exp > 0\n \n exp_to_gain = actor.needed_exp\n \n else\n \n exp_to_gain = actor_exp.tick_exp\n \n end\n \n else\n \n exp_to_gain = actor_exp.remaining_exp\n \n end\n \n actor.gain_exp(exp_to_gain, false)\n actor_exp.remaining_exp -= exp_to_gain\n else\n actor.gain_exp(actor_exp.remaining_exp, false)\n actor_exp.remaining_exp = 0\n end\n \n @victory_char_info_windows[i].window_update(actor)\n \n if actor.level > last_level\n actor_exp.tick_exp = determine_tick(actor.next_exp, actor_exp.remaining_exp)\n \n @victory_level_up_windows[i].visible = true\n Sound.play_level_up_se\n wait(30)\n @victory_level_up_windows[i].visible = false\n end\n new_skills = actor.skills - last_skills\n for skill in new_skills\n @victory_new_skill_windows[i].window_update(skill)\n @victory_new_skill_windows[i].visible = true\n Sound.play_new_skill_se\n wait(30)\n @victory_new_skill_windows[i].visible = false\n end\n end\n end\n \n if total_remaining == 0\n @complete = true\n end\n end\n end", "def advance_stage\n puts 'Inside advance stage in dashboard controller'\n patient_id = params[:patient]\n patient = Patient.find(patient_id)\n\n if patient.nil?\n #\n else\n puts 'calling dashboardHelper function'\n DashboardHelper.advance_stage(patient)\n end\n end", "def update_skill\n if Input.trigger?(Input::B)\n $game_system.se_play($data_system.cancel_se)\n return_scene\n return\n end\n if Input.trigger?(Input::R)\n $game_system.se_play($data_system.cursor_se)\n @actor_index += 1\n @actor_index %= $game_party.actors.size\n $scene = Scene_Combo.new(@actor_index)\n return\n end\n if Input.trigger?(Input::L)\n $game_system.se_play($data_system.cursor_se)\n @actor_index += $game_party.actors.size - 1\n @actor_index %= $game_party.actors.size\n $scene = Scene_Combo.new(@actor_index)\n return\n end\n end", "def continue\n\n inventory_with_leisure = expected_inventory.dup\n inventory_with_leisure[:leisure] = 1\n\n inventory_with_fishing = expected_inventory.dup\n # TODO: DRY up this logic with Person#catch_fish\n inventory_with_fishing[:fish] += @skills[:fish]\n\n #p '@'*88\n #p inventory_with_fishing\n #p rank_potential_inventory(inventory_with_fishing)\n #p '@'*88\n #p inventory_with_leisure\n #p rank_potential_inventory(inventory_with_leisure)\n #p '@'*88\n if rank_potential_inventory(inventory_with_fishing) < rank_potential_inventory(inventory_with_leisure)\n catch_fish\n @last_activity = :catch_fish\n else\n @last_activity = :leisure\n end\n\n\n eat # or starve\n end", "def call_quest_journal(quest_id = nil)\n return if $game_party.in_battle\n $game_system.last_quest_id = quest_id if quest_id\n SceneManager.call(Scene_Quest)\n Fiber.yield\n end", "def decisions_that_will_move_to_next_stage=(value)\n @decisions_that_will_move_to_next_stage = value\n end", "def tour (starting, following)\n action(action_choice(starting.name), starting)\n if is_over? != true\n action(action_choice(following.name), following)\n end\nend", "def getStageLocation(quest,stage)\n loc = (\"Location\" + \"#{stage}\").to_sym\n return \"#{QuestModule.const_get(quest)[loc]}\"\n end", "def process_ok\n $game_party.menu_actor = $game_party.member_at_position(index)\n super\n end", "def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end", "def deal_community_cards\n if @stage_of_play == 1\n puts 'The flop is now being being dealt.'\n sleep(1)\n deal_flop\n elsif @stage_of_play == 2\n puts 'The turn is now being being dealt.'\n sleep(1)\n deal_post_flop\n elsif @stage_of_play == 3\n puts 'The river is now being dealt.'\n sleep(1)\n deal_post_flop\n end\nend", "def setup_add_state\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n c = @acts[2] || 100\n c = c/100.0 if c.integer?\n if area_flag\n target_array.each do |t|\n cx = c # Chance extra\n if !@acts[3]\n cx *= target.state_rate(@acts[1]) if opposite?(self)\n cx *= target.luk_effect_rate(self) if opposite?(self)\n end\n if chance(cx)\n t.add_state(@acts[1]) \n get_scene.tsbs_redraw_status(t)\n end\n end\n return\n end\n return unless target\n if !@acts[3]\n c *= target.state_rate(@acts[1]) if opposite?(self)\n c *= target.luk_effect_rate(self) if opposite?(self)\n end\n if chance(c)\n target.add_state(@acts[1]) \n get_scene.tsbs_redraw_status(target)\n end\n end", "def hit!\n\t\t@cards << @deck.take!\n\tend", "def tsbs_action_main(targets, item, subj)\n # Determine if item is not AoE ~\n if !item.area?\n subj.area_flag = false\n # Repeat item sequence for target number times\n targets.each do |target|\n # Change target if the target is currently dead\n if target.dead? && !item.for_dead_friend? \n target = subj.opponents_unit.random_target\n break if target.nil?\n # Break if there is no target avalaible or force break action\n end\n target = @cover_battlers[target] if @cover_battlers[target]\n # Do sequence\n subj.target = target\n subj.battle_phase = :skill\n wait_for_skill_sequence\n break if [:forced, :idle].include?(subj.battle_phase) || \n subj.break_action\n end\n # If item is area of effect damage. Do sequence skill only once\n else\n subj.area_flag = true\n subj.battle_phase = :skill\n wait_for_skill_sequence\n subj.area_flag = false\n end\n end", "def select_stage\n if !params[:stage][:id].empty?\n session[:stage_id] = params[:stage][:id].to_i\n redirect_to :back, :notice => \"You can now add assets to #{Stage.find(session[:stage_id]).title}\"\n else\n redirect_to :back, :notice => \"No stage was selected\"\n end\n end", "def award; end", "def audit\n while cursor = @queue.shift\n step(Stupidedi::Builder::StateMachine.new(@config, [cursor]))\n end\n end", "def update_phase3_actor_select\n # Update actor arrow\n @actor_arrow.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End actor selection\n end_actor_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.target_index = @actor_arrow.index\n # End actor selection\n end_actor_select\n # If skill window is showing\n if @skill_window != nil\n # End skill selection\n end_skill_select\n end\n # If item window is showing\n if @item_window != nil\n # End item selection\n end_item_select\n end\n # Go to command input for next actor\n phase3_next_actor\n end\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def gameflow\n \n end", "def start_player_quest_line(player_id)\n quest_ids = without_locking do\n Quest.select(\"`id`\").where(parent_id: nil)\n end.c_select_values\n quest_progresses = quest_ids.map do |quest_id|\n QuestProgress.new(player_id: player_id, quest_id: quest_id)\n end\n BulkSql::QuestProgress.save(quest_progresses)\n\n objective_ids = without_locking do\n Objective.select(\"`id`\").where(quest_id: quest_ids)\n end.c_select_values\n objective_progresses = objective_ids.map do |objective_id|\n ObjectiveProgress.new(player_id: player_id, objective_id: objective_id)\n end\n BulkSql::ObjectiveProgress.save(objective_progresses)\n end", "def next_item\n if (player.location.inventory.length > @index)\n @item = player.location.inventory[@index]\n game.messages << \"Do you want to pick up #{@item}? Y/N\"\n else\n game.change_state(Map.new)\n end\n end", "def nav(vector) # called in :turn > active_piece.nav()\n # check vector*1\n # is on board?\n # if vacant, move\n # else check vector*2 (jump) --> jump if vacant\n # remove jumped piece from board \n # add jumped piece to captured array?\n # move again or set jump? true\n # check for :crown --> make king?\nend", "def perform\n\tgame_menu\n\tgameplay\nend", "def phase2_command_fight\r\n # Start actor command phase\r\n start_phase3\r\n end", "def update_phase3_item_select\n # Make item window visible\n @item_window.visible = true\n # Update item window\n @item_window.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End item selection\n end_item_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the item window\n @item = @item_window.item\n # If it can't be used\n unless $game_party.item_can_use?(@item.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.item_id = @item.id\n # Make item window invisible\n @item_window.visible = false\n # If effect scope is single enemy\n if @item.scope == 1\n # Start enemy selection\n start_enemy_select\n # If effect scope is single ally\n elsif @item.scope == 3 or @item.scope == 5\n # Start actor selection\n start_actor_select\n # If effect scope is not single\n else\n # End item selection\n end_item_select\n # Go to command input for next actor\n phase3_next_actor\n end\n return\n end\n end", "def skill_choice\n if @visual.show_skill_choice(@player_actions.size)\n # The player choosed a move\n @next_update = :target_choice\n else\n # The player canceled\n @next_update = :player_action_choice\n end\n ensure\n @skip_frame = true\n end", "def update_completion(completed, date = nil)\n if completed? && !completed\n stage.destroy\n reload\n elsif !completed? && completed\n add_stage(date)\n end\n end", "def complete_quests(options={})\n options.reverse_merge!(:count => 1)\n\n @objectives.push([\n Objective::CompleteQuests,\n {:key => Objective::CompleteQuests::KEY, :count => options[:count]}\n ])\n end", "def hit\n @cards.push @deck.shift\n end", "def update_call_quest_journal\n if $game_map.interpreter.running?\n @quest_journal_calling = false\n else\n if Input.trigger?(QuestData::MAP_BUTTON)\n $game_system.quest_access_disabled || $game_party.quests.list.empty? ?\n Sound.play_buzzer : @quest_journal_calling = true\n end\n call_quest_journal if @quest_journal_calling && !$game_player.moving?\n end\n end", "def update_phase3_skill_select\n # Make skill window visible\n @skill_window.visible = true\n # Update skill window\n @skill_window.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End skill selection\n end_skill_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the skill window\n @skill = @skill_window.skill\n # If it can't be used\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.skill_id = @skill.id\n # Make skill window invisible\n @skill_window.visible = false\n # If effect scope is single enemy\n if @skill.scope == 1\n # Start enemy selection\n start_enemy_select\n # If effect scope is single ally\n elsif @skill.scope == 3 or @skill.scope == 5\n # Start actor selection\n start_actor_select\n # If effect scope is not single\n else\n # End skill selection\n end_skill_select\n # Go to command input for next actor\n phase3_next_actor\n end\n return\n end\n end", "def update_phase3_item_select\r\n # Make item window visible\r\n @item_window.visible = true\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End item selection\r\n end_item_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the item window\r\n @item = @item_window.item\r\n # If it can't be used\r\n unless $game_party.item_can_use?(@item.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.item_id = @item.id\r\n # Make item window invisible\r\n @item_window.visible = false\r\n @item_window.active = false\r\n # If effect scope is single enemy\r\n if @item.scope == 1\r\n # Start enemy selection\r\n start_enemy_select\r\n # If effect scope is single ally\r\n elsif @item.scope == 3 or @item.scope == 5\r\n # Start actor selection\r\n start_actor_select\r\n # If effect scope is not single\r\n else\r\n # End item selection\r\n end_item_select\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n return\r\n end\r\n end", "def update_phase3_enemy_select\n pkmn = @actors[@actor_actions.size]\n skill = pkmn.skills_set[@atk_index]\n if skill.id == 174 and !pkmn.type_ghost? #> Malédiction\n return [pkmn]\n end\n #>Choix automatique en 1v1\n if $game_temp.vs_type == 1 or (@enemy_party.pokemon_alive==1 and $pokemon_party.pokemon_alive==1) or skill.is_no_choice_skill?\n return util_targetselection_automatic(pkmn, skill)\n #>Choix 2v2\n elsif $game_temp.vs_type == 2\n data = update_phase3_pokemon_select_2v2(pkmn, skill)\n return -1 if data == -1\n if data < 2\n return [@enemies[data]]\n end\n return [@actors[data-2]]\n else\n return -1\n end\n\n end", "def move\n @glade['add_point'].sensitive = false\n @locate_thread = @planning.locate(@start, @finish) {move_finished}\n end", "def change_lead_stage\n lead = @current_organization.deals.find(params[:id])\n #lead.update_attributes(deal_status_id: params[:stage_id])\n #Activity.create(:organization_id => @current_organization.id, :activity_user_id => self.user.id,:activity_type=> \"DealMove\", :activity_id => self.id, :activity_status => \"Move\",:activity_desc=>self.deal.title,:activity_date => self.updated_at, :is_public => (self.deal.is_public.nil? || self.deal.is_public.blank?) ? false : self.deal.is_public, :source_id => self.deal.id)\n \n dm = DealMove.create(:organization => @current_organization, :deal_id => lead.id, :deal_status_id => params[:stage_id], :user => @current_user)\n lead.deal_status_id = params[:stage_id]\n lead.move_deal = true\n lead.save\n render text: \"#{lead.deal_status.name}\"\n end", "def reveal_objective(*obj)\n valid_obj = obj.select {|x| x < objectives.size && !@revealed_objectives.include?(x) }\n valid_obj.each {|i| @revealed_objectives.maqj_insert_sort(i) }\n quest_status_changed unless valid_obj.empty?\n end", "def command_354\n $game_temp.next_scene = \"title\"\n return false\n end", "def phase_3(player, bots)\r\n puts \" ----------------------- \"\r\n puts \" -- TOUR ENNEMI -- \"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n i = 0\r\n bots.each do |bot|\r\n if i > 0 && bot.life_points > 0\r\n bot.attacks(player)\r\n end\r\n i += 1\r\n end\r\nend", "def update_phase3_skill_select\r\n # Make skill window visible\r\n @skill_window.visible = true\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End skill selection\r\n end_skill_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the skill window\r\n @skill = @skill_window.skill\r\n # If it can't be used\r\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.skill_id = @skill.id\r\n # Make skill window invisible\r\n @skill_window.visible = false\r\n @skill_window.active = false\r\n # If effect scope is single enemy\r\n if @skill.scope == 1\r\n # Start enemy selection\r\n start_enemy_select\r\n # If effect scope is single ally\r\n elsif @skill.scope == 3 or @skill.scope == 5\r\n # Start actor selection\r\n start_actor_select\r\n # If effect scope is not single\r\n else\r\n # End skill selection\r\n end_skill_select\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n return\r\n end\r\n end", "def award_vps(player, amount)\n unless amount <= 0\n @vps -= amount\n @finishing ||= @vps <= 0\n player.add_vps(amount)\n end\n end", "def advance_player!(player)\n<<<<<<< HEAD\n # lanzo el dado\n if not_advance_more_than_lenght?(player)\n @race_progress[player] += @die.roll\n if somebody_is_winner?(player)\n @finished = true \n end\n end\n end", "def current_stage\n current = if self.published?\n if self.future?\n # Todavía no ha llegado la fecha de la presentación\n self.stages.first\n elsif self.finished?\n self.stages.last\n else\n\n this=self.stages.detect {|s| s.starts_on <= Date.today && s.ends_on >= Date.today}\n if this.nil?\n this = self.stages.detect {|s| s.starts_on <= Date.today || s.ends_on >= Date.today}\n end\n this\n end\n else\n self.stages.first\n end\n current\n end", "def print_current_action\n p phase_sequence[battle_phase].call\n end", "def getStageDescription(quest,stage)\n stg = (\"Stage\" + \"#{stage}\").to_sym\n return \"#{QuestModule.const_get(quest)[stg]}\"\n end" ]
[ "0.57296294", "0.57182324", "0.571017", "0.56700176", "0.5653914", "0.56302047", "0.5585278", "0.5565238", "0.5515287", "0.55095565", "0.54952955", "0.53983873", "0.53963214", "0.53963214", "0.53699756", "0.5367081", "0.53667486", "0.5360327", "0.5336824", "0.53367835", "0.5315255", "0.5312591", "0.5308079", "0.5304004", "0.53020024", "0.529783", "0.5285943", "0.528319", "0.52751243", "0.52578974", "0.52478653", "0.52262086", "0.5225807", "0.520385", "0.51783663", "0.51671976", "0.51538086", "0.5138745", "0.51365215", "0.51216584", "0.5113837", "0.5110356", "0.51075107", "0.5106672", "0.5103621", "0.50743985", "0.5065566", "0.50650567", "0.5057713", "0.50479835", "0.5036227", "0.5035168", "0.5031673", "0.5029518", "0.5026353", "0.5022864", "0.50130045", "0.50054735", "0.49935982", "0.49923295", "0.49902746", "0.49896958", "0.49867693", "0.4977356", "0.4974421", "0.49627683", "0.49623105", "0.49452853", "0.4944018", "0.49435425", "0.49352443", "0.49330866", "0.49285385", "0.49250767", "0.49174175", "0.49165618", "0.4916363", "0.49142578", "0.49109164", "0.4910403", "0.49072662", "0.49042445", "0.48809814", "0.4880054", "0.487107", "0.48648813", "0.48613384", "0.48584586", "0.4858343", "0.48536122", "0.4852741", "0.48516768", "0.48475215", "0.48466313", "0.48414117", "0.4830477", "0.48275843", "0.48274142", "0.4824323", "0.4818994" ]
0.71767396
0
Get symbolic names of active quests Unused
def getActiveQuests active = [] $PokemonGlobal.quests.active_quests.each do |s| active.push(s.id) end return active end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end", "def lesson_plan_item_actable_names\n []\n end", "def used_names; end", "def defined_names\n @lhs_names\n end", "def related_names_in_use\n @in_use.map { |n| /\\A#{normalised_name}_(\\d+)\\z/.match(n) }.compact\n end", "def names\n all.map { |item| item.name_sym }\n end", "def equipment_names\n equipment = self.quote.project.company.equipment\n list = equipment.collect! {|x| x.name}\n# list.join()\n end", "def names()\n names = []\n names.push \"q-\"\n return names\n end", "def completed_quests; $game_variables[17]; end", "def names\n @@enums_by_nm.keys\n end", "def names\n $LEDGER.keys\n end", "def slotnames\n @slots.keys\n end", "def hidden\n context.hidden.map(&:name)\n end", "def non_terminal_symbols\n symbols.values.select {|symbol| symbol.non_terminal}\n end", "def symbols() @symbols end", "def names()\n\t\tnames = []\n\t\tnames.push \"help\"\n\t\treturn names\n\tend", "def getQuestStages(quest)\n arr = []\n for key in QuestModule.const_get(quest).keys\n arr.push(key) if key.to_s.include?(\"Stage\")\n end\n return arr\n end", "def current_action_names\n return @actions.find_all{|a| a.start_state == @current_state}.map{|a| a.name}\n end", "def variable_names()\n @var_set.keys\n end", "def lifter_names\n gym_lifters.map(&:name)\n end", "def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end", "def names\n collect { |n, v|\n n\n }\n end", "def reserved_shortcuts\n [home_shortcut, items_shortcut, inventory_shortcut, blogs_shortcut, calendars_shortcut, categories_shortcut, items_shortcut].uniq.compact\n end", "def unused_nodes_with(char)\n # puts unused_nodes\n # puts position[unused_nodes.first].letter\n # s = unused_nodes.delete_if { |node| position[node].letter == char }\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i if position[i].die.getLetter == char\n end\n end\n s\n end", "def used_names=(_arg0); end", "def bible_list\n bible_list_sym.map{|l| t(\"bible.#{l}\")}\n end", "def as_names\n __getobj__.map { |i| i.name }\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def get_unref_symbols\n unref = []\n @modules.each do |mod|\n mod.symbols.values.each do |s|\n unless s.referenced?\n unref << s.name\n end\n end\n end\n unref\n end", "def all_names; end", "def all_names; end", "def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end", "def to_s\n name.sub(/^completed_|^admissible_/, \"\")\n end", "def available\n keys = send_command(\"available\")\n keys.collect do |k|\n if k.match /^timer/\n [\"mean\", \"min\", \"max\", \"upper_90\", \"stddev\", \"count\"].collect{|a| \"#{k}:#{a}\"}\n else\n k\n end\n end.flatten\n end", "def abbreviations\n answers_hash.keys\n end", "def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end", "def lifter_names_gym\n lifters_gym.map do |lifter|\n lifter.name\n end\n end", "def all_names\n @__names__\n end", "def get_champion_names\n Static.get_champion_list.keys\n end", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def getFailedQuests\n failed = []\n $PokemonGlobal.quests.failed_quests.each do |s|\n failed.push(s.id)\n end\n return failed\nend", "def denied_titles\n %w(Steez Onkyo Edifier Logitech Sony VicTsing Lightbeats Eupatorium WHARNCLIFFE\n Audio-Technica Senbowe SoundBot FOCUS-Lucia-Bose Sennheiser Kindle Skullcandy\n Beats Fitbit\n CoolStream Tenergy Einstein CableJive Meily ASICS JAM YCC BMR)\n end", "def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end", "def alternative_full_names\n @alternative_full_names ||= []\n end", "def misc_items\n misc_items_names = self.class::MISC_ITEMS.map { |index, item|\n self.send(index) ? item : nil\n }\n misc_items_names.delete(nil)\n misc_items_names\n end", "def symbols\n @flags.keys\n end", "def localized_names\n @localized_names ||= []\n end", "def names\n [name]\n end", "def getQuestDescription(quest)\n return \"#{QuestModule.const_get(quest)[:QuestDescription]}\"\n end", "def names\n @metrics.keys.dup.freeze\n end", "def unused\n end", "def file_name\n 'unused'\n end", "def scope_names\n keys.map { |k| k.to_s }\n end", "def symbols; end", "def names\n map(&:name)\n end", "def names\n map(&:name)\n end", "def item_names\n @registry.keys\n end", "def defined_names\n @defined_names ||= DefinedNames.new\n end", "def var_names\n @var_names ||= eval \"local_variables\", get_binding\n end", "def lifter_names\n # binding.pry\n lifters.map { |lifter| lifter.name }\n end", "def names\n fs = []\n %w( ORDER_RELAXED ORDER_ACQ_REL ORDER_SEQ_CST SCOPE_WORK_ITEM SCOPE_WORK_GROUP SCOPE_DEVICE SCOPE_ALL_DEVICES ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end", "def state_names\n @names = Set.new\n @names.merge machine.states\n @names.merge [ANY_STATE, ANY_STATE_HOOK]\n end", "def names\n map(&:names).flatten\n end", "def data_symbol_array\n [:name, :level, :objectives, :prime_objectives, :custom_categories, \n :icon_index, :description, :banner, :banner_hue, :common_event_id, \n :layout, :rewards] + QuestData::BASIC_DATA_TYPES\n end", "def list_known_names\n end", "def phase_inactive?(*symbols)\n unless ProjectMeta::HASH.keys.superset? symbols\n raise(Exception, 'Project Meta parameter fault') \n end\n\n array = ProjectMeta::HASH.select do |symbol, _|\n symbols.include? symbol\n end.values.reduce(:|) || []\n\n not array.include? ProjectMeta::CURRENT_PHASE\n end", "def undefined_names\n @undef ||= @rhs_names - @lhs_names\n @undef\n end", "def terminal_symbols\n symbols.values.select {|symbol| symbol.terminal}\n end", "def names\n [\n \"Charge de travail\" , #00\n \"Travail en groupe\" , #01\n \"Maths\" , #02\n \"Codage\" , #03\n \"Théorique\" , #04\n \"Technique\" , #05\n \"Satisfaction\" , #06\n \"Dur à valider\" , #07\n \"Fun\" , #08\n \"Pipo\" , #09\n \"Économie\" , #10\n \"fondamental\" , #11\n \"Difficile à suivre\" , #12\n \"Calcul\" , #13\n \"Professionalisant\" , #14\n \"Étendue du cours\" , #15\n \"Interactivité\" , #16\n \"Culture générale\" , #17\n ]\n end", "def std_player_names\n\t\tnames = []\n\t\tfor i in 1..Constants::MAX_PLAYERS\n\t\t\tnames << \"Player\" + i.to_s\n\t\tend\n\t\tnames\n\tend", "def get_state_names(item)\n state_table(item).keys\n end", "def not_used\n [:not_used, nil, Reader::Position.caller(2)]\n end", "def all_skills\n self.skills.map(&:name).join(\", \")\n end", "def slot_name(index)\r\n @actor ? Vocab::etype(@actor.equip_slots[index]) : \"\"\r\n end", "def names\n case name\n when \"Road\"\n [nil, \"\", 'Circuit', \"Criterium\", \"Road\", \"Time Trial\", \"Singlespeed\", \"Tour\"]\n when \"Mountain Bike\"\n ['Downhill', 'Mountain Bike']\n else\n [name]\n end\n end", "def quest_name_colour(quest = @quest)\n return if !quest\n quest = $game_party.quests[quest] if quest.is_a?(Integer)\n s = [:failed, :complete, :active].find { |status| quest.status?(status) }\n text_color(QuestData::COLOURS[s])\n end", "def all_name_strings\n names.collect { |a| a.name }\n end", "def all_skills\n self.skills.map(&:name).join(', ')\n end", "def symbols\n @symbol_set.symbols\n end", "def one_word_names(list)\n own = list.select do |c|\n c[:name].include?(\" \") == false\n end\n return own\nend", "def medicinal_uses\n self.object.medicinal_uses.map{|mu| mu.name}.join(', ')\n end", "def get_symbols\n\t\treturn @symbols\n\tend", "def getCompletedQuests\n completed = []\n $PokemonGlobal.quests.completed_quests.each do |s|\n completed.push(s.id)\n end\n return completed\nend", "def list_avail_apts\n a = self.apts_avail.map {|apt| apt.a_name }\n return \"{#{a.join(\", \")}}\"\n end", "def unassigned_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).unassigned\n end\n output\n end", "def print_unused(db)\n\tact_list = db.execute(\"SELECT * FROM activities\")\n\ttodo_list = db.execute(\"SELECT activity_id FROM todo\")\n\tputs \"\\nActivities Available (i.e. Not Being Used):\"\n\tputs '*~'*20+'*'\n\tact_list.each { |act| \n\t\texists = false\n\t\ttodo_list.each{ |todo_act| \n\t\t\texists = true if act[\"id\"] == todo_act[\"activity_id\"]\n\t\t}\n\t\tputs \"#{act['id']} - #{act['name']}\" if !exists \n\t}\nend", "def command_names\n commands.map &:name\n end", "def names\n planet_names = []\n @planets.each do |planet|\n planet_names << planet.name\n end\n return planet_names\n end", "def letter_choices(game_data)\n \"USED LETTERS: #{game_data.chosen_letters}\"\n end", "def included_tag_names\n parsed_included_tags[:missing]\n end", "def names\n @opt_types.keys.map {|e| undasherize e }\n end", "def wake_words\n\t\t[\"light\", \"lights\", \"scene\", \"seen\"]\n\tend", "def attack_use\n puts \"\"\n puts \"#{@type.name.upcase} MOVES ARE POWERFUL AGAINST:\"\n @type.super_effective.each_with_index {|other_type, index| puts \"#{index+1}. #{other_type.name}\"}\n end" ]
[ "0.617534", "0.5931871", "0.58520836", "0.58183587", "0.5790985", "0.57345754", "0.5594455", "0.55781186", "0.5558778", "0.5539813", "0.5539057", "0.55273706", "0.5502031", "0.5472204", "0.5449715", "0.54429585", "0.5400919", "0.5392848", "0.539003", "0.533629", "0.53264123", "0.53134835", "0.5290768", "0.5272161", "0.5263647", "0.52597415", "0.52256733", "0.52241886", "0.52236325", "0.52164936", "0.52164936", "0.5198562", "0.51954406", "0.51885504", "0.5186166", "0.5180971", "0.5177695", "0.5171867", "0.5164191", "0.51551044", "0.51426786", "0.51426786", "0.51426786", "0.51426786", "0.51426786", "0.51426786", "0.51426786", "0.51375663", "0.51168936", "0.5107226", "0.51067716", "0.510434", "0.50985354", "0.50974256", "0.5092343", "0.5072813", "0.50727534", "0.507061", "0.5070572", "0.50704163", "0.50647557", "0.50518286", "0.5048279", "0.50466865", "0.5042413", "0.5041691", "0.5041286", "0.5035978", "0.50309", "0.5030059", "0.50283796", "0.5023765", "0.5017507", "0.50029045", "0.5000127", "0.49935222", "0.49913213", "0.4981614", "0.4978579", "0.4961114", "0.495945", "0.49584213", "0.49520907", "0.49506682", "0.49504572", "0.49447566", "0.49437514", "0.49319753", "0.49298543", "0.49209195", "0.49189246", "0.49142098", "0.49131617", "0.49129", "0.49097797", "0.49022594", "0.49011776", "0.4891463", "0.48909432", "0.48893788" ]
0.5572735
8
Get symbolic names of completed quests Unused
def getCompletedQuests completed = [] $PokemonGlobal.quests.completed_quests.each do |s| completed.push(s.id) end return completed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end", "def completed_quests; $game_variables[17]; end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def to_s\n name.sub(/^completed_|^admissible_/, \"\")\n end", "def lesson_plan_item_actable_names\n []\n end", "def related_names_in_use\n @in_use.map { |n| /\\A#{normalised_name}_(\\d+)\\z/.match(n) }.compact\n end", "def getFailedQuests\n failed = []\n $PokemonGlobal.quests.failed_quests.each do |s|\n failed.push(s.id)\n end\n return failed\nend", "def defined_names\n @lhs_names\n end", "def used_names; end", "def getQuestDescription(quest)\n return \"#{QuestModule.const_get(quest)[:QuestDescription]}\"\n end", "def names\n all.map { |item| item.name_sym }\n end", "def names()\n names = []\n names.push \"q-\"\n return names\n end", "def getQuestStages(quest)\n arr = []\n for key in QuestModule.const_get(quest).keys\n arr.push(key) if key.to_s.include?(\"Stage\")\n end\n return arr\n end", "def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end", "def alternative_full_names\n @alternative_full_names ||= []\n end", "def names\n collect { |n, v|\n n\n }\n end", "def equipment_names\n equipment = self.quote.project.company.equipment\n list = equipment.collect! {|x| x.name}\n# list.join()\n end", "def find_completed\n completed = self.user_quests.where(complete: true)\n completed.map do |x|\n x.quest_id\n end\n end", "def names\n $LEDGER.keys\n end", "def quest_name_colour(quest = @quest)\n return if !quest\n quest = $game_party.quests[quest] if quest.is_a?(Integer)\n s = [:failed, :complete, :active].find { |status| quest.status?(status) }\n text_color(QuestData::COLOURS[s])\n end", "def complete(so_far)\n if so_far =~ / ([^ ]*)\\z/\n self.list(%r{\\A#{$2}}).map(&:name)\n else\n self.list.map(&:name)\n end\n end", "def lifter_names\n gym_lifters.map(&:name)\n end", "def all_names; end", "def all_names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names\n [\n \"Charge de travail\" , #00\n \"Travail en groupe\" , #01\n \"Maths\" , #02\n \"Codage\" , #03\n \"Théorique\" , #04\n \"Technique\" , #05\n \"Satisfaction\" , #06\n \"Dur à valider\" , #07\n \"Fun\" , #08\n \"Pipo\" , #09\n \"Économie\" , #10\n \"fondamental\" , #11\n \"Difficile à suivre\" , #12\n \"Calcul\" , #13\n \"Professionalisant\" , #14\n \"Étendue du cours\" , #15\n \"Interactivité\" , #16\n \"Culture générale\" , #17\n ]\n end", "def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\nend", "def names\n @@enums_by_nm.keys\n end", "def names()\n\t\tnames = []\n\t\tnames.push \"help\"\n\t\treturn names\n\tend", "def file_name\n 'unused'\n end", "def localized_names\n @localized_names ||= []\n end", "def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end", "def abbreviations\n answers_hash.keys\n end", "def names\n case name\n when \"Road\"\n [nil, \"\", 'Circuit', \"Criterium\", \"Road\", \"Time Trial\", \"Singlespeed\", \"Tour\"]\n when \"Mountain Bike\"\n ['Downhill', 'Mountain Bike']\n else\n [name]\n end\n end", "def slotnames\n @slots.keys\n end", "def name\n problem\n end", "def lifter_names_gym\n lifters_gym.map do |lifter|\n lifter.name\n end\n end", "def unassigned_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).unassigned\n end\n output\n end", "def bible_list\n bible_list_sym.map{|l| t(\"bible.#{l}\")}\n end", "def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end", "def used_names=(_arg0); end", "def pariculars\n\t\t[\"Concentration\", \"Concept\", \"Participation\", \"Completion of Task\"]\n\tend", "def non_terminal_symbols\n symbols.values.select {|symbol| symbol.non_terminal}\n end", "def printNotDone\n notDoneList = \"\"\n @toDoListArray.each do |e|\n if !e.status\n notDoneList = notDoneList + e.printItem + \" \"\n end\n end\n notDoneList\n end", "def undefined_names\n @undef ||= @rhs_names - @lhs_names\n @undef\n end", "def get_unref_symbols\n unref = []\n @modules.each do |mod|\n mod.symbols.values.each do |s|\n unless s.referenced?\n unref << s.name\n end\n end\n end\n unref\n end", "def gather_names(item:)\n names = []\n return names unless item.present? && item.is_a?(Hash)\n\n names << item[:domain] if item[:domain].present?\n names << item[:aliases] if item[:aliases].present?\n names << item[:acronyms] if item[:acronyms].present?\n item.fetch(:labels, []).map { |hash| names << hash[:label] }\n names.flatten.compact.uniq\n end", "def hidden\n context.hidden.map(&:name)\n end", "def donee_names_for(user)\n @donee_names = {} unless defined? @donee_names\n\n @donee_names[user.id] = collect_donee_names_for(user) if @donee_names[user.id].nil?\n\n @donee_names[user.id]\n end", "def all_names\n @__names__\n end", "def pending_keywords\n spec_keywords('pending')\n end", "def variable_names()\n @var_set.keys\n end", "def unused\n end", "def show_not_completed_items\n return @to_do_item.select { |x| x.is_done? == false }\n end", "def list_known_names\n end", "def as_names\n __getobj__.map { |i| i.name }\n end", "def credit_strings\n\t if credit_assignments.empty? \n\t [\"No credits assigned.\"]\n\t else\n\t credit_assignments.collect{|c| c.credit_string}\n\t end\n\tend", "def task_names \n\t\t\tHelpers::DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(\n\t\t\t:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number, \n\t\t\t:Tasks__Name, :Tasks__Completed, :Tasks__Priority).filter(:Lists__Name => Config[:working_list_name])\n\t\tend", "def names\n [name]\n end", "def names\n map(&:names).flatten\n end", "def print_quests(difficulty)\n self.get_recommended_quests(difficulty).each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end", "def find_selected\n selected_quests = self.user_quests.where(complete: false)\n selected_quests.map do |x|\n x.quest_id\n end\n end", "def data_symbol_array\n [:name, :level, :objectives, :prime_objectives, :custom_categories, \n :icon_index, :description, :banner, :banner_hue, :common_event_id, \n :layout, :rewards] + QuestData::BASIC_DATA_TYPES\n end", "def get_champion_names\n Static.get_champion_list.keys\n end", "def all_skills\n self.skills.map(&:name).join(\", \")\n end", "def symbols() @symbols end", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def names\n map(&:name)\n end", "def name; nutrdesc; end", "def all_skills\n self.skills.map(&:name).join(', ')\n end", "def denied_titles\n %w(Steez Onkyo Edifier Logitech Sony VicTsing Lightbeats Eupatorium WHARNCLIFFE\n Audio-Technica Senbowe SoundBot FOCUS-Lucia-Bose Sennheiser Kindle Skullcandy\n Beats Fitbit\n CoolStream Tenergy Einstein CableJive Meily ASICS JAM YCC BMR)\n end", "def names\n map(&:name)\n end", "def assignments_completed\n self.final_completed_assignments.map { |a| a.assignment }.reject { |a| a.nil? }\n end", "def all_name_strings\n names.collect { |a| a.name }\n end", "def descendent_names\n self_and_descendents.map(&:name).flatten \n end", "def defined_names\n @defined_names ||= DefinedNames.new\n end", "def alternative_full_names_without_diacritics\n @alternative_full_names_without_diacritics ||= []\n end", "def get_recommended_quests(difficulty)\n self.get_uncompleted_quests.select do |quest|\n quest.difficulty == difficulty\n end\n end", "def names\n planet_names = []\n @planets.each do |planet|\n planet_names << planet.name\n end\n return planet_names\n end", "def quest_duration\n Objective.find_by_id(self.objective_id).duration.capitalize\n end", "def lifter_names\n # binding.pry\n lifters.map { |lifter| lifter.name }\n end", "def task_names\n map do |task|\n task.name\n end\n end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def find_labels\n labels = {}\n\n govDeps = @parsed_sentence.typedDependencies.to_a\n # identify its corresponding position in govDep and fetch its label\n govDeps.each_with_index do |govDep|\n token = govDep.dep().to_s.split(\"/\").first\n labels[token] = govDep.reln.getShortName()\n end\n\n labels\n end", "def quest; end", "def included_tag_names\n parsed_included_tags[:missing]\n end", "def medicinal_uses\n self.object.medicinal_uses.map{|mu| mu.name}.join(', ')\n end", "def current_action_names\n return @actions.find_all{|a| a.start_state == @current_state}.map{|a| a.name}\n end", "def slot_name(index)\r\n @actor ? Vocab::etype(@actor.equip_slots[index]) : \"\"\r\n end", "def pbPocketNames; return [\"\",\n _INTL(\"Items\"),\n _INTL(\"Medicine\"),\n _INTL(\"Jermo Balls\"),\n _INTL(\"TMs & HMs\"),\n _INTL(\"Bewwies\"),\n _INTL(\"Mail\"),\n _INTL(\"Battle Items\"),\n _INTL(\"Key Items\")\n]; end", "def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end", "def unused_nodes_with(char)\n # puts unused_nodes\n # puts position[unused_nodes.first].letter\n # s = unused_nodes.delete_if { |node| position[node].letter == char }\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i if position[i].die.getLetter == char\n end\n end\n s\n end", "def names_not_indexed\n names.select { |n| !@index[n.index] }\n end", "def std_player_names\n\t\tnames = []\n\t\tfor i in 1..Constants::MAX_PLAYERS\n\t\t\tnames << \"Player\" + i.to_s\n\t\tend\n\t\tnames\n\tend" ]
[ "0.64709145", "0.6108061", "0.59939396", "0.5953557", "0.58078766", "0.56050587", "0.55726904", "0.5569817", "0.5561762", "0.55098194", "0.5463352", "0.5459464", "0.54468244", "0.5428521", "0.53907114", "0.53527", "0.5345816", "0.52985424", "0.5290342", "0.5251468", "0.52309716", "0.5221864", "0.52191406", "0.52191406", "0.5218307", "0.5218307", "0.5218307", "0.5218307", "0.5218307", "0.5218307", "0.5218307", "0.5216723", "0.52055794", "0.517782", "0.51735634", "0.51649445", "0.51641864", "0.5158426", "0.5127883", "0.5124993", "0.5115774", "0.5090324", "0.5090176", "0.5086261", "0.50859797", "0.5074091", "0.5046782", "0.50451005", "0.5042699", "0.5024242", "0.5022807", "0.5022419", "0.5007956", "0.4991575", "0.4979416", "0.49723342", "0.49646592", "0.49645114", "0.49545008", "0.4953963", "0.49530092", "0.49502498", "0.49498698", "0.49435207", "0.49433506", "0.49427995", "0.4921621", "0.49188158", "0.4916007", "0.49114147", "0.49060944", "0.49038294", "0.49010375", "0.48993143", "0.48928064", "0.48912725", "0.4887008", "0.48839113", "0.48807165", "0.4876176", "0.48720962", "0.48564842", "0.48489657", "0.4846729", "0.4841167", "0.48399913", "0.48397347", "0.48391777", "0.48388484", "0.4836473", "0.4832972", "0.4830585", "0.48294502", "0.48276103", "0.4826023", "0.48177555", "0.4814148", "0.48077753", "0.48061976", "0.48028973" ]
0.5570121
7
Get symbolic names of failed quests Unused
def getFailedQuests failed = [] $PokemonGlobal.quests.failed_quests.each do |s| failed.push(s.id) end return failed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failing_modules\n modules.reject {|m| %w(passed softfailed running none).include? m['result']}.map {|m| m['name'] }\n end", "def verify_unused(names,flags,switches,context) # :nodoc:\n names.each do |name|\n verify_unused_in_option(name,flags,\"flag\",context)\n verify_unused_in_option(name,switches,\"switch\",context)\n end\n end", "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end", "def incomplete_attempts\n @attempts.select { |x| x.missing_identifiers? || x.ungraded? }\n end", "def not_used\n [:not_used, nil, Reader::Position.caller(2)]\n end", "def verify_unused(names) # :nodoc:\n names.each do |name|\n verify_unused_in_option(name,flags,\"flag\")\n verify_unused_in_option(name,switches,\"switch\")\n end\n end", "def failed_attemps\n\t\tselected_letters.select {|letter| !word.include?(letter)}.size\n\tend", "def extract_uni_err(mis)\n run_cmd(\n \"samtools view -H #{@names.get('mapped_uniqsort')}\" \\\n \"> #{@names.get('mapped_uni', mis)}\"\n )\n run_cmd(\n \"samtools view -h #{@names.get('mapped_uniqsort')} \" \\\n \"| grep -E '([nN]M:i:#{mis})|(^@)' \" \\\n '| samtools view -S - ' \\\n \">> #{@names.get('mapped_uni', mis)}\"\n )\n end", "def invalid_attempts\n @attempts.select { |x| x.missing_identifiers? }\n end", "def used_names; end", "def cannot_register_for_competition_reasons\n [].tap do |reasons|\n reasons << I18n.t('registrations.errors.need_name') if name.blank?\n reasons << I18n.t('registrations.errors.need_gender') if gender.blank?\n reasons << I18n.t('registrations.errors.need_dob') if dob.blank?\n reasons << I18n.t('registrations.errors.need_country') if country_iso2.blank?\n end\n end", "def param_names\n all_errors.map(&:param_name)\n end", "def completed_quests; $game_variables[17]; end", "def failQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.failQuest(quest,color,story)\nend", "def defined_names\n @lhs_names\n end", "def name\n problem\n end", "def names_of_people_who_failed_english(results_set)\nend", "def show_wrong_letters\n puts \"These letters are not in the word: #{@wrong_letters.join(\", \")}\"\n puts \"\\n\"\n end", "def error(name)\n array name, required: false do |s|\n s.string\n end\n end", "def file_name\n 'unused'\n end", "def error_list\n res = []\n t = @data_object\n res << \"Missing team name\" if t.team_name.empty?\n\n check_length(res, t.team_name, 100, \"Team Name\")\n\n cha = Challenge.with_id(t.team_challenge)\n if cha\n msg = cha.check_ok_for_level(t.team_level)\n res << msg if msg\n else\n res << \"Unknown challenge\"\n end\n\n @members.each do |m|\n unless m.tm_name.empty?\n res.concat m.error_list\n end\n end\n\n if res.empty?\n err = check_team_level\n res << err if err\n end\n res\n end", "def names\n $LEDGER.keys\n end", "def find_fail_keys(contents)\n keys = []\n contents.map do |line|\n line.scan(/(fail|raise)\\s+([A-Z]\\w+)\\,\\s+\\:(\\w+)/).each do |m|\n keys << m[1..2].map(&:underscore).join('.')\n end\n end\n keys.uniq\n end", "def failure_reason\n return nil unless (tf = terminal_failures) && tf.size > 0\n\t\"Expected \" +\n\t (tf.size == 1 ?\n\t tf[0].expected_string :\n \"one of #{tf.map{|f| f.expected_string}.uniq*', '}\"\n\t ) +\n \" at line #{failure_line}, column #{failure_column} (byte #{failure_index+1})\" +\n \" after #{input[index...failure_index]}\"\n end", "def lesson_plan_item_actable_names\n []\n end", "def explain\n \"<Conflict wanted: #{@failed_dep}, had: #{activated.spec.full_name}>\"\n end", "def explain\n \"<Conflict wanted: #{@failed_dep}, had: #{activated.spec.full_name}>\"\n end", "def list_known_names\n end", "def undefined_names\n @undef ||= @rhs_names - @lhs_names\n @undef\n end", "def errors\n @user_guesses - normalized_letters\n end", "def quest_name_colour(quest = @quest)\n return if !quest\n quest = $game_party.quests[quest] if quest.is_a?(Integer)\n s = [:failed, :complete, :active].find { |status| quest.status?(status) }\n text_color(QuestData::COLOURS[s])\n end", "def misses()\r\n\t\treturn @bad_guesses\r\n\tend", "def non_terminal_symbols\n symbols.values.select {|symbol| symbol.non_terminal}\n end", "def failed_tasks\n each_task.select do |task|\n task.status == :failed\n end\n end", "def failed\n @failed ||= all.select { |rule| rule.status == \"FAIL\" }\n end", "def unused\n end", "def unknown_param_errors\n\t\tself.log.debug \"Fetching unknown param errors for %p.\" % [ self.unknown ]\n\t\treturn self.unknown.collect do |field|\n\t\t\t\"Unknown parameter '%s'\" % [ field.capitalize ]\n\t\tend\n\tend", "def get_unreachable_alts\n return @dfa.get_unreachable_alts\n end", "def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end", "def names\n @@enums_by_nm.keys\n end", "def used_names=(_arg0); end", "def alternative_full_names\n @alternative_full_names ||= []\n end", "def miss_reason; end", "def failure_message\n @failures.map(&:failure_message).join(\" and \")\n end", "def failed_text\n 'Failed: %d' % failed\n end", "def lifter_names\n gym_lifters.map(&:name)\n end", "def denied_titles\n %w(Steez Onkyo Edifier Logitech Sony VicTsing Lightbeats Eupatorium WHARNCLIFFE\n Audio-Technica Senbowe SoundBot FOCUS-Lucia-Bose Sennheiser Kindle Skullcandy\n Beats Fitbit\n CoolStream Tenergy Einstein CableJive Meily ASICS JAM YCC BMR)\n end", "def failed_states\n states - success_states - transitive_states\n end", "def warnings\n @warnings ||= failed.select { |rule| rule.severity == \"Warning\" }\n end", "def slotnames\n @slots.keys\n end", "def related_names_in_use\n @in_use.map { |n| /\\A#{normalised_name}_(\\d+)\\z/.match(n) }.compact\n end", "def alternatives_for_invalids\n return [4] if lines[0] == ' ' && lines[1] == '|_|' && lines[2] == ' '\n\n return [4] if lines[0] == ' ' && lines[1] == '|_ ' && lines[2] == ' |'\n\n return [4] if lines[0] == ' ' && lines[1] == '| |' && lines[2] == ' |'\n\n return [4] if lines[0] == ' ' && lines[1] == ' _|' && lines[2] == ' |'\n\n return [4] if lines[0] == ' |' && lines[1] == '|_|' && lines[2] == ' |'\n\n []\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def test_names\n line_tests.collect{|line_test| Test.find(line_test.test_id).name}.join(\", \")\n end", "def negative_failure_message\n return '' if found.nil? || found == []\n\n found_count = found.length\n found_string = found.map {|job| strategy.pretty_print_job(job) }.join(\"\\n\")\n if expected_count?\n job_count = expected_count\n job_word = expected_count == 1 ? 'job' : 'jobs'\n else\n job_count = 'any'\n job_word = 'jobs'\n end\n return [\n \"did not expect #{job_count} #{job_word} matching #{expected.to_s},\",\n \"found #{found_count}:\",\n found_string,\n ].join(' ')\n end", "def get_error_counts(execution, task)\n h = Hash[['QRDA Errors', 'Reporting Errors', 'Submission Errors', 'Warnings'].zip(get_error_counts_helper(execution))]\n h.except!('Submission Errors', 'Warnings') unless task.product_test.product.c3_test\n h\n end", "def error_fields\n\t\treturn self.missing | self.invalid.keys\n\tend", "def error_fields\n\t\treturn self.missing | self.invalid.keys\n\tend", "def to_sym\n failure? ? :failure : :error\n end", "def show_wrong_letters\n\t\t@wrong_letters.sort.join(\", \")\n\tend", "def prerequisite_unmet_message\n \" No tests found. The 'tests' task will be empty.\"\n end", "def getQuestStages(quest)\n arr = []\n for key in QuestModule.const_get(quest).keys\n arr.push(key) if key.to_s.include?(\"Stage\")\n end\n return arr\n end", "def create_errors(node_variables, context)\n errors = []\n # Declared but not used:\n errors += node_variables\n .select { |name, usage| usage.declared? && !usage.used? }\n .map { |var_name, usage| [\"Variable $#{var_name} is declared by #{usage.declared_by.name} but not used\", usage.declared_by] }\n\n # Used but not declared:\n errors += node_variables\n .select { |name, usage| usage.used? && !usage.declared? }\n .map { |var_name, usage| [\"Variable $#{var_name} is used by #{usage.used_by.name} but not declared\", usage.ast_node] }\n\n errors.each do |error_args|\n context.errors << message(*error_args)\n end\n end", "def get_incorrect\n @mismatches = @solution.crossword.get_mismatches(params[:letters])\n if @mismatches.empty?\n @solution.update_attributes(is_complete: true)\n end\n end", "def uninstallable_reasons\n reasons = []\n reasons << Reason::UNVERIFIED unless verified?\n reasons << Reason::UNSIGNED unless signed?\n reasons << Reason::TEST_ONLY if test_only?\n reasons\n end", "def to_s\n name.sub(/^completed_|^admissible_/, \"\")\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 get_unref_symbols\n unref = []\n @modules.each do |mod|\n mod.symbols.values.each do |s|\n unless s.referenced?\n unref << s.name\n end\n end\n end\n unref\n end", "def show_failure\n failed_commands = Cache.instance[\"failed_commands\"]\n failed_commands.each_with_index do |command, i|\n Ansi.write($stdout, :red, \"Failed command (#{i + 1}/#{failed_commands.size}):\", :reset, \"\\n\")\n $stdout.puts Util.command_to_s(command)\n end\n end", "def results_reason()\n r = attr_get(\"status\")\n if(r.eql?(\"passed\"))\n nil\n end\n r = attr_get(\"reason\")\n unless r\n \"No reason given\"\n end\n r.to_s\n end", "def variable_names()\n @var_set.keys\n end", "def return_suggestion_reasons\n return @return_suggestion_reasons\n end", "def bad_results\n select {|r| !r.success }\n end", "def negative_failure_message\n matchers.map(&:negative_failure_message).join(\" and \")\n end", "def error_msg\n name\n end", "def missing_param_errors\n\t\treturn self.missing.collect do |field|\n\t\t\tconstraint = self.constraints[ field.to_sym ] or\n\t\t\t\traise NameError, \"no such field %p!\" % [ field ]\n\t\t\t\"Missing value for '%s'\" % [ constraint.description ]\n\t\tend\n\tend", "def reasons_array\n self.reasons ||= {}\n ALL_REASONS.map do |num|\n Reason.new(reasons, num)\n end\n end", "def errors\n @test_results.map { |tuple| (tuple[2] - tuple[3]).abs }\n end", "def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def miss_reason=(_arg0); end", "def error_check(resolved_facts)\n status = 0\n if Options[:strict]\n missing_names = resolved_facts.select { |fact| fact.type == :nil }.map(&:user_query)\n\n if missing_names.count.positive?\n status = 1\n log_errors(missing_names)\n end\n end\n\n status\n end", "def unknown\n\t\t(@unknown_fields - @invalid_fields.keys).uniq.sort_by {|f| f.to_s}\n\tend", "def negative_failure_message\n return '' if found.nil?\n return [\n \"expected no tubes matching #{expected.to_s},\",\n \"found #{strategy.pretty_print_tube(found)}\",\n ].join(' ')\n end", "def failed_asserts\n asserts.select { |a| !a[:value] }\n end", "def failed_nodes\n select do |node|\n node.failed?\n end\n end", "def errors\n if missing.empty?\n return RipperErrors.new(@code_lines.map(&:original).join).call.errors\n end\n\n missing.map { |miss| why(miss) }\n end", "def reason\n res = \"Selected correctly:\\n\\n\"\n res << make_list(@correct_choices, @points_per_choice.round(1))\n res << \"\\n\"\n res << \"Selected incorrectly:\\n\\n\"\n res << make_list(@incorrect_choices, -@points_per_choice.round(1))\n end", "def expected_terminals\n return @entries4term.keys\n end", "def errors\n @errors ||= failed.select { |rule| rule.severity == \"Severe\" }\n end", "def names\n all.map { |item| item.name_sym }\n end", "def unanswered_check_in_questions\n action_items.where(component_type:Check::COMPONENT_TYPE, day:1..day.to_i).select{|i| !i.complete?}\n end", "def lifter_names\n # binding.pry\n lifters.map { |lifter| lifter.name }\n end", "def output_missing(missing)\n puts \"\"\n puts \"ERROR: Missing input parameters for steps:\"\n output = missing.collect {|step, miss| \" #{step} is missing #{miss}\"}\n output.each {|o| puts o}\n puts \"\"\n end", "def reason\n require 'sisimai/reason'\n table = {}\n names = Sisimai::Reason.index\n\n # These reasons are not included in the results of Sisimai::Reason.index\n names.concat(%w|Delivered Feedback Undefined Vacation|)\n\n names.each do |e|\n # Call .description() method of Sisimai::Reason::*\n r = 'Sisimai::Reason::' + e\n require r.gsub('::', '/').downcase\n table[r.to_sym] = Module.const_get(r).send(:description)\n end\n\n return table\n end", "def problems\n\t\t\treturn nil\n\t\tend", "def unknown; status[:unknown] || []; end", "def disambiguate(error)\n @enum ||= Spotify.enum_type(:error)\n\n if error.is_a? Symbol\n error = @enum[symbol = error]\n else\n symbol = @enum[error]\n end\n\n if error.nil? || symbol.nil?\n [-1, nil]\n else\n [error, symbol]\n end\n end", "def hints\n assertions = []\n\n if suitable?\n AvailableHints.keys.select {|a| send(a).present?}.each do |hint|\n Array.wrap(send(hint)).each do |assertion|\n assertions << \"#{AvailableHints[hint]} '#{assertion}'.\"\n end\n end\n end\n\n assertions.shuffle\n end", "def missing_letters\n missing = Array.new\n ('a'..'z').each {|l| missing << l if @hist[l] == 0}\n missing\n end" ]
[ "0.61377", "0.55914456", "0.55671275", "0.5499207", "0.54338914", "0.5429478", "0.54044485", "0.53673255", "0.5342061", "0.5331159", "0.53132546", "0.5295025", "0.5266962", "0.525107", "0.5232682", "0.5230677", "0.5217739", "0.52134484", "0.52079004", "0.51857936", "0.5170335", "0.5162983", "0.5131483", "0.51282287", "0.5120478", "0.51104444", "0.51104444", "0.5104554", "0.5102295", "0.50964177", "0.5084137", "0.5070511", "0.5025523", "0.5022045", "0.50053656", "0.49923977", "0.4992083", "0.4986679", "0.49641913", "0.49468076", "0.49370533", "0.49328914", "0.4926447", "0.4919596", "0.49133056", "0.4910429", "0.48911396", "0.48787105", "0.48735753", "0.48711476", "0.4860307", "0.48583674", "0.48569638", "0.48552695", "0.48535082", "0.48516884", "0.48446414", "0.48446414", "0.48426312", "0.484186", "0.48405117", "0.4832578", "0.48225734", "0.48187852", "0.48185524", "0.48154086", "0.4811562", "0.48093012", "0.4804423", "0.4802451", "0.48018122", "0.479974", "0.47968385", "0.47966248", "0.47963202", "0.4795632", "0.47948837", "0.47918344", "0.47861248", "0.47860515", "0.4778733", "0.47783557", "0.47739872", "0.47717378", "0.47710508", "0.47699124", "0.47611794", "0.47587132", "0.47555667", "0.47506598", "0.47494537", "0.47485483", "0.47411945", "0.4738221", "0.47380033", "0.4734301", "0.47331664", "0.47324806", "0.4730731", "0.47270787" ]
0.62398887
0
Get name of quest giver
def getQuestGiver(quest) return "#{QuestModule.const_get(quest)[:QuestGiver]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @gapi ? @gapi[\"name\"] : @name\n end", "def name\n @gapi[\"name\"]\n end", "def name\n @gapi[\"name\"]\n end", "def name\n @game_info['name']\n end", "def name\n @gapi.name\n end", "def name\n @gapi.name\n end", "def getQuestDescription(quest)\n return \"#{QuestModule.const_get(quest)[:QuestDescription]}\"\n end", "def name\n text_get(6, @id)\n end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def name\n return \"LA100QAQC\"\n end", "def get_name\n\t\tputs \"What tile would you like to claim? (1-9)\"\n\t\tname = gets.chomp\n\tend", "def name\n @rom.monster_name(@index)\n end", "def name\n\t\tsuper || game.name\n\tend", "def name\n return text_get(0, id)\n end", "def name\n problem\n end", "def name() return @name end", "def name() return @name end", "def name\n return 'AedgSmallToMediumOfficeRoofConstruction'\n end", "def get_player_name(name)\n return prompt(\"Player Name? [Player #{name}]\",\"Player #{name}\")\n end", "def name\n\t\t@db.hget('sgt-world:'+@id, 'name')\n\tend", "def name\n @gapi[\"friendlyName\"]\n end", "def name\n zombie_check\n @name\n end", "def get_name\n return \"#{name}\"\n end", "def get_name\n # The last sentence in a function is always returned so no need to mention return\n @name\n end", "def game_name\n fetch('sword_art_online.game_name')\n end", "def get_full_name\n \"#{get_scheduled_date} #{get_event_type}: #{rank}) #{athlete_name}, #{get_timing}\"\n end", "def get_name\r\n self.name\r\n end", "def get_name()\n @name\n end", "def get_name()\n @name\n end", "def getName()\n\t\t\treturn @_name\n\t\tend", "def missionName \n \"missionName\" \n end", "def get_name\n @name\n end", "def get_name\n @heating_name\n end", "def getName()\n return @name\n end", "def name()\n return @name\n end", "def winner_name\n comp = Competitor.find_by_id(self.winner)\n name = comp.name\n return name\n end", "def name\n @_name\n end", "def name\n @this_dogs_name\n end", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def name\n return '_untitled_' if self[:name].blank?\n self[:name]\n end", "def get_name\n return @name\n end", "def name\n @this_dog_name\n end", "def getName()\n return @name ;\n end", "def name\n return 'AedgSmallToMediumOfficeExteriorDoorConstruction'\n end", "def name\n return item_info.name + quality_txt\n end", "def name\n @this_dogs_name\n end", "def name\n return @name\n end", "def getName\n return @name\n end", "def getName\n return @name\n end", "def name\n @this_dogs_name\n end", "def getName; @name; end", "def return_name\n @name\n end", "def name; nutrdesc; end", "def name\n GCODE_DICTIONARY[cmd.to_sym] || :unknown\n end", "def name\n return @playing_girl ? @name_girl : @name_boy\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def name\n \"Player#{@ix}\"\n end", "def name\n names.first\n end", "def quest_name_colour(quest = @quest)\n return if !quest\n quest = $game_party.quests[quest] if quest.is_a?(Integer)\n s = [:failed, :complete, :active].find { |status| quest.status?(status) }\n text_color(QuestData::COLOURS[s])\n end", "def name\n @info.name\n end", "def name\n @name.to_s\n end", "def name\n @name.to_s\n end", "def name \n @this_dogs_name\n end", "def name\n response[\"name\"]\n end", "def lot_name\n lot.name\n end", "def get_name\n\t\t@name\n\tend", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def getName()\r\n\t\treturn @name\r\n\tend", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\r\n @name\r\n end", "def gym_name\n gym.try(:gym_name)\n end", "def\n get_name()\n @name\n end" ]
[ "0.6607635", "0.6561576", "0.6561576", "0.6528959", "0.65129274", "0.6440821", "0.64353913", "0.6405718", "0.6319761", "0.6312193", "0.63046086", "0.6271073", "0.6251253", "0.62409055", "0.62362516", "0.6233459", "0.6233459", "0.62158597", "0.6206141", "0.61976737", "0.6184792", "0.6182235", "0.6181647", "0.617501", "0.6160295", "0.61591613", "0.61531174", "0.61498225", "0.61498225", "0.6145574", "0.6140569", "0.6133624", "0.6125735", "0.6124979", "0.611247", "0.6109873", "0.61085814", "0.61074805", "0.6106973", "0.6106973", "0.6106973", "0.61000246", "0.60951763", "0.6093386", "0.6091617", "0.6091461", "0.60890555", "0.6086883", "0.60829574", "0.6078668", "0.6078668", "0.6067736", "0.6061228", "0.6060951", "0.6059488", "0.60525644", "0.6049435", "0.6048404", "0.6048404", "0.6048404", "0.6048404", "0.6047284", "0.6035689", "0.6034976", "0.6028116", "0.602685", "0.602685", "0.602103", "0.60194445", "0.6019339", "0.6015161", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6014533", "0.6012428", "0.60103285", "0.60103285", "0.60103285", "0.60103285", "0.60103285", "0.60103285", "0.60103285", "0.60103285", "0.6008713", "0.6004085", "0.6002851" ]
0.78256774
0
Get array of quest stages
def getQuestStages(quest) arr = [] for key in QuestModule.const_get(quest).keys arr.push(key) if key.to_s.include?("Stage") end return arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stages\n return @stages\n end", "def stages\n return @stages\n end", "def stage_names\n @stages.keys\n end", "def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\nend", "def getCompletedQuests\n completed = []\n $PokemonGlobal.quests.completed_quests.each do |s|\n completed.push(s.id)\n end\n return completed\nend", "def getMaxStagesForQuest(quest)\n quests = getQuestStages(quest)\n return quests.length\n end", "def index\n @project_stages = Project::Stage.all\n end", "def workflow\n return @@WORKFLOW.collect(&:values).flatten\n end", "def array_for_stage(jobs)\n jobs, _ = jobs.to_a.first if jobs.is_a? Hash\n\n jobs.inject([]) do |arr, job|\n arr << if job.is_a? Hash\n # Take just the job class, without any dependents\n job.keys[0]\n else\n job\n end\n end\n end", "def stages_for_creation\n environment = deploy_group.environment\n template_stages = environment.template_stages.all\n deploy_group_stages = deploy_group.stages.all\n\n preexisting_stages = []\n missing_stages = []\n Project.where(include_new_deploy_groups: true).each do |project|\n template_stage = template_stages.detect { |ts| ts.project_id == project.id }\n deploy_group_stage = deploy_group_stages.detect { |dgs| dgs.project.id == project.id }\n if deploy_group_stage\n preexisting_stages << deploy_group_stage\n elsif template_stage\n missing_stages << template_stage\n end\n end\n\n [preexisting_stages, missing_stages]\n end", "def stages_for_creation\n environment = deploy_group.environment\n template_stages = environment.template_stages.all\n deploy_group_stages = deploy_group.stages.all\n\n preexisting_stages = []\n missing_stages = []\n Project.where(include_new_deploy_groups: true).each do |project|\n template_stage = template_stages.detect { |ts| ts.project_id == project.id }\n deploy_group_stage = deploy_group_stages.detect { |dgs| dgs.project_id == project.id }\n if deploy_group_stage\n preexisting_stages << deploy_group_stage\n elsif template_stage\n missing_stages << template_stage\n end\n end\n\n [preexisting_stages, missing_stages]\n end", "def steps\n step_flows.collect(&:current_step)\n end", "def completed_quests; $game_variables[17]; end", "def get_stages exec_trace\n ret_array = []\n lines = exec_trace.split /\\n/\n current_line = 0\n # Skip past preamble\n until lines[current_line] =~ /M@/\n current_line += 1\n end\n pattern = /M@(\\w+)/\n while current_line < lines.length\n if lines[current_line].match pattern\n command = lines[current_line].sub pattern, '\\1'\n case command\n when \"assign\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var} := #{exp}\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"new\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var} := new(#{exp})\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"dispose\"\n var = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"free(#{var})\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"lookup\"\n var1 = lines[current_line += 1]\n var2 = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var1} := [#{var2}]\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"mutate\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"[#{var}] := #{exp}\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"conditional\"\n bool = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n prog = lines[current_line += 1]\n text = \"if #{bool} (taking branch: #{prog})\"\n ret_array.push Stage.new i_heap, i_store, i_heap, i_store, text\n current_line += 1\n else\n raise \"command did not match\"\n end\n else\n raise \"line #{lines[current_line]} didn't match\"\n end\n end\n ret_array\nend", "def jobs_in_stage(stage)\n array_for_stage(@stages[stage])\n end", "def phases\n Phase.where(edition_id: id)\n end", "def all_games\n return self.stages\n .map{ |stage| stage.games }\n .flatten\n .sort do |game0, game1|\n if game0.starts_at.nil?\n -1\n elsif game1.starts_at.nil?\n 1\n else\n game0.starts_at <=> game1.starts_at\n end\n end\n end", "def phases\n lifecycle.phases \n end", "def index\n @project_stages = ProjectStage.all\n end", "def betting_phases\n @betting_phases ||= [:pre_flop, :flop, :turn, :river]\n end", "def steps\n @result['tracks'].collect {|track| track.name}\n end", "def get_scene_indexes\n sn = @scenes.size - 1\n ssn = @scenes[sn][:says].size - 1\n return [sn, ssn]\n end", "def states\n []\n end", "def states\n []\n end", "def steps\n @steps ||= []\n end", "def stage\n fetch('games.street_fighter.stages')\n end", "def steps\n self.survey_questions.collect(&:step).uniq\n end", "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def pluck_stage_ids\n deploy_groups_stages.pluck(:stage_id)\n end", "def workflow\n []\n end", "def workflow\n []\n end", "def dependents_for_stage(stage_name)\n stage = array_for_stage(@stages[stage_name.to_sym])\n\n stage.inject([]) do |jobs, job|\n # Does the job have dependents?\n if job.is_a? Hash\n job, dependents = job.to_a.first\n jobs << job\n jobs << dependencies_for_job(dependents)\n else\n # Defined job is a simple class (eg Publisher)\n jobs << [job] + dependents_for(job)\n end\n end.flatten.uniq\n end", "def compared_stages\n @compared_stages ||= project.stages.ordered.each_cons(2).map do |ahead, behind|\n comparison = snapshot&.comparisons&.detect { |c| c.behind_stage_id == behind.id && c.ahead_stage_id == ahead.id }\n {\n stages: [ahead, behind],\n snapshot: comparison,\n diff: diff_commits(comparison),\n blame: diff_blame(comparison),\n score: (ComparisonService.comparison_score(comparison) if comparison)\n }\n end\n end", "def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end", "def index\n @building_stage_sub_stages = Building::Stage::SubStage.all\n end", "def states\r\n @states.collect {|id| $data_states[id] }\r\n end", "def get_stages\n\t\trender :json=>{:success=>false, :msg=>'Missing race ID'} and return if (!params.has_key?(:id))\n\t\t\n\t\trace = Race.find_by_id(params[:id])\n\t\trender :json=>{:success=>false, :msg=>'Invalid race ID'} and return if (race.nil?)\n\t\t\n\t\tdata = []\n\t\tstages = Stage.where({:race_id=>race.id, :status=>STATUS[:ACTIVE]})\n\t\tstages.each do |stage|\n\t\t\tdata.push({\n\t\t\t\t:id => stage.id,\n\t\t\t\t:name => stage.name\n\t\t\t})\n\t\tend\n\t\t\n\t\trender :json=>{:success=>true, :data=>data}\n\tend", "def scenes\n @scenes ||= []\n end", "def getFailedQuests\n failed = []\n $PokemonGlobal.quests.failed_quests.each do |s|\n failed.push(s.id)\n end\n return failed\nend", "def getStageDescription(quest,stage)\n stg = (\"Stage\" + \"#{stage}\").to_sym\n return \"#{QuestModule.const_get(quest)[stg]}\"\n end", "def index\n @floor_stages = Floor::Stage.all\n end", "def index\n @flat_stages = Flat::Stage.all\n end", "def stages=(value)\n @stages = value\n end", "def stages=(value)\n @stages = value\n end", "def new_or_last_stage(without_cycle)\n stage = if new_record?\n Array.new(without_cycle.first.game_range.max, 0)\n else\n Array.new(stages.last)\n end\n stage\n end", "def backstage\n @stage.backstage\n end", "def editions\n works.map {|work| work.editions}.flatten.map\n end", "def steps\n %w[name time]\n end", "def index\n @project_phases = ProjectPhase.all\n end", "def find_completed\n completed = self.user_quests.where(complete: true)\n completed.map do |x|\n x.quest_id\n end\n end", "def get_scenes(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n scene_starts = find_scene_starts(script)\n scene_ends = find_scene_ends(script)\n scene_starts.zip(scene_ends).map {|s, e| Bun::Script::Scene.new(script[s..e], s) }\n end", "def index\n @flat_stage_sub_stages = Flat::Stage::SubStage.all\n end", "def stage\n fetch('games.super_smash_bros.stage')\n end", "def future_steps\n if active\n Step.filter(:system => system).where{ |o| o.number >= next_step_number}.order(:number.asc)\n else\n []\n end\n end", "def scenarios\n return @scenarios\n end", "def where(options = {})\n _, _, root = @client.get(\"/stages\", options)\n\n root[:items].map{ |item| Stage.new(item[:data]) }\n end", "def stages_with_resolved_dependencies\n # Looping over all stages...\n @stages.inject({}) do |resolved_stages, (name, jobs)|\n # If it's defined with a stage dependency\n jobs, _ = jobs.to_a.first if jobs.is_a? Hash\n\n # Looping over all jobs...\n resolved_stages[name] = jobs.inject([]) do |resolved_stage, job|\n job = job.keys[0] if job.is_a? Hash\n # Normalze to new hash form\n resolved_stage << {job => @dependencies[job]}\n end\n resolved_stages\n end\n end", "def children\n steps\n end", "def step_tags(current_step,completed_steps)\n tags = {}\n for i in 1 .. Survey::STEP_COMPLETE\n tags[i] = []\n end\n\n tags[4] << \"mainNavNoBg\"\n\n last_done_step = 0\n tags[current_step].push(\"current\")\n if completed_steps > current_step\n tags[current_step].push(\"nextDone\")\n end\n if current_step > 1\n tags[current_step - 1] << (\"lastDone\")\n last_done_step = current_step - 1\n end\n\n if completed_steps > 1\n for i in 1 .. completed_steps\n if i != current_step and i != last_done_step \n tags[i] << \"done\"\n end\n end\n end\n tags.each {|k,v| tags[k] = v.join(\" \")}\n return tags\n end", "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def started_projects\n teams.flat_map(&:projects)\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def current_stage\n current = if self.published?\n if self.future?\n # Todavía no ha llegado la fecha de la presentación\n self.stages.first\n elsif self.finished?\n self.stages.last\n else\n\n this=self.stages.detect {|s| s.starts_on <= Date.today && s.ends_on >= Date.today}\n if this.nil?\n this = self.stages.detect {|s| s.starts_on <= Date.today || s.ends_on >= Date.today}\n end\n this\n end\n else\n self.stages.first\n end\n current\n end", "def index\n @transitions = @workflow_event.transition.to_a\n end", "def get_sprite_states()\n [\n [\"walking\", [\"/sprites/moogle_s_w0.png\", \"/sprites/moogle_s_w1.png\"]],\n [\"alert\", [\"/sprites/moogle_s_alert0.png\"]]\n ]\n end", "def next_stage\n stages = project.stages.to_a\n stages[stages.index(self) + 1]\n end", "def index\n @experiments = Experiment.where(pend_status: [0])\n @experiments_wait = Experiment.where(pend_status: [1])\n end", "def finished_states\n states - transitive_states\n end", "def levels\n @json[\"sleep\"].map {|sleep_json| sleep_json[\"levels\"][\"data\"]} # TODO what does it mean if there are more than one of these?\n end", "def find_selected\n selected_quests = self.user_quests.where(complete: false)\n selected_quests.map do |x|\n x.quest_id\n end\n end", "def index\n @clapme_stages = Clapme::Stage.all\n end", "def step_flows\n self.workflow.step_flows\n end", "def index\n @phase_levels = PhaseLevel.all\n end", "def timeline\n []\n end", "def current_bets\n if Game.in_progress?\n self.bets.find_all_by_game_id(Game.in_progress.id).collect{ |b| b.period }\n else\n []\n end\n end", "def parse_stages(dockerfile)\n stages = File.read(dockerfile).scan(/^FROM .*? AS (.*?)$/).flatten\n deps = [nil] + stages[0..-2]\n stages.zip(deps).map do |stage, dep|\n dep.nil? ? %{ stage :\"#{stage}\"\\n} : %{ stage :\"#{stage}\" => :\"#{dep}\"\\n}\n end.join\n end", "def states\n @finity.states.map { |name, _| name }\n end", "def get_step_plugins\n plugin_step_list = {}\n\n # get the full plugin list\n plugin_list = get_general_plugins + get_applicable_plugins\n\n plugin_list.each {|plugin|\n plugin_config = PluginManager.get_plugin_config(plugin)\n plugin_config['stages'].each {|stage|\n plugin_step_list[stage] = [] unless plugin_step_list.has_key?(stage)\n plugin_step_list[stage] << plugin }\n }\n end", "def phases\n phs = ''\n PHASES.each do |ph|\n rating = self[\"power#{ph}_rating\".to_sym]\n phs += ph unless rating.nil? || rating.to_f == 0\n end\n phs\n end", "def stage\n return @stage\n end", "def stage\n return @stage\n end", "def step_points\n points.select { |point| point.kind == \"Step\" }\n end", "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "def dirs_for_stage(stage)\n if (stage % 2) == 0\n return [[-1, -1], [1, -1], [1, 1], [-1, 1]]\n else\n return [[0, 1], [1, 0], [0, -1], [-1, 0]]\n end\n end", "def index\n @stages = Stage.all\n end", "def index\n @segments = @stage.all\n end", "def get_pipeline_stages(opts = {})\n data, status_code, headers = get_pipeline_stages_with_http_info(opts)\n return data\n end", "def advanceQuestToStage(quest,stageNum,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.advanceQuestToStage(quest,stageNum,color,story)\nend", "def index\n @scenes = @scenario.scenes\n end", "def new_episodes( season )\n return @seasons[season][1].flatten\n end", "def current_opponent_effect_descriptors\n []\n end", "def index\n @phases = Phase.all\n end", "def workflowSteps\n result = []\n @workflow[:steps].each do |step|\n result << WorkflowStep_Shim.new(step)\n end\n result\n end", "def all_by_exit_status(status)\n\ta = Array.new\n\t@chain.taskchain_array.each do |task|\n\t\ta << task if task.exit_status == status\n end\n return a\nend", "def getStage\n if (@myUnplaced[Controller::Player::WHITE] > 0) || (@myUnplaced[Controller::Player::BLACK] > 0)\n return Controller::GameState::ONE\n elsif (@myPlaced[Controller::Player::WHITE] < 4) || (@myPlaced[Controller::Player::BLACK] < 4)\n return Controller::GameState::THREE\n else\n return Controller::GameState::TWO\n end\n end", "def phase_active?(*symbols)\n unless ProjectMeta::HASH.keys.superset? symbols\n raise(Exception, 'Project Meta parameter fault') \n end\n\n array = ProjectMeta::HASH.select do |symbol, _|\n symbols.include? symbol\n end.values.reduce(:&) || []\n\n array.include? ProjectMeta::CURRENT_PHASE\n end", "def generate_dag_stages_json\n # For compatibility with the legacy DAG json.\n # Generates a JSON composed by the jsons of all four stages in the DAG pipeline.\n stages_json = {}\n @pipeline_run.pipeline_run_stages.order(:step_number).each do |prs|\n stage_info = PipelineRunStage::STAGE_INFO[prs.step_number]\n dag_json = prs.send(stage_info[:json_generation_func])\n stages_json[stage_info[:dag_name]] = JSON.parse(dag_json)\n prs.update(dag_json: dag_json)\n end\n return stages_json\n end", "def portfolio\n funding_rounds.map{|fr| fr.startup}.uniq\n #binding.pry\n end", "def states\n peek_state\n if !@state_queue.empty?\n @current_state = @state_queue.last\n @state_queue,old = [],@state_queue\n old\n else\n []\n end\n end", "def outcomes\n return @outcomes\n end" ]
[ "0.6830067", "0.6830067", "0.61889935", "0.59292173", "0.59120125", "0.5834044", "0.57828534", "0.5767325", "0.57462835", "0.5743583", "0.5738883", "0.5694336", "0.56836957", "0.5673413", "0.56726485", "0.5645226", "0.5608514", "0.55898213", "0.5585968", "0.55788153", "0.5576371", "0.55719185", "0.55487895", "0.55487895", "0.5538651", "0.55143213", "0.5512217", "0.5490264", "0.54765993", "0.54738086", "0.54738086", "0.5451363", "0.5396479", "0.5376625", "0.5359619", "0.5354692", "0.5349769", "0.53426117", "0.5335529", "0.53298134", "0.5323636", "0.5319521", "0.53080666", "0.53080666", "0.52942467", "0.52867794", "0.5280735", "0.52760553", "0.5270956", "0.5262747", "0.525509", "0.5252597", "0.5242692", "0.52361965", "0.5218552", "0.5218084", "0.5205864", "0.5205555", "0.5203543", "0.5197181", "0.51968944", "0.5189804", "0.5188733", "0.5183698", "0.51734215", "0.5169747", "0.51682955", "0.51646936", "0.51629305", "0.5157613", "0.5152142", "0.51497537", "0.5148319", "0.5140784", "0.51199955", "0.5111812", "0.51111", "0.51067865", "0.5103572", "0.5078588", "0.5078588", "0.50606656", "0.506039", "0.50488704", "0.5027511", "0.50223845", "0.50191826", "0.50130045", "0.50114596", "0.5001325", "0.49891725", "0.4988116", "0.49832404", "0.4964037", "0.4960025", "0.49586782", "0.49540573", "0.49522513", "0.49387947", "0.49386564" ]
0.80295444
0
Get overall quest description
def getQuestDescription(quest) return "#{QuestModule.const_get(quest)[:QuestDescription]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def descr\n return text_get(2, id)\n end", "def description\n text_get(7, @id)\n end", "def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n parts << \"#{number_to_currency(sa)} setup fee\" if sa && sa > 0\n \n am = amount(false)\n parts << \"#{number_to_currency(am)}/mo\"\n \n if prepaid_message_count >= UNLIMITED\n texts = \"unlimited\"\n else\n texts = \"#{prepaid_message_count}/mo prepaid\"\n end\n \n @description = parts.join(', ') + \" and #{texts} texts after that.\"\n\n return @description\n end", "def ask_for_description(question)\n\tdesc = Q.multiline(question)\n\tdesc = desc.collect{|l|l.strip}.join(\"\\n\")\n\tdesc = nil if desc.empty?\n\n\treturn desc\nend", "def description\n return $BlizzABS.util.add_skill_text(@description, @id, 2)\n end", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def description\n metapage = ::Metapage.find_by(grade_id: nil, subject_id: o.id)\n metapage.description\n end", "def best_description\n if description?\n description\n else\n additional_description\n end\n end", "def description; @text; end", "def get_description(room)\n lo = room.learning_objects.shuffle.first\n description = \"Zastúpené témy: \"\n list = Array.new\n\n list = lo.concepts.take(Room::NUMBER_OF_CONCEPTS_IN_DESCRIPTION).map(&:name)\n\n \"#{list.join(\", \")}.\"\n end", "def get_description(n)\n description = Nokogiri::HTML(super(n)).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[0]\n description = description.split(\" \")[3..-1].join(\" \") # remove \"by 'author name'\"\n description.slice!(\"[ Subscribe to the comments on this story ] \")\n description\n else\n nil\n end\n end", "def description\n @description ||= (\n ld = LessonDescription.find_by_schoolday_and_lesson(@schoolday, @lesson)\n ld && ld.description\n )\n end", "def description\n response_json = @client.api_get_request('', 'tree=description')\n response_json['description']\n end", "def div_introduction\n if ureponses.nil?\n (\n (avant_description_quiz || '') +\n description_formated +\n (apres_description_quiz || '')\n ).in_div(id: 'quiz_description')\n else\n ''\n end\n end", "def description\n return summary\n end", "def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end", "def description\n\t\t\treturn @description || self.generate_description\n\t\tend", "def description\n meta['description'] || extract_description\n end", "def get_description\n @description\n end", "def description\n description = puts \"Shelves containing food and other common supplies line the walls \"\\\n \"here. These things were probably stolen from the local village or nearby farms during \"\\\n \"raids. Although there doesn't seem to be anything of value here, you never know what a \"\\\n \"search will turn up.\"\n puts \"You can go back the way you came from.\"\n if @monster\n puts \"An evil #{@monster.monster} is here, ruffling for something to eat.\"\n else\n puts \"The squeek of a rat and pitter-patter of tiny rodent feet is all you hear.\"\n end\n end", "def description\n search_by_itemprop 'description'\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def description\n return @description\n end", "def detailed_description\n \"#{parent.detailed_description} #{description}\".strip\n end", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def get_description\n return @m_description\n end", "def get_description\n return @m_description\n end", "def description\n\t\t\t@data[\"description\"]\n\t\tend", "def description\n info[\"Description\"]\n end", "def description\n @data['description']\n end", "def draw_description\n buff = description_x*2\n paragraph = mapf_format_paragraph(@quest.description, contents_width - buff)\n y = @draw_y\n # Draw Rect\n draw_box(paragraph.scan(/\\n/).size + 1) if QuestData::DESCRIPTION_IN_BOX\n # Draw Description Label\n draw_heading(:description, y) unless QuestData::VOCAB[:description].empty?\n # Draw Description\n y += line_height if !QuestData::VOCAB[:description].empty? || QuestData::DESCRIPTION_IN_BOX\n draw_text_ex(description_x, y, paragraph)\n end", "def description\n [basic_description, extra_description].compact.join(\" \")\n end", "def description\n\n return @description\n\n end", "def description\n project.description\n end", "def description\n project.description\n end", "def description\n data_from_r['description']\n end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def get_full_description( use_HTML = true )\n d = (use_HTML && self.is_done? ? '<s>' : '') +\n self.get_verb_description() +\n (use_HTML ? '<b> ' : ' ') +\n self.get_full_name +\n (use_HTML ? '</b> ' : ' ') +\n (self.notes.blank? ? '' : self.notes) +\n (use_HTML && self.is_done? ? '</s>' : '')\n d\n end", "def description\n return $BlizzABS.util.add_item_text(@description, @id, 2)\n end", "def quest_duration\n Objective.find_by_id(self.objective_id).duration.capitalize\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def print_quests(difficulty)\n self.get_recommended_quests(difficulty).each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end", "def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end", "def description\n @data['description']\n end", "def description\n \"This task hits the corpwatch API and adds detail for the organization.\"\nend", "def description\n\t\ts = \"#{title}, a song \"\n\t\ts+= \"by #{artist.name} \" if artist\n\t\ts+= \"on Stoffi\"\n\tend", "def description\n data['description']\n end", "def long_desc\n return @name << \", \" << @desc << \", has the following inventory: \" << @inv.item_list\n end", "def desc\n return @desc\n end", "def description\n data[:description]\n end", "def description\n data[:description]\n end", "def description\n self[:description]\n end", "def formated_description_for(game)\n return \"\" if game.nil?\n formated_body(description_for(game))\n end", "def description\n return nil if info.nil?\n info[:description]\n end", "def description\n reading = @pinyin.empty? ? @pinyin_diacritic : @pinyin\n desc_str = \"%s %s [%s], %s\" % [@headword_trad, @headword_simp, reading, meaning_txt]\n end", "def description(index)\n feed.entries[index].content || feed.entries[index].summary\n end", "def description\n ensure_full_data!\n @gapi[\"description\"]\n end", "def description\n end", "def description\n end", "def full_description\n\t\t\t\"#{@name}\\n\\nYou are in #{@description}\"\n\t\tend", "def full_description\n self.study_detail.try(:full_description)\n end", "def description\n [@group.description,@description].join(' ')\n end", "def description\n text = ['A']\n text << [duration, 'minute'] if duration.present?\n text << [format, 'publication']\n text << [ 'from', pretty_date(published_on) ] if published_on.present?\n text << ['by', presentations.first.speaker_names] if presentations.present?\n text.join(' ')\n end", "def short_description\n description\n end", "def description\n description = \"\"\n if @monster\n puts \"An evil #{@monster.monster} is here.\"\n else\n puts \"The room is eerily quite.\"\n end\n end", "def description\n read_attribute(:description) || \"n/a\"\n end" ]
[ "0.7065177", "0.70596975", "0.6922498", "0.69074833", "0.68928367", "0.6856413", "0.6760685", "0.6734638", "0.67250705", "0.66907924", "0.66221803", "0.6583001", "0.6558498", "0.65495914", "0.65452635", "0.65243983", "0.6521471", "0.6512449", "0.6503124", "0.64869064", "0.64734524", "0.6468685", "0.6468685", "0.6464261", "0.64272803", "0.6424984", "0.6424984", "0.6421554", "0.6421554", "0.6421554", "0.6421554", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.64164835", "0.641601", "0.641601", "0.63960505", "0.63809896", "0.637862", "0.6378002", "0.63749397", "0.6358433", "0.6345994", "0.6345994", "0.63432676", "0.6340793", "0.6340457", "0.6340269", "0.6331055", "0.6317591", "0.6317591", "0.6316956", "0.6315422", "0.63143265", "0.63122964", "0.631133", "0.62999934", "0.6294438", "0.62898505", "0.6289027", "0.6289027", "0.6285136", "0.6281106", "0.62763184", "0.6266863", "0.6266144", "0.6262379", "0.6257082", "0.6257082", "0.625352", "0.62467885", "0.624437", "0.6236852", "0.623122", "0.6225018", "0.6224421" ]
0.8123579
0
Get current task location
def getStageLocation(quest,stage) loc = ("Location" + "#{stage}").to_sym return "#{QuestModule.const_get(quest)[loc]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_loc\r\n\t\treturn driver.location\r\n\tend", "def get_current_location\n\t \tif Rails.env.test? || Rails.env.development?\n\t \t\t[43.648209, -79.397865] # Hello HackerYou!\n\t \telse\n\t \t\trequest.location\n\t \tend\n\t end", "def getCurrentLocation\n nil\n end", "def location\n @gapi.job_reference.location\n end", "def current_location\n object.location\n end", "def getLocation\r\n\t\t\t\t\treturn @location\r\n\t\t\t\tend", "def location\n return @location\n end", "def location\n @location\n end", "def location\n @location\n end", "def location\n ActivityLocation.new(@root)\n end", "def location\n ActivityLocation.new(@root)\n end", "def get_location\n\n end", "def current_location\n @current_location ||= location_from_session unless @current_location == false\n Core::Location.current_location = @current_location unless @current_location == false\n @current_location\n end", "def location\n @location\n end", "def getTaskURL\r\n\t\t\t\t\treturn @taskUrl\r\n\t\t\t\tend", "def location\n fetch('hey_arnold.locations')\n end", "def location_code\n location_code = nil\n root_task = tasks.first.root_task if !tasks.empty?\n\n if root_task && root_task.status == Constants.TASK_STATUSES.completed\n location_code = COPY::CASE_LIST_TABLE_POST_DECISION_LABEL\n else\n active_tasks = tasks.where(status: [Constants.TASK_STATUSES.in_progress, Constants.TASK_STATUSES.assigned])\n if active_tasks == [root_task]\n location_code = COPY::CASE_LIST_TABLE_CASE_STORAGE_LABEL\n elsif !active_tasks.empty?\n most_recent_assignee = active_tasks.order(updated_at: :desc).first.assigned_to\n location_code = if most_recent_assignee.is_a?(Organization)\n most_recent_assignee.name\n else\n most_recent_assignee.css_id\n end\n end\n end\n\n location_code\n end", "def location\n fetch('doraemon.locations')\n end", "def current_location\n ip = request.remote_ip\n results = Geocoder.search(ip)\n results.first.address\n end", "def location\n fetch('rick_and_morty.locations')\n end", "def location_code\n location_code = nil\n\n if root_task && root_task.status == Constants.TASK_STATUSES.completed\n location_code = COPY::CASE_LIST_TABLE_POST_DECISION_LABEL\n else\n active_tasks = tasks.where(status: [Constants.TASK_STATUSES.in_progress, Constants.TASK_STATUSES.assigned])\n if active_tasks == [root_task]\n location_code = COPY::CASE_LIST_TABLE_CASE_STORAGE_LABEL\n elsif !active_tasks.empty?\n most_recent_assignee = active_tasks.order(updated_at: :desc).first.assigned_to\n location_code = if most_recent_assignee.is_a?(Organization)\n most_recent_assignee.name\n else\n most_recent_assignee.css_id\n end\n end\n end\n\n location_code\n end", "def current_task_name\n return nil unless enabled?\n self.class.current_task_name\n end", "def location\n @location\n end", "def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end", "def current_location\n @current_location ||= locations.order(\"created_at DESC\").first\n end", "def location\n vm.location\n end", "def location\n @client.get(\"#{path}/location\")\n end", "def path\n location.path\n end", "def location\n peer.get_location\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def current_path\n current_folder.path\n end", "def path\n @location.path\n end", "def location\n @gapi[\"location\"]\n end", "def location\n self\n end", "def location\n fetch('harry_potter.locations')\n end", "def store_current_location\n store_location_for(:member, request.url)\n end", "def full_location; end", "def location\n fetch('sword_art_online.location')\n end", "def curr_task_id\n ENV['mapred_tip_id']\n end", "def store_current_location\n store_location_for(:user, request.url)\n end", "def location\n result_hash['loc']\n end", "def store_current_location\n store_location_for(:member, request.url)\n end", "def location\n @location ||= TermuxRubyApi::SubSystems::Location.new(self)\n end", "def currentTask _args\n \"currentTask _args;\" \n end", "def location\n\t\t@location\n\tend", "def location\n Location.get(@entity['location_id'], client: @client)\n end", "def location\n ensure_full_data!\n @gapi[\"location\"]\n end", "def location\n\t\tif machine.blank?\n\t\t\t\"Location Unknown\"\n\t\telsif usage.blank?\n\t\t\t\"#{machine.name}\"\n\t\telse\n\t\t\t\"#{machine.name} (#{usage})\"\n\t\tend\n\tend", "def get_location(io, context)\n generate_location(io, context)\n end", "def location\n response[\"location\"]\n end", "def store_current_location\n store_location_for(:user, request.url) if request.get?\n end", "def location\n fetch('how_to_train_your_dragon.locations')\n end", "def location\n\t\tif @location\n\t\t\t@location\n\t\telsif File.exists?(default_location)\n\t\t\tdefault_location\n\t\telsif File.exists?(appstore_location)\n\t\t\tappstore_location\n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def report\n puts current_location\n end", "def current_workplace\n if @workplace && current_admin\n @workplace.name\n else#fail safe\n end \n end", "def location\n @location ||= Station.get(@attrs['LocationCode'])\n end", "def get_starting_point\n\t\tif starting_location_meeting.blank?\n\t\t\tstarting_location_dl\n\t\telse\n\t\t\tstarting_location_meeting\n\t\tend\n\tend", "def location\n @location_cache || self.locations[0]\n end", "def backup_location\n @location\n end", "def location\n\t\tfireeagle_user.best_guess.name\n\tend", "def current_task\n self.current_task = Task.find_by(schedule_id: current_schedule.id)\n end", "def location\n fetch('books.the_kingkiller_chronicle.locations')\n end", "def path\n location.nil? ? nil : location.path\n end", "def store_current_location\n store_location_for(:user, request.url) if request.get? \n end", "def location\r\n infoxml = get_info\r\n return infoxml.at('location').inner_text\r\n end", "def location_s\n self.location.to_s\n end", "def location\n @ole.Location\n end", "def location\n fetch('games.super_mario.locations')\n end", "def location_path location\n Admin::V2::BigtableInstanceAdminClient.location_path(\n project_id,\n location\n )\n end", "def to_s\n location\n end", "def current_location\n return @history[-1]\n end", "def location\n fetch('simpsons.locations')\n end", "def location\n self.well_info.location\n end", "def location_from_session\n self.current_location = Core::Location.find_by_location_id(session[:location_id]) if session[:location_id]\n end", "def path\n current_localization.path\n end", "def last_location\n session[:last_location] || root_url\n end", "def storage_location\n return @storage_location\n end", "def location_info(location = locations.first)\n if location\n location.full_location\n else\n []\n end\n end", "def location\n @location ||= locations.hq.first\n end", "def location_path location\n Admin::V2::BigtableInstanceAdmin::Paths.location_path project: project_id, location: location\n end", "def location\n wrap.location\n end", "def get_start_location(name=:default)\n name = name.to_sym\n return @start_locations[name]\n end", "def step_location_for(step)\n underscored_step = Spinach::Support.underscore(step)\n location = method(underscored_step).source_location if self.respond_to?(underscored_step)\n end", "def step_location_for(step)\n underscored_step = Spinach::Support.underscore(step)\n location = method(underscored_step).source_location if self.respond_to?(underscored_step)\n end", "def last_location\n if !current_user.stories.last.nil?\n current_user.stories.last.location\n else\n Location.new(latitude: 53.1235, longitude: 18.0084)\n end\n end", "def task\n return @task\n end", "def solve(location)\n if location == :current\n request.url\n else\n location\n end\n end", "def location\n @fog_wrapper.location\n end", "def get_current_path\n decompress_value(session['app.current_path']).tap do |path|\n session.delete('app.current_path') if path.blank?\n end\n end", "def get_location\n\n if (cookies[:location] != nil)\n @location = Location.from_cookie(cookies[:location])\n elsif (logged_in? == true)\n @location = current_user.location\n else\n @location = nil\n end\n\n return @location\n end", "def location\n # TODO Check this\n # return poi.location unless poi.nil?\n # return place.location unless place.nil?\n return get_location\n end" ]
[ "0.7338161", "0.71840775", "0.7132401", "0.68587494", "0.6845513", "0.67206126", "0.66920763", "0.667796", "0.667796", "0.6611901", "0.6611901", "0.6609358", "0.65347", "0.6491789", "0.64660543", "0.6439193", "0.64293504", "0.63915515", "0.63754165", "0.6331876", "0.6317313", "0.6314856", "0.63011223", "0.629183", "0.6291273", "0.6252844", "0.6246573", "0.6238293", "0.62339675", "0.6212838", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.6211453", "0.620431", "0.6192019", "0.61880517", "0.6165192", "0.6164888", "0.6164267", "0.6163369", "0.6159981", "0.6152595", "0.614682", "0.61408067", "0.613976", "0.6127924", "0.61216295", "0.61077946", "0.6104252", "0.6102543", "0.60974723", "0.6077902", "0.60624206", "0.6060937", "0.604636", "0.604536", "0.6011204", "0.60014164", "0.60010356", "0.5999408", "0.5997901", "0.596088", "0.59452343", "0.593754", "0.593547", "0.5934964", "0.5928772", "0.5921884", "0.5900232", "0.589946", "0.5893851", "0.58709866", "0.5865174", "0.5819907", "0.5817552", "0.5796315", "0.5792113", "0.57881874", "0.5785264", "0.5769024", "0.5764522", "0.57644993", "0.57504684", "0.5749432", "0.57467616", "0.5743463", "0.5743463", "0.5743451", "0.57392824", "0.572845", "0.57223177", "0.572002", "0.5718144", "0.5697798" ]
0.0
-1
Get summary of current task
def getStageDescription(quest,stage) stg = ("Stage" + "#{stage}").to_sym return "#{QuestModule.const_get(quest)[stg]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary\n @summary ||= HTML::Pipeline::TaskList::Summary.new(record.task_list_items)\n end", "def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end", "def task_status\n return '' if description.blank?\n\n sum = tasks.summary\n \"#{sum.item_count} tasks (#{sum.complete_count} completed, #{sum.incomplete_count} remaining)\"\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Autopilot.V1.TaskStatisticsContext #{context}>\"\n end", "def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end", "def to_s # Method to display completion status and description of Task\n \"#{represent_status} : #{description}\"\n end", "def summary\n # TODO\n end", "def summary(info)\n\treturn info[\"currently\"][\"summary\"]\nend", "def exp_task\n\t\texperiments.each do |e|\n\t\t\tif !e.task_desc.nil?\n\t\t\t\te.task_desc + ' '\n\t\t\tend\n\t\tend\n\tend", "def summary\n return @summary\n end", "def summary\n return @summary\n end", "def summary\n return @summary\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Autopilot.V1.TaskStatisticsContext #{context}>\"\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Autopilot.V1.TaskStatisticsInstance #{values}>\"\n end", "def summary\n end", "def summary\n end", "def summary(id)\n connection.get do |req|\n req.url \"job/#{id}/summary\"\n end\n end", "def print_task_summary(taskid, names, callers, completed, running, task_not_known, wrapper_failure, success, fails, runtime, rpcstats)\n if callers.size > 1 || names.size > 1\n out.puts\n out.puts(\"%s received more than 1 task name or caller name for this task, this should not happen\" % Util.colorize(:red, \"WARNING\"))\n out.puts(\"happen in normal operations and might indicate forged requests were made or cache corruption.\")\n out.puts\n end\n\n out.puts(\"Summary for task %s\" % [Util.colorize(:bold, taskid)])\n out.puts\n out.puts(\" Task Name: %s\" % names.join(\",\"))\n out.puts(\" Caller: %s\" % callers.join(\",\"))\n out.puts(\" Completed: %s\" % (completed > 0 ? Util.colorize(:green, completed) : Util.colorize(:yellow, completed)))\n out.puts(\" Running: %s\" % (running > 0 ? Util.colorize(:yellow, running) : Util.colorize(:green, running)))\n out.puts(\" Unknown Task: %s\" % Util.colorize(:red, task_not_known)) if task_not_known > 0\n out.puts(\" Wrapper Failure: %s\" % Util.colorize(:red, wrapper_failure)) if wrapper_failure > 0\n out.puts\n out.puts(\" Successful: %s\" % (success > 0 ? Util.colorize(:green, success) : Util.colorize(:red, success)))\n out.puts(\" Failed: %s\" % (fails > 0 ? Util.colorize(:red, fails) : fails))\n out.puts\n out.puts(\" Average Run Time: %.2fs\" % [runtime / (running + completed)])\n\n if rpcstats.noresponsefrom.empty?\n out.puts\n out.puts rpcstats.no_response_report\n end\n\n if running > 0\n out.puts\n out.puts(\"%s nodes are still running, use 'mco tasks status %s' to check on them later\" % [Util.colorize(:bold, running), taskid])\n end\n end", "def summary\n @data['summary']\n end", "def print_task()\n puts @task_name\n puts \" Assigned to: #{@assigned_to}\"\n puts \" Priority: #{@priority}\"\n print \" Start Date: #{@date_start.month}/\"\n print \"#{@date_start.day}/\"\n puts \"#{@date_start.year}\"\n print \" End Date: #{@date_end.month}/\"\n print \"#{@date_end.day}/\"\n puts \"#{@date_end.year}\"\n self.get_duration\n end", "def summary\n \n end", "def summary\n authenticated_post(\"summary\").body\n end", "def run\n\t\t\tsummary\n\t\tend", "def summary_information\n @summary_information ||= create_summary_information\n end", "def display_task(task)\n\t\t\tsplit_task(task.name).each_with_index do |name_line, line_index|\n\t\t\t\tcol_1 = pad((task.start_time if line_index==0), 5)\n\t\t\t\tcol_2 = pad(name_line, @name_width)\n\t\t\t\tcol_3 = pad((task.elapsed_time if line_index==0), @elapsed_time_width)\n\n\t\t\t\tif task.current? and TrackingConfig[:color_current_task]\n\t\t\t\t\tcurrent_task_color = TrackingConfig[:current_task_color]\n\t\t\t\t\tcurrent_task_color = TrackingConfig.defaults[:current_task_color] unless String.colors.include? current_task_color\n\n\t\t\t\t\tcol_1 = col_1.colorize current_task_color\n\t\t\t\t\tcol_2 = col_2.colorize current_task_color\n\t\t\t\t\tcol_3 = col_3.colorize current_task_color\n\t\t\t\tend\n\n\t\t\t\tputs \"| #{col_1} | #{col_2} | #{col_3} |\"\n\t\t\tend\n\t\tend", "def summarize\n success = @task.color(:green)\n success << \": \"\n success << \"[#{@output[:lint_warnings].length}]\".color(:yellow)\n success << \" [#{@output[:lint_errors].length}]\".color(:red)\n if @task == 'rubocop'\n success << \" [#{@output[:lint_conventions].length}]\".color(:cyan)\n success << \" [#{@output[:lint_refactors].length}]\".color(:white)\n success << \" [#{@output[:lint_fatals].length}]\".color(:magenta)\n end\n success << \"\\n#{'Warning'.color(:red)}: #{@output[:lint_errors].length} errors found in #{@task}\" if @output[:lint_errors].length > 0\n\n success\n end", "def show # Show tasks method\n all_tasks.map.with_index { |l, i| \"(#{i.next}): #{l}\"} # Show all tasks array in numerical order and whether a task is completed\n end", "def describe(detail=0, indent=0)\n i = ' ' * indent\n lines = [\"#{i}#{name} (#{self.class}) {\"]\n @tasks.each_value { |t|\n lines << t.describe(detail, indent + 2)\n }\n lines << i + \"}\"\n lines.join(\"\\n\")\n end", "def task\n return @task\n end", "def summary\n response = get \"summary\", {}\n Hashie::Mash.new(response)\n end", "def print_task_info(task:)\n path = task.files.first['path'].chomp(\"/tasks/#{task.files.first['name']}\")\n module_dir = if path.start_with?(Bolt::Config::Modulepath::MODULES_PATH)\n \"built-in module\"\n else\n path\n end\n @stream.puts task.to_h.merge(module_dir: module_dir).to_json\n end", "def description\n \"This task hits the corpwatch API and adds detail for the organization.\"\nend", "def summary\n {}\n end", "def name\n\t\t\t@task\n end", "def print_task(task)\n print \"==> \".info, task.bold, \"\\n\"\nend", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def get_description(task)\n desc = @last_description\n @last_description = nil\n desc\n end", "def total_tasks\n return @total_tasks\n end", "def total_tasks\n return @total_tasks\n end", "def index\n active_task\n completed_task\n end", "def task\n @keys[:task]\n end", "def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend", "def getTaskName\r\n\t\t\t\t\treturn @taskName\r\n\t\t\t\tend", "def job_summary\n summary = \"#{self.title} - \"\n\n if self.avg_bid\n summary += \"#{self.avg_bid}\"\n elsif self.budget\n summary += \"#{self.budget}\"\n elsif self.budget_range\n summary += \"#{self.budget_range.join(\" - \")}\"\n end\n summary\n end", "def show\n @completed_tasks_count = @network_event.network_event_tasks.where.not(completed_at: nil).count\n @network_event_task = NetworkEventTask.new\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsContext #{context}>\"\n end", "def summary(weather_info)\n\tweather_info[\"currently\"][\"summary\"]\nend", "def summary\n\t\tobject.summary || \"\"\n\tend", "def to_machine # To_machine method to display completion status and description of Task\n \"#{represent_status} : #{description}\"\n end", "def summary\n self.to_s\n end", "def summary(text)\n Runner.instance.summary = text\n end", "def task_status(proxmox, pve_node, task)\n status_info = proxmox_get(proxmox, \"nodes/#{pve_node}/tasks/#{task}/status\")\n \"#{status_info['status']}#{status_info['exitstatus'] ? \":#{status_info['exitstatus']}\" : ''}\"\n end", "def status_message\n (+'').tap do |ret|\n if task.progress\n ret << \"#{(task.progress * 100).to_i}%\"\n ret << ': ' if task.progress_message.present?\n end\n ret << task.progress_message if task.progress_message.present?\n end\n end", "def task_duration\n if status == :active\n formatted_duration(running_time) \n else\n formatted_duration(duration)\n end\n end", "def to_s\n '#<Twilio.Autopilot.V1.TaskStatisticsList>'\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Autopilot.V1.TaskStatisticsInstance #{values}>\"\n end", "def desc(*args)\n Rake.application.DescribeTask(*args)\n end", "def summary\n \"#{name} (#{email})\"\n end", "def description\n \"This task searches for common social media profiles\"\nend", "def description\n \"This task searches for common social media profiles\"\nend", "def description\n\t\"This task scrapes Hoovers for company info.\"\nend", "def display_tasks\n puts \"What do you want to do? \\n\"\n puts TASKS.values\n end", "def print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # datas\n @status = (params[:status] ? params[:status] : ['wait', 'develop', 'test', 'completed'])\n @collaborators = (params[:collaborators] ? params[:collaborators] : @project.collaborators.ids)\n @start_date = params[:start_date]\n @end_date = params[:end_date]\n @show_expected_time = (params[:show_expected_time] === '1')\n # find tasks\n @tasks = @project.tasks.where(status: @status, collaborator_id: @collaborators)\n unless @start_date.blank?\n @tasks = @tasks.where('start_date >= ?', @start_date.to_date)\n end\n unless @end_date.blank?\n @tasks = @tasks.where('end_date <= ?', @end_date.to_date)\n end\n # disable layout\n render layout: false\n end", "def description\n\t\t\"Msf Pro Wrapper Task\"\n\tend", "def task_help(shell, task_name)\n meth = normalize_task_name(task_name)\n task = all_tasks[meth]\n handle_no_task_error(meth) unless task\n\n shell.say \"Usage:\"\n shell.say \" #{banner(task)}\"\n shell.say\n class_options_help(shell, nil => task.options.map { |_, o| o })\n if task.long_description\n shell.say \"Description:\"\n shell.print_wrapped(task.long_description, :ident => 2)\n else\n shell.say task.description\n end\n end", "def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end", "def summary\n {\n :identity => @identity,\n :alias => @alias,\n :status => @status,\n :retries => @retries,\n :disconnects => @disconnect_stats.total,\n :failures => @failure_stats.total,\n }\n end", "def description\n return summary\n end", "def dump_summary(duration, example_count, failure_count, pending_count)\n end", "def dump_summary(duration, example_count, failure_count, pending_count)\n end", "def summary\n @transmission.summary\n end", "def summary\n summary = \"\n - Name: #{@name}\n - Color: #{@color}\n - Mass (in kg): #{@mass_kg}\n - Distance From Sun (in km): #{@distance_from_sun_km}\n - Fun Fact: #{@fun_facts}\"\n\n #returns summary as string\n return summary\n end", "def task_info_tip(task)\n values = []\n values << [ _(\"Description\"), task.description ]\n comment = task.last_comment\n if comment\n values << [ _(\"Last Comment\"), \"#{ comment.user.shout_nick }:<br/>#{ comment.body.gsub(/\\n/, '<br/>') }\" ]\n end\n\n return task_tooltip(values)\n end", "def description\n\t\t\"Msf Wrapper Task\"\n\tend", "def show\n @tasks.each do |project_name, project_tasks|\n @output.puts project_name\n project_tasks.each do |task|\n @output.printf(\" [%c] %d: %s : %s \\n\", (task.done? ? 'x' : ' '), task.id, task.description, task.deadline)\n end\n @output.puts\n end\n end", "def stats\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find datas\n @tasks = Task.where(project_id: @project.id).order('end_date ASC')\n @wait_tasks = @tasks.where(status: 'wait')\n @develop_tasks = @tasks.where(status: 'develop')\n @test_tasks = @tasks.where(status: 'test')\n @completed_tasks = @tasks.where(status: 'completed')\n @collaborators = @project.collaborators\n end", "def summary\n description_section.first\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.TaskContext #{context}>\"\n end", "def summary\n summary =\n \" - Name: #{@name}\\n\"+\n \" - Color: #{@color}\\n\"+\n \" - Mass (in kg): #{@mass_kg}kg\\n\"+\n \" - Distance From Sun (in km): #{@distance_from_sun_km} million km.\\n\"+\n \" - Fun Fact: #{@fun_fact}\"\n return summary\n end", "def status_summary(statuspage_id)\n request :method => :get,\n :url => @url + 'status/summary/' + statuspage_id\n end", "def dump\n unless @obsolete then\n puts \" WorkFlow task ##{ @id } '#{ @label }':\"\n puts \" #{ @inflows.count{ |f| !f.obsolete }} incoming flows:\"\n @inflows.each_with_index do |f,i|\n puts \" (#{ i }) #{ f.dump_info_from }\" unless f.obsolete\n end\n puts \" #{ @outflows.count{ |f| !f.obsolete }} outgoing flows:\"\n @outflows.each_with_index do |f,i| \n puts \" (#{ i }) #{ f.dump_info_to }\" unless f.obsolete\n end\n end\n end", "def summary\n ret = pending\n\n items = { UPCOMING: ret.response.items,\n CURRENT: ongoing.response.items }\n\n ret.response.items = items\n ret\n end", "def dump_info_from\n \"from task #{ source_task_id } as '#{ status_id }'#{ ' >obsolete<' if obsolete }\"\n end", "def help_task(task)\n package, name = Bee::Util::get_package_name(task)\n if not @packages[package]\n @packages[package] = Bee::Task::PackageManager.load_package(package, @build)\n end\n help = {}\n if name == '?'\n methods = @packages[package].class.public_instance_methods(false)\n for method in methods\n help[method] = @packages[package].class.method_info(method).comment\n end\n return help\n else\n error \"Task '#{name}' not found in package '#{package}'\" if\n not @packages[package].respond_to?(name)\n help[task] = @packages[package].class.method_info(name).comment\n end\n return help\n end", "def DescribeTask(*args)\n descriptionLines = []\n args.each() do |arg|\n if(arg.is_a?(String))\n descriptionLines.push(arg)\n end\n end\n @ProjectFileLoader.CurrentlyLoadedProjectFile().AddTaskDescriptions(descriptionLines)\n end", "def log_action_summary(event)\n env = event.payload\n info do\n \"[#{req_id(env)}] #{req_origin(env)} -> #{res_result(env)} \" \\\n \"(#{event.duration.round(1)}ms)\"\n end\n end", "def dump\n puts\n puts \"WorkFlow '#{ @label }' consists of the following tasks:\"\n @task_list.each{ |t| t.dump }\n puts\n end", "def description\n \"This is an example Tapir task. It associates a random host with the calling entity.\"\n end", "def task_duration\n\n if self.complete?\n sprintf(\"%4.1f\", (self.completed_on - self.created_on) / 1.day)\n else\n '0'\n end\n\n end", "def cp_summary(*filter)\n @the_nurse.completed_procs_summary(*filter).map {|name, n| \"#{name} #{n}\"}\n end", "def current_task_name\n return nil unless enabled?\n self.class.current_task_name\n end", "def inspect\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.TaskContext #{context}>\"\n end", "def fetch_summary(name, opts = {}, &block)\n fetch_metric(:summary, name, opts, &block)\n end", "def taskDescription _args\n \"taskDescription _args;\" \n end", "def tasks?\n tasks.summary.items?\n end", "def task_report\n print \"task #{@name} is #{@state}\"\n case @state\n when 'waiting' ; puts \"\"\n when 'running'\n puts \" and \"+VT100.RED(\"has not completed\")+\" because\"\n @emits.each { |event_name|\n event = @joblist.find(event_name)\n event.report_consumers(@joblist)\n }\n end\n end", "def runnable_summary_path(activity)\n if @sequence && @sequence_run\n append_white_list_params sequence_summary_with_run_path(@sequence, activity, @sequence_run.run_for_activity(activity))\n elsif @run && @run.activity == activity\n append_white_list_params summary_with_run_path(activity, @run)\n else\n raise Exception.new(\"no run or sequence run available\")\n end\n end", "def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end" ]
[ "0.7704578", "0.7395565", "0.73943114", "0.72888577", "0.72435576", "0.7167506", "0.6887434", "0.6883904", "0.682446", "0.6818422", "0.6818422", "0.6818422", "0.6805448", "0.67691916", "0.674125", "0.674125", "0.67317307", "0.67301863", "0.669316", "0.6684633", "0.66448915", "0.6634534", "0.66245884", "0.6575614", "0.65479", "0.6525223", "0.64725107", "0.6472342", "0.64673823", "0.6456078", "0.6452484", "0.6419437", "0.64074975", "0.6380346", "0.6358466", "0.63530076", "0.63530076", "0.63530076", "0.63530076", "0.6347636", "0.6345215", "0.6345215", "0.63297886", "0.6304597", "0.6302107", "0.6296561", "0.6286137", "0.62616295", "0.6258846", "0.62554085", "0.6254542", "0.62402743", "0.623476", "0.62000364", "0.6195715", "0.61932796", "0.6192133", "0.6189305", "0.61868876", "0.61854726", "0.61852247", "0.61707836", "0.61707836", "0.61524063", "0.61488134", "0.6144788", "0.61188626", "0.6117626", "0.61073244", "0.61019975", "0.6100806", "0.60963696", "0.60963696", "0.6092532", "0.6084294", "0.6083904", "0.6083804", "0.6080282", "0.60643494", "0.6055015", "0.60510546", "0.60475296", "0.60414225", "0.60258543", "0.60226643", "0.60196203", "0.6017674", "0.6014349", "0.6010204", "0.6002532", "0.5998635", "0.5989206", "0.5987516", "0.5986528", "0.5984589", "0.59837043", "0.59832036", "0.5982438", "0.5976151", "0.5962974", "0.59566903" ]
0.0
-1
Get maximum number of tasks for quest
def getMaxStagesForQuest(quest) quests = getQuestStages(quest) return quests.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_task_count\n variables.has_key?(:task_count) ? variables[:task_count] : 14\n end", "def tasks_total_count\n tasks.length\n end", "def total_tasks\n tasks.count\n end", "def task_count()\n @tasks.size\n end", "def max_queue_count()\n @max_queue_count\n end", "def max_items\n main.max_items\n end", "def suggestedNumber\r\n return self.maxLength\r\n end", "def maxjobs\n runopts(:maxjobs)\n end", "def pending_tasks_count\n @@pending_tasks.length\n end", "def total_complete\n tasks.select { |task| task.complete? }.count\n end", "def doGetMaxCountPerRequest()\n end", "def max_failed_count\n MAX_FAILED_COUNT\n end", "def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end", "def tasks_pending_count\n count do |task|\n task.pending?\n end\n end", "def tasks_pending_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_pending_count\n end\n end", "def tasks_pending_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_pending_count\n end\n end", "def remaining\n max - used\n end", "def total_tasks_count\n return @total_tasks_count\n end", "def doGetMaxCountPerRequest()\n return MAX_COUNT_PER_REQUEST\n end", "def total_task_lists_count\n task_lists.count\n end", "def get_num_of_completed_trips\n return @trips.length - 1 if !@trips.empty? && @trips.last.is_in_progress?\n return @trips.length\n end", "def max_items\n items_node[:max_items].to_i if items_node[:max_items]\n end", "def largest_length\n @executor.getLargestPoolSize\n end", "def item_max\r\n $game_troop.alive_members.size\r\n end", "def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end", "def snippet_task_limit\n ENV['LIMIT'] ? ENV['LIMIT'].to_i : DEFAULT_LIMIT\n end", "def num_waiting\n @waiting.size\n end", "def num_waiting\n @waiting.size\n end", "def item_max\r\n @list.size\r\n end", "def max_length\n @executor.getMaximumPoolSize\n end", "def nb_problems\n return @pb_list.length\n end", "def njobs\n @njobs.to_i\n end", "def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end", "def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end", "def max_tp\r\n return 100\r\n end", "def limit\n 7\n end", "def get_max_results\n @max_results\n end", "def failed_tasks_count\n return @failed_tasks_count\n end", "def quantity\n @task_worker_lock.synchronize {@task_workers.size}\n end", "def max_attendees_per_activity\n my_activity = Activity.includes(:orders).find(activity_id)\n\n if quantity.to_i + my_activity.orders.sum(:quantity) > my_activity.max_attendees\n errors.add :activity, 'does not have enough tickets available'\n end\n end", "def item_max() SES::Bestiary.get_enemy_list.size end", "def max_respawns\n @options['max_respawns'] ? @options['max_respawns'].to_i : 5\n end", "def maximum_size\n @ids.size\n end", "def get_max_system_token_count\n max = []\n get_pool_names.each do |pool_name|\n\tmax.push( self.pools[pool_name].max_counted_token[0] )\n end\n max = max.sort {|a,b| b[1] <=> a[1]}\n #puts max.inspect\n return max[0] \n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def item_max\r\n $game_party.members.size\r\n end", "def get_max_interactions\n return @snps.length-1\n end", "def item_max\n $game_party.members.size\n end", "def item_max\n $game_party.members.size\n end", "def doGetMaxObtainableTweets()\n return MAX_OBTAINABLE_TWEETS\n end", "def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end", "def max_threads\n\t\t\t@max_threads ||= 30\n\t\tend", "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 waiting_count\n @map[Constants::TaskStatus::REQUESTED]\n end", "def time_limit\n [2, problem.time_limit].min\n end", "def get_max_num\n r,t,a = 0, 0, 9**self\n while r < t.to_s.size\n r,t = r + 1, t+a\n end\n return t\n end", "def maximum_limit\n 100\n end", "def completed_task_count\n @executor.getCompletedTaskCount\n end", "def item_max() @item_max end", "def last_job_number\n @jobs.length\n end", "def total_tasks\n return @total_tasks\n end", "def total_tasks\n return @total_tasks\n end", "def item_max\n $game_party.battle_members.size\n end", "def total_number_basic_tasks\n total=0\n @sub_tasks.each { |task| total += task.total_number_basic_tasks }\n total \n end", "def max_hops; end", "def item_max\n @item_max\n end", "def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end", "def solution(a)\n return a.count(a.max)\nend", "def max_candidates\n return @max_candidates\n end", "def tasks_failed_count\n count do |task|\n task.failed?\n end\n end", "def flow_completion_count\n last = children_nodes_in_flow_order.last\n return last.flow_completion_count if last\n flow_entry_count\n end", "def num_waiting\n @resources.num_waiting\n end", "def limited_milestones_count\n @limited_milestones_count ||= milestones.limit(count_limit).count\n end", "def item_max; 64; end", "def num_questions\n return sections.includes(:questions).joins(:questions).reduce(0){ |m, s| m + s.questions.length }\n end", "def queued_max_age\n max_age = 0\n \n @collection.find(status: 'QUEUED').each do |item|\n age = Time.now - item[\"queue_time\"]\n if age > max_age\n max_age = age\n end\n end\n\n return max_age\n end", "def pending_job_count\n\n @pending_jobs.size\n end", "def num_waiting\n @queue.num_waiting\n end", "def num_waiting\n @num_waiting\n end", "def tasks_failed_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_failed_count\n end\n end", "def tasks_failed_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_failed_count\n end\n end", "def num_waiting\n end", "def num_waiting\n end", "def max_consumption\n @max_consumption ||= begin\n augment = max_repeats == Float::INFINITY ? 10 : max_repeats\n self.next&.max_consumption.to_i + augment\n end\n end", "def item_max\r\n @item_max || 0\r\n end", "def num_of_tickets()\n result = films()\n @number_of_tickets = result.count\n end", "def recent_count(project)\n # Count task messages\n task_message_count = 0\n project.tasks.each do |task|\n task_message_count += self.count(:conditions =>\n [\"task_id = ? AND updated_at > ?\", task.id, $duration_for_activity_calculation.day.ago])\n end\n return task_message_count\n end", "def max_sets_to_play\n case scoring.to_sym\n when :two_six_game_ten_point\n 3\n when :one_eight_game\n 1\n else # :three_six_game\n 3\n end\n end", "def num_waiting\n @num_waiting.value\n end", "def item_max\n @dataConsumable ? @dataConsumable.size : 1\n end", "def item_max\n return 0 unless @data\n @data.size\n end", "def ask_count\n @asks.count\n end", "def item_max\n return @data.size\n end", "def item_max\n return @data.size\n end", "def max_wait_time\n @data[\"max_wait_time\"]\n end", "def tasks_finished_count\n count do |task|\n task.finished?\n end\n end", "def num_waiting\n @waiting\n end", "def item_max\n return 1\n end", "def most_important(tasks)\n tasks.max_by{|name, priority| priority}\nend" ]
[ "0.70064133", "0.6908555", "0.675357", "0.6669237", "0.66600496", "0.6603714", "0.6390325", "0.6351163", "0.6274227", "0.62049484", "0.6155755", "0.6142336", "0.6129812", "0.6095859", "0.6093563", "0.6093563", "0.60773253", "0.6073894", "0.6063058", "0.60590833", "0.60535693", "0.6039652", "0.60389984", "0.59816533", "0.59568655", "0.59471387", "0.59330803", "0.59330803", "0.592147", "0.59177554", "0.59033453", "0.58804196", "0.5879859", "0.5879859", "0.5879384", "0.5861712", "0.5850948", "0.5829084", "0.5817825", "0.58069104", "0.58056635", "0.58017325", "0.5798019", "0.5788811", "0.57844114", "0.57844114", "0.57817376", "0.57746166", "0.5773953", "0.5773953", "0.5763577", "0.5759603", "0.5753041", "0.57483685", "0.57481754", "0.5742363", "0.5742344", "0.5740594", "0.572084", "0.57020384", "0.56964475", "0.5691459", "0.5691459", "0.5681706", "0.56745535", "0.5672372", "0.5667641", "0.5666155", "0.56655556", "0.5660382", "0.5653368", "0.5647975", "0.5640083", "0.56361264", "0.56274056", "0.56244105", "0.56241995", "0.5623953", "0.56181026", "0.56163067", "0.5608623", "0.5608623", "0.5604884", "0.5604884", "0.5598775", "0.5592896", "0.5588995", "0.55880713", "0.558383", "0.55710566", "0.55634475", "0.5563262", "0.5562827", "0.55601484", "0.55601484", "0.5558958", "0.5558198", "0.55572504", "0.5554874", "0.55396223" ]
0.6930273
1
=============================================================================== Class that contains utility methods to return quest properties =============================================================================== Utility function to check whether the player current has any quests
def hasAnyQuests? if $PokemonGlobal.quests.active_quests.length >0 || $PokemonGlobal.quests.completed_quests.length >0 || $PokemonGlobal.quests.failed_quests.length >0 return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end", "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end", "def completed_quests; $game_variables[17]; end", "def quest; end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def quest\n @quest ||= Quest.find(params[:id])\n end", "def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\nend", "def therapist_quest; end", "def show\n @quest = Quest.find(params[:id])\n quest_objectives = @quest.locations\n completed_objectives = []\n quest_objectives.each do |obj|\n if @current_user.locations.exists?(obj)\n completed_objectives << obj\n end\n end\n if completed_objectives.length == quest_objectives.length\n unless @quest.winner_id\n @quest.update(winner_id: @current_user.id)\n end\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n end\n\n if(@quest.owner_id == @current_user.id)\n redirect_to edit_quest_path(@quest)\n elsif @quest.start_date > DateTime.current\n flash[:warning] = \"Quest has not yet begun!\"\n redirect_to user_path(@current_user) and return\n elsif @quest.end_date < DateTime.current\n flash[:warning] = \"Quest has ended. Womp womp\"\n\n redirect_to \"/quests/\" + @quest.id.to_s + \"/complete\" and return\n elsif @quest.users.exists?(@current_user.id)\n gon.track = true\n locations = @quest.locations\n gon.remaining_locations = []\n gon.completed_locations = []\n locations.each do |loc|\n if loc.users.exists?(@current_user.id)\n gon.completed_locations << loc\n else\n gon.remaining_locations << loc\n end\n end\n @remaining_locations = gon.remaining_locations\n @completed_locations = gon.completed_locations\n else\n gon.track = false\n flash[:danger] = \"You are not a member of this quest! Please contact the quest owner for an invite.\"\n redirect_to quests_path and return\n end\n end", "def create\n @quest = Quest.new(params[:quest])\n @quest.creator_id=Profile.where(:users_id=>current_user.id)[0].id\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render json: @quest, status: :created, location: @quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para crear esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para crear esta quest!'\n end\n end", "def quest_revealed?(quest_id)\n $game_party.quests.revealed?(quest_id)\n end", "def getCompletedQuests\n completed = []\n $PokemonGlobal.quests.completed_quests.each do |s|\n completed.push(s.id)\n end\n return completed\nend", "def find_completed\n completed = self.user_quests.where(complete: true)\n completed.map do |x|\n x.quest_id\n end\n end", "def quest_interface\n\n#obtain the difficulty level for the given player\n difficulty = self.get_difficulty\n\n#see if the player has any quests left to complete\n if self.get_recommended_quests(difficulty).size == 0\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"You have completed all recommended quests!!!\".bold\n puts \"=====================================\".red\n puts \"=====================================\".red\n\n#show the player the available quests\n else\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"Recommended Quests for Player Attack: #{self.power}\".blue.on_light_green.bold\n puts \"\"\n self.print_quests(difficulty)\n puts \"=====================================\".red\n puts \"=====================================\".red\n puts \"Select a quest number\".bold.white.on_light_blue\n puts \"Number:\".bold.white.on_light_blue\n\n#selection prompt the player to actually choose a quest\n selection = gets.chomp\n\n#check for invalid input\n if selection.to_i > self.get_recommended_quests(difficulty).size || selection.to_i < 1\n puts \"Invalid input, please try again!\".red.bold\n\n#if input is valid, show the player that he has completed the quest\n else\n puts\"*******************************************\"\n puts \"You have completed: #{self.get_recommended_quests(difficulty)[selection.to_i-1].title}\".bold\n puts\"*******************************************\"\n puts \" \"\n puts\"#####################################\".blink\n puts \"Time For Your Reward Adventurer!!!\".bold.blue.on_light_yellow\n\n #obtain the available weapons based on player difficulty\n available_weapons = self.get_available_weapons(difficulty)\n\n #create the new characterquest instance to show that player has completed the quest\n self.quest_selection(selection, difficulty)\n\n #run the weapon_reward method to get reward for the quest\n self.weapon_reward(available_weapons)\n end\n end\n end", "def pbBoxesFull?\n return !$Trainer || ($Trainer.party.length==6 && $PokemonStorage.full?)\nend", "def get_available_weapons(difficulty)\n\n#if the difficulty of the quest is 1\n#only select weapons with attack power less than or equal to 3\n# and that the player has not yet obtained\n if difficulty == 1\n available_weapons = Weapon.all.where(\"attack_power <=3\").select do |weapon|\n weapon.characters.include?(self) == false\n end\n\n#if the difficulty of the quest is 2\n#only select weapons with attack power greater than 3 and less than or equal to 6\n# and that the player has not yet obtained\n elsif difficulty == 2\n available_weapons = Weapon.all.where(\"attack_power >3 and attack_power <= 6\").select do |weapon|\n weapon.characters.include?(self) == false\n end\n\n\n#if the difficulty of the quest is 3\n#only select weapons with attack power greater than 6\n# and that the player has not yet obtained\n else\n available_weapons = Weapon.all.where(\"attack_power > 6\").select do |weapon|\n weapon.characters.include?(self) == false\n end\n end\n end", "def show\n @thisAccount = Account.find(params[:id])\n\n @readyQuests = Quest.where('attack <= ?', @thisAccount.attack)\n .where('strength <= ?', @thisAccount.strength)\n .where('defence <= ?', @thisAccount.defence)\n .where('ranged <= ?', @thisAccount.ranged)\n .where('prayer <= ?', @thisAccount.prayer)\n .where('magic <= ?', @thisAccount.magic)\n .where('runecrafting <= ?', @thisAccount.runecrafting)\n .where('construction <= ?', @thisAccount.construction)\n .where('hitpoints <= ?', @thisAccount.hitpoints)\n .where('agility <= ?', @thisAccount.agility)\n .where('herblore <= ?', @thisAccount.herblore)\n .where('thieving <= ?', @thisAccount.thieving)\n .where('crafting <= ?', @thisAccount.crafting)\n .where('fletching <= ?', @thisAccount.fletching)\n .where('slayer <= ?', @thisAccount.slayer)\n .where('hunter <= ?', @thisAccount.hunter)\n .where('mining <= ?', @thisAccount.mining)\n .where('smithing <= ?', @thisAccount.smithing)\n .where('fishing <= ?', @thisAccount.fishing)\n .where('cooking <= ?', @thisAccount.cooking)\n .where('firemaking <= ?', @thisAccount.firemaking)\n .where('woodcutting <= ?', @thisAccount.woodcutting)\n\n @notReadyQuests = Quest.where('attack >= ?', @thisAccount.attack)\n .where('strength > ?', @thisAccount.strength)\n .where('defence > ?', @thisAccount.defence)\n .where('ranged > ?', @thisAccount.ranged)\n .where('prayer > ?', @thisAccount.prayer)\n .where('magic > ?', @thisAccount.magic)\n .where('runecrafting > ?', @thisAccount.runecrafting)\n .where('construction > ?', @thisAccount.construction)\n .where('hitpoints > ?', @thisAccount.hitpoints)\n .where('agility > ?', @thisAccount.agility)\n .where('herblore > ?', @thisAccount.herblore)\n .where('thieving > ?', @thisAccount.thieving)\n .where('crafting > ?', @thisAccount.crafting)\n .where('fletching > ?', @thisAccount.fletching)\n .where('slayer > ?', @thisAccount.slayer)\n .where('hunter > ?', @thisAccount.hunter)\n .where('mining > ?', @thisAccount.mining)\n .where('smithing > ?', @thisAccount.smithing)\n .where('fishing > ?', @thisAccount.fishing)\n .where('cooking > ?', @thisAccount.cooking)\n .where('firemaking > ?', @thisAccount.firemaking)\n .where('woodcutting > ?', @thisAccount.woodcutting)\n end", "def quest_duration\n Objective.find_by_id(self.objective_id).duration.capitalize\n end", "def find_level\n determine_level(self.experience_points, self.user_quests.where(complete: true))\n end", "def get_recommended_quests(difficulty)\n self.get_uncompleted_quests.select do |quest|\n quest.difficulty == difficulty\n end\n end", "def quest(id) \n\tsys('quest')\n\t$progress.add_quest(id) \n\tpop_quest(id)\n\t$scene.hud.quest_sparkle(\"misc/profile\")\nend", "def quest_rewarded?(quest_id)\n quest_revealed?(quest_id) && quest(quest_id).status?(:reward)\n end", "def general_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => true).where.not(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end", "def init_maqj_data\n @quests = Game_Quests.new # Initialize @quests\n end", "def has_hands\n return @hands.select{|hands| hands.status == HandStatus::PLAY} != []\n end", "def main_commands_enabled\n $game_party.exists\n end", "def main_commands_enabled\n $game_party.exists\n end", "def main_commands_enabled\n $game_party.exists\n end", "def player_has_armor?(kind=2) #defaults to check for body armor\n case kind\n when 0\n return true unless $game_party.actors[0].armor1_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor1_fix == true\n when 1\n return true unless $game_party.actors[0].armor2_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor2_fix == true\n when 2\n return true unless $game_party.actors[0].armor3_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor3_fix == true\n when 3\n return true unless $game_party.actors[0].armor4_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor4_fix == true\n end\n for armor_hash in $game_party.armors\n armor = $data_armors[armor_hash[0]]\n amount = armor_hash[1]\n if amount != 0 and armor.kind == kind and $game_party.actors[0].equippable?(armor)\n return true #armor in inventory\n end\n end\n return false #armor not equipped or in inventory\nend", "def profile_completed?\n return true if self.for_testing?\n !self.skills.blank? and !self.bio.blank?\n end", "def init_quest\n @quest = Quest.find_by_id(params[:id])\n @quest ||= Quest.draft(params[:id])\n end", "def knows? question\n @strength >= question.difficulty\n end", "def has_torch?\n self.items.has_key? :torch\n end", "def superShiny?\n return self.pokemon && self.pokemon.superShiny?\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def user_meets_requirements(user, quest)\n if user.total_level >= quest.level_requirement\n true\n else\n false\n flash[:error] = \"You are \" + levels_away_from_req(user, quest) + \" levels are from the requirement.\"\n redirect_to quests_path\n return\n end\n end", "def player_has_armor?(kind=2) #defaults to check for body armor\n=begin\n case kind\n when 0\n return true unless $game_party.actors[0].armor1_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor1_fix == true\n when 1\n return true unless $game_party.actors[0].armor2_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor2_fix == true\n when 2\n return true unless $game_party.actors[0].armor3_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor3_fix == true\n when 3\n return true unless $game_party.actors[0].armor4_id == 0\n return false if $data_actors[$game_party.actors[0].id].armor4_fix == true\n end\n=end\n party_actor_id = 0\n kind_id = kind.to_i + 1\n armor_id_attr_name = sprintf('armor%d_id', kind_id)\n armor_fix_attr_name = sprintf('armor%d_fix', kind_id)\n return true unless $game_party.actors[party_actor_id].send(armor_id_attr_name) == 0\n return false if $game_party.actors[party_actor_id].equip_fix?(kind_id) == true\n \n for armor_hash in $game_party.armors\n armor = $data_armors[armor_hash[0]]\n amount = armor_hash[1]\n if amount != 0 and armor.kind == kind and $game_party.actors[party_actor_id].equippable?(armor)\n return true #armor in inventory\n end\n end\n return false #armor not equipped or in inventory\nend", "def can_loot?\n false\n end", "def hasProperties\n end", "def has_testimonial?\n testimonial_text?\n end", "def mechanic_quest; end", "def show\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n raise ForbiddenError.new ('Access forbidden.') unless staff? || admin? || @tutorial_quest.tutorial_state.owner == current_character\n\n if stale?(:last_modified => @tutorial_quest.updated_at.utc, :etag => @tutorial_quest)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial_quest }\n end\n end\n end", "def find_selected\n selected_quests = self.user_quests.where(complete: false)\n selected_quests.map do |x|\n x.quest_id\n end\n end", "def peacekeeper_quest; end", "def update\n @quest = Quest.find(params[:id])\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para editar esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para editar esta quest!'\n end\n end", "def getFailedQuests\n failed = []\n $PokemonGlobal.quests.failed_quests.each do |s|\n failed.push(s.id)\n end\n return failed\nend", "def inventoriable?\n inventory?\n end", "def completeQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.completeQuest(quest,color,story)\nend", "def skill_busy?\n (@enemy_sprites + @actor_sprites).any? do |sprite|\n sprite.skill_busy?\n end\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def prapor_quest; end", "def enough_human_players?\n players.length >= needed_players\n end", "def temporary_phase?\n Temporary_Phase.any? do |phase|\n battle_phase == phase\n end\n end", "def item_conditions_met?(item)\r\n usable_item_conditions_met?(item) && $game_party.has_item?(item)\r\n end", "def pbAllFainted\n return $Trainer.ablePokemonCount==0\nend", "def has_units_being_prepared\n units_beings_prepared = Unit.where(:order_id => self.id).where('unit_status = \"unapproved\" or unit_status = \"condition\" or unit_status = \"copyright\"')\n return units_beings_prepared\n end", "def empty?\n @actor_id == 0 && @skill_id == 0\n end", "def is_empty\n return (@some_levels == 0 && @some_visible_treasures == 0 && @some_hidden_treasures == 0 && @death == false && @some_specific_visible_treasures.empty? && @some_specific_hidden_treasures.empty? && @monster == nil)\n end", "def quest_book\n GamePlay::QuestBookMenu.new.main\n Graphics.transition\n @wait_count = 2\n end", "def get_question\n if self.key.to_s =~ /(an_)([0-9])/\n q_id = QUESTION_MAP[\"qs_#{$+}\".to_sym][:id]\n q = ProfileQuestion.find_by_profile_id_and_question_id(self.profile_id, q_id)\n q.answer\n else\n nil\n end\n end", "def has_questions?\n all_questions.any?\n end", "def taken?\n return !@player.nil?\n end", "def has_inventory?\n inventory_count > 0\n end", "def has_inventory?\n inventory_count > 0\n end", "def has_creature?\r\n not @creatures.empty?\r\n end", "def profile_completed?\n !self.name.blank? and !self.country.blank? and !self.contact_number.blank?\n end", "def ragman_quest; end", "def players_alive?\n @players[0][:lives] != 0 && @players[1][:lives] != 0 \nend", "def activateQuest(quest,color=colorQuest(nil),story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.activateQuest(quest,color,story)\nend", "def cumple_requisitos?\n propietario.hangar.nivel >= 6 && propietario.cuenta.tecnologia_energia.nivel >= 6 && propietario.cuenta.tecnologia_militar.nivel >= 3 && propietario.cuenta.tecnologia_defensa.nivel >= 1 && super\n end", "def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n @enemy.water_magic >= @skill.water_cost &&\n @enemy.earth_magic >= @skill.earth_cost &&\n @enemy.wind_magic >= @skill.wind_cost )\n #@enemy.light_magic >= @skill.light_cost &&\n #@enemy.dark_magic >= @skill.dark_cost )\n \n self.tone.set(0, 30, 0)\n else\n self.tone.set(70, 0, 0)\n end\n else\n self.tone.set(0, 0, 70)\n end\n end\n end", "def create_quest_tbl\n\t\t\tq_rows = @player_data_db.execute <<-SQL\n\t\t\t\tCREATE TABLE IF NOT EXISTS quests (\n\t\t\t\t\tid INTEGER PRIMARY KEY,\n\t\t\t\t\tdb_name varchar(30),\n\t\t\t\t\tname varchar(30),\n\t\t\t\t\tdescrip varchar(255),\n\t\t\t\t\tk_g_goal int,\n\t\t\t\t\tk_g_name varchar(30),\n\t\t\t\t\texp_reward int,\n\t\t\t\t\tsilver_reward int,\n\t\t\t\t\tgold_reward int,\n\t\t\t\t\tloot_reward varcar(30),\n\t\t\t\t\tk_g_count int,\n\t\t\t\t\tq_status varchar(5)\n\t\t\t\t\t\n\t\t\t\t);\n\t\t\tSQL\n\t\tend", "def has_results?\n meeting_individual_results.has_points(:goggle_cup_points).exists?\n end", "def pending_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n by_me_quests = UsersQuest.where(:assignor_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @by_me_quests = Quest.where(:id => by_me_quests).order('due_date')\n end", "def failQuest(quest,color=nil,story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.failQuest(quest,color,story)\nend", "def check_can_act\r\n return t('battle.you_are_not_in_combat') if !enactor.is_in_combat?\r\n return t('battle.cannot_act_while_koed') if (acting_for_self && enactor.combatant.is_ko)\r\n return t('battle.you_are_a_noncombatant') if (acting_for_self && enactor.combatant.is_noncombatant)\r\n return nil\r\n end", "def get_quest\n\t\tget_data\n\n\t\t$finish = false\n\t\tunless $finish == true\n\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\twhile $quiz_arr.include?(@data[$randId]['id'])\n\t\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\tend\n\t\t\t$quiz_arr.push(@data[$randId]['id'])\n\t\t\t$i += 1\n\n\t\t\tif $i == 7\n\t\t\t\t$finish = true\n\t\t\tend\n\n\t\t\t@quest = @data[$randId]['question_name']\n\t\t\t@c_answer = @data[$randId]['c_answer']\n\t\t\t@alt1 = @data[$randId]['alt1']\n\t\t\t@alt2 = @data[$randId]['alt2']\n\t\t\t@alt3 = @data[$randId]['alt3']\n\t\t\t@imgurl = @data[$randId]['imgurl']\n\t\t\t@url = @data[$randId]['news_url']\n\t\t\t@cat = @data[$randId]['category_id']\n\t\t\t@hex = @data[$randId]['category_hex_code']\n\t\t\tget_descriptions(@url)\n\t\t\t@image = @desc_data['image']\n\n\t\t\t$answer_array = Array.new()\n\t \tend\n\tend", "def skier_quest; end", "def checkPlayer(difficulty, attributeName, *modifiers)\r\n return $game_party.members[0].check(difficulty, attributeName, *modifiers)\r\n end", "def activateQuest(questID)\n if questID.is_a?(String)\n questID = $quest_data.getIDFromName(questID)\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id==questID\n Kernel.pbMessage(\"You have already started this quest\")\n return\n end\n end\n for i in 0...@completed_quests.length\n if @completed_quests[i].id==questID\n Kernel.pbMessage(\"You have already complete this quest\")\n return\n end\n end\n for i in 0...@failed_quests.length\n if @failed_quests[i].id==questID\n Kernel.pbMessage(\"You have already failed this quest\")\n return\n end\n end\n @active_quests.push(Quest.new(questID))\n end", "def terminal?\n (0..@players.length-1).all? {|ix| get_actions(ix).empty?}\n end", "def verify_player(msg)\n nick = msg.user.nick\n player = get_player msg\n return nil unless player\n # Check that the player is ready for use.\n # The idea is to tell the user everything he needs to set, all at once.\n ready = true\n unless player.name\n msg.reply \"#{nick} does not have a name yet!\"\n msg.reply \"Spare yourself an existential crisis and set a name with !name.\"\n ready = false\n end\n unless player.backstory\n msg.reply \"#{nick} does not have a backstory!\"\n msg.reply \"Who even are you? Tell us with !player set backstory.\"\n ready = false\n end\n unless player.race\n msg.reply \"#{nick} has no race!\"\n msg.reply \"Use !player set race to forever idetifiy as a single stereotype.\"\n msg.reply \"Use !races to get a list the playable races.\"\n ready = false\n end\n unless player.baseType\n msg.reply \"#{nick} has no base class!\"\n msg.reply \"High school is full of cliques. Now choose one with !player set class.\"\n msg.reply \"Use !classes to get a list of the playable classes.\"\n ready = false\n end\n ready ? player : nil\n end", "def skillsNeeded\n\t\t[]\n\tend", "def properties_in_set(game = @owner.game)\n\t\t\tgame.board.select { |p| p.is_a? self.class }.select { |p| p.set == @set }\n\t\tend", "def available_inventory\n object.check_inventory\n end", "def is_support_unit\n $data_enemies[@enemy_id].is_support_unit\n end", "def can_play_with?(nick)\n puts \"checking for #{nick}\"\n true\n # games = $db[:uno].where(:nick => nick).all[0][:games] unless\n # games ||= 0\n # games < 200 or game_ratio(nick) < 0.33\nend", "def inventory_item_is_available\n \tif self.inventory_item.present? && self.inventory_item.is_available?(project.rental_delivery, project.rental_pickup) == false\n \t\terrors.add(:inventory_item, \"is not available within this project's duration\")\n \telsif self.inventory_item.blank?\n \t\tself.inventory_item = inventory_style.find_available(project.rental_delivery, project.rental_pickup)\n \t\terrors.add(:inventory_style, \"has no available items within this project's duration\") if self.inventory_item.blank?\n \tend\n end", "def getQuestDescription(quest)\n return \"#{QuestModule.const_get(quest)[:QuestDescription]}\"\n end", "def poss\r\n Pronouns.get_pronoun_set(@object)[2]\r\n end", "def is_available?\n return self.available_inventory > 0\n end", "def filled_info(opponent)\n opponent.gamertag != \"\" && opponent.game != \"\" && opponent.bracket != \"\" && opponent.characters != \"\" && opponent.score != \"\"\n end", "def non_quest_attribute\n !!(controller == \"inspirations\" || controller == \"family_members\" || controller == \"subscriptions\" || controller == \"disciplines\" || controller == \"priority_items\")\n end", "def get_completed_too?\n session.fetch(:completed, params.fetch(:completed, \"0\")) == \"1\"\n end", "def has_unplayed_hands()\n @current_hand < @hands.length\n end", "def in_this_hand?\n\t\t\t@state_hash['state']['players'].any? {|p| p['id'] == @player_id}\n\t\tend", "def in_this_hand?\n\t\t\t@state_hash['state']['players'].any? {|p| p['id'] == @player_id}\n\t\tend", "def cumple_requisitos?\n propietario.hangar.nivel >= 4 && propietario.cuenta.tecnologia_energia.nivel >= 3 && propietario.cuenta.tecnologia_laser.nivel >= 6 && super\n end", "def has_played?\n stats != nil\n end", "def experience?\n experiences.present?\n end" ]
[ "0.6926412", "0.68074673", "0.6314898", "0.6099784", "0.6074462", "0.59012276", "0.57835287", "0.5622351", "0.55206466", "0.5518889", "0.5451204", "0.5374794", "0.5361204", "0.53589755", "0.53361446", "0.5306457", "0.5283109", "0.52714807", "0.5264498", "0.5262639", "0.52486587", "0.5237543", "0.5212496", "0.5180042", "0.5157498", "0.5156809", "0.5156809", "0.5156809", "0.5152695", "0.51355135", "0.51302034", "0.51131934", "0.5109887", "0.5109316", "0.51073736", "0.51060134", "0.50959814", "0.5092231", "0.5091406", "0.5086831", "0.5074254", "0.50730854", "0.50680536", "0.50539017", "0.50392824", "0.50299454", "0.50279635", "0.5025501", "0.5022095", "0.500797", "0.500691", "0.4997914", "0.49961403", "0.49941793", "0.49903932", "0.49866176", "0.49658337", "0.49615407", "0.4956762", "0.49548286", "0.4953678", "0.49520466", "0.4950998", "0.4950998", "0.49478936", "0.49304342", "0.4928166", "0.49269038", "0.49218974", "0.4921159", "0.49194634", "0.49182305", "0.49154758", "0.49111158", "0.49067038", "0.48976558", "0.4896367", "0.4895643", "0.48875934", "0.4885594", "0.4878275", "0.48735037", "0.48703006", "0.4869301", "0.4864952", "0.48623458", "0.486194", "0.48602098", "0.48477617", "0.48442227", "0.48433113", "0.48430067", "0.4840836", "0.48399135", "0.4837287", "0.48362294", "0.48362294", "0.48355868", "0.48269665", "0.48220748" ]
0.6944552
0
Creates a competitor instance
def initialize(kernel, id, url) @kernel, @id, @base_url = kernel, id, url @browser = Waw::WSpec::Browser.new(url) @logged = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\t\t@competitor=Competitor.new\n\tend", "def create\n @competitor = Competitor.new(params[:competitor])\n\n respond_to do |format|\n if @competitor.save\n format.html { redirect_to @competitor, notice: 'Competitor was successfully created.' }\n format.json { render json: @competitor, status: :created, location: @competitor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competitor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @competitor = Competitor.new(competitor_params)\n\n respond_to do |format|\n if @competitor.save\n format.html { redirect_to @competitor, notice: 'Competitor was successfully created.' }\n format.json { render :show, status: :created, location: @competitor }\n else\n format.html { render :new }\n format.json { render json: @competitor.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @opponent = Opponent.new\n end", "def load_competitor!(competitor_name, hq_entry_attrs)\n Competitor.\n create_with(\n # if the games site changes the capitalization between years, or over time, we don't want to load\n # the same competitor multiple times.\n name: competitor_name\n ).\n find_or_create_by(hq_id: hq_entry_attrs[:id])\n end", "def new\n @composer = Composer.new\n end", "def signup\n @companion = Companion.new\n end", "def new\n @composition = Composition.new\n end", "def create_account\n account = Account.create(name: \"#{full_name}'s Portfolio\")\n account.collaborators << self\n end", "def new \n @cuber = Cuber.new\n end", "def new_com(x, y, z, a)\n x = Company.new(x, y, z, a)\n @port << x\n end", "def create(name)\n object = new(name)\n @instances.push(object)\n object\n end", "def create_comp_gen\n MPC::IDLProject.new(:comp_gen, self)\n end", "def create_company\n company = Company.create!()\n company\n end", "def create_pit name, composite\n mapping = @constellation.Mapping(:new, name: name, object_type: composite.mapping.object_type)\n @constellation.Composite(mapping, composition: @composition, composite_group: 'bdv')\n end", "def create_communication\n return Communication.new({\n :communication_type_id => 1,\n :communication_method_id => 1,\n :communication_agent_class => 'P',\n :communication_subject => 'Test communication',\n :communication_note => 'Note about test communication',\n :priority => 1,\n :status => 'o'\n }\n )\n end", "def create_collaboration(email, role=:viewer)\n RubyBox::Collaboration.new(@session, {\n 'item' => {'id' => id, 'type' => type},\n 'accessible_by' => {'login' => email},\n 'role' => role.to_s\n }).create\n end", "def create_curator\n curator = User.gen(:username => 'curator_for_tc', :password => 'password', :credentials => 'Curator', :curator_scope => 'very scoped')\n curator.grant_curator\n curator.save!\n return curator\n end", "def make_corpse\n if @@corpse_proto == nil\n @@corpse_proto = Tag.find_any_obj(\"do.not.change::corpse.prototype\")[0] # corpse prototype\n end\n # generate a new item based off of the corpse prototype.\n\n o = @@corpse_proto.instance # new corpse\n if ('A'..'Z') === short_desc[0]\n o.name = o.name % self.short_desc\n else\n o.name = o.name % self.short_desc.en.a\n end\n\n in_room.accept(o) # put the object in the same room.\n end", "def initialize # clinic\n # @company = clinic.company\n\n response = create\n end", "def Factory(name, *args, &block)\n puts \"*** WARNING *** You should migrate over to using the proper Cobble methods as this won't be here forever!\"\n Cobble.create(name, *args, &block)\nend", "def generate_cargo(multiplier)\n return nil unless playable?\n result = KuiCargo.new\n result.blueprint = self\n rl = Opal::ResourceLocator.instance\n repo = rl.storage[:repository]\n if repo\n result.tag = repo.ensure_unique_tag(\"cargo_#{self.name}_x#{multiplier}\")\n end\n result.auto_price(multiplier)\n return result \n end", "def create\n name_to_const.new\n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def create_component(name)\n Backlogjp::Component.create(self, name)\n end", "def new\n \n end", "def create_object\n sut.send(:new)\n end", "def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)\n\n\n #Creacion de una instancia de FacturamaApiMultiemisor\n Facturama::FacturamaApiMulti.new(facturama_user,facturama_password,is_development)\n end", "def new(components)\n self.class.new(self, components)\n end", "def create\n return nil if created?\n request :create_creative_on_bidstalk do\n client = Bidstalk::Creative::Client.new\n client.create to_platform_creative!\n end\n end", "def creator\n send(Redcrumbs.creator_class_sym) if respond_to?(Redcrumbs.creator_class_sym)\n end", "def new\n @vendor = Vendor.new\n end", "def set_competitor\n @competitor = Competitor.find(params[:id])\n end", "def set_competitor\n @competitor = Competitor.find(params[:id])\n end", "def create_instance_core() \r\n @log.debug(\"Create core scopetta\")\r\n return CoreGameScopetta.new\r\n end", "def create\n in_directory do\n raise(\"Please use a specific Condom class, not Base.\")\n end\n end", "def create\n @competence_type = CompetenceType.new(competence_type_params)\n respond_to do |format|\n if @competence_type.save\n format.json { render :show, status: :created, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_driver name\n\t\tdriver = Driver.new name\n\t\t@drivers[driver.name] = driver\n\t\tdriver\t\t\n\tend", "def create\n @companium = Companium.new(companium_params)\n\n respond_to do |format|\n if @companium.save\n format.html { redirect_to @companium, notice: 'Companium was successfully created.' }\n format.json { render :show, status: :created, location: @companium }\n else\n format.html { render :new }\n format.json { render json: @companium.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_entity\n Taxcalendario::Client::Entities::Conta.new\n end", "def create\n @manage_compete = Manage::Compete.new(manage_compete_params)\n\n respond_to do |format|\n if @manage_compete.save\n format.html { redirect_to @manage_compete, notice: 'Compete was successfully created.' }\n format.json { render :show, status: :created, location: @manage_compete }\n else\n format.html { render :new }\n format.json { render json: @manage_compete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comunity = Comunity.new(comunity_params)\n\n respond_to do |format|\n if @comunity.save\n format.html { redirect_to @comunity, notice: 'Comunity was successfully created.' }\n format.json { render :show, status: :created, location: @comunity }\n else\n format.html { render :new }\n format.json { render json: @comunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(competition = nil)\n\n #Create the core competition instance we're proxying.\n @competition = competition || JDBeacon::Competition.new\n\n #Create a thread object used to \n @thread = nil\n\n end", "def new(*args)\n obj = super\n @provider_instances << obj\n obj\n end", "def new\n @company = Company.new\n end", "def set_competitor\n @competitor = Competitor.find(params[:id])\n @current_obj = @competitor\n end", "def create_channel\n Channel.new @grpc_stub_class, endpoint: @endpoint, credentials: @credentials, channel_args: @channel_args,\n interceptors: @interceptors, on_channel_create: @config.on_channel_create\n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def Cobble(name, *args, &block)\n Cobble.create(name, *args, &block)\nend", "def create\n raise NotImplementedError\n end", "def create\n raise NotImplementedError\n end", "def create!\n raise NotImplementedError\n end", "def new\n # brand instance\n @brand = Brand.new\n end", "def create_widget\n widget_class.new(widget_assigns)\n end", "def new\n @robot = Robot.new\n end", "def new_entity\n Taxcalendario::Admin::Client::Entities::Obrigacao.new\n end", "def new\n @noticium = Noticium.new\n end", "def create\n # TODO: implement create\n end", "def new\n @provider = Provider.new\n end", "def new_entity\n Taxcalendario::Admin::Client::Entities::Conta.new\n end", "def new\n @company = Company.new\n @user = User.new(:user_roles => [UserRole[:company_admin]])\n @user.build_person\n end", "def create!(*args, &block)\n instance = new(*args, &block)\n instance.create!\n instance\n end", "def new\n # new cocktail part\n # @cocktail = Cocktail.new\n end", "def create\n @competence = Competence.new(competence_params)\n respond_to do |format|\n if @competence.save\n format.json { render :show, status: :created, object: @competence }\n else\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def construct\n end", "def new \n @intervention = Intervention.new\n logger.info(\"INTERVENTIONS CONTROLLER \") \n end", "def create\n @colaborator = Colaborator.new(colaborator_params)\n\n respond_to do |format|\n if @colaborator.save\n format.html { redirect_to @colaborator, notice: 'Colaborator was successfully created.' }\n format.json { render :show, status: :created, location: @colaborator }\n else\n format.html { render :new }\n format.json { render json: @colaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def otCreate(rconstant, &block)\n otObj = $otObjectService.createObject(rconstant.java_class)\n yield otObj\n otObj\nend", "def create_instance\n create_instances(1).first\n end", "def create(name)\n self.new(name)\n end", "def create\n @collaborator = Collaborator.new(params[:collaborator])\n\n respond_to do |format|\n if @collaborator.save\n format.html { redirect_to @collaborator, notice: 'Collaborator was successfully created.' }\n format.json { render json: @collaborator, status: :created, location: @collaborator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contra = Contra.new\n end", "def new\n\t\t@company = Company.new\n\tend", "def create\n competition_type = params[:competition_type]\n\n creator = SampleCompetitionCreator.new(competition_type)\n if creator.create\n flash[:notice] = \"Sample Competition Created\"\n else\n flash[:alert] = \"Error creating record: #{creator.errors}\"\n end\n redirect_to sample_data_competitions_path\n end", "def new\n build_client\n end", "def create\n @conductormobibus = Conductormobibus.new(conductormobibus_params)\n\n respond_to do |format|\n if @conductormobibus.save\n format.html { redirect_to @conductormobibus, notice: 'Conductor was successfully created.' }\n format.json { render :show, status: :created, location: @conductormobibus }\n else\n format.html { render :new }\n format.json { render json: @conductormobibus.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @contribution = Contribution.new\r\n end", "def new\n @bond = Bond.new\n end", "def new\n @object = DRI::Batch.with_standard :qdc\n\n # configure default permissions\n @object.apply_depositor_metadata(current_user.to_s)\n @object.manager_users_string = current_user.to_s\n @object.discover_groups_string = 'public'\n @object.read_groups_string = 'public'\n @object.master_file_access = 'private'\n @object.object_type = ['Collection']\n @object.title = ['']\n @object.description = ['']\n @object.creator = ['']\n @object.creation_date = ['']\n @object.rights = ['']\n @object.type = ['Collection']\n\n supported_licences\n\n respond_to do |format|\n format.html\n end\n end", "def initialize(name, creator)\n @name = name\n @creator = creator\n end", "def new\n @catogory = Catogory.new\n end", "def new\n @user = People.new\n @comunities = Comunity.find(:all, :order => :name)\n end", "def create\n \n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end", "def new\n @cocktail = Cocktail.new\n end", "def new\n @company = Company.new\n end", "def create\n @collaborator = Collaborator.new(collaborator_params)\n authorize! :create, @collaborator\n\n respond_to do |format|\n if @collaborator.save\n if @collaborator.role == \"consultant\"\n format.html { redirect_to creer_propositions_entity_path(@collaborator.entity), notice: \"Le Collaborateur #{@collaborator.name} a été créé avec succès.\" }\n # format.json { render action: 'show', status: :created, location: @collaborator }\n else\n format.html { redirect_to collaborators_path, notice: \"Le Collaborateur #{@collaborator.name} a été créé avec succès.\" }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @collaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_object\n @object = scope.new params[object_name.to_sym]\n set_instance\n end", "def initialize\n @comp = Computer.new\n @player = Player.new\n end" ]
[ "0.6566123", "0.6186139", "0.6151295", "0.60796285", "0.5994616", "0.59778684", "0.59422135", "0.59255385", "0.5859046", "0.5844704", "0.58171433", "0.57836956", "0.5757123", "0.57419735", "0.5709396", "0.57029086", "0.57025623", "0.56908786", "0.5640841", "0.56271875", "0.5601123", "0.5598193", "0.55474037", "0.554573", "0.554573", "0.554573", "0.554573", "0.554573", "0.55453336", "0.5539361", "0.5515946", "0.5513585", "0.5508264", "0.5489671", "0.5487796", "0.54757696", "0.5474382", "0.5474382", "0.54655695", "0.5459384", "0.54584605", "0.545525", "0.54506", "0.5443465", "0.5443044", "0.5437063", "0.5420153", "0.54200447", "0.5419023", "0.541057", "0.54045355", "0.5397209", "0.5397209", "0.5397209", "0.5397209", "0.5397209", "0.5397209", "0.5397209", "0.5397209", "0.5397209", "0.5391221", "0.53703517", "0.53703517", "0.53691036", "0.5355348", "0.534456", "0.5341733", "0.53365254", "0.53320056", "0.5322864", "0.5320276", "0.5316415", "0.5312974", "0.53118515", "0.5311578", "0.53050125", "0.53038716", "0.5290403", "0.5288007", "0.52719474", "0.52707624", "0.52683485", "0.5265029", "0.5264682", "0.52644116", "0.5263934", "0.5257566", "0.52560556", "0.5243302", "0.52429014", "0.524129", "0.52411306", "0.52404946", "0.52385885", "0.52380806", "0.5235264", "0.5235168", "0.52239263", "0.5218388", "0.5216381", "0.5216283" ]
0.0
-1
Logs the competitor in
def login_logout if @logged puts "Competitor #{@id} is going to log out" @browser.invoke_action(@kernel.resources.controllers.people.logout) raise "Logout action failed" unless @browser.last_action_result == ["success", "ok"] @logged = false else puts "Competitor #{@id} is going to log in" @browser.invoke_action( @kernel.resources.controllers.people.login, user_tuple(@id, false).keep(:mail, :password) ) raise "Login action failed" unless @browser.last_action_result == ["success", "ok"] @logged = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logging_in\n end", "def logging_in\n \t\t\n \tend", "def log\n end", "def log_in\n end", "def logging_in\n logger.debug \"ApplicationController:logging_in >>> \"\n current_user.transfer_data(guest_user)\n end", "def log_user_event\n depositor.log_event( event ) if depositor.respond_to? :log_event\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log_state\n super\n end", "def log_user_event\n\n depositor.log_profile_event(event)\n end", "def enter_login\n @logger.info(\"enter login: %s\" % @username) if @logger\n enter_command(@username)\n end", "def logged_in\r\n end", "def log()\n @log\n end", "def log_user_event\n depositor.log_event(event)\n end", "def log_user_event\n depositor.log_profile_event(event)\n end", "def logme\n\t\tlogger.debug \"============Main ApplicationController get calls at #{Time.now}\"\n\tend", "def log_user_event(depositor)\n # log the event to the proxy depositor's profile\n proxy_depositor.log_profile_event(event)\n depositor.log_event(event)\n end", "def log\n @log\n end", "def logs\n end", "def log \n\t\t\tArrow::Logger[ self.class ]\n\t\tend", "def logged?; false end", "def logged?; false end", "def log_user_profile_event\n depositor.log_profile_event( event ) if depositor.respond_to? :log_profile_event\n end", "def logger ; @log end", "def log_user_event(depositor)\n depositor.log_profile_event(event)\n rescue => exception\n Honeybadger.notify(exception)\n end", "def logs\n\n end", "def sign_in_local\n __log_activity\n __debug_route\n end", "def logger_output; end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def info_and_log(message)\n @ui.info(message)\n @logger.info(message)\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def loggin_opc(puser, pcontroller, paction, pcomment)\n #para que no haga logging de clicks de navegacion\n if pcontroller == 'home'\n\t\treturn\n else\n\t logmodel = Logeclubapi.new\n\t logmodel.login = puser.login\n\t logmodel.username = puser.name\n\t logmodel.log_option = pcontroller\n\t logmodel.log_action = paction[0..9]\n\t logmodel.log_comment = pcomment\n\t logmodel.origin = 'W' #origen web\n\t #logmodel.save\n end\n end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def log_connection\r\n msg = \"\"\r\n msg << \"Host: #{@host.inspect}, \" unless @host.empty?\r\n msg << \"Namespace: #{@namespace.inspect}, \" unless @namespace == \"root\\\\cimv2\" && @host.empty?\r\n msg << \"User: #{@user.inspect}, \" if @user\r\n msg << \"Password: #{@password.gsub(/./,'#')}, \" if @password\r\n msg << \"Privileges: #{@privileges.inspect}\" if @privileges\r\n logger.debug msg unless msg.empty?\r\n end", "def log\n Lita.logger\n end", "def logging_prefs; end", "def on_open(event)\n logger.debug \"Connection openned as user: #{@user} on channel: #{@channel}.\"\n end", "def log\n advanced[:log]\n end", "def log!\n Logger.info \"#{ notifier_name } started notifying about the process.\"\n end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def autoflush_log; end", "def autoflush_log; end", "def log(from, to=nil)\n scm :log, repository, authentication, \"-r#{from}:#{to || head}\"\n end", "def sub_log \n send_cmd(\"sub_log\")\n end", "def smartlog\n assert_in_repo\n SugarJar::Log.info(hub(\n 'log', '--graph', '--oneline', '--decorate', '--boundary',\n '--branches', \"#{most_master}..\"\n ).stdout.chomp)\n end", "def log_activity\n\n BgJob.enqueue(\n UserActivityLogJob,\n {\n client_id: @client.id,\n user_id: @edit_kyc_request.user_id,\n admin_id: @edit_kyc_request.admin_id,\n action: GlobalConstant::UserActivityLog.open_case,\n action_timestamp: Time.now.to_i,\n extra_data: {\n case_id: @edit_kyc_request.case_id\n }\n }\n )\n\n end", "def log\n self.class.log\n end", "def Auditlog( mo, msg )\n auditEntry = Audit.new\n auditEntry.message = \"#{mo} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n #auditEntry.origin = ip\n auditEntry.origin = request.remote_ip\n auditEntry.user = !current_user.nil? ? current_user.email : 'no-user'\n auditEntry.datetime = DateTime.now\n\n if !auditEntry.save\n _auditLog.info \"#{user} #{ip} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n end\n\n end", "def log!\n Logger.message \"#{ self.class } started notifying about the process.\"\n end", "def log_current_inspection\n qc_current_inspection = get_current_inspection_record( session[:user_id].id, @qc_inspection_type_code )\n if qc_current_inspection.nil?\n ActiveRecord::Base.connection.execute(\"INSERT INTO qc_current_inspections (user_id, qc_inspection_type_code, qc_inspection_id)\n VALUES(#{session[:user_id].id}, '#{@qc_inspection_type_code}', #{@qc_inspection.id})\")\n else\n ActiveRecord::Base.connection.execute(ActiveRecord::Base.extend_update_sql_with_request(\"UPDATE qc_current_inspections SET qc_inspection_id = #{@qc_inspection.id}\n WHERE user_id = #{session[:user_id].id} AND qc_inspection_type_code = '#{@qc_inspection_type_code}' \"))\n end\n end", "def log_start\n @notifier.log \"#{identifier}: Waiting for #{describe_query}\".strip, level: :collect\n end", "def log_action msg\n\t\t\t\tputs '=> ' + msg\n\t\t\tend", "def did_log_in\n self.last_logged_in_at = DateTime.now\n self.class.execute_without_timestamps { save }\n end", "def log\n LOGGER\n end", "def log_command(cmd, str, user, to)\n if cmd.loggable? then\n log \"[ `#{str}' from \" +\n \"#{user.nick}!#{user.user}@#{user.host} to #{to} ]\"\n else\n log \"[ `#{cmd.name}' from \" +\n \"#{user.nick}!#{user.user}@#{user.host} to #{to} ]\"\n end\n end", "def log_on_button\n $tracer.trace(__method__)\n return ToolTag.new(input.value(\"Log On\"), __method__)\n end", "def log_to_followers\n depositor.followers.select { |user|\n user.can?(:read, collection)\n }.each do |follower|\n follower.log_event(event)\n end\n end", "def log(msg)\n Serv::Log.info(Time.now.to_s+': '+msg+\"\\n\")\n end", "def log(from, to=nil)\n scm :log, repository, authentication, \"-r#{from}:#{to || head}\"\n end", "def call_tracing\n @page_title = _('Call_Tracing')\n @page_icon = 'lightning.png'\n @users = User.find_all_for_select(correct_owner_id)\n end", "def history\n\t\t@user.show_log\n\tend", "def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend", "def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend", "def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend" ]
[ "0.65025175", "0.6403714", "0.61328286", "0.6070707", "0.60577536", "0.60282683", "0.600166", "0.600166", "0.600166", "0.600166", "0.600166", "0.600166", "0.600166", "0.600166", "0.59717184", "0.59443665", "0.59229016", "0.58729225", "0.5857296", "0.5856763", "0.58112717", "0.5795025", "0.57702345", "0.5716967", "0.57084596", "0.5703458", "0.5696419", "0.5696419", "0.56859916", "0.56767297", "0.56727904", "0.5656204", "0.5578722", "0.55725014", "0.555195", "0.555195", "0.555195", "0.555195", "0.555195", "0.555195", "0.555195", "0.555195", "0.5549612", "0.5539428", "0.5539428", "0.5539428", "0.5539428", "0.5539428", "0.5539428", "0.5509948", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5492547", "0.5486492", "0.5476722", "0.5453396", "0.54528654", "0.5439632", "0.54324496", "0.543048", "0.5421968", "0.5421968", "0.54202926", "0.5419248", "0.54162383", "0.5415868", "0.5409768", "0.5394017", "0.53928316", "0.53755635", "0.5350917", "0.53502524", "0.53362983", "0.5330013", "0.53224796", "0.53143334", "0.5308837", "0.53062326", "0.5292766", "0.529072", "0.5285867", "0.52766573", "0.52766573", "0.52766573" ]
0.5412943
82
Visits a static page
def visit_static_page visiting = STATIC_LOCATIONS[Kernel.rand(STATIC_LOCATIONS.size)] puts "Competitor #{@id} is visiting #{visiting}" @browser.location = @base_url + visiting raise "Visiting #{visiting} led to an error" unless @browser.is200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_mandate\n # renders static page\n end", "def accessibility_statement\n # renders static page\n end", "def load_page\n page.visit('')\n end", "def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end", "def visit_page \n visit URL \n end", "def main_page\n visit '/'\n end", "def about\n # Static Page\n end", "def page\n # get the id parameter, which can be either a page ID # or a page name\n @page_id = params[:id]\n raise \"static page without id\" if @page_id.blank?\n\n unless read_fragment(:controller => 'content', :part => @page_id + \"_\" + current_user.language_abbr)\n if @page_id.is_int?\n @content = ContentPage.find_by_id(@page_id)\n else # assume it's a page name\n page_name = @page_id.gsub(' ', '_').gsub('_', ' ')\n @content = ContentPage.find_by_page_name(page_name)\n end\n\n if @content.nil?\n raise \"static page content #{@page_id} for #{current_user.language_abbr} not found\"\n else\n @navigation_tree_breadcrumbs = ContentPage.get_navigation_tree_with_links(@content.id)\n current_language = Language.from_iso(current_user.language_abbr)\n @translated_content = TranslatedContentPage.find_by_content_page_id_and_language_id(@content.id, current_language.id)\n if @translated_content.nil?\n @page_title = I18n.t(\"cms_missing_content_title\")\n @translated_pages = TranslatedContentPage.find_all_by_content_page_id(@content.id)\n else\n @page_title = @translated_content.title\n end\n\n end\n\n\n\n # if this static page is simply a redirect, then go there\n current_user.log_activity(:viewed_content_page_id, :value => @page_id)\n end\n end", "def load_page\n logger.info 'Loading Core homepage'\n get ConfigCore.base_url\n when_exists(page_heading, Config.medium_wait)\n end", "def set_static_page\n @static_page = StaticPage.find(params[:id])\n end", "def set_static_page\n @static_page = StaticPage.find(params[:id])\n end", "def set_static_page\n @static_page = StaticPage.find(params[:id])\n end", "def link_to_page(name)\n page = StaticPage.find_by_name(name)\n page = StaticPage.create!(:name => name) unless page\n static_page_path(page)\n end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def set_page\n @static_page = StaticPage.find_by name: params[:name]\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @static_page }\n end\n end", "def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @static_page }\n end\n end", "def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @static_page }\n end\n end", "def visit_page(urlparameter)\n\n visit(urlparameter)\n\n end", "def visit\n remote_url = File.join(Rails.configuration.application_root_url, \"people/#{rubydora_object.pid}\")\n RestClient.get(remote_url, content_type: :html, accept: :html, verify_ssl: OpenSSL::SSL::VERIFY_NONE) do |response, request, result, &block|\n if [301, 302, 307].include? response.code\n response.follow_redirection(request, result, &block)\n else\n response.return!(request, result, &block)\n end\n end\n end", "def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def render_pages(static_path)\n puts \" Rendering pages\"\n Page.all.each do |p|\n if p.published? && (body = p.render)\n dir, filename = p.url, \"index.html\"\n dir, filename = p.parent.url, p.slug if p.slug =~ /\\.[^.]+$/i # File with extension (e.g. styles.css)\n FileUtils.mkdir_p(File.join(static_path, dir))\n File.open(File.join(static_path, dir, filename), 'w') { |io| io.print(body) }\n else\n puts \" ! Not rendering #{p.id} - #{p.status.name} - #{p.url}\"\n end\n end\nend", "def visit_homepage\n visit(HOMEPAGE)\n end", "def show\n render(page_path)\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @static_page }\n end\n end", "def index\n @pages = Static.all\n end", "def crawler_page\n open(crawler_url)\n end", "def page\n\n end", "def menu_page\n visit '/menu'\n end", "def visit_page(url)\n logger.info { \"visit #{url}\" }\n WebPage.new(url, web[url.to_s])\n end", "def index\n redirect_to 'static#home'\n end", "def url_home\n\tvisit url_visit\n end", "def visit\n @browser.goto(URL)\n end", "def load_page\n visit \"umple.php\"\n end", "def show\n @static_page = StaticPage.find(params[:id])\n flash.clear\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def terms_and_conditions\n # renders static page\n end", "def template_page(site); end", "def page_load; end", "def index\n #@page = Page.find_by_slug('home') || Page.first(:conditions => {:root => true})\n #render '/pages/show'\n if cookies[:first_time_visit]\n redirect_to courses_path\n return\n else\n cookies[:first_time_visit] = {:value => Time.now.to_s, :expires => 1.year.from_now }\n redirect_to '/landing'\n end\n end", "def view\n @page = StaticContent.find(:first,:conditions =>[\"url_name=?\",params[:url].join('/')]) \n if @page == nil\n if admin?\n flash[:warning] = 'Requested page does not exist. Would you like to <a href=\"/static/new?document[url_name]=' + params[:url].to_s + '\">create it</a>?'\n else\n flash[:warning] = 'Sorry, the page you have requested does not exist.'\n end\n redirect_to :back;\n return\n end\n @page_title = @page.one_line_summary\nend", "def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_page }\n end\n end", "def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_page }\n end\n end", "def new\n redirect_to static_pages_home_url\n end", "def index\n render layout: 'static_pages'\n end", "def homepage\n get '/Pages/Default.aspx'\n end", "def cookies\n # renders static page\n end", "def new\n redirect_to static_pages_notactive_path\n end", "def open\r\n visit \"/\"\r\n end", "def sample_page\n\n end", "def webpage\n render(:webpage, layout:false) and return\n end", "def get_page\n begin\n puts \"@@@@@@@@@@@@@ Visiting: #{@url} from #{@parent_page.address if @parent_page.present?}\"\n require 'nokogiri'\n require 'open-uri'\n @page = Nokogiri::HTML(open(@url))\n @page_title = (title_container = @page.css('title').first) ? title_container.content : \"Title unknown\"\n @links = @page.css(\"a\")\n\n return true\n rescue => exc\n puts \"==Problem with URL #{@url} == #{ exc.message}\"\n return false\n end\n end", "def page_view(title, page, utmhid = random_id)\n check_account_params\n hey(page_view_params(title, page, utmhid))\n end", "def get\n respond_to_html { render \"page/#{@request.id}.html\" }\n end", "def load_page()\n page = @mech.get(PARENT + PAGE)\n\n # Catch exception - 404 => Net::HTTPNotFound\n end", "def open_page(key)\n return if verify_page?(key, false)\n site.goto(site.get_path(key))\n page_delay\n verify_page?(key)\n end", "def uses_page page # only works with IE\n new_url = self.class.html_root + page\n browser.goto new_url unless browser.url == new_url\n end", "def create\n @static_page = StaticPage.new(static_page_params)\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to @static_page }\n format.json { render :show, status: :created, location: @static_page }\n else\n format.html { render :new }\n format.json { render json: @static_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def visit(url)\n url = absolute_url(url)\n puts \"Visiting: #{url}\"\n @body = Nokogiri::HTML(open(url))\n end", "def show\n if Gluttonberg::Member.enable_members == true\n return unless require_member\n unless current_member.does_member_have_access_to_the_page?(page)\n raise CanCan::AccessDenied\n end \n end\n \n template = page.view\n template_path = \"pages/#{template}\"\n \n if File.exists?(File.join(Rails.root, \"app/views/pages/#{template}.#{locale.slug}.html.haml\" ) )\n template_path = \"pages/#{template}.#{locale.slug}\"\n end \n \n # do not render layout for ajax requests\n if request.xhr?\n render :template => template_path, :layout => false\n else\n render :template => template_path, :layout => page.layout\n end\n end", "def goto newPage\n unless friends[newPage.to_sym].nil?\n uri = friends[newPage.to_sym].uri\n end\n uri ||= newPage\n uri = @page.uri+uri unless uri.to_s =~ /^http/u\n @page = @agent.get uri\n @page\n end", "def page!\n save_and_open_page\n end", "def page!\n save_and_open_page\n end", "def should_have_correct_static_pages_links\n visit root_path\n\tclick_link \"About\"\n\tpage.should have_selector 'title', text: 'About'\n\tclick_link \"Home\"\n\tclick_link \"Sign up now!\"\n\tpage.should have_selector 'title', text: 'Sign up'\n\tclick_link \"pbook\"\n\tpage.should have_selector 'title', text: 'PammBook'\nend", "def set_page\n end", "def goto_page(page)\r\n goto_url full_url(page);\r\n end", "def show\n authorize! :show, @page\n render_page if render_fresh_page?\n end", "def privacy_notice\n # renders static page\n end", "def index\n @rcadmin_static_pages = Rcadmin::StaticPage.all\n end", "def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. render 404 error\n return dc_render_404('Site!') if @site.nil?\n dc_set_options(@site.settings)\n# HOMEPAGE. When no parameters is set\n params[:path] = @site.homepage_link if params[:id].nil? and params[:path].nil?\n# Search for page \n pageclass = @site.page_table.classify.constantize\n if params[:id]\n @page = pageclass.find_by(subject_link: params[:id])\n elsif params[:path]\n# path may point direct to page's subject_link\n @page = pageclass.find_by(subject_link: params[:path])\n end\n# if @page is not found render 404 error\n return dc_render_404('Page!') unless @page\n dc_set_options @page.params\n# find design if defined. Otherwise design MUST be declared in site\n if @page.dc_design_id\n @design = DcDesign.find(@page.dc_design_id)\n return dc_render_404('Design!') unless @design\n end\n# Add to edit menu\n if session[:edit_mode] > 0\n session[:site_id] = @site.id\n session[:site_page_table] = @site.page_table\n session[:page_id] = @page.id\n end\n# perform check every hour. Perhaps if user has rights changes\n session[:last_check] ||= Time.now\n if (session[:last_check] - Time.now) > 3600\n # perform checks\n # TO BE DONE\n \n # update time\n session[:last_check] = Time.now\n end \n @page_title = @page.subject.empty? ? @site.page_title : @page.subject\n get_design_and_render @design\nend", "def visited_page(url); end", "def visited_page(url); end", "def pages; end", "def load_item_page\n visit(ITEM_PAGE_URL)\n end", "def create\n @static_page = StaticPage.new(params[:static_page])\n\n respond_to do |format|\n if @static_page.save\n format.html { redirect_to(@static_page, :notice => 'Static page was successfully created.') }\n format.xml { render :xml => @static_page, :status => :created, :location => @static_page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @static_page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def homepage\n end", "def homepage\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def create\n @crawled_site = WebCrawlers.new(\"http://wiprodigital.com/\")\n render :show\n end", "def page_from_static_file(static_file)\n base = static_file.instance_variable_get(\"@base\")\n dir = static_file.instance_variable_get(\"@dir\")\n name = static_file.instance_variable_get(\"@name\")\n page = Jekyll::Page.new(site, base, dir, name)\n page.data[\"layout\"] = nil\n return page\n end", "def homepage\n end", "def homepage\n end", "def create\n @rcadmin_static_page = Rcadmin::StaticPage.new(rcadmin_static_page_params)\n\n respond_to do |format|\n if @rcadmin_static_page.save\n\t\tflash[:notice] = 'Static page was successfully created.'\n format.html { redirect_to rcadmin_static_pages_url, notice: 'Static page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rcadmin_static_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @rcadmin_static_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def pages\n end", "def show\n if should_skip_to_first_child?\n redirect_to refinery.url_for(first_live_child.url) and return\n elsif page.link_url.present?\n redirect_to page.link_url and return\n elsif should_redirect_to_friendly_url?\n redirect_to refinery.url_for(page.url), :status => 301 and return\n end\n\n render_with_templates?\n end", "def show\n if should_skip_to_first_child?\n redirect_to refinery.url_for(first_live_child.url) and return\n elsif page.link_url.present?\n redirect_to page.link_url and return\n elsif should_redirect_to_friendly_url?\n redirect_to refinery.url_for(page.url), :status => 301 and return\n end\n\n render_with_templates?\n end", "def main_page\n find_by(url: 'http://class.rambler.ru/')\n end" ]
[ "0.7374358", "0.7279139", "0.69864595", "0.686534", "0.6844059", "0.6788788", "0.67241484", "0.6723106", "0.66264635", "0.6612763", "0.6612763", "0.6612763", "0.6482587", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.6482501", "0.64597905", "0.6413655", "0.63779896", "0.63779896", "0.6376839", "0.6312099", "0.63091636", "0.62982166", "0.6294716", "0.62608707", "0.6257538", "0.6257538", "0.62524265", "0.6248452", "0.6247515", "0.62391937", "0.6238588", "0.62152064", "0.62044805", "0.6195687", "0.61926603", "0.6176729", "0.6176321", "0.61741894", "0.617176", "0.6158245", "0.6141515", "0.6139359", "0.6130876", "0.6130876", "0.61301875", "0.6129945", "0.61278224", "0.6121857", "0.61144406", "0.61111534", "0.609609", "0.6080392", "0.6068444", "0.6051308", "0.6051002", "0.60442483", "0.60380936", "0.6035551", "0.6031118", "0.6010987", "0.59839267", "0.5968678", "0.5960426", "0.5960426", "0.5956933", "0.5953131", "0.5948296", "0.5947646", "0.59430844", "0.59351754", "0.5933987", "0.5931589", "0.5931589", "0.5931196", "0.59305936", "0.5917388", "0.59155375", "0.59155375", "0.5908129", "0.5908129", "0.5907423", "0.59033716", "0.5899876", "0.5899876", "0.5891097", "0.5890289", "0.58891374", "0.58891374", "0.58856446" ]
0.7803893
0
takes current_page and maximum to produce pagination array
def getPaginationArray(current_page, maximum, window = WINDOW, minimum = 1) return((minimum+window<current_page ? minimum.upto(window).collect : minimum.upto(current_page+window).collect) + (current_page-window > minimum+window ? [".."] : []) + (current_page>minimum+window ? (current_page-window > minimum+window ? current_page-window : minimum+window).upto(current_page+window > maximum ? maximum : current_page+window).collect : [])+(current_page+window+1<maximum-window ? [".."] : [])+(current_page<maximum-2*window ? maximum-window : current_page+window+1).upto(maximum).collect) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginated_pages(current_page, total_pages) # rubocop:disable Metrics/MethodLength\n paginated_pages = []\n pages = prepare_pages(current_page, total_pages)\n pages.each_with_index do |page, index|\n if (pages.size == index + 1) || (pages[index + 1] - page == 1)\n paginated_pages << page\n elsif pages[index + 1] - page == 2\n paginated_pages += [page, page + 1]\n else\n paginated_pages += [page, '...']\n end\n end\n\n paginated_pages\n end", "def create_pagination(pages,controller,current_page)\n pagination = \"\"\n params[:controller] = controller\n current_page = 1 if current_page.nil?\n if pages.length > 1\n pagination << link_to('&lt;', {:params => params.merge('page' => pages.first)}) << \" \"\n end\n if pages.length > 1\n pages.each do |page|\n if (page.number < current_page.to_i+6) && (page.number > current_page.to_i-6)\n if current_page.to_i == page.number\n pagination << page.number.to_s << \" \"\n else\n pagination << link_to(page.number, {:params => params.merge('page' => page)}) << \" \"\n end\n end\n end\n end\n if pages.length > 1\n pagination << link_to('&gt;', {:params => params.merge('page' => pages.last)}) << \" \"\n end\n return pagination\n end", "def pagination(current_page, items_per_page, total_pages)\n index = current_page % items_per_page\n offset = current_page - index\n offset -= items_per_page if index == 0\n 0.upto(items_per_page + 1).map{|p| offset + p }.delete_if{|p| p < 1 || p > total_pages }\n end", "def fleets_paginated_pages(current_page, total_pages)\n return (1..total_pages).to_a unless total_pages > 13\n\n paginated_pages(current_page, total_pages)\n end", "def page\n [[params[:page].to_i, 1].max, total_pages].min\n end", "def pagination_range\n case JSONAPI.configuration.default_paginator\n when :paged\n number = page_params['number'].to_i.nonzero? || 1\n size = page_params['size'].to_i.nonzero? || JSONAPI.configuration.default_page_size\n (number - 1) * size..number * size - 1\n when :offset\n offset = page_params['offset'].to_i.nonzero? || 0\n limit = page_params['limit'].to_i.nonzero? || JSONAPI.configuration.default_page_size\n offset..offset + limit - 1\n else\n paginator.pagination_range(page_params)\n end\n end", "def pagination(items_count, default_per_page: 20,\n maxium_per_page: 100,\n set_header: true)\n items_count = items_count.count if items_count.respond_to? :count\n\n @pagination_per_page = (params[:per_page] || default_per_page).to_i\n @pagination_per_page = maxium_per_page if @pagination_per_page > maxium_per_page\n @pagination_per_page = 1 if @pagination_per_page < 1\n\n items_count = 0 if items_count < 0\n pages_count = (items_count.to_f / @pagination_per_page).ceil\n pages_count = 1 if pages_count < 1\n\n @pagination_items_count = items_count\n @pagination_pages_count = pages_count\n\n @pagination_page = (params[:page] || 1).to_i\n @pagination_page = pages_count if @pagination_page > pages_count\n @pagination_page = 1 if @pagination_page < 1\n\n if current_page > 1\n @pagination_first_page_url = add_or_replace_uri_param(request.url, :page, 1)\n @pagination_prev_page_url = add_or_replace_uri_param(request.url, :page, (current_page > pages_count ? pages_count : current_page - 1))\n end\n\n if current_page < pages_count\n @pagination_next_page_url = add_or_replace_uri_param(request.url, :page, current_page + 1)\n @pagination_last_page_url = add_or_replace_uri_param(request.url, :page, pages_count)\n end\n\n if set_header\n link_headers ||= []\n\n if current_page > 1\n link_headers << \"<#{@pagination_first_page_url}>; rel=\\\"first\\\"\" if @pagination_first_page_url\n link_headers << \"<#{@pagination_prev_page_url}>; rel=\\\"prev\\\"\" if @pagination_prev_page_url\n end\n\n if current_page < pages_count\n link_headers << \"<#{@pagination_next_page_url}>; rel=\\\"next\\\"\" if @pagination_next_page_url\n link_headers << \"<#{@pagination_last_page_url}>; rel=\\\"last\\\"\" if @pagination_last_page_url\n end\n\n link_header = link_headers.join(', ')\n\n if self.respond_to?(:header)\n self.header('Link', link_header)\n self.header('X-Items-Count', items_count.to_s)\n self.header('X-Pages-Count', pages_count.to_s)\n end\n\n if defined?(response) && response.respond_to?(:headers)\n response.headers['Link'] = link_header\n response.headers['X-Items-Count'] = items_count.to_s\n response.headers['X-Pages-Count'] = pages_count.to_s\n end\n end\n end", "def paginate!(curr_page)\n return if !hard_paginate?\n @page = curr_page.to_i\n raise ArgumentError if @page < 1 || @page > total_pages\n adj_page = @page - 1 > 0 ? @page - 1 : 0 \n @prev_page = adj_page > 0 ? adj_page : nil\n @next_page = page < total_pages ? (@page + 1) : nil\n @data.only!(adj_page * per_page..(@page * per_page - 1))\n end", "def paginator\n per_page = @ruhoh.db.config(\"paginator\")[\"per_page\"]\n current_page = master.context[\"page\"]['current_page'].to_i rescue 0\n current_page = current_page.zero? ? 1 : current_page\n offset = (current_page-1)*per_page\n\n page_batch = all[offset, per_page]\n raise \"Page does not exist\" unless page_batch\n page_batch\n end", "def jsonapi_pagination_params\n pagination = params[:page].try(:slice, :number, :size) || {}\n per_page = jsonapi_page_size(pagination)\n num = [1, pagination[:number].to_f.to_i].max\n\n [(num - 1) * per_page, per_page, num]\n end", "def paginator_navigation\n paginator_config = {\"borders\"=>5, \"per_page\"=>10}.merge(config[\"paginator\"] || {})\n page_count = all.length\n total_pages = (page_count.to_f/paginator_config[\"per_page\"]).ceil\n current_page = master.page_data['current_page'].to_i\n current_page = current_page.zero? ? 1 : current_page\n\n left_dots = ((current_page+1)/2).ceil\n right_dots = ((total_pages+current_page)/2).ceil\n borders = paginator_config[\"borders\"]\n\n pages = total_pages.times.select { |i|\n i+1 <= borders || i+1 > total_pages-borders ||\n (i+1 >= current_page-(borders/2).ceil && i+1 <= current_page+(borders/2).ceil) ||\n i+1 == left_dots || i+1 == right_dots\n }.map { |i|\n url = i.zero? && paginator_config[\"root_page\"] ?\n paginator_config[\"root_page\"] : \"#{paginator_config[\"url\"]}/#{i+1}\"\n name = (i+1 > borders) && (i+1 < total_pages-borders) &&\n ((i+1 < current_page-(borders/2).ceil) || (i+1 > current_page+(borders/2).ceil)) &&\n (i+1 == left_dots || i+1 == right_dots) ? '…' : \"#{i+1}\"\n\n {\n \"url\" => ruhoh.to_url(url),\n \"name\" => name,\n \"is_active_page\" => (i+1 == current_page),\n \"title\" => \"#{i+1}\"\n }\n }\n pages\n end", "def pager( page_count, page_current )\n display = [10, page_count].min\n return (1..display) if display < 10\n return (1..10) if page_current < 6\n return ((page_count-10)..page_count) if (page_count - page_current) < 5\n return ((page_current-5)..page_current+5)\n end", "def pages_tail(current_page, total_pages)\n tail = [total_pages - 2, total_pages - 1, total_pages]\n tail += [total_pages - 5, total_pages - 4, total_pages - 3] if current_page >= total_pages - 1\n tail\n end", "def manageable_pagination(options = {})\n current_page = options[:current_page] || 1\n num_pages = options[:num_pages] || 1\n outer_window = options[:outer_window] || 4\n page_param = options[:param_name] || :page\n\n if current_page <= num_pages\n previous_page = current_page - 1\n next_page = current_page + 1\n left_window = ((current_page - outer_window)...current_page).to_a.select{|i| i > 0}\n right_window = ((current_page + 1)..(current_page + outer_window)).to_a.select{|i| i <= num_pages}\n\n elements = []\n\n if 1 != current_page\n # First\n elements << {:value => t(\"manageable.pagination.first\"), :href => params.merge(page_param => 1)}\n\n # Previous\n elements << {:value => t(\"manageable.pagination.previous\"), :href => params.merge(page_param => previous_page)}\n end\n\n # Left Gap\n if left_window.first && left_window.first != 1\n elements << {:value => t(\"manageable.pagination.gap\")}\n end\n\n # Left window\n left_window.each do |i|\n elements << {:value => i, :href => params.merge(page_param => i)}\n end\n\n # Current Page\n elements << {:value => current_page, :html => {:class => \"current\"}}\n\n # Right window\n right_window.each do |i|\n elements << {:value => i, :href => params.merge(page_param => i)}\n end\n\n # Right Gap\n if right_window.last && right_window.last != num_pages\n elements << {:value => t(\"manageable.pagination.gap\")}\n end\n\n if num_pages != current_page\n # Next\n elements << {:value => t(\"manageable.pagination.next\"), :href => params.merge(page_param => next_page)}\n\n # Last\n elements << {:value => t(\"manageable.pagination.last\"), :href => params.merge(page_param => num_pages)}\n end\n\n content_tag :div, :class => \"pagination\" do\n elements.map do |options|\n if options[:href]\n link_to options[:value], options[:href]\n else\n content_tag(:span, options[:value], options[:html])\n end\n end.join.html_safe\n end\n end\n end", "def jsonapi_pagination(resources)\n links = { self: request.base_url + request.fullpath }\n pagination = jsonapi_pagination_meta(resources)\n\n return links if pagination.blank?\n\n original_params = params.except(\n *jsonapi_path_parameters.keys.map(&:to_s)\n ).as_json.with_indifferent_access\n\n original_params[:page] = original_params[:page].dup || {}\n original_url = request.base_url + request.path + '?'\n\n pagination.each do |page_name, number|\n next if page_name == :records\n\n original_params[:page][:number] = number\n links[page_name] = original_url + CGI.unescape(\n original_params.to_query\n )\n end\n\n links\n end", "def paginate_array(apps)\n current_page = page_from_params\n from = (current_page - 1) * page_size\n to = [current_page * page_size, apps.count].min - 1\n\n apps.values_at(from..to)\n end", "def paginator; end", "def max_per_page\n 200\n end", "def max_pages() 1 end", "def displayed_pages(limit = 10, left_offset = -5, right_offset = 4)\n lower, upper = nil, nil\n\n if page + left_offset < 1 || page + right_offset > pages.last\n lower = [page, [pages.last - limit, 0].max + 1].min\n upper = [page + limit - 1, pages.last].min\n else\n lower = page + left_offset\n upper = page + right_offset\n end\n\n (lower..upper).to_a\n end", "def adjustPaging (page, lastPage)\n pages = []\n count = 0\n pageCountDisplay = 3\n # 1 2 <3> 4 5\n if(page - pageCountDisplay > 0 && page + pageCountDisplay <= lastPage)\n i = page - pageCountDisplay + 1\n while count < pageCountDisplay * 2 do #for ($i = $page - $pageCountDisplay + 1; $count < $pageCountDisplay * 2; $i++)\n pages << i\n count += 1\n i += 1\n end\n elsif(page - pageCountDisplay <= 0 && page + pageCountDisplay > lastPage) # <1> 2\n i = 2\n while i <= lastPage - 1 do #for($i = 2; $i <= $lastPage - 1; $i++)\n pages << i\n i += 1\n end\n elsif(page - pageCountDisplay <= 0 && page + pageCountDisplay <= lastPage)# <1> 2 3 4 5\n i = 2\n while i < pageCountDisplay * 2 && i < lastPage do #for ($i = 2; $i < $pageCountDisplay * 2 && $i < $lastPage; $i++)\n pages << i\n i += 1\n end\n elsif(page - pageCountDisplay >= 0 && page + pageCountDisplay > lastPage) # 2 3 4 5 <6>\n i = page - pageCountDisplay + 1\n while i <= lastPage - 1 do # for ($i = $page - $pageCountDisplay + 1; $i <= $lastPage-1; $i++)\n pages << i\n i += 1\n end\n end\n pages\n end", "def prepare_pages(current_page, total_pages)\n pages = pages_head(current_page) + pages_body(current_page) + pages_tail(current_page, total_pages)\n\n pages.uniq.sort.select { |num| num.positive? && num <= total_pages }\n end", "def page_last(current_page, page_size, total_number)\n [current_page * page_size, total_number].min\n end", "def pages\n @pages ||= begin\n from = @page - (@size / 2).ceil\n from = 1 if from < 1\n upto = from + @size - 1\n\n # Correct +from+ and +to+ if +to+ is more than number of pages\n if upto > pages_count\n from -= (upto - pages_count)\n from = 1 if from < 1\n upto = pages_count\n end\n\n (from..upto).to_a\n end\n end", "def paginate(current_page, request = nil)\n changed\n @page_criteria = dbi.paginate(current_page,@per_page,:request => request, :pagination_method => @pagination_method)\n notify_observers(:paginate,self,request)\n @page_criteria\n end", "def paginate opts = {}\n @paginator = true\n page = (opts[:page] || 1).to_i\n per_page = (opts[:per_page] || 20).to_i\n page = 1 if page < 1\n limit( per_page, ( page - 1 ) * per_page )\n end", "def paginate(idx, max, url, &b)\n return '' if max == 0\n url = url.gsub(%r{^/?(.*?)/?$}, '\\1')\n b ||= lambda{}\n link = lambda {|*args|\n i, title, text = args\n \"<a href=\\\"/#{url}/#{i}#{'?' + @query_string if @query_string}\\\" \" +\n \"#{'onclick=\"return false;\"' if (i == idx)} \" +\n \"class=\\\"#{'disabled ' if (i == idx)}#{b.call(i)}\\\" \" +\n \"title=\\\"#{title||\"Go to page #{i}\"}\\\">#{text||i}</a>\"\n }\n res = '<div class=\"nav\">'\n if (idx > 0)\n res << link.call(idx - 1, \"Go to previous page\", \"&#171; Previous\")\n else\n res << \"<a href=\\\"/#{url}/0\\\" onclick=\\\"return false;\\\" \" +\n \"class=\\\"disabled\\\" title=\\\"Disabled\\\">&#171; Previous</a>\"\n end\n if idx < 10\n idx.times {|i| res << link.call(i)}\n else\n (0..2).each {|i| res << link.call(i)}\n res << '&nbsp;&#8230;&nbsp;'\n ((idx-4)...idx).each {|i| res << link.call(i)}\n end\n res << link.call(idx, 'Current Page')\n if idx > (max - 10)\n ((idx+1)...max).each {|i| res << link.call(i)}\n else\n ((idx+1)..(idx+4)).each {|i| res << link.call(i)}\n res << '&nbsp;&#8230;&nbsp;'\n ((max-3)...max).each {|i| res << link.call(i)}\n end\n if (idx < (max - 1))\n res << link.call(idx + 1, \"Go to next page\", \"Next &#187;\")\n else\n res << \"<a href=\\\"/#{url}/#{max-1}\\\" onclick=\\\"return false;\\\" \" +\n \"class=\\\"disabled\\\" title=\\\"Disabled\\\"}\\\">Next &#187;</a>\"\n end\n res << '</div>'\n end", "def page(num = nil, params = {})\n return current_page if num.nil?\n per = params[:limit] || params[:per_page] || limit\n per = per.to_i > 0 ? per.to_i : 1\n start = [num.to_i - 1, 0].max\n add_root from: start * per, size: per\n end", "def pages\n return [*1..@_pages] if @_pages <= 10\n return [*1..8] + [@_pages] if @_page <= 5\n return [1] + [*(@_pages-7)..@_pages] if [*(@_pages-7)..@_pages].include? @_page\n\n [1]+[*(@_page-3)..(@_page+3)]+[@_pages]\n end", "def to\n [page_number * page_size, total].min\n end", "def per_page_list\n [[\"10\"], [\"25\"],[\"50\"],[\"100\"],[\"200\"]]\n end", "def chunk_pagination(options = {})\n page = options[:page] ? options[:page].to_i : 1\n per_page = self.length\n total_entries = options[:total_entries] ? options[:total_entries].to_i : self.length\n left_array = [nil]*(per_page * (page - 1))\n right_array = total_entries > per_page * page ? [nil]*(total_entries - per_page * page) : []\n self.unshift *left_array\n self.push *right_array\n self.paginate(:page => page, :per_page => per_page)\n end", "def paginate\n @max_pages = (@transactions_all.size/TRANSACTIONS_PER_PAGE) + 1\n if(@max_pages == 0)\n @max_pages = 1 # Because @max_pages indexes from 0, if its 0 change it to 1\n end\n\n # Boundary conditions for pages, a user should not be able to paginate under 0 or over the max limit\n if(@page >= @max_pages || @page < 0)\n redirect_to transactions_path\n end\n end", "def current_page\n [results.current_page, results.total_pages].min\n end", "def pagination\n [ :next_page ]\n end", "def current_page\n [(params[:page] || @default_page || 1).to_i, 1].max # ensure positive integer\n end", "def paginator(paginator_range: DEFAULT_PAGINATOR_RANGE)\n range = (1..paginator_range)\n if (@page - paginator_range / 2) > 0 && (@page + paginator_range / 2) <= @pages\n range = ((@page - paginator_range / 2)..(@page + paginator_range / 2))\n elsif (@page - (paginator_range / 2)) > 0 && @page + paginator_range >= @pages\n range = ((@pages - (paginator_range - 1))..@pages)\n end\n range.to_a\n end", "def paginate_items(items)\n paginated_items = items.paginate(paginate_options)\n next_page_exists = paginated_items.length > @limit || paginated_items.next_page\n add_link_header(offset: (offset + 1)) if next_page_exists\n paginated_items[0..(@limit - 1)] # get paginated_collection of length 'limit'\n end", "def page_range\n 1..page_count\n end", "def pagination_numbers(pages, args = {})\n result = safe_empty\n if pages && pages.num_pages > 1\n params = args[:params] ||= {}\n if pages.letter_arg && pages.letter\n params[pages.letter_arg] = pages.letter\n end\n\n num = pages.num_pages\n arg = pages.number_arg\n this = pages.number\n this = 1 if this < 1\n this = num if this > num\n size = args[:window_size] || 5\n from = this - size\n to = this + size\n\n result = []\n pstr = \"« #{:PREV.t}\"\n nstr = \"#{:NEXT.t} »\"\n result << pagination_link(pstr, this - 1, arg, args) if this > 1\n result << pagination_link(1, 1, arg, args) if from > 1\n if from > 2\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n (from..to).each do |n|\n if n == this\n result << content_tag(:li, content_tag(:span, n), class: \"active\")\n elsif n.positive? && n <= num\n result << pagination_link(n, n, arg, args)\n end\n end\n if to < num - 1\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n result << pagination_link(num, num, arg, args) if to < num\n result << pagination_link(nstr, this + 1, arg, args) if this < num\n\n result = content_tag(:ul,\n result.safe_join(\" \"),\n class: \"pagination pagination-sm\")\n end\n result\n end", "def paginate\n paginated?? self : page(1)\n end", "def paginate_at ()\n return 8\n end", "def paginate!(*args) # @private :nodoc:\n options = args.extract_options!\n self.items_per_page = options[:per_page] || 50\n self.current_page = args.first || 1\n self.limit_value = items_per_page\n self.offset_value = items_per_page * (current_page - 1)\n end", "def paginate(num)\n l = sorted_articles\n npages = (l.length - 1) / num\n\n for i in 1..(npages)\n create_old_page \"/page/\", i, npages, num\n end\n end", "def pagination\n Pagination.new( total_items, search_args)\n end", "def paginate\n @max_pages = (@transactions.size/TRANSACTIONS_PER_PAGE) + 1\n if(@max_pages == 0)\n @max_pages = 1 # Because @max_pages indexes from 0, if its 0 change it to 1\n end\n\n # Boundary conditions for pages, a user should not be able to paginate under 0 or over the max limit\n if(@page >= @max_pages || @page < 0)\n redirect_to admin_transactions_path\n end\n end", "def paginator=(_arg0); end", "def paginate(options={})\n page = [options[:page].to_i, 1].max\n per_page = (options[:per_page] || per_page).to_i\n request[:args].update(start: (page - 1) * per_page, hit: per_page)\n self\n end", "def items\n if ( @paginator.items_per_page.kind_of?(Array) )\n @number <= @paginator.items_per_page.size ? @paginator.items_per_page[@number-1] : @paginator.items_per_page.last\n else\n @paginator.items_per_page\n end\n end", "def paginate\n @max_pages = (@accounts.size/ACCOUNTS_PER_PAGE) + 1\n if(@max_pages == 0)\n @max_pages = 1 # Because @max_pages indexes from 0, if its 0 change it to 1\n end\n\n # Boundary conditions for pages, a user should not be able to paginate under 0 or over the max limit\n if(@page >= @max_pages || @page < 0)\n redirect_to admin_accounts_path\n end\n end", "def current_page_record_range\n return (0..0) if @current_page > @page_count\n \n a = 1 + (@current_page - 1) * @page_size\n b = a + @page_size - 1\n b = @pagination_record_count if b > @pagination_record_count\n a..b\n end", "def pages\n [self] + (has_next_page? ? next_page.pages : [])\n end", "def show_pagination\n previous_link = ''\n next_link = ''\n page_num_links = ''\n\n if show_current_page > 1\n previous_page = show_current_page - 1\n previous_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{previous_page.to_s})\") + '\">&laquo; Previous</a></li>'\n else\n previous_link = '<li class=\"disabled\"><a href=\"\">&laquo; Previous</a></li>'\n end\n\n if (show_current_page * show_results_per_page) < show_total_hits\n next_page = show_current_page + 1\n next_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{next_page.to_s})\") +'\">Next &raquo;</a></li>'\n else\n next_link = '<li class=\"disabled\"><a href=\"\">Next &raquo;</a></li>'\n end\n\n if show_current_page >= 4\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(1)\") + '\">1</a></li>'\n end\n if show_current_page >= 5\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n # show links to the two pages the the left and right (where applicable)\n bottom_page = show_current_page - 2\n if bottom_page <= 0\n bottom_page = 1\n end\n top_page = show_current_page + 2\n if top_page >= show_total_pages\n top_page = show_total_pages\n end\n (bottom_page..top_page).each do |i|\n unless i == show_current_page\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{i.to_s})\") + '\">' + i.to_s + '</a></li>'\n else\n page_num_links << '<li class=\"disabled\"><a href=\"\">' + i.to_s + '</a></li>'\n end\n end\n\n if show_total_pages >= (show_current_page + 3)\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n pagination_links = previous_link + next_link + page_num_links\n return pagination_links.html_safe\n end", "def pages_body(current_page)\n (current_page - 3..current_page + 3).to_a\n end", "def pagination\n @pagination ||= WscSdk::Pagination.new()\n end", "def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end", "def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end", "def data_grid_pager(data_grid)\n output = []\n if data_grid.pages < 8\n 1.upto(data_grid.pages){|page_number|\n if data_grid.page == page_number or data_grid.page == 0\n output << \"<li>#{page_number}</li>\"\n else\n output << '<li>' + link_to(page_number, data_grid.params.merge('page_' + data_grid.name => page_number) ) + '</li>'\n end\n }\n else\n if data_grid.page - 4 > 0\n output << '<li>' + link_to(\"1\", data_grid.params.merge('page_' + data_grid.name => 1), :class => 'prev' ) + '</li><li>...</li>'\n end\n 1.upto(data_grid.pages){|page_number|\n if data_grid.page == page_number or data_grid.page == 0\n output << \"<li>#{page_number}</li>\"\n else\n if page_number > data_grid.page - 4 and page_number < data_grid.page + 4\n output << '<li>' + link_to(page_number, data_grid.params.merge('page_' + data_grid.name => page_number) ) + '</li>'\n end\n end\n }\n if data_grid.page + 3 < data_grid.pages\n output << '<li>...</li><li>' + link_to(\"#{data_grid.pages}\",data_grid.params.merge('page_' + data_grid.name => data_grid.pages), :class => 'next' ) + '</li>'\n end\n end\n \n raw(\"<ul class='data_grid_pagination'>\" + output.join(' ') + \"</ul>\")\n end", "def pagination_page_list(pager)\n links = []\n window = (pager.current_page - 2)..(pager.current_page + 2)\n\n window = Range.new(0, window.end - window.begin) if window.begin.negative?\n window = Range.new(window.begin, pager.pages - 1) if window.end >= pager.pages\n\n first_link = pagination_navigate_link(pager, 0, '&laquo;')\n previous_link = pagination_navigate_link(pager, pager.current_page - 1, '&lsaquo;')\n last_link = pagination_navigate_link(pager, pager.pages - 1, '&raquo;')\n next_link = pagination_navigate_link(pager, pager.current_page + 1, '&rsaquo;')\n\n if pager.previous_page?(window.begin)\n links << pagination_non_link('&hellip;', 'disabled')\n end\n\n window.each do |number|\n links << pagination_page_link(number, pager)\n end\n\n if pager.next_page?(window.end)\n links << pagination_non_link('&hellip;', 'disabled')\n end\n\n links.unshift(first_link, previous_link)\n links << next_link\n links << last_link\n\n return content_tag(:div, links.reduce(&:+), class: 'btn-group')\n end", "def paginated(result, params, with = API::Entities::Notification)\n env['auc_pagination_meta'] = params.to_hash\n if result.respond_to?(:count) && result.count > params[:limit]\n env['auc_pagination_meta'][:has_more] = true\n result = result[0, params[:limit]]\n end\n present result, with: with\n end", "def paginate(paginator, args = {})\n instantiate(paginate_ids(paginator), args)\n end", "def pagination_meta(total_count)\n current_page = page_from_params.to_i\n total_pages = (total_count / page_size.to_f).ceil\n {\n count: total_count,\n pagination: {\n current_page: current_page,\n next_page: current_page < total_pages ? current_page + 1 : nil,\n prev_page: current_page > 1 ? current_page - 1 : nil,\n total_pages: total_pages,\n total_count: total_count,\n },\n }\n end", "def page(num)\n limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))\n end", "def paginate(collection_id, options={})\r\n if collection_id.is_a? Array\r\n per_page = options[:per_page] || 10 \r\n parameter = options[:parameter] || 'page'\r\n current_page = params[parameter]\r\n paginator = Paginator.new self,collection_id.size,per_page,current_page \r\n return [paginator,collection_id[paginator.current_page.offset..paginator.current_page.offset+per_page-1]] \r\n end\r\n super(collection_id,options)\r\n end", "def paginate_resources(resources)\n page_number = DEFAULT_PAGE_NUMBER\n per_page = DEFAULT_MIN_PER_PAGE\n\n page_number = params[:page]&.to_i if params[:page].present?\n per_page = params[:per_page]&.to_i if params[:per_page].present?\n\n page_number = DEFAULT_PAGE_NUMBER if page_number < 1\n per_page = DEFAULT_MIN_PER_PAGE if per_page < 1\n per_page = DEFAULT_MAX_PER_PAGE if per_page > DEFAULT_MAX_PER_PAGE\n\n page = resources&.paginate(page: page_number, per_page: per_page)\n [page, build_pagination_meta(page, [page_number, per_page])]\n end", "def paginated_products\n p = self.products.where(:admin_validation => true)\n unless self.page.blank?\n p.page(self.page)\n end\n end", "def page(value)\n\t\t\tl = @params.get(\"limit\") || 1000\n\t\t\tskip((l.to_i * value.to_i) - l.to_i)\n\t\tend", "def max_pages\n if Kaminari.config.respond_to? :max_pages\n nil\n else\n super\n end\n end", "def max_per_page\n nil\n end", "def pagination_links(where, vars = {}, prev_str = nil, next_str = nil, cur_pg_class = nil)\n range_start = MAX.call(@page_number - DEFAULT_PAGE_LINK_RANGE, 1)\n range_end = MIN.call(@page_number + DEFAULT_PAGE_LINK_RANGE, @pages)\n\n prev_str ||= 'Previous'\n next_str ||= 'Next'\n\n links = []\n prev_link = nil\n next_link = nil\n\n # Create links for \"< Previous \" if the current page is not the first\n if @page_number > 1\n prev_link = to_link(to_href(where, vars, page: @page_number - 1), prev_str, 'va-pagination-prev')\n end\n\n # Display a link for \"1 ...\" if the start of the page range >= 2\n if range_start > 1\n links << to_link(to_href(where, vars, page: 1), '1') + ' ...'\n end\n\n # Create links for each page in the ragebut the current page\n (range_start..range_end).each do |i|\n links << if i == @page_number\n %(<a class=\"#{cur_pg_class}\">#{i}</a>)\n else\n to_link(to_href(where, vars, page: i), i)\n end\n end\n\n # Create links for \" ... n\" if the end of the page range <= n\n if range_end < @pages\n links << '... ' + to_link(to_href(where, vars, page: @pages), @pages)\n end\n\n # Create links for \" Next >\" if the current page is not the last\n if @page_number < @pages\n next_link = to_link(to_href(where, vars, page: @page_number + 1), next_str, 'va-pagination-next')\n end\n\n [\n prev_link,\n \"<div class='va-pagination-inner'>\",\n *links,\n '</div>',\n next_link\n ].compact.join(' ')\n end", "def get_all_pages\n list_of_pages = Array.new\n list_of_pages[0] = @current_page\n pos = 1\n while @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n list_of_pages[pos] = @agent.page.links.find { |l| l.text == \"Next →\" }.click\n pos += 1\n end\n list_of_pages\n end", "def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end", "def paginate_songs(limit, offset)\n\t\t@paginated_songs = Array.new\n\t\tsongs.limit(limit).offset(offset).each do |song|\n\t\t\t@paginated_songs << song\n\t\tend\n\tend", "def pageViewer(currentPage)\n first = (currentPage - 1) * $maxPerPage\n # does not include last item\n last = currentPage * $maxPerPage -1\n $ticketArray[first..last].each { |i| puts \"id:#{i['id']}: #{i['subject'].ljust(45)} author:#{i['requester_id']} created:#{i['created_at']}\" }\nend", "def paginate_data(data)\n per_page = data[\"per_page\"] || 0\n current_page = data[\"current_page\"] || 0\n total_entries = data[\"total_entries\"] || 0\n\n # find the first array and use that as the resultset (lame workaround)\n results = data.values.select{|v| v.is_a?(Array)}.first || []\n if results.empty?\n data.delete(\"per_page\")\n data.delete(\"current_page\")\n data.delete(\"total_entries\")\n data.delete(\"type\")\n results = [data.values.first].compact\n end\n\n # define total_entries accessor on result object\n results.instance_eval \"def total_entries; #{total_entries.to_i}; end\"\n\n # define current_page accessor on result object\n results.instance_eval \"def current_page; #{current_page.to_i}; end\"\n\n # define per_page accessor on result object\n results.instance_eval \"def per_page; #{per_page.to_i}; end\"\n\n results\n end", "def jsonapi_paginate(resources)\n offset, limit, _ = jsonapi_pagination_params\n\n if resources.respond_to?(:offset)\n resources = resources.offset(offset).limit(limit)\n else\n original_size = resources.size\n resources = resources[(offset)..(offset + limit - 1)] || []\n\n # Cache the original resources size to be used for pagination meta\n resources.instance_variable_set(:@original_size, original_size)\n end\n\n block_given? ? yield(resources) : resources\n end", "def pages(options={}, page=0, limit=15, do_iterate=false, with_attachments=false)\n $stderr.puts \"[debug] pages(options=#{options}, page=#{page}, limit=#{limit}, do_iterate=#{do_iterate})\" if @debug\n opts = options.dup\n max_rows = max_numrows(opts)\n $stderr.puts \"[debug] pages() max_rows=#{max_rows}\" if @debug\n \n opts[\"limit\"] = limit\n if options.has_key?(\"group\") and options[\"group\"].to_s == \"true\"\n opts.delete(\"reduce\")\n opts.delete(\"include_docs\")\n else\n opts.delete(\"group\")\n opts[\"reduce\"] = \"false\"\n end\n \n yield_skip_page(limit, max_rows, page) do |i_limit, skip, current_page, max_page|\n opts[\"skip\"] = skip\n opts[\"limit\"] = i_limit\n uri = gen_view_uri(opts)\n $stderr.puts \"[debug] pages() uri=#{uri}\" if @debug\n \n resset = YALTools::YaJsonRows.new(@couch, @dbname)\n json = @couch.get(uri)\n json.has_key?(\"rows\") and yield_rows(json[\"rows\"]) do |doc|\n if with_attachments and doc.has_key?(\"_attachments\")\n resset << get_page_with_attachment(doc) \n else\n resset << doc\n end\n end\n if do_iterate\n yield [resset, skip, current_page, max_page ,max_rows]\n else\n return [resset, skip, current_page, max_page ,max_rows]\n end\n end\n ## return [YALTools::YaJsonRows.new(@couch, @dbname), opts[\"skip\"], 0,0,0]\n end", "def paginator(dataset, per_page=PER_PAGE)\n return dataset.all if params[:all] == '1'\n page = (params[:page] || 1).to_i\n page = 1 if page < 1\n @previous_page = true if page > 1\n @page = page\n offset = (page - 1) * per_page\n values = dataset.limit(per_page+1, offset > 0 ? offset : nil).all\n if values.length == per_page+1\n values.pop\n @next_page = true\n end\n values\n end", "def page(query_options={}, page_num=0, limit=15)\n return pages(@default_query_options.merge(query_options), page_num, limit, false, false)\n end", "def set_paging\n if extjs_paging?\n offset = params[:start].to_i\n @page_limit = params[:limit].to_i\n @current_page = (offset / @page_limit) + 1 # start at page 1\n else\n @page_limit = 20 # sync with ExtJS PagingToolbar configuration in view!\n @current_page = 1\n end\n end", "def pagination_options\n { :offset => offset, :limit => per_page } if paginated?\n end", "def pagination_params\n page = params[:page].to_i\n page = 1 unless page > 0\n per = params[:per].to_i\n per = 25 unless per > 0\n {page: page, per: per}\n end", "def do_pagination\n @page_number = 1\n if params[:page] && params[:page].to_i > 0\n @page_number = params[:page].to_i\n end\n @pagination = true\n @pagination_options = { :limit => items_per_page, :offset => (@page_number - 1) * items_per_page }\n @pagination_options = {} if params[:all]\n end", "def extract_pagination_hash(model)\n\n {pagination: {current_page: model.current_page, total_pages: model.total_pages}}#,total_entries: model.total_entries,\n #offset: model.offset}} \n end", "def apply_pagination(data)\n data = data.paginate(page: params[:page], per_page: params[:limit])\n end", "def paginate(collection)\n page_size = params.dig(:page, :size)&.to_i\n page_number = params.dig(:page, :number)&.to_i\n return collection unless page_size && page_number\n\n Jaf::Pagination.filter(collection, size: page_size, number: page_number)\n end", "def paged_nodes\n return @paged_nodes if defined? @paged_nodes\n\n items = sliced_nodes\n\n if first\n if relation_limit(items).nil? || relation_limit(items) > first\n items = items.limit(first)\n end\n end\n\n if last\n if relation_limit(items)\n if last <= relation_limit(items)\n offset = (relation_offset(items) || 0) + (relation_limit(items) - last)\n items = items.offset(offset).limit(last)\n end\n else\n offset = (relation_offset(items) || 0) + relation_count(items) - last\n items = items.offset(offset).limit(last)\n end\n end\n\n if max_page_size && !first && !last\n if relation_limit(items).nil? || relation_limit(items) > max_page_size\n items = items.limit(max_page_size)\n end\n end\n\n @paged_nodes = items\n end", "def page (page = 1)\n\t \tdiff = (page - 1) * 10\n\t \tall.offset(diff).limit(10)\n\t end", "def pagination_page\n @pagination_page\n end", "def page_build(page, page_count, start = 0)\n (start..page_count).map do |i|\n instance_variable_set(\"@page#{ii(i)}\", instance_variable_get(\"@page#{ii(i)}\") + page)\n end\nend", "def get_start_and_end_pagination_intervals(page, result_count)\n intervals = []\n start_interval = (page) ? page.to_i : 1 \n start_interval = (start_interval * 20) - 19\n end_interval = (page) ? page.to_i : 1\n end_interval = (result_count < (end_interval * 20)) ? result_count : (end_interval * 20) \t\t\t\t\n intervals[0] = start_interval\n intervals[1] = end_interval\n intervals\n end", "def pagination_number_list \n (0...page_button_count).to_a.map do |n|\n link_number = n + page_number_offset\n number_span(link_number)\n end.join(' ')\n end", "def compute_pages(count = 1, page = 1, pagesize = PAGE_SIZE)\n pages = [(count.to_f / pagesize).ceil, 1].max\n page = page > pages ? pages : (page < 1 ? 1 : page)\n offset = (page - 1) * pagesize\n { page: page, pages: pages, offset: offset }\nend", "def page_size_with_links\n [10, 25, 50, 100].map do |per_page|\n # do math so that current first item is still on screen.\n # (use zero-based params for talking to GA)\n new_page_number = (@start.div per_page) + 1\n [search_merge('page' => new_page_number, 'per_page' => per_page), per_page]\n end\n end", "def per_page(limit)\n @size = limit.to_i\n @current_page ||= 1\n self\n end", "def page_current_class_cards\n cards = Card.with_class(@current_class)\n page_num = params[:prev] ? last_page_num(cards) : params[:page]\n cards.page(page_num).per_page(8)\n end", "def build_resources(documents, resource_config, page, page_count, document_count, items_per_page)\n if page_count > 0 && page > page_count\n error 400, convert(body_for(:errors,\n \"page (#{page}) must be <= page_count (#{page_count})\"))\n end\n {\n 'previous' => page > 1 ? link_to_page(page - 1) : nil,\n 'next' => page < page_count ? link_to_page(page + 1) : nil,\n 'page_count' => page_count,\n 'page_size' => items_per_page,\n 'document_count' => document_count,\n 'members' => documents.map do |document|\n build_resource(lookup_role(document), document, resource_config)\n end,\n }\n end", "def paginate(scope, options = {}, &block)\n PaginationRenderer.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :remote => false)\n end", "def pagination_to(collection)\n collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value\n end", "def paginate!\n paginated?? nil : page!(1)\n end" ]
[ "0.7356153", "0.727306", "0.7216143", "0.7207415", "0.7133741", "0.6868365", "0.6846854", "0.6814351", "0.6745161", "0.6718364", "0.6591143", "0.65344787", "0.6528539", "0.64752436", "0.6467507", "0.64656174", "0.6465026", "0.64492476", "0.6447451", "0.6426955", "0.6425104", "0.6418327", "0.6410573", "0.6389889", "0.63618845", "0.6333072", "0.6319554", "0.63133305", "0.6305168", "0.6295837", "0.6292951", "0.627876", "0.6270251", "0.62696934", "0.6268637", "0.6264983", "0.6262849", "0.6262325", "0.6252496", "0.62467456", "0.62316465", "0.62242556", "0.6223866", "0.6213846", "0.6203491", "0.6180549", "0.61796033", "0.6159058", "0.6136998", "0.6128", "0.6127354", "0.6126639", "0.6116186", "0.61105376", "0.6088976", "0.60764563", "0.60764563", "0.60730493", "0.60725605", "0.6072295", "0.6054387", "0.60537195", "0.60471916", "0.60441035", "0.6043707", "0.60123736", "0.5999779", "0.59951216", "0.5980251", "0.5970082", "0.59617", "0.5957248", "0.59474623", "0.5945291", "0.59448695", "0.5935674", "0.5924948", "0.5910319", "0.59086245", "0.5906341", "0.5904986", "0.590236", "0.5901877", "0.5900389", "0.589905", "0.58980805", "0.5881119", "0.58806896", "0.5880244", "0.58777916", "0.5874562", "0.5867341", "0.58629113", "0.58599484", "0.58522743", "0.58473814", "0.5834381", "0.58248293", "0.58184516", "0.58181196" ]
0.7689271
0
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new if !@bank_aba_code.nil? && @bank_aba_code.to_s.length > 9 invalid_properties.push('invalid value for "bank_aba_code", the character length must be smaller than or equal to 9.') end if !@bank_account_name.nil? && @bank_account_name.to_s.length > 50 invalid_properties.push('invalid value for "bank_account_name", the character length must be smaller than or equal to 50.') end if !@bank_account_number.nil? && @bank_account_number.to_s.length > 50 invalid_properties.push('invalid value for "bank_account_number", the character length must be smaller than or equal to 50.') end if !@bank_name.nil? && @bank_name.to_s.length > 50 invalid_properties.push('invalid value for "bank_name", the character length must be smaller than or equal to 50.') end if !@customer_tax_id.nil? && @customer_tax_id.to_s.length > 9 invalid_properties.push('invalid value for "customer_tax_id", the character length must be smaller than or equal to 9.') end if !@drivers_license_dob.nil? && @drivers_license_dob.to_s.length > 10 invalid_properties.push('invalid value for "drivers_license_dob", the character length must be smaller than or equal to 10.') end if !@drivers_license_number.nil? && @drivers_license_number.to_s.length > 50 invalid_properties.push('invalid value for "drivers_license_number", the character length must be smaller than or equal to 50.') end if !@drivers_license_state.nil? && @drivers_license_state.to_s.length > 2 invalid_properties.push('invalid value for "drivers_license_state", the character length must be smaller than or equal to 2.') end invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@uuid.nil? && @uuid !~ pattern\n invalid_properties.push(\"invalid value for \\\"uuid\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@vdisk_id.nil? && @vdisk_id !~ pattern\n invalid_properties.push(\"invalid value for \\\"vdisk_id\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @style.nil?\n invalid_properties.push('invalid value for \"style\", style cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if !@name.nil? && @name.to_s.length > 31\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 31.')\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if !@name.nil? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@wwpn.nil? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @is_object_icon.nil?\n invalid_properties.push('invalid value for \"is_object_icon\", is_object_icon cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @input_currency.nil?\n invalid_properties.push('invalid value for \"input_currency\", input_currency cannot be nil.')\n end\n\n if @sender.nil?\n invalid_properties.push('invalid value for \"sender\", sender cannot be nil.')\n end\n\n if @recipients.nil?\n invalid_properties.push('invalid value for \"recipients\", recipients cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @index.nil?\n invalid_properties.push('invalid value for \"index\", index cannot be nil.')\n end\n\n if @orientation.nil?\n invalid_properties.push('invalid value for \"orientation\", orientation cannot be nil.')\n end\n\n if @size.nil?\n invalid_properties.push('invalid value for \"size\", size cannot be nil.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @direction.nil?\n invalid_properties.push('invalid value for \"direction\", direction cannot be nil.')\n end\n\n if @shape.nil?\n invalid_properties.push('invalid value for \"shape\", shape cannot be nil.')\n end\n\n if @linear_angle.nil?\n invalid_properties.push('invalid value for \"linear_angle\", linear_angle cannot be nil.')\n end\n\n if @is_scaled.nil?\n invalid_properties.push('invalid value for \"is_scaled\", is_scaled cannot be nil.')\n end\n\n if @tile_flip.nil?\n invalid_properties.push('invalid value for \"tile_flip\", tile_flip cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @format.nil?\n invalid_properties.push('invalid value for \"format\", format cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end" ]
[ "0.76497203", "0.76497203", "0.76497203", "0.76497203", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7356452", "0.7334807", "0.72685325", "0.7238964", "0.7231359", "0.72258264", "0.7208294", "0.71760833", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241" ]
0.0
-1
Check to see if the all the properties in the model are valid
def valid? return false if !@bank_aba_code.nil? && @bank_aba_code.to_s.length > 9 return false if !@bank_account_name.nil? && @bank_account_name.to_s.length > 50 return false if !@bank_account_number.nil? && @bank_account_number.to_s.length > 50 bank_account_type_validator = EnumAttributeValidator.new('String', ['Checking', 'Savings']) return false unless bank_account_type_validator.valid?(@bank_account_type) return false if !@bank_name.nil? && @bank_name.to_s.length > 50 bank_owner_type_validator = EnumAttributeValidator.new('String', ['Personal', 'Business']) return false unless bank_owner_type_validator.valid?(@bank_owner_type) return false if !@customer_tax_id.nil? && @customer_tax_id.to_s.length > 9 return false if !@drivers_license_dob.nil? && @drivers_license_dob.to_s.length > 10 return false if !@drivers_license_number.nil? && @drivers_license_number.to_s.length > 50 return false if !@drivers_license_state.nil? && @drivers_license_state.to_s.length > 2 true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end", "def valid_attributes?\n true\n end", "def valid_attributes?\n attribute_errors.empty?\n end", "def valid?\n return false if @property_code.nil?\n return false if @property_name.nil?\n return false if @location.nil?\n return false if @total_price.nil?\n return false if @min_daily_rate.nil?\n return true\n end", "def validate_presence_of(klazz, properties)\r\n instance = klazz.new \r\n instance.should_not be_valid\r\n \r\n properties.each do |property| \r\n instance.errors.should be_invalid(property)\r\n err_properties = instance.errors[property]\r\n if err_properties.is_a? Array\r\n err_properties.include?(ActiveRecord::Errors.default_error_messages[:blank]).should be_true\r\n else\r\n err_properties.should == ActiveRecord::Errors.default_error_messages[:blank] \r\n end\r\n end \r\n end", "def validate_attributes!(attributes)\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n raise UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if invalid_properties.size > 0\n end", "def model_valid?\n true\n end", "def model_valid?\n true\n end", "def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end", "def valid?\n validate\n @model.errors.on(:preferences).blank?\n end", "def validate_properties\n if @properties.keys.count > 0\n if @properties.key?(:label)\n unless @properties[:label] =~ /^[a-zA-Z][\\w|\\s]*$/\n raise 'property label validation error'\n end\n end\n\n if @properties.key?(:default_aggregate)\n unless @properties[:default_aggregate] =~ /^max$|^min$|^avg$|^count$/i\n raise 'property default_aggregate validation error'\n end\n end\n end\n end", "def validate_properties\n @properties.each do |property, values|\n valid_values = validate_values(property, values)\n\n if valid_values.is_a?(Array) && valid_values == [] || valid_values.nil?\n @properties.delete(property)\n else\n @properties[property] = valid_values\n end\n end\n end", "def validate\n valid?\n end", "def validate_attributes!(attributes)\n return attributes if attributes.blank?\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n invalid_properties.reject! { |name| self.respond_to?(\"#{name}=\") }\n fail UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if !invalid_properties.empty?\n end", "def is_valid; end", "def valid?\n # TODO validate nested objects\n output = super\n errors.empty? && output\n end", "def property_checks\n errors.add(:base, \"You can't have a Thing without properties\") if property_keys.empty?\n\n self.property_keys.each do |key|\n errors.add(:properties, \"'#{key}' is an invalid property for this List\") unless available_property_keys.include?(key)\n end\n end", "def valid_for_attributes( model, attributes )\n unless model.valid?\n errors = model.errors\n our_errors = Array.new\n errors.each { |attr,error|\n if attributes.include? attr\n our_errors << [attr,error]\n end\n }\n errors.clear\n our_errors.each { |attr,error| errors.add(attr,error) }\n return false unless errors.empty?\n end\n return true\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end", "def valid?\n return false if !super\n return false if @index.nil?\n return false if @orientation.nil?\n orientation_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical'])\n return false unless orientation_validator.valid?(@orientation)\n return false if @size.nil?\n size_validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter'])\n return false unless size_validator.valid?(@size)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture'])\n return false unless type_validator.valid?(@type)\n true\n end", "def validate\n validate_string_attributes\n @relations.map(&:validate)\n end", "def is_valid?\n end", "def run_validations\n true\n end", "def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end", "def checkAttributeRequirements\n if @valid_attributes.empty?\n @error_text = \"No valid attributes found\"\n return false\n elsif (@mandatory_attributes_from_db & @valid_attributes) != @mandatory_attributes_from_db\n missing_attr = @mandatory_attributes_from_db - (@mandatory_attributes_from_db & @valid_attributes)\n\n x_attr_txt = \"\"\n missing_attr.each {|x_attr| x_attr_txt += x_attr[:name] + \", \"}\n @error_text = \"Mandatory attributes #{x_attr_txt[0..-3]} is/are missing\"\n return false\n end\n\n return true\n end", "def validations\n {}\n end", "def validatable?\n true\n end", "def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end", "def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end", "def validate\n validate_root\n validate_associated\n valid?\n end", "def validate\n true\n end", "def valid?\n return false if @id.nil?\n return false if @created.nil?\n return false if @modified.nil?\n return false if @company_name.nil?\n return false if @company_name.to_s.length < 1\n return false if @domain_name.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"active\", \"deactivated\"])\n return false unless state_validator.valid?(@state)\n return false if @billing_email.nil?\n return false if @application_count.nil?\n return false if @user_count.nil?\n return false if @campaigns_active_count.nil?\n return false if @campaigns_inactive_count.nil?\n true\n end", "def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end", "def valid?\n true\n end", "def validate!\n expected_props, required_props = @properties.keys, @required\n\n unless is_a?(Dialect) || is_a?(Template)\n expected_props = expected_props + INHERITED_PROPERTIES.keys\n end\n\n # It has only expected properties (exclude metadata)\n keys = self.keys - [:\"@context\"]\n keys = keys.reject {|k| k.to_s.include?(':')} unless is_a?(Dialect)\n raise \"#{type} has unexpected keys: #{keys - expected_props}\" unless keys.all? {|k| expected_props.include?(k)}\n\n # It has required properties\n raise \"#{type} missing required keys: #{required_props & keys}\" unless (required_props & keys) == required_props\n\n # Every property is valid\n keys.each do |key|\n value = self[key]\n is_valid = case key\n when :columns\n column_names = value.map(&:name)\n value.is_a?(Array) &&\n value.all? {|v| v.is_a?(Column) && v.validate!} &&\n begin\n # The name properties of the column descriptions must be unique within a given table description.\n column_names = value.map(&:name)\n raise \"Columns must have unique names\" if column_names.uniq != column_names\n true\n end\n when :commentPrefix then value.is_a?(String) && value.length == 1\n when :datatype then value.is_a?(String) && DATATYPES.keys.map(&:to_s).include?(value)\n when :default then value.is_a?(String)\n when :delimiter then value.is_a?(String) && value.length == 1\n when :dialect then value.is_a?(Dialect) && value.validate!\n when :doubleQuote then %w(true false 1 0).include?(value.to_s.downcase)\n when :encoding then Encoding.find(value)\n when :foreignKeys\n # An array of foreign key definitions that define how the values from specified columns within this table link to rows within this table or other tables. A foreign key definition is a JSON object with the properties:\n value.is_a?(Array) && value.all? do |fk|\n raise \"Foreign key must be an object\" unless fk.is_a?(Hash)\n columns, reference = fk['columns'], fk['reference']\n raise \"Foreign key missing columns and reference\" unless columns && reference\n raise \"Foreign key has extra entries\" unless fk.keys.length == 2\n raise \"Foreign key must reference columns\" unless Array(columns).all? {|k| self.columns.any? {|c| c.name == k}}\n raise \"Foreign key reference must be an Object\" unless reference.is_a?(Hash)\n\n if reference.has_key?('resource')\n raise \"Foreign key having a resource reference, must not have a schema\" if reference.has_key?('schema')\n # FIXME resource is a URL of a specific resource (table) which must exist\n elsif reference.has_key?('schema')\n # FIXME schema is a URL of a specific schema which must exist\n end\n # FIXME: columns\n true\n end\n when :format then value.is_a?(String)\n when :header then %w(true false 1 0).include?(value.to_s.downcase)\n when :headerColumnCount, :headerRowCount\n value.is_a?(Numeric) && value.integer? && value > 0\n when :length\n # Applications must raise an error if length, maxLength or minLength are specified and the cell value is not a list (ie separator is not specified), a string or one of its subtypes, or a binary value.\n raise \"Use if minLength or maxLength with length requires separator\" if self[:minLength] || self[:maxLength] && !self[:separator]\n raise \"Use of both length and minLength requires they be equal\" unless self.fetch(:minLength, value) == value\n raise \"Use of both length and maxLength requires they be equal\" unless self.fetch(:maxLength, value) == value\n value.is_a?(Numeric) && value.integer? && value > 0\n when :language then BCP47::Language.identify(value)\n when :lineTerminator then value.is_a?(String)\n when :minimum, :maximum, :minInclusive, :maxInclusive, :minExclusive, :maxExclusive\n value.is_a?(Numeric) ||\n RDF::Literal::Date.new(value).valid? ||\n RDF::Literal::Time.new(value).valid? ||\n RDF::Literal::DateTime.new(value).valid?\n when :minLength, :maxLength\n value.is_a?(Numeric) && value.integer? && value > 0\n when :name then value.is_a?(String) && !name.start_with?(\"_\")\n when :notes then value.is_a?(Array) && value.all? {|v| v.is_a?(Hash)}\n when :null then value.is_a?(String)\n when :predicateUrl then Array(value).all? {|v| RDF::URI(v).valid?}\n when :primaryKey\n # A column reference property that holds either a single reference to a column description object or an array of references.\n Array(value).all? do |k|\n self.columns.any? {|c| c.name == k}\n end\n when :quoteChar then value.is_a?(String) && value.length == 1\n when :required then %w(true false 1 0).include?(value.to_s.downcase)\n when :resources then value.is_a?(Array) && value.all? {|v| v.is_a?(Table) && v.validate!}\n when :schema then value.is_a?(Schema) && value.validate!\n when :separator then value.nil? || value.is_a?(String) && value.length == 1\n when :skipInitialSpace then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipBlankRows then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipColumns then value.is_a?(Numeric) && value.integer? && value >= 0\n when :skipRows then value.is_a?(Numeric) && value.integer? && value >= 0\n when :source then %w(json rdf).include?(value)\n when :\"table-direction\" then %w(rtl ltr default).include?(value)\n when :targetFormat, :templateFormat then RDF::URI(value).valid?\n when :templates then value.is_a?(Array) && value.all? {|v| v.is_a?(Template) && v.validate!}\n when :\"text-direction\" then %w(rtl ltr).include?(value)\n when :title then valid_natural_language_property?(value)\n when :trim then %w(true false 1 0 start end).include?(value.to_s.downcase)\n when :urlTemplate then value.is_a?(String)\n when :@id then @id.valid?\n when :@type then value.to_sym == type\n else\n raise \"?!?! shouldn't get here for key #{key}\"\n end\n raise \"#{type} has invalid #{key}: #{value.inspect}\" unless is_valid\n end\n\n self\n end", "def valid?\n return false if @subject_property.nil?\n return false if @proprietorship.nil?\n proprietorship_validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Sole\", \"Joint\"])\n return false unless proprietorship_validator.valid?(@proprietorship)\n return false if @surname.nil?\n return false if @forename.nil?\n return false if @middle_name.nil?\n return true\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless object_type_validator.valid?(@object_type)\n hardware_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless hardware_status_validator.valid?(@hardware_status)\n reason_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless reason_validator.valid?(@reason)\n software_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless software_status_validator.valid?(@software_status)\n status_validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n return false unless status_validator.valid?(@status)\n true && super\n end", "def core_attributes_valid\n core_attributes = [@rateable, @rater, @ratee, @rating_type]\n return if core_attributes.all? { |atr| atr.present? && atr.valid? }\n errors.add('message', 'Not all core attributes present and valid.')\n end", "def valid?\n super\n errors.empty?\n end", "def valid?\n \n if @account_id.nil?\n false\n elsif @campaign_id.nil?\n false\n elsif @csp_id.nil?\n false\n elsif @status.nil?\n false\n elsif @create_date.nil?\n false\n elsif @auto_renewal.nil?\n false\n elsif @brand_id.nil?\n false\n elsif @usecase.nil?\n false\n elsif @sub_usecases.nil?\n false\n elsif @description.nil?\n false\n elsif @embedded_link.nil?\n false\n elsif @embedded_phone.nil?\n false\n elsif @affiliate_marketing.nil?\n false\n elsif @number_pool.nil?\n false\n elsif @age_gated.nil?\n false\n elsif @direct_lending.nil?\n false\n elsif @subscriber_optin.nil?\n false\n elsif @subscriber_optout.nil?\n false\n elsif @subscriber_help.nil?\n false\n elsif @sample1.nil?\n false\n elsif @mock.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\n end", "def valid?(metadata)\n validate.each do |attr|\n return false if metadata[attr.to_sym].nil? || metadata[attr.to_sym].zero?\n end\n end", "def is_valid\n return true\n end", "def validate_attrs\n @target.present? && !@target.errors.any? && @actor.present? && @action_key.present?\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if !@name.nil? && @name.to_s.length > 31\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 31.')\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if !@name.nil? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@wwpn.nil? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "def valid_save?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n if self.general_info.nil? || self.general_info == \"\"\n valid = false\n end\n\n if self.technical_specs.nil? || self.technical_specs == \"\"\n valid = false\n end\n\n if self.where_to_buy.nil? || self.where_to_buy == \"\"\n valid = false\n end\n\n return valid\n end", "def valid?\n schema.validate(self)\n end", "def valid?\n reset_errors\n valid_date?\n valid_user?\n valid_activity_type?\n self.errors.empty?\n end", "def valid?\n validate\n end", "def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend", "def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if !@description.nil? && @description.to_s.length > 255\n true\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless object_type_validator.valid?(@object_type)\n ethernet_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless ethernet_switching_mode_validator.valid?(@ethernet_switching_mode)\n fc_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless fc_switching_mode_validator.valid?(@fc_switching_mode)\n management_mode_validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n return false unless management_mode_validator.valid?(@management_mode)\n thermal_validator = EnumAttributeValidator.new('String', [\"unknown\", \"ok\", \"upper-non-recoverable\", \"upper-critical\", \"upper-non-critical\", \"lower-non-critical\", \"lower-critical\", \"lower-non-recoverable\"])\n return false unless thermal_validator.valid?(@thermal)\n true && super\n end", "def valid?\n\t\t\t\ttrue\n\t\t\tend", "def validate\r\n validate! rescue false\r\n end", "def validate\n validate_string_attributes\n end", "def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end", "def valid\n @valid\n end", "def valid_objects\n all_objects.select { |o| o.valid? }\n end", "def valid?\n return false if @summary.nil?\n return false if @summary.to_s.length > 100\n record_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n return false unless record_type_validator.valid?(@record_type)\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n return false if @company.nil?\n return false if !@site_name.nil? && @site_name.to_s.length > 50\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@contact_phone_number.nil? && @contact_phone_number.to_s.length > 20\n return false if !@contact_phone_extension.nil? && @contact_phone_extension.to_s.length > 15\n return false if !@contact_email_address.nil? && @contact_email_address.to_s.length > 250\n severity_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless severity_validator.valid?(@severity)\n impact_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless impact_validator.valid?(@impact)\n return false if !@external_x_ref.nil? && @external_x_ref.to_s.length > 100\n return false if !@po_number.nil? && @po_number.to_s.length > 50\n return false if !@automatic_email_cc.nil? && @automatic_email_cc.to_s.length > 1000\n sub_billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless sub_billing_method_validator.valid?(@sub_billing_method)\n knowledge_base_link_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\", \"KnowledgeBaseArticle\", \"Time\", \"Activity\"])\n return false unless knowledge_base_link_type_validator.valid?(@knowledge_base_link_type)\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n predecessor_type_validator = EnumAttributeValidator.new('String', [\"Ticket\", \"Phase\"])\n return false unless predecessor_type_validator.valid?(@predecessor_type)\n return true\n end", "def validate!\n true\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if !@name.nil? && @name.to_s.length > 31\n return false if !@name.nil? && @name !~ Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n return false if !@static_wwpn_address.nil? && @static_wwpn_address !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n type_validator = EnumAttributeValidator.new('String', [\"fc-initiator\", \"fc-nvme-initiator\", \"fc-nvme-target\", \"fc-target\"])\n return false unless type_validator.valid?(@type)\n return false if !@wwpn.nil? && @wwpn !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n wwpn_address_type_validator = EnumAttributeValidator.new('String', [\"POOL\", \"STATIC\"])\n return false unless wwpn_address_type_validator.valid?(@wwpn_address_type)\n true && super\n end", "def valid?\n validate_survivors and validate_items && validate_records\n end", "def valid?\n return false if @id.nil?\n return false if @next_send.nil?\n return false if @rrule.nil?\n return false if @session.nil?\n return false if @last_sent.nil?\n return false if @contact_name.nil?\n return false if @parameters.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n return false unless type_validator.valid?(@type)\n return false if @summary.nil?\n return false if @text_parameters.nil?\n return false if @first_occurrence.nil?\n return false if @last_occurrence.nil?\n return false if @recipients_count.nil?\n return false if @timezone.nil?\n return false if @completed.nil?\n return false if @avatar.nil?\n return false if @created_at.nil?\n true\n end", "def valid?\n return false if !@description.nil? && @description.to_s.length > 255\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 17\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if @signatory.nil?\n return false if @signatory.to_s.length > 30\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bank_[a-zA-Z0-9]+$/)\n return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\\/\\/lob-assets\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"bank_account\"])\n return false unless object_validator.valid?(@object)\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n return false if @id.nil?\n return false if @account_id.nil?\n return false if @organization_id.nil?\n return false if @product_id.nil?\n return false if @product_rate_plan_id.nil?\n return false if @name.nil?\n type_validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n return false unless type_validator.valid?(@type)\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n return false unless state_validator.valid?(@state)\n return false if @initial_period_start.nil?\n return false if @trial_end.nil?\n managed_by_validator = EnumAttributeValidator.new('String', [\"BillForward\", \"Stripe\"])\n return false unless managed_by_validator.valid?(@managed_by)\n return false if @version_start.nil?\n return false if @version_number.nil?\n return false if @current_time.nil?\n failed_payment_behaviour_validator = EnumAttributeValidator.new('String', [\"CancelSubscription\", \"None\"])\n return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour)\n return true\n end", "def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @timezone.nil?\n return false if @timezone.to_s.length < 1\n return false if @currency.nil?\n return false if @currency.to_s.length < 1\n case_sensitivity_validator = EnumAttributeValidator.new('String', [\"sensitive\", \"insensitive-uppercase\", \"insensitive-lowercase\"])\n return false unless case_sensitivity_validator.valid?(@case_sensitivity)\n campaign_priority_validator = EnumAttributeValidator.new('String', [\"universal\", \"stackable\", \"exclusive\"])\n return false unless campaign_priority_validator.valid?(@campaign_priority)\n exclusive_campaigns_strategy_validator = EnumAttributeValidator.new('String', [\"listOrder\", \"lowestDiscount\", \"highestDiscount\"])\n return false unless exclusive_campaigns_strategy_validator.valid?(@exclusive_campaigns_strategy)\n default_discount_scope_validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n return false unless default_discount_scope_validator.valid?(@default_discount_scope)\n default_discount_additional_cost_per_item_scope_validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n return false unless default_discount_additional_cost_per_item_scope_validator.valid?(@default_discount_additional_cost_per_item_scope)\n true\n end", "def valid?\n run_validation\n @errors.empty?\n end", "def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end", "def valid?\n return false if @id.nil?\n return false if @token.nil?\n return false if @tipo.nil?\n tipo_validator = EnumAttributeValidator.new('String', ['fatture', 'proforma', 'ordini', 'preventivi', 'ndc'])\n return false unless tipo_validator.valid?(@tipo)\n return false if @nome.nil?\n return false if @indirizzo_via.nil?\n return false if @indirizzo_cap.nil?\n return false if @indirizzo_citta.nil?\n return false if @indirizzo_provincia.nil?\n return false if @paese.nil?\n lingua_validator = EnumAttributeValidator.new('String', ['it', 'en', 'de'])\n return false unless lingua_validator.valid?(@lingua)\n return false if @piva.nil?\n return false if @cf.nil?\n return false if @numero.nil?\n return false if @valuta.nil?\n return false if @valuta_cambio.nil?\n return false if @prezzi_ivati.nil?\n return false if @importo_netto.nil?\n return false if @importo_iva.nil?\n return false if @importo_totale.nil?\n mostra_totali_validator = EnumAttributeValidator.new('String', ['tutti', 'netto', 'nessuno'])\n return false unless mostra_totali_validator.valid?(@mostra_totali)\n return false if @lista_articoli.nil?\n pa_tipo_cliente_validator = EnumAttributeValidator.new('String', ['PA', 'B2B'])\n return false unless pa_tipo_cliente_validator.valid?(@pa_tipo_cliente)\n pa_tipo_validator = EnumAttributeValidator.new('String', ['ordine', 'convenzione', 'contratto', 'nessuno'])\n return false unless pa_tipo_validator.valid?(@pa_tipo)\n pa_esigibilita_validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n return false unless pa_esigibilita_validator.valid?(@pa_esigibilita)\n true\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end", "def validate\n end", "def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@url.nil? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if !@description.nil? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def supports_validations?\n true\n end", "def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n return false if @first_name.nil?\n return false if @first_name.to_s.length > 30\n return false if !@last_name.nil? && @last_name.to_s.length > 30\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state.nil? && @state.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@country.nil? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if !@title.nil? && @title.to_s.length > 100\n return false if !@school.nil? && @school.to_s.length > 50\n return false if !@nick_name.nil? && @nick_name.to_s.length > 30\n return false if !@significant_other.nil? && @significant_other.to_s.length > 30\n return false if !@portal_password.nil? && @portal_password.to_s.length > 15\n return false if !@portal_security_level.nil? && @portal_security_level > 6.0\n return false if !@portal_security_level.nil? && @portal_security_level < 1.0\n gender_validator = EnumAttributeValidator.new('String', [\"Male\", \"Female\"])\n return false unless gender_validator.valid?(@gender)\n presence_validator = EnumAttributeValidator.new('String', [\"Online\", \"DoNotDisturb\", \"Away\", \"Offline\", \"NoAgent\"])\n return false unless presence_validator.valid?(@presence)\n return true\n end", "def validated?; end", "def valid?\n return false if @name.nil?\n return false if @slug.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])\n return false unless status_validator.valid?(@status)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['digital', 'physical'])\n return false unless type_validator.valid?(@type)\n return false if @sku.nil?\n return false if @price.nil?\n availability_validator = EnumAttributeValidator.new('String', ['available', 'comingSoon', 'retired'])\n return false unless availability_validator.valid?(@availability)\n stock_status_validator = EnumAttributeValidator.new('String', ['available', 'alert', 'unavailable'])\n return false unless stock_status_validator.valid?(@stock_status)\n return false if @categories.nil?\n true\n end", "def valid?\n self.valid\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end" ]
[ "0.78992486", "0.78992486", "0.70971805", "0.70782334", "0.7032205", "0.7031276", "0.69510347", "0.6869891", "0.6858077", "0.6858077", "0.68287027", "0.6823878", "0.6820306", "0.68144894", "0.6794656", "0.6752167", "0.66843414", "0.6676546", "0.6667755", "0.66296124", "0.66184515", "0.6608204", "0.6599208", "0.6594276", "0.6584302", "0.6580472", "0.6578095", "0.6558585", "0.6555879", "0.6542414", "0.6536983", "0.6533884", "0.65315515", "0.65311855", "0.65267456", "0.65258855", "0.6520786", "0.65205675", "0.6511026", "0.6498394", "0.64966303", "0.64935124", "0.6491113", "0.64885867", "0.6479024", "0.6473706", "0.64679337", "0.6467217", "0.6461245", "0.64601135", "0.64553183", "0.64540446", "0.6447954", "0.64393955", "0.6434162", "0.64312094", "0.6428205", "0.6426148", "0.6412439", "0.64070046", "0.64044213", "0.6403482", "0.6399368", "0.63979715", "0.63858813", "0.63855004", "0.63855004", "0.63855004", "0.63855004", "0.63740236", "0.6367379", "0.63645166", "0.6362151", "0.63599974", "0.6357385", "0.63549066", "0.63549066", "0.63549066", "0.63549066", "0.6354845", "0.6354207", "0.6350302", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.63435715", "0.63406414", "0.63344824", "0.6333158", "0.63313466", "0.63294095", "0.6327076", "0.63247603", "0.63247603", "0.63247603", "0.63247603" ]
0.0
-1
Custom attribute writer method with validation
def bank_aba_code=(bank_aba_code) if !bank_aba_code.nil? && bank_aba_code.to_s.length > 9 fail ArgumentError, 'invalid value for "bank_aba_code", the character length must be smaller than or equal to 9.' end @bank_aba_code = bank_aba_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Custom attribute writer method with validation
def bank_account_name=(bank_account_name) if !bank_account_name.nil? && bank_account_name.to_s.length > 50 fail ArgumentError, 'invalid value for "bank_account_name", the character length must be smaller than or equal to 50.' end @bank_account_name = bank_account_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attribute(name); end", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def has_attributes?; end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def validate\n validate_string_attributes\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end", "def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end" ]
[ "0.64714426", "0.6314092", "0.6314092", "0.62843996", "0.6279117", "0.6212286", "0.6188891", "0.6179444", "0.6065791", "0.6032525", "0.5996907", "0.5990497", "0.5959816", "0.5938802", "0.59287214", "0.5895985", "0.58595186", "0.5852596", "0.5847984", "0.58444107", "0.58343303", "0.58235955", "0.58229995", "0.57836556", "0.5703459", "0.5696362", "0.5680679", "0.568021", "0.5665294", "0.5655645", "0.5654744", "0.56396836", "0.5619648", "0.5614121", "0.5609959", "0.5599945", "0.5596874", "0.5592224", "0.55861783", "0.55828875", "0.5578926", "0.5567833", "0.5567749", "0.556693", "0.5563338", "0.55633235", "0.5560897", "0.55579615", "0.55579615", "0.55528605", "0.55528605", "0.5537348", "0.5532933", "0.5526811", "0.55265874", "0.5523069", "0.5501535", "0.5497166", "0.5496419", "0.54923123", "0.5464168", "0.5463242", "0.5462326", "0.545007", "0.54497737", "0.54497737", "0.54365075", "0.54297453", "0.54297453", "0.54255736", "0.5418367", "0.5415406", "0.5410525", "0.54069287", "0.54015315", "0.54002845", "0.5399175", "0.5392583", "0.5381682", "0.53771824", "0.5376701", "0.5374139", "0.5370942", "0.53677666", "0.536467", "0.53600067", "0.5359843", "0.5353416", "0.53490984", "0.53480154", "0.5345155", "0.53413296", "0.5327117", "0.5327117", "0.5321078", "0.5321078", "0.5321078", "0.5318564", "0.5317283", "0.53138846", "0.53127176" ]
0.0
-1
Custom attribute writer method with validation
def bank_account_number=(bank_account_number) if !bank_account_number.nil? && bank_account_number.to_s.length > 50 fail ArgumentError, 'invalid value for "bank_account_number", the character length must be smaller than or equal to 50.' end @bank_account_number = bank_account_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Custom attribute writer method checking allowed values (enum).
def bank_account_type=(bank_account_type) validator = EnumAttributeValidator.new('String', ['Checking', 'Savings']) unless validator.valid?(bank_account_type) fail ArgumentError, 'invalid value for "bank_account_type", must be one of #{validator.allowable_values}.' end @bank_account_type = bank_account_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n :validate => true\n }.merge(options)\n\n required = options[:required] == true\n converter = block_given? ? block : Converters.converter_for(:enum, options)\n\n attr_reader_with_converter name, converter, options\n\n validates name,\n :allow_blank => !required,\n :allow_nil => !required,\n :inclusion => { :in => enum.values } if options[:validate]\n\n attr_writer name\n\n add_attr(name, :enum, converter, options)\n end", "def _attribute_enum?(attr)\n return false unless self.class.respond_to?(:defined_enums)\n self.class.defined_enums.with_indifferent_access.include?(attr)\n end", "def nature_of_business=(nature_of_business)\n validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n unless validator.valid?(nature_of_business) || nature_of_business.empty?\n fail ArgumentError, \"invalid value for \\\"nature_of_business\\\", must be one of #{validator.allowable_values}.\"\n end\n @nature_of_business = nature_of_business\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n return false unless type_validator.valid?(@type)\n subtype_validator = EnumAttributeValidator.new('String', ['None', 'Across', 'Bottom', 'BottomLeft', 'BottomRight', 'Center', 'Clockwise', 'CounterClockwise', 'GradualAndCycleClockwise', 'GradualAndCycleCounterClockwise', 'Down', 'DownLeft', 'DownRight', 'FontAllCaps', 'FontBold', 'FontItalic', 'FontShadow', 'FontStrikethrough', 'FontUnderline', 'Gradual', 'Horizontal', 'HorizontalIn', 'HorizontalOut', 'In', 'InBottom', 'InCenter', 'InSlightly', 'Instant', 'Left', 'OrdinalMask', 'Out', 'OutBottom', 'OutCenter', 'OutSlightly', 'Right', 'Slightly', 'Top', 'TopLeft', 'TopRight', 'Up', 'UpLeft', 'UpRight', 'Vertical', 'VerticalIn', 'VerticalOut', 'Wheel1', 'Wheel2', 'Wheel3', 'Wheel4', 'Wheel8'])\n return false unless subtype_validator.valid?(@subtype)\n preset_class_type_validator = EnumAttributeValidator.new('String', ['Entrance', 'Exit', 'Emphasis', 'Path', 'MediaCall', 'OLEActionVerbs'])\n return false unless preset_class_type_validator.valid?(@preset_class_type)\n return false if @shape_index.nil?\n trigger_type_validator = EnumAttributeValidator.new('String', ['AfterPrevious', 'OnClick', 'WithPrevious'])\n return false unless trigger_type_validator.valid?(@trigger_type)\n restart_validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n return false unless restart_validator.valid?(@restart)\n after_animation_type_validator = EnumAttributeValidator.new('String', ['DoNotDim', 'Color', 'HideAfterAnimation', 'HideOnNextMouseClick'])\n return false unless after_animation_type_validator.valid?(@after_animation_type)\n true\n end", "def enum_attr?(name)\n return false unless @enum_attrs\n @enum_attrs.key?(name)\n end", "def classy_enum_attr(attribute, options={})\n enum = (options[:class_name] || options[:enum] || attribute).to_s.camelize.constantize\n allow_blank = options[:allow_blank] || false\n allow_nil = options[:allow_nil] || false\n default = ClassyEnum._normalize_default(options[:default], enum)\n\n # Add ActiveRecord validation to ensure it won't be saved unless it's an option\n validates_inclusion_of attribute,\n in: enum,\n allow_blank: allow_blank,\n allow_nil: allow_nil\n\n # Use a module so that the reader methods can be overridden in classes and\n # use super to get the enum value.\n mod = Module.new do\n\n # Define getter method that returns a ClassyEnum instance\n define_method attribute do\n enum.build(read_attribute(attribute), owner: self)\n end\n\n # Define setter method that accepts string, symbol, instance or class for member\n define_method \"#{attribute}=\" do |value|\n value = ClassyEnum._normalize_value(value, default, (allow_nil || allow_blank))\n super(value)\n end\n\n define_method :save_changed_attribute do |attr_name, arg|\n if attribute.to_s == attr_name.to_s && !attribute_changed?(attr_name)\n arg = enum.build(arg)\n current_value = clone_attribute_value(:read_attribute, attr_name)\n\n if arg != current_value\n if respond_to?(:set_attribute_was, true)\n set_attribute_was(attr_name, enum.build(arg, owner: self))\n else\n changed_attributes[attr_name] = enum.build(current_value, owner: self)\n end\n end\n else\n super(attr_name, arg)\n end\n end\n end\n\n include mod\n\n # Initialize the object with the default value if it is present\n # because this will let you store the default value in the\n # database and make it searchable.\n if default.present?\n after_initialize do\n value = read_attribute(attribute)\n\n if (value.blank? && !(allow_blank || allow_nil)) || (value.nil? && !allow_nil)\n send(\"#{attribute}=\", default)\n end\n end\n end\n\n end", "def is_enum_param(name)\n [\"bookmarkType\", \"order\", \"role\"].include?(name)\n end", "def valid?\n ENUM.include? @type.downcase.to_sym\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end", "def set_enum_attrs(subset)\n raise ArgumentError, \"attrs is not a proper subset of available values\" unless subset.all? { |attr| attrs.include? attr }\n @enum_attrs = subset\n end", "def country=(country)\n validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n unless validator.valid?(country)\n fail ArgumentError, \"invalid value for 'country', must be one of #{validator.allowable_values}.\"\n end\n @country = country\n end", "def check_option!(name, definition)\n case name\n when :values\n raise AttributorException, \"Allowed set of values requires an array. Got (#{definition})\" unless definition.is_a? ::Array\n when :default\n raise AttributorException, \"Default value doesn't have the correct attribute type. Got (#{definition.inspect})\" unless type.valid_type?(definition) || definition.is_a?(Proc)\n options[:default] = load(definition) unless definition.is_a?(Proc)\n when :description\n raise AttributorException, \"Description value must be a string. Got (#{definition})\" unless definition.is_a? ::String\n when :required\n raise AttributorException, 'Required must be a boolean' unless definition == true || definition == false\n raise AttributorException, 'Required cannot be enabled in combination with :default' if definition == true && options.key?(:default)\n when :required_if\n raise AttributorException, 'Required_if must be a String, a Hash definition or a Proc' unless definition.is_a?(::String) || definition.is_a?(::Hash) || definition.is_a?(::Proc)\n raise AttributorException, 'Required_if cannot be specified together with :required' if options[:required]\n when :example\n unless definition.is_a?(::Regexp) || definition.is_a?(::String) || definition.is_a?(::Array) || definition.is_a?(::Proc) || definition.nil? || type.valid_type?(definition)\n raise AttributorException, \"Invalid example type (got: #{definition.class.name}). It must always match the type of the attribute (except if passing Regex that is allowed for some types)\"\n end\n when :custom_data\n raise AttributorException, \"custom_data must be a Hash. Got (#{definition})\" unless definition.is_a?(::Hash)\n else\n return :unknown # unknown option\n end\n\n :ok # passes\n end", "def define_active_enum_write_method(attribute)\n class_eval <<-DEF\n def #{attribute}=(arg)\n if arg.is_a?(Symbol)\n super(self.class.active_enum_for(:#{attribute})[arg])\n else\n super\n end\n end\n DEF\n end", "def check_enum(validation:, key:, schema:)\n return false if !validation[:required] && schema.nil? # Optional and not here, dont check\n return false unless validation[:values]\n return false if validation[:values].include?(schema)\n\n schema = 'nothing' if schema.nil?\n error! key, \"must be one of #{validation[:values].join(', ')}, but was #{schema}\"\n true\n end", "def should_allow_values_for(attribute, *good_values)\n get_options!(good_values)\n good_values.each do |value|\n matcher = allow_value(value).for(attribute)\n should matcher.description do\n assert_accepts matcher, subject\n end\n end\n end", "def validate_exclusion_of(attr); end", "def valid_attribute_types\n\t\treturn self.must_attribute_types |\n\t\t self.may_attribute_types |\n\t\t self.operational_attribute_types\n\tend", "def valid?\n status_validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INACTIVE\"])\n return false unless status_validator.valid?(@status)\n country_validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n return false unless country_validator.valid?(@country)\n currency_validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n return false unless currency_validator.valid?(@currency)\n type_validator = EnumAttributeValidator.new('String', [\"PHYSICAL\", \"MOBILE\"])\n return false unless type_validator.valid?(@type)\n return true\n end", "def update_allowed_values\n self.url_allowed = true if url_required\n self.description_allowed = true if description_required\n self.title_allowed = true if title_required\n\n TagSet::TAG_TYPES.each do |tag_type|\n required = eval(\"#{tag_type}_num_required\") || eval(\"self.#{tag_type}_num_required\") || 0\n allowed = eval(\"#{tag_type}_num_allowed\") || eval(\"self.#{tag_type}_num_allowed\") || 0\n if required > allowed\n eval(\"self.#{tag_type}_num_allowed = required\")\n end\n end\n end", "def test_valid?\n assert_raise( RuntimeError ) { Tui::Model::Enum.new( 'lab1', { }, 1 ) }\n base = Tui::Model::Enum.new( 'lab1', { 'val1' => '1', 'val99' => '99' }, 'val99' )\n assert_false base.valid?( 1 )\n assert_true base.valid?( \"val1\" )\n ex = assert_raise( RuntimeError ) { base.value = 1; }\n assert_equal( 'Invalid value for model type Tui::Model::Enum!', ex.message )\n end", "def validate_may_attributes\n\t\thash = (self.entry || {} ).merge( @values )\n\t\tattributes = hash.keys.map( &:to_sym ).uniq\n\t\tvalid_attributes = self.valid_attribute_oids +\n\t\t\tself.operational_attribute_oids +\n\t\t\tIGNORED_OPERATIONAL_ATTRS\n\n\t\tself.log.debug \"Validating MAY attributes: %p against the list of valid OIDs: %p\" %\n\t\t\t[ attributes, valid_attributes ]\n\t\tunknown_attributes = attributes - valid_attributes\n\t\tunknown_attributes.each do |oid|\n\t\t\tself.errors.add( oid, \"is not allowed by entry's objectClasses\" )\n\t\tend\n\tend", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def validate_range(key, value, enum_values)\n values = value.instance_of?(Array) ? value : [value]\n values.each do |v|\n add_templated_error(key, \"'#{v}' is not a valid setting for '#{template.name_for(key)}'\") unless enum_values.include?(v)\n end\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end", "def allowed_values(value, pdef)\n if(pdef['AllowedValues'].include?(value))\n true\n else\n \"Not an allowed value: #{pdef['AllowedValues'].join(', ')}\"\n end\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def status_enum=(status)\n write_attribute(:status, status)\n end", "def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end", "def valid?\n return false if !super\n status_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Active', 'Resolved', 'Closed'])\n return false unless status_validator.valid?(@status)\n true\n end", "def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end", "def valid?\n return false if !super\n return false if @style.nil?\n style_validator = EnumAttributeValidator.new('String', ['Unknown', 'Percent05', 'Percent10', 'Percent20', 'Percent25', 'Percent30', 'Percent40', 'Percent50', 'Percent60', 'Percent70', 'Percent75', 'Percent80', 'Percent90', 'DarkHorizontal', 'DarkVertical', 'DarkDownwardDiagonal', 'DarkUpwardDiagonal', 'SmallCheckerBoard', 'Trellis', 'LightHorizontal', 'LightVertical', 'LightDownwardDiagonal', 'LightUpwardDiagonal', 'SmallGrid', 'DottedDiamond', 'WideDownwardDiagonal', 'WideUpwardDiagonal', 'DashedUpwardDiagonal', 'DashedDownwardDiagonal', 'NarrowVertical', 'NarrowHorizontal', 'DashedVertical', 'DashedHorizontal', 'LargeConfetti', 'LargeGrid', 'HorizontalBrick', 'LargeCheckerBoard', 'SmallConfetti', 'Zigzag', 'SolidDiamond', 'DiagonalBrick', 'OutlinedDiamond', 'Plaid', 'Sphere', 'Weave', 'DottedGrid', 'Divot', 'Shingle', 'Wave', 'Horizontal', 'Vertical', 'Cross', 'DownwardDiagonal', 'UpwardDiagonal', 'DiagonalCross', 'NotDefined'])\n return false unless style_validator.valid?(@style)\n true\n end", "def enum?(field)\n !!self.enums[field.to_sym]\n end", "def currency=(currency)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n unless validator.valid?(currency)\n fail ArgumentError, \"invalid value for 'currency', must be one of #{validator.allowable_values}.\"\n end\n @currency = currency\n end", "def enum_defined_for?(attribute)\n context = self.eh_params[:enum_contexts][attribute.to_s]\n !!(eh_params[:db_codes][context] && eh_params[:db_codes][context][attribute.to_s])\n # Returns true if the indicated attribute has an enum defined\n end", "def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end", "def type=(type)\n 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 unless validator.valid?(type)\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end", "def compliance=(compliance)\n validator = EnumAttributeValidator.new('String', ['Pdf15', 'PdfA1b'])\n unless validator.valid?(compliance)\n fail ArgumentError, 'invalid value for \"compliance\", must be one of #{validator.allowable_values}.'\n end\n @compliance = compliance\n end", "def supports_polymorphic_enum_handling(attribute_name)\n self.eh_params[:polymorphic_attribute] = \"#{attribute_name}_type\".to_sym\n end", "def should_deny_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"not allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert !instance.valid?, \n \"Expected #{klass} to be invalid when #{attribute} is set to #{display_value}\"\n assert instance.errors.on(attribute.to_sym), \n \"Expected errors on #{attribute} when set to #{display_value}\"\n end\n end\n end\n end\n end", "def enum?\n true\n end", "def kind=(kind)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN\", \"USER_CREATED\", \"INTERNAL\"])\n unless validator.valid?(kind)\n fail ArgumentError, \"invalid value for \\\"kind\\\", must be one of #{validator.allowable_values}.\"\n end\n @kind = kind\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 25\n return false if @based_on.nil?\n based_on_validator = EnumAttributeValidator.new('String', [\"MyCalendar\", \"Customer\", \"AllHours\", \"Custom\"])\n return false unless based_on_validator.valid?(@based_on)\n return false if !@application_order.nil? && @application_order > 32767\n return false if !@application_order.nil? && @application_order < 1\n return false if !@respond_hours.nil? && @respond_hours > 999\n return false if !@respond_hours.nil? && @respond_hours < 0\n return false if !@respond_percent.nil? && @respond_percent > 99999\n return false if !@respond_percent.nil? && @respond_percent < 0\n return false if !@plan_within.nil? && @plan_within > 999\n return false if !@plan_within.nil? && @plan_within < 0\n return false if !@plan_within_percent.nil? && @plan_within_percent > 99999\n return false if !@plan_within_percent.nil? && @plan_within_percent < 0\n return false if !@resolution_hours.nil? && @resolution_hours > 999\n return false if !@resolution_hours.nil? && @resolution_hours < 0\n return false if !@resolution_percent.nil? && @resolution_percent > 99999\n return false if !@resolution_percent.nil? && @resolution_percent < 0\n return true\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 enum?\n false\n end", "def unassignable_value_for(attr)\n case attr.type\n when :integer\n attr.assignable_values.max + 1\n when :string\n assignable_value_for(attr) + '-unassignable'\n else\n raise \"Assignable values for :#{attr.type} attributes not supported\"\n end\n end", "def define_value_methods!\n self.accepted_values.each do |(name, bit)|\n self.meta_class.class_eval <<-FLAG_METHODS\n\n def #{name}\n ((@value || 0) & #{bit}) != 0\n end\n alias :#{name}? :#{name}\n\n def #{name}=(new_value)\n boolean = self.to_boolean(new_value)\n current = self.#{name}\n if boolean ^ current\n self.value = ((@value || 0) ^ #{bit})\n end\n self.#{name}\n end\n\n FLAG_METHODS\n end\n end", "def replace_enumerations_in_hash(attrs, allow_multiple = true) #:nodoc:\n attrs.each do |attr, value|\n if options = enumerator_options_for(attr, value, allow_multiple)\n attrs.delete(attr)\n attrs.merge!(options)\n end\n end\n end", "def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{key}', key)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if elements.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"elements\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n if default.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"default\"')\n end\n\n params = {\n elements: elements,\n required: required,\n default: default,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeEnum\n )\n end", "def as_enum\n # Should look like:\n # enum attribute_name: [\"one\", \"two\"]\n\n if is_enum?\n if (enum_options = properties[:enum_options]).present?\n enum_options_as_hash = Frontier::HashSingleLineDecorator.new array_as_hash(enum_options)\n \"enum #{name}: {#{enum_options_as_hash}}\"\n else\n raise(ArgumentError, \"No enum_options provided for attribute: #{name}\")\n end\n else\n raise(ArgumentError, \"Attempting to display field #{name} as enum, but is #{type}\")\n end\n end", "def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end", "def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end", "def enumeration?\n @is_enumeration ||= @xml.xpath('./xs:restriction/xs:enumeration', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).length > 0\n end", "def pa_esigibilita=(pa_esigibilita)\n validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n unless validator.valid?(pa_esigibilita)\n fail ArgumentError, 'invalid value for \"pa_esigibilita\", must be one of #{validator.allowable_values}.'\n end\n @pa_esigibilita = pa_esigibilita\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end", "def validate_allowed(record)\n unknown = provided(record) - allowed\n\n return if unknown.empty?\n\n record.errors.add(\n options[:attribute],\n \"contains unknown options: #{unknown.join(', ')}\"\n )\n end", "def valid?\n source_validator = EnumAttributeValidator.new('Integer', [\"1\", \"2\"])\n return false unless source_validator.valid?(@source)\n return true\n end", "def valid?(value)\n return false if self == Enum\n return true if value.equal?(LAZY_VALUE)\n self.values.include?(value.to_s)\n end", "def smee=(smee)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(smee)\n fail ArgumentError, \"invalid value for \\\"smee\\\", must be one of #{validator.allowable_values}.\"\n end\n @smee = smee\n end", "def allowed_status\n errors.add(:string, 'must be pending, accepted or declined.') unless %w[pending accepted declined].any?(status)\n end", "def define_active_enum_write_method_multiple(attribute, column)\n class_eval <<-DEF\n def #{attribute}=(args)\n self.#{column} = args.map do |arg|\n self.class.active_enum_get_id_for_#{attribute}(arg)\n end\n end\n DEF\n end", "def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"alert\", \"notification\"])\n return false unless type_validator.valid?(@type)\n priority_validator = EnumAttributeValidator.new('String', [\"P1\", \"P2\", \"P3\", \"P4\", \"P5\"])\n return false unless priority_validator.valid?(@priority)\n return true\n end", "def has_enums?\n !!eh_params[:has_enums]\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n unless validator.valid?(type)\n fail ArgumentError, %Q'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end", "def level=(level)\n validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Inline\", \"Block\", \"Row\", \"Cell\"])\n if level.to_i == 0\n unless validator.valid?(level)\n raise ArgumentError, \"invalid value for 'level', must be one of #{validator.allowable_values}.\"\n end\n @level = level\n else\n @level = validator.allowable_values[level.to_i]\n end\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n return false unless type_validator.valid?(@type)\n true\n end", "def allowed_access_levels\n validator = lambda do |field|\n level = public_send(field) || ENABLED # rubocop:disable GitlabSecurity/PublicSend\n not_allowed = level > ENABLED\n self.errors.add(field, \"cannot have public visibility level\") if not_allowed\n end\n\n (FEATURES - %i(pages)).each {|f| validator.call(\"#{f}_access_level\")}\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Paragraph\", \"Character\", \"Table\", \"List\"])\n if type.to_i == 0\n unless validator.valid?(type)\n raise ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n else\n @type = validator.allowable_values[type.to_i]\n end\n end", "def legal_entity_type=(legal_entity_type)\n validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n unless validator.valid?(legal_entity_type) || legal_entity_type.empty?\n fail ArgumentError, \"invalid value for \\\"legal_entity_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @legal_entity_type = legal_entity_type\n end", "def all_attributes_exists_with_enumerations?(attribute_names)\n exists = all_attributes_exists_without_enumerations?(attribute_names)\n exists ||= attribute_names.all? do |name|\n column_methods_hash.include?(name.to_sym) || reflect_on_enumeration(name)\n end\n end", "def valid_setters\n methods = ScheduledActivity.instance_methods\n @valid_setters ||= methods.select do |m|\n methods.include?(:\"#{m}=\")\n end\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Weekly\", \"BiWeekly\", \"SemiMonthly\", \"Monthly\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end", "def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"ITEM\", \"CATEGORY\", \"ITEM_VARIATION\", \"TAX\", \"DISCOUNT\", \"MODIFIER_LIST\", \"MODIFIER\"])\n return false unless type_validator.valid?(@type)\n return false if @id.nil?\n return false if @id.to_s.length < 1\n return true\n end", "def valid?\n return false if @value.nil?\n change_mode_validator = EnumAttributeValidator.new('String', [\"immediate\", \"delayed\"])\n return false unless change_mode_validator.valid?(@change_mode)\n invoicing_type_validator = EnumAttributeValidator.new('String', [\"Immediate\", \"Aggregated\"])\n return false unless invoicing_type_validator.valid?(@invoicing_type)\n return true\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end", "def class_id=(class_id)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(class_id)\n fail ArgumentError, \"invalid value for \\\"class_id\\\", must be one of #{validator.allowable_values}.\"\n end\n @class_id = class_id\n end", "def assert_white_list_setter(clazz, attr, value, whitelist_clazz)\n instance = clazz.new(attr => value)\n assert_kind_of whitelist_clazz, instance.send(attr)\n assert_equal value, instance.send(attr).value\n end", "def allow_value_matcher; end", "def raise_invalid(value)\n if value.is_a?(Numeric)\n raise EnumError, \"#{value.inspect} is out of bounds of #{self.class.name}\"\n else\n raise EnumError, \"#{value.inspect} is not valid for #{self.class.name}\"\n end\n end", "def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end", "def valid_parameter_for_conditional_formatting\n %i[\n type\n format\n criteria\n value\n minimum\n maximum\n stop_if_true\n min_type\n mid_type\n max_type\n min_value\n mid_value\n max_value\n min_color\n mid_color\n max_color\n bar_color\n bar_negative_color\n bar_negative_color_same\n bar_solid\n bar_border_color\n bar_negative_border_color\n bar_negative_border_color_same\n bar_no_border\n bar_direction\n bar_axis_position\n bar_axis_color\n bar_only\n icon_style\n reverse_icons\n icons_only\n icons\n data_bar_2010\n ]\n end", "def oil_types=(vals = [])\n if vals.is_a?(Array)\n OilTypes.collect {|t| t[1]}.each do |type|\n if vals.member?(type)\n send(type+\"=\",true)\n else\n send(type+\"=\",false)\n end\n end\n end\n end", "def validate_enum_name(name)\n name.gsub(/[-\\s]/, \"_\").sub(/^\\d/, '_\\0')\n end", "def sr_iov=(sr_iov)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(sr_iov)\n fail ArgumentError, \"invalid value for \\\"sr_iov\\\", must be one of #{validator.allowable_values}.\"\n end\n @sr_iov = sr_iov\n end", "def appearance=(appearance)\n validator = EnumAttributeValidator.new('String', [\"Default\", \"BoundingBox\", \"Tags\", \"Hidden\"])\n if appearance.to_i == 0\n unless validator.valid?(appearance)\n raise ArgumentError, \"invalid value for 'appearance', must be one of #{validator.allowable_values}.\"\n end\n @appearance = appearance\n else\n @appearance = validator.allowable_values[appearance.to_i]\n end\n end", "def validate_entities!(enum)\n unless enum.respond_to?(:each)\n raise Errors::InternalError, 'Validation cannot be performed on non-enumerable objects'\n end\n enum.each(&:valid!)\n enum\n rescue ::Occi::Core::Errors::MandatoryArgumentError, ::Occi::Core::Errors::ValidationError => ex\n logger.error \"Validation failed: #{ex.class} #{ex.message}\"\n raise Errors::ValidationError, ex.message\n end", "def attr_bool_writer *symbols\n attr_writer *symbols\n end", "def valid?\n frequency_validator = EnumAttributeValidator.new('String', [\"daily\", \"weekly\", \"monthly\", \"quarterly\", \"yearly\"])\n return false unless frequency_validator.valid?(@frequency)\n return true\n end", "def valid_attributes\n {\n name: \"Unlimited\",\n award_title_name: \"10k Unlimited\",\n scoring_class: \"Freestyle\"\n }\n end", "def should_allow_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert_nil instance.errors.on(attribute), \n \"Expected no errors when #{attribute} is set to #{display_value}, \n instead found error \\\"#{instance.errors.on(attribute)}\\\".\"\n end\n end\n end\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def gr_append_check? obj\n return false if obj.class!=self.class\n return false if !respond_to(\"each\")\n myEnum=to_enum\n objEnum=obj.to_enum\n while true\n begin\n myEle=myEnum.next\n rescue\n return true\n end\n begin\n objEle=objEnum.next\n rescue\n return false\n end\n return false if myEle!=objEle\n end\n return true\n end", "def validate( value )\n raise ReadOnlyException.new(self) unless settable?\n @definition.type.validate(value)\n end", "def valid?\n only_display_validator = EnumAttributeValidator.new('String', [\"DoNotDisplay\", \"Closed30Days\", \"Closed60Days\", \"Closed90Days\", \"Closed120Days\", \"AllClosed\"])\n return false unless only_display_validator.valid?(@only_display)\n return true\n end", "def patrol_scrub=(patrol_scrub)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Enable at End of POST\", \"enabled\"])\n unless validator.valid?(patrol_scrub)\n fail ArgumentError, \"invalid value for \\\"patrol_scrub\\\", must be one of #{validator.allowable_values}.\"\n end\n @patrol_scrub = patrol_scrub\n end", "def _class=(_class)\n validator = EnumAttributeValidator.new('String', [\"Other\", \"Absolute\", \"Possessory\", \"Qualified\", \"Good\"])\n unless validator.valid?(_class)\n fail ArgumentError, \"invalid value for '_class', must be one of #{validator.allowable_values}.\"\n end\n @_class = _class\n end", "def valid?\n return false if !super\n quartile_method_validator = EnumAttributeValidator.new('String', ['Exclusive', 'Inclusive'])\n return false unless quartile_method_validator.valid?(@quartile_method)\n true\n end" ]
[ "0.7088127", "0.64820594", "0.6429773", "0.6227689", "0.61418885", "0.5809922", "0.57507086", "0.5743216", "0.5736045", "0.5708027", "0.57014966", "0.56777334", "0.5601988", "0.55947953", "0.55464065", "0.55371004", "0.55344343", "0.5528221", "0.5434983", "0.54312384", "0.5418137", "0.5379602", "0.53794384", "0.53794384", "0.53653747", "0.53513694", "0.53364015", "0.5330548", "0.5324624", "0.53222466", "0.5307476", "0.53004855", "0.52841866", "0.52784383", "0.52683413", "0.5265264", "0.525289", "0.52094126", "0.5189669", "0.5185224", "0.51700306", "0.5146029", "0.51444733", "0.51369494", "0.5134045", "0.5133414", "0.5130944", "0.51203525", "0.5117331", "0.5108703", "0.5108653", "0.5106191", "0.50937504", "0.50937504", "0.50840217", "0.5082524", "0.5074987", "0.50655115", "0.5064211", "0.505987", "0.50555235", "0.50513357", "0.5044483", "0.5041556", "0.5036054", "0.5031193", "0.5023556", "0.5019361", "0.49934402", "0.4989093", "0.49836317", "0.49754748", "0.49738207", "0.49702868", "0.49647367", "0.49602023", "0.4959052", "0.49577102", "0.49549797", "0.49535498", "0.49489576", "0.49489233", "0.4943718", "0.494183", "0.494042", "0.4935984", "0.49353147", "0.4934332", "0.49269903", "0.49202663", "0.49195725", "0.49171844", "0.49135497", "0.49132174", "0.4910008", "0.49098906", "0.49096495", "0.49090025", "0.49080157", "0.49024847", "0.49014568" ]
0.0
-1
Custom attribute writer method with validation
def bank_name=(bank_name) if !bank_name.nil? && bank_name.to_s.length > 50 fail ArgumentError, 'invalid value for "bank_name", the character length must be smaller than or equal to 50.' end @bank_name = bank_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Custom attribute writer method checking allowed values (enum).
def bank_owner_type=(bank_owner_type) validator = EnumAttributeValidator.new('String', ['Personal', 'Business']) unless validator.valid?(bank_owner_type) fail ArgumentError, 'invalid value for "bank_owner_type", must be one of #{validator.allowable_values}.' end @bank_owner_type = bank_owner_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n :validate => true\n }.merge(options)\n\n required = options[:required] == true\n converter = block_given? ? block : Converters.converter_for(:enum, options)\n\n attr_reader_with_converter name, converter, options\n\n validates name,\n :allow_blank => !required,\n :allow_nil => !required,\n :inclusion => { :in => enum.values } if options[:validate]\n\n attr_writer name\n\n add_attr(name, :enum, converter, options)\n end", "def _attribute_enum?(attr)\n return false unless self.class.respond_to?(:defined_enums)\n self.class.defined_enums.with_indifferent_access.include?(attr)\n end", "def nature_of_business=(nature_of_business)\n validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n unless validator.valid?(nature_of_business) || nature_of_business.empty?\n fail ArgumentError, \"invalid value for \\\"nature_of_business\\\", must be one of #{validator.allowable_values}.\"\n end\n @nature_of_business = nature_of_business\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n return false unless type_validator.valid?(@type)\n subtype_validator = EnumAttributeValidator.new('String', ['None', 'Across', 'Bottom', 'BottomLeft', 'BottomRight', 'Center', 'Clockwise', 'CounterClockwise', 'GradualAndCycleClockwise', 'GradualAndCycleCounterClockwise', 'Down', 'DownLeft', 'DownRight', 'FontAllCaps', 'FontBold', 'FontItalic', 'FontShadow', 'FontStrikethrough', 'FontUnderline', 'Gradual', 'Horizontal', 'HorizontalIn', 'HorizontalOut', 'In', 'InBottom', 'InCenter', 'InSlightly', 'Instant', 'Left', 'OrdinalMask', 'Out', 'OutBottom', 'OutCenter', 'OutSlightly', 'Right', 'Slightly', 'Top', 'TopLeft', 'TopRight', 'Up', 'UpLeft', 'UpRight', 'Vertical', 'VerticalIn', 'VerticalOut', 'Wheel1', 'Wheel2', 'Wheel3', 'Wheel4', 'Wheel8'])\n return false unless subtype_validator.valid?(@subtype)\n preset_class_type_validator = EnumAttributeValidator.new('String', ['Entrance', 'Exit', 'Emphasis', 'Path', 'MediaCall', 'OLEActionVerbs'])\n return false unless preset_class_type_validator.valid?(@preset_class_type)\n return false if @shape_index.nil?\n trigger_type_validator = EnumAttributeValidator.new('String', ['AfterPrevious', 'OnClick', 'WithPrevious'])\n return false unless trigger_type_validator.valid?(@trigger_type)\n restart_validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n return false unless restart_validator.valid?(@restart)\n after_animation_type_validator = EnumAttributeValidator.new('String', ['DoNotDim', 'Color', 'HideAfterAnimation', 'HideOnNextMouseClick'])\n return false unless after_animation_type_validator.valid?(@after_animation_type)\n true\n end", "def enum_attr?(name)\n return false unless @enum_attrs\n @enum_attrs.key?(name)\n end", "def classy_enum_attr(attribute, options={})\n enum = (options[:class_name] || options[:enum] || attribute).to_s.camelize.constantize\n allow_blank = options[:allow_blank] || false\n allow_nil = options[:allow_nil] || false\n default = ClassyEnum._normalize_default(options[:default], enum)\n\n # Add ActiveRecord validation to ensure it won't be saved unless it's an option\n validates_inclusion_of attribute,\n in: enum,\n allow_blank: allow_blank,\n allow_nil: allow_nil\n\n # Use a module so that the reader methods can be overridden in classes and\n # use super to get the enum value.\n mod = Module.new do\n\n # Define getter method that returns a ClassyEnum instance\n define_method attribute do\n enum.build(read_attribute(attribute), owner: self)\n end\n\n # Define setter method that accepts string, symbol, instance or class for member\n define_method \"#{attribute}=\" do |value|\n value = ClassyEnum._normalize_value(value, default, (allow_nil || allow_blank))\n super(value)\n end\n\n define_method :save_changed_attribute do |attr_name, arg|\n if attribute.to_s == attr_name.to_s && !attribute_changed?(attr_name)\n arg = enum.build(arg)\n current_value = clone_attribute_value(:read_attribute, attr_name)\n\n if arg != current_value\n if respond_to?(:set_attribute_was, true)\n set_attribute_was(attr_name, enum.build(arg, owner: self))\n else\n changed_attributes[attr_name] = enum.build(current_value, owner: self)\n end\n end\n else\n super(attr_name, arg)\n end\n end\n end\n\n include mod\n\n # Initialize the object with the default value if it is present\n # because this will let you store the default value in the\n # database and make it searchable.\n if default.present?\n after_initialize do\n value = read_attribute(attribute)\n\n if (value.blank? && !(allow_blank || allow_nil)) || (value.nil? && !allow_nil)\n send(\"#{attribute}=\", default)\n end\n end\n end\n\n end", "def is_enum_param(name)\n [\"bookmarkType\", \"order\", \"role\"].include?(name)\n end", "def valid?\n ENUM.include? @type.downcase.to_sym\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end", "def set_enum_attrs(subset)\n raise ArgumentError, \"attrs is not a proper subset of available values\" unless subset.all? { |attr| attrs.include? attr }\n @enum_attrs = subset\n end", "def country=(country)\n validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n unless validator.valid?(country)\n fail ArgumentError, \"invalid value for 'country', must be one of #{validator.allowable_values}.\"\n end\n @country = country\n end", "def check_option!(name, definition)\n case name\n when :values\n raise AttributorException, \"Allowed set of values requires an array. Got (#{definition})\" unless definition.is_a? ::Array\n when :default\n raise AttributorException, \"Default value doesn't have the correct attribute type. Got (#{definition.inspect})\" unless type.valid_type?(definition) || definition.is_a?(Proc)\n options[:default] = load(definition) unless definition.is_a?(Proc)\n when :description\n raise AttributorException, \"Description value must be a string. Got (#{definition})\" unless definition.is_a? ::String\n when :required\n raise AttributorException, 'Required must be a boolean' unless definition == true || definition == false\n raise AttributorException, 'Required cannot be enabled in combination with :default' if definition == true && options.key?(:default)\n when :required_if\n raise AttributorException, 'Required_if must be a String, a Hash definition or a Proc' unless definition.is_a?(::String) || definition.is_a?(::Hash) || definition.is_a?(::Proc)\n raise AttributorException, 'Required_if cannot be specified together with :required' if options[:required]\n when :example\n unless definition.is_a?(::Regexp) || definition.is_a?(::String) || definition.is_a?(::Array) || definition.is_a?(::Proc) || definition.nil? || type.valid_type?(definition)\n raise AttributorException, \"Invalid example type (got: #{definition.class.name}). It must always match the type of the attribute (except if passing Regex that is allowed for some types)\"\n end\n when :custom_data\n raise AttributorException, \"custom_data must be a Hash. Got (#{definition})\" unless definition.is_a?(::Hash)\n else\n return :unknown # unknown option\n end\n\n :ok # passes\n end", "def define_active_enum_write_method(attribute)\n class_eval <<-DEF\n def #{attribute}=(arg)\n if arg.is_a?(Symbol)\n super(self.class.active_enum_for(:#{attribute})[arg])\n else\n super\n end\n end\n DEF\n end", "def check_enum(validation:, key:, schema:)\n return false if !validation[:required] && schema.nil? # Optional and not here, dont check\n return false unless validation[:values]\n return false if validation[:values].include?(schema)\n\n schema = 'nothing' if schema.nil?\n error! key, \"must be one of #{validation[:values].join(', ')}, but was #{schema}\"\n true\n end", "def should_allow_values_for(attribute, *good_values)\n get_options!(good_values)\n good_values.each do |value|\n matcher = allow_value(value).for(attribute)\n should matcher.description do\n assert_accepts matcher, subject\n end\n end\n end", "def validate_exclusion_of(attr); end", "def valid_attribute_types\n\t\treturn self.must_attribute_types |\n\t\t self.may_attribute_types |\n\t\t self.operational_attribute_types\n\tend", "def valid?\n status_validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INACTIVE\"])\n return false unless status_validator.valid?(@status)\n country_validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n return false unless country_validator.valid?(@country)\n currency_validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n return false unless currency_validator.valid?(@currency)\n type_validator = EnumAttributeValidator.new('String', [\"PHYSICAL\", \"MOBILE\"])\n return false unless type_validator.valid?(@type)\n return true\n end", "def update_allowed_values\n self.url_allowed = true if url_required\n self.description_allowed = true if description_required\n self.title_allowed = true if title_required\n\n TagSet::TAG_TYPES.each do |tag_type|\n required = eval(\"#{tag_type}_num_required\") || eval(\"self.#{tag_type}_num_required\") || 0\n allowed = eval(\"#{tag_type}_num_allowed\") || eval(\"self.#{tag_type}_num_allowed\") || 0\n if required > allowed\n eval(\"self.#{tag_type}_num_allowed = required\")\n end\n end\n end", "def test_valid?\n assert_raise( RuntimeError ) { Tui::Model::Enum.new( 'lab1', { }, 1 ) }\n base = Tui::Model::Enum.new( 'lab1', { 'val1' => '1', 'val99' => '99' }, 'val99' )\n assert_false base.valid?( 1 )\n assert_true base.valid?( \"val1\" )\n ex = assert_raise( RuntimeError ) { base.value = 1; }\n assert_equal( 'Invalid value for model type Tui::Model::Enum!', ex.message )\n end", "def validate_may_attributes\n\t\thash = (self.entry || {} ).merge( @values )\n\t\tattributes = hash.keys.map( &:to_sym ).uniq\n\t\tvalid_attributes = self.valid_attribute_oids +\n\t\t\tself.operational_attribute_oids +\n\t\t\tIGNORED_OPERATIONAL_ATTRS\n\n\t\tself.log.debug \"Validating MAY attributes: %p against the list of valid OIDs: %p\" %\n\t\t\t[ attributes, valid_attributes ]\n\t\tunknown_attributes = attributes - valid_attributes\n\t\tunknown_attributes.each do |oid|\n\t\t\tself.errors.add( oid, \"is not allowed by entry's objectClasses\" )\n\t\tend\n\tend", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def validate_range(key, value, enum_values)\n values = value.instance_of?(Array) ? value : [value]\n values.each do |v|\n add_templated_error(key, \"'#{v}' is not a valid setting for '#{template.name_for(key)}'\") unless enum_values.include?(v)\n end\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end", "def allowed_values(value, pdef)\n if(pdef['AllowedValues'].include?(value))\n true\n else\n \"Not an allowed value: #{pdef['AllowedValues'].join(', ')}\"\n end\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def status_enum=(status)\n write_attribute(:status, status)\n end", "def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end", "def valid?\n return false if !super\n status_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Active', 'Resolved', 'Closed'])\n return false unless status_validator.valid?(@status)\n true\n end", "def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end", "def valid?\n return false if !super\n return false if @style.nil?\n style_validator = EnumAttributeValidator.new('String', ['Unknown', 'Percent05', 'Percent10', 'Percent20', 'Percent25', 'Percent30', 'Percent40', 'Percent50', 'Percent60', 'Percent70', 'Percent75', 'Percent80', 'Percent90', 'DarkHorizontal', 'DarkVertical', 'DarkDownwardDiagonal', 'DarkUpwardDiagonal', 'SmallCheckerBoard', 'Trellis', 'LightHorizontal', 'LightVertical', 'LightDownwardDiagonal', 'LightUpwardDiagonal', 'SmallGrid', 'DottedDiamond', 'WideDownwardDiagonal', 'WideUpwardDiagonal', 'DashedUpwardDiagonal', 'DashedDownwardDiagonal', 'NarrowVertical', 'NarrowHorizontal', 'DashedVertical', 'DashedHorizontal', 'LargeConfetti', 'LargeGrid', 'HorizontalBrick', 'LargeCheckerBoard', 'SmallConfetti', 'Zigzag', 'SolidDiamond', 'DiagonalBrick', 'OutlinedDiamond', 'Plaid', 'Sphere', 'Weave', 'DottedGrid', 'Divot', 'Shingle', 'Wave', 'Horizontal', 'Vertical', 'Cross', 'DownwardDiagonal', 'UpwardDiagonal', 'DiagonalCross', 'NotDefined'])\n return false unless style_validator.valid?(@style)\n true\n end", "def enum?(field)\n !!self.enums[field.to_sym]\n end", "def currency=(currency)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n unless validator.valid?(currency)\n fail ArgumentError, \"invalid value for 'currency', must be one of #{validator.allowable_values}.\"\n end\n @currency = currency\n end", "def enum_defined_for?(attribute)\n context = self.eh_params[:enum_contexts][attribute.to_s]\n !!(eh_params[:db_codes][context] && eh_params[:db_codes][context][attribute.to_s])\n # Returns true if the indicated attribute has an enum defined\n end", "def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end", "def type=(type)\n 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 unless validator.valid?(type)\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end", "def compliance=(compliance)\n validator = EnumAttributeValidator.new('String', ['Pdf15', 'PdfA1b'])\n unless validator.valid?(compliance)\n fail ArgumentError, 'invalid value for \"compliance\", must be one of #{validator.allowable_values}.'\n end\n @compliance = compliance\n end", "def supports_polymorphic_enum_handling(attribute_name)\n self.eh_params[:polymorphic_attribute] = \"#{attribute_name}_type\".to_sym\n end", "def should_deny_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"not allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert !instance.valid?, \n \"Expected #{klass} to be invalid when #{attribute} is set to #{display_value}\"\n assert instance.errors.on(attribute.to_sym), \n \"Expected errors on #{attribute} when set to #{display_value}\"\n end\n end\n end\n end\n end", "def enum?\n true\n end", "def kind=(kind)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN\", \"USER_CREATED\", \"INTERNAL\"])\n unless validator.valid?(kind)\n fail ArgumentError, \"invalid value for \\\"kind\\\", must be one of #{validator.allowable_values}.\"\n end\n @kind = kind\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 25\n return false if @based_on.nil?\n based_on_validator = EnumAttributeValidator.new('String', [\"MyCalendar\", \"Customer\", \"AllHours\", \"Custom\"])\n return false unless based_on_validator.valid?(@based_on)\n return false if !@application_order.nil? && @application_order > 32767\n return false if !@application_order.nil? && @application_order < 1\n return false if !@respond_hours.nil? && @respond_hours > 999\n return false if !@respond_hours.nil? && @respond_hours < 0\n return false if !@respond_percent.nil? && @respond_percent > 99999\n return false if !@respond_percent.nil? && @respond_percent < 0\n return false if !@plan_within.nil? && @plan_within > 999\n return false if !@plan_within.nil? && @plan_within < 0\n return false if !@plan_within_percent.nil? && @plan_within_percent > 99999\n return false if !@plan_within_percent.nil? && @plan_within_percent < 0\n return false if !@resolution_hours.nil? && @resolution_hours > 999\n return false if !@resolution_hours.nil? && @resolution_hours < 0\n return false if !@resolution_percent.nil? && @resolution_percent > 99999\n return false if !@resolution_percent.nil? && @resolution_percent < 0\n return true\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 enum?\n false\n end", "def unassignable_value_for(attr)\n case attr.type\n when :integer\n attr.assignable_values.max + 1\n when :string\n assignable_value_for(attr) + '-unassignable'\n else\n raise \"Assignable values for :#{attr.type} attributes not supported\"\n end\n end", "def define_value_methods!\n self.accepted_values.each do |(name, bit)|\n self.meta_class.class_eval <<-FLAG_METHODS\n\n def #{name}\n ((@value || 0) & #{bit}) != 0\n end\n alias :#{name}? :#{name}\n\n def #{name}=(new_value)\n boolean = self.to_boolean(new_value)\n current = self.#{name}\n if boolean ^ current\n self.value = ((@value || 0) ^ #{bit})\n end\n self.#{name}\n end\n\n FLAG_METHODS\n end\n end", "def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{key}', key)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if elements.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"elements\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n if default.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"default\"')\n end\n\n params = {\n elements: elements,\n required: required,\n default: default,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeEnum\n )\n end", "def replace_enumerations_in_hash(attrs, allow_multiple = true) #:nodoc:\n attrs.each do |attr, value|\n if options = enumerator_options_for(attr, value, allow_multiple)\n attrs.delete(attr)\n attrs.merge!(options)\n end\n end\n end", "def as_enum\n # Should look like:\n # enum attribute_name: [\"one\", \"two\"]\n\n if is_enum?\n if (enum_options = properties[:enum_options]).present?\n enum_options_as_hash = Frontier::HashSingleLineDecorator.new array_as_hash(enum_options)\n \"enum #{name}: {#{enum_options_as_hash}}\"\n else\n raise(ArgumentError, \"No enum_options provided for attribute: #{name}\")\n end\n else\n raise(ArgumentError, \"Attempting to display field #{name} as enum, but is #{type}\")\n end\n end", "def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end", "def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end", "def enumeration?\n @is_enumeration ||= @xml.xpath('./xs:restriction/xs:enumeration', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).length > 0\n end", "def pa_esigibilita=(pa_esigibilita)\n validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n unless validator.valid?(pa_esigibilita)\n fail ArgumentError, 'invalid value for \"pa_esigibilita\", must be one of #{validator.allowable_values}.'\n end\n @pa_esigibilita = pa_esigibilita\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def validate_allowed(record)\n unknown = provided(record) - allowed\n\n return if unknown.empty?\n\n record.errors.add(\n options[:attribute],\n \"contains unknown options: #{unknown.join(', ')}\"\n )\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end", "def valid?\n source_validator = EnumAttributeValidator.new('Integer', [\"1\", \"2\"])\n return false unless source_validator.valid?(@source)\n return true\n end", "def valid?(value)\n return false if self == Enum\n return true if value.equal?(LAZY_VALUE)\n self.values.include?(value.to_s)\n end", "def smee=(smee)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(smee)\n fail ArgumentError, \"invalid value for \\\"smee\\\", must be one of #{validator.allowable_values}.\"\n end\n @smee = smee\n end", "def allowed_status\n errors.add(:string, 'must be pending, accepted or declined.') unless %w[pending accepted declined].any?(status)\n end", "def define_active_enum_write_method_multiple(attribute, column)\n class_eval <<-DEF\n def #{attribute}=(args)\n self.#{column} = args.map do |arg|\n self.class.active_enum_get_id_for_#{attribute}(arg)\n end\n end\n DEF\n end", "def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"alert\", \"notification\"])\n return false unless type_validator.valid?(@type)\n priority_validator = EnumAttributeValidator.new('String', [\"P1\", \"P2\", \"P3\", \"P4\", \"P5\"])\n return false unless priority_validator.valid?(@priority)\n return true\n end", "def has_enums?\n !!eh_params[:has_enums]\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n unless validator.valid?(type)\n fail ArgumentError, %Q'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end", "def level=(level)\n validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Inline\", \"Block\", \"Row\", \"Cell\"])\n if level.to_i == 0\n unless validator.valid?(level)\n raise ArgumentError, \"invalid value for 'level', must be one of #{validator.allowable_values}.\"\n end\n @level = level\n else\n @level = validator.allowable_values[level.to_i]\n end\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n return false unless type_validator.valid?(@type)\n true\n end", "def allowed_access_levels\n validator = lambda do |field|\n level = public_send(field) || ENABLED # rubocop:disable GitlabSecurity/PublicSend\n not_allowed = level > ENABLED\n self.errors.add(field, \"cannot have public visibility level\") if not_allowed\n end\n\n (FEATURES - %i(pages)).each {|f| validator.call(\"#{f}_access_level\")}\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Paragraph\", \"Character\", \"Table\", \"List\"])\n if type.to_i == 0\n unless validator.valid?(type)\n raise ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n else\n @type = validator.allowable_values[type.to_i]\n end\n end", "def legal_entity_type=(legal_entity_type)\n validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n unless validator.valid?(legal_entity_type) || legal_entity_type.empty?\n fail ArgumentError, \"invalid value for \\\"legal_entity_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @legal_entity_type = legal_entity_type\n end", "def all_attributes_exists_with_enumerations?(attribute_names)\n exists = all_attributes_exists_without_enumerations?(attribute_names)\n exists ||= attribute_names.all? do |name|\n column_methods_hash.include?(name.to_sym) || reflect_on_enumeration(name)\n end\n end", "def valid_setters\n methods = ScheduledActivity.instance_methods\n @valid_setters ||= methods.select do |m|\n methods.include?(:\"#{m}=\")\n end\n end", "def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"ITEM\", \"CATEGORY\", \"ITEM_VARIATION\", \"TAX\", \"DISCOUNT\", \"MODIFIER_LIST\", \"MODIFIER\"])\n return false unless type_validator.valid?(@type)\n return false if @id.nil?\n return false if @id.to_s.length < 1\n return true\n end", "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Weekly\", \"BiWeekly\", \"SemiMonthly\", \"Monthly\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end", "def valid?\n return false if @value.nil?\n change_mode_validator = EnumAttributeValidator.new('String', [\"immediate\", \"delayed\"])\n return false unless change_mode_validator.valid?(@change_mode)\n invoicing_type_validator = EnumAttributeValidator.new('String', [\"Immediate\", \"Aggregated\"])\n return false unless invoicing_type_validator.valid?(@invoicing_type)\n return true\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end", "def class_id=(class_id)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(class_id)\n fail ArgumentError, \"invalid value for \\\"class_id\\\", must be one of #{validator.allowable_values}.\"\n end\n @class_id = class_id\n end", "def allow_value_matcher; end", "def assert_white_list_setter(clazz, attr, value, whitelist_clazz)\n instance = clazz.new(attr => value)\n assert_kind_of whitelist_clazz, instance.send(attr)\n assert_equal value, instance.send(attr).value\n end", "def raise_invalid(value)\n if value.is_a?(Numeric)\n raise EnumError, \"#{value.inspect} is out of bounds of #{self.class.name}\"\n else\n raise EnumError, \"#{value.inspect} is not valid for #{self.class.name}\"\n end\n end", "def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end", "def valid_parameter_for_conditional_formatting\n %i[\n type\n format\n criteria\n value\n minimum\n maximum\n stop_if_true\n min_type\n mid_type\n max_type\n min_value\n mid_value\n max_value\n min_color\n mid_color\n max_color\n bar_color\n bar_negative_color\n bar_negative_color_same\n bar_solid\n bar_border_color\n bar_negative_border_color\n bar_negative_border_color_same\n bar_no_border\n bar_direction\n bar_axis_position\n bar_axis_color\n bar_only\n icon_style\n reverse_icons\n icons_only\n icons\n data_bar_2010\n ]\n end", "def validate_enum_name(name)\n name.gsub(/[-\\s]/, \"_\").sub(/^\\d/, '_\\0')\n end", "def oil_types=(vals = [])\n if vals.is_a?(Array)\n OilTypes.collect {|t| t[1]}.each do |type|\n if vals.member?(type)\n send(type+\"=\",true)\n else\n send(type+\"=\",false)\n end\n end\n end\n end", "def sr_iov=(sr_iov)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(sr_iov)\n fail ArgumentError, \"invalid value for \\\"sr_iov\\\", must be one of #{validator.allowable_values}.\"\n end\n @sr_iov = sr_iov\n end", "def appearance=(appearance)\n validator = EnumAttributeValidator.new('String', [\"Default\", \"BoundingBox\", \"Tags\", \"Hidden\"])\n if appearance.to_i == 0\n unless validator.valid?(appearance)\n raise ArgumentError, \"invalid value for 'appearance', must be one of #{validator.allowable_values}.\"\n end\n @appearance = appearance\n else\n @appearance = validator.allowable_values[appearance.to_i]\n end\n end", "def valid?\n frequency_validator = EnumAttributeValidator.new('String', [\"daily\", \"weekly\", \"monthly\", \"quarterly\", \"yearly\"])\n return false unless frequency_validator.valid?(@frequency)\n return true\n end", "def validate_entities!(enum)\n unless enum.respond_to?(:each)\n raise Errors::InternalError, 'Validation cannot be performed on non-enumerable objects'\n end\n enum.each(&:valid!)\n enum\n rescue ::Occi::Core::Errors::MandatoryArgumentError, ::Occi::Core::Errors::ValidationError => ex\n logger.error \"Validation failed: #{ex.class} #{ex.message}\"\n raise Errors::ValidationError, ex.message\n end", "def attr_bool_writer *symbols\n attr_writer *symbols\n end", "def should_allow_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert_nil instance.errors.on(attribute), \n \"Expected no errors when #{attribute} is set to #{display_value}, \n instead found error \\\"#{instance.errors.on(attribute)}\\\".\"\n end\n end\n end\n end\n end", "def valid_attributes\n {\n name: \"Unlimited\",\n award_title_name: \"10k Unlimited\",\n scoring_class: \"Freestyle\"\n }\n end", "def gr_append_check? obj\n return false if obj.class!=self.class\n return false if !respond_to(\"each\")\n myEnum=to_enum\n objEnum=obj.to_enum\n while true\n begin\n myEle=myEnum.next\n rescue\n return true\n end\n begin\n objEle=objEnum.next\n rescue\n return false\n end\n return false if myEle!=objEle\n end\n return true\n end", "def valid?\n only_display_validator = EnumAttributeValidator.new('String', [\"DoNotDisplay\", \"Closed30Days\", \"Closed60Days\", \"Closed90Days\", \"Closed120Days\", \"AllClosed\"])\n return false unless only_display_validator.valid?(@only_display)\n return true\n end", "def validate( value )\n raise ReadOnlyException.new(self) unless settable?\n @definition.type.validate(value)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def patrol_scrub=(patrol_scrub)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Enable at End of POST\", \"enabled\"])\n unless validator.valid?(patrol_scrub)\n fail ArgumentError, \"invalid value for \\\"patrol_scrub\\\", must be one of #{validator.allowable_values}.\"\n end\n @patrol_scrub = patrol_scrub\n end", "def _class=(_class)\n validator = EnumAttributeValidator.new('String', [\"Other\", \"Absolute\", \"Possessory\", \"Qualified\", \"Good\"])\n unless validator.valid?(_class)\n fail ArgumentError, \"invalid value for '_class', must be one of #{validator.allowable_values}.\"\n end\n @_class = _class\n end", "def valid?\n return false if !super\n quartile_method_validator = EnumAttributeValidator.new('String', ['Exclusive', 'Inclusive'])\n return false unless quartile_method_validator.valid?(@quartile_method)\n true\n end" ]
[ "0.7087152", "0.6480326", "0.6429858", "0.62265116", "0.61428237", "0.58098733", "0.57501006", "0.5743426", "0.57373345", "0.5708213", "0.56996876", "0.5677225", "0.5603006", "0.5594775", "0.5547809", "0.5538741", "0.5535209", "0.55286884", "0.5435018", "0.5430014", "0.5419004", "0.5380077", "0.5378358", "0.5378358", "0.5366266", "0.5352894", "0.533707", "0.53292704", "0.5322375", "0.53205645", "0.53076315", "0.53009784", "0.5285228", "0.52781546", "0.52682555", "0.52669793", "0.5252785", "0.5209564", "0.5190264", "0.5185184", "0.51704866", "0.5145971", "0.5144865", "0.5138945", "0.5135254", "0.5133985", "0.5130808", "0.5121619", "0.5115126", "0.5107675", "0.5107026", "0.51063734", "0.5094698", "0.5094698", "0.5084315", "0.508093", "0.5074612", "0.5065415", "0.5064945", "0.50616825", "0.5056761", "0.5049034", "0.5043723", "0.5040373", "0.5037366", "0.503119", "0.5023019", "0.50198084", "0.49920952", "0.49898186", "0.49832702", "0.49751768", "0.4972478", "0.4970321", "0.49637032", "0.49605447", "0.4959534", "0.49587002", "0.49551633", "0.4954813", "0.49500528", "0.49487162", "0.49450964", "0.49433044", "0.4942149", "0.49365103", "0.49344257", "0.49331868", "0.4928106", "0.49184048", "0.49183148", "0.4917808", "0.49140236", "0.49133492", "0.4910852", "0.4910187", "0.490948", "0.49093893", "0.49074686", "0.4902142", "0.49020022" ]
0.0
-1
Custom attribute writer method with validation
def customer_tax_id=(customer_tax_id) if !customer_tax_id.nil? && customer_tax_id.to_s.length > 9 fail ArgumentError, 'invalid value for "customer_tax_id", the character length must be smaller than or equal to 9.' end @customer_tax_id = customer_tax_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Custom attribute writer method with validation
def drivers_license_dob=(drivers_license_dob) if !drivers_license_dob.nil? && drivers_license_dob.to_s.length > 10 fail ArgumentError, 'invalid value for "drivers_license_dob", the character length must be smaller than or equal to 10.' end @drivers_license_dob = drivers_license_dob end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Custom attribute writer method with validation
def drivers_license_number=(drivers_license_number) if !drivers_license_number.nil? && drivers_license_number.to_s.length > 50 fail ArgumentError, 'invalid value for "drivers_license_number", the character length must be smaller than or equal to 50.' end @drivers_license_number = drivers_license_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Custom attribute writer method with validation
def drivers_license_state=(drivers_license_state) if !drivers_license_state.nil? && drivers_license_state.to_s.length > 2 fail ArgumentError, 'invalid value for "drivers_license_state", the character length must be smaller than or equal to 2.' end @drivers_license_state = drivers_license_state end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attribute(name); end", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def has_attributes?; end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def validate\n validate_string_attributes\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end", "def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end" ]
[ "0.64714426", "0.6314092", "0.6314092", "0.62843996", "0.6279117", "0.6212286", "0.6188891", "0.6179444", "0.6065791", "0.6032525", "0.5996907", "0.5990497", "0.5959816", "0.5938802", "0.59287214", "0.5895985", "0.58595186", "0.5852596", "0.5847984", "0.58444107", "0.58343303", "0.58235955", "0.58229995", "0.57836556", "0.5703459", "0.5696362", "0.5680679", "0.568021", "0.5665294", "0.5655645", "0.5654744", "0.56396836", "0.5619648", "0.5614121", "0.5609959", "0.5599945", "0.5596874", "0.5592224", "0.55861783", "0.55828875", "0.5578926", "0.5567833", "0.5567749", "0.556693", "0.5563338", "0.55633235", "0.5560897", "0.55579615", "0.55579615", "0.55528605", "0.55528605", "0.5537348", "0.5532933", "0.5526811", "0.55265874", "0.5523069", "0.5501535", "0.5497166", "0.5496419", "0.54923123", "0.5464168", "0.5463242", "0.5462326", "0.545007", "0.54497737", "0.54497737", "0.54365075", "0.54297453", "0.54297453", "0.54255736", "0.5418367", "0.5415406", "0.5410525", "0.54069287", "0.54015315", "0.54002845", "0.5399175", "0.5392583", "0.5381682", "0.53771824", "0.5376701", "0.5374139", "0.5370942", "0.53677666", "0.536467", "0.53600067", "0.5359843", "0.5353416", "0.53490984", "0.53480154", "0.5345155", "0.53413296", "0.5327117", "0.5327117", "0.5321078", "0.5321078", "0.5321078", "0.5318564", "0.5317283", "0.53138846", "0.53127176" ]
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && bank_aba_code == o.bank_aba_code && bank_account_name == o.bank_account_name && bank_account_number == o.bank_account_number && bank_account_type == o.bank_account_type && bank_name == o.bank_name && bank_owner_type == o.bank_owner_type && customer_tax_id == o.customer_tax_id && drivers_license_dob == o.drivers_license_dob && drivers_license_number == o.drivers_license_number && drivers_license_state == o.drivers_license_state end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end", "def assert_equal_attributes(object, expected_attributes)\n expected_attributes.each do |index, value|\n assert_equal value, object[index], \"#{index}\"\n end\n end", "def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end", "def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end", "def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end", "def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end", "def ==(other)\n other.present? && self.attributes == other.attributes\n end", "def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end", "def match?(attributes)\n attributes.each do |attr, val|\n return false if send(attr).to_s != val.to_s\n end\n true\n end", "def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end", "def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\n end", "def changed?(comparison)\n attributes.any? do |attribute, value|\n next unless comparison.key?(attribute)\n comparison[attribute] != value\n end\n end", "def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end", "def ==(other)\n if other.kind_of? Details::Attribute\n self.name == other.name && self.value == other.value\n else\n self.value == other\n end\n end", "def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n Attribute === other && \n !(Expression === other) &&\n relation == other.relation && \n name == other.name && \n self.alias == other.alias && \n original_relation == other.original_relation\n end", "def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end", "def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end", "def ==(other)\n case other\n when Chair::Row\n @attributes == other.instance_variable_get('@attributes')\n when Array\n @attributes.values == other\n else false\n end\n end", "def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end", "def correct_combination?(attr1, attr2, attr3)\n result = false\n if attr1 == attr2 && attr2 == attr3\n result = true\n elsif attr1 != attr2 && attr2 != attr3 && attr1 != attr3\n result = true\n end\n return result\n end", "def ==(other)\n return false if self.class != other.class\n return super if @_lazer_model.required_properties.empty?\n @_lazer_model.required_properties.each do |key_name|\n return false if read_attribute(key_name) != other.read_attribute(key_name)\n end\n true\n end", "def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end", "def verify_attributes(hash, expected)\n return [] unless expected.attributes\n expected.attributes.map{ |a| verify_attribute_value(hash[a.name.to_s], a) }\n end", "def assert_attributes obj, attr_hash\n default_attr_hash = {}\n if obj.respond_to? :default_attr_hash\n default_attr_hash = obj.default_attr_hash\n end\n default_attr_hash.merge(attr_hash).each_pair do |key, value|\n assert_equal value, obj.__send__(key), \"Attribute #{key} of #{obj}\"\n end\n end", "def match_attributes(attrs)\n attrs = Saxxy::Helpers.stringify_keys(attrs)\n attributes.reduce(true) do |b, (k, v)|\n value = attrs[k]\n b && ((!value.nil? && match(v, value)) || (v.nil? && value.nil?))\n end\n end", "def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left != right, message)\n end", "def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end", "def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end", "def ==(x)\n return true if object_id == x.object_id\n return false unless x.kind_of?(AttrArray)\n each_with_index do |a, n|\n return false unless a == x[n]\n end\n true\n end", "def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left == right, message)\n end", "def compare_attributes(data_criteria, criteria)\n return false unless data_criteria['dataElementAttributes']&.any?\n\n data_criteria['dataElementAttributes'].map { |dc| dc.except('_id') }.include? criteria['dataElementAttributes'][attribute_index].except('_id')\n end", "def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end", "def ==(other)\n other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end", "def == other\n return false unless self.class == other.class\n [:unit, :frequency, :anchor, :weeks, :monthdays, :weekdays, :times].all? do |attribute|\n self.send(attribute) == other.send(attribute)\n end\n end", "def compare_equal?(item, line_item)\n ![\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n :first_name,\n :last_name,\n :serial_number,\n :purch_order_form_num\n ].detect { |attr| item.send(attr) != line_item.send(attr) }\n end", "def ==(b) # :nodoc:\n ( b.respond_to?(:result_attributes) &&\n result_attributes == b.result_attributes && \n @result_attributes.all?{ |k| send(k) == b.send(k) } )\n end", "def validates_different(*attr_names)\n validates_with ValidatesAll::DifferenceValidator, _merge_attributes(attr_names)\n end", "def identical?\n #Song.first.attributes.each { |v,k| Song.find(:all, :conditions => [\" #{v} like ?\", \"%blah%\"])}\n Song.find(:all, :conditions => [\"name = ? or length = ?\", \"#{self.name}\", self.length]) do |x| \n x.hash == self.hash\n end\n end", "def diff?(model = self.class.find(id))\n self.class.diffable_attributes.each do |attribute|\n return true if send(attribute) != model.send(attribute)\n end\n return false\n end", "def filter_attributes_match?(hash_one, hash_two)\n hash_one.all? do |key, value_one|\n value_two = hash_two[key]\n case\n when value_one == value_two\n true\n when value_one.is_a?(Hash) && value_two.is_a?(Hash)\n filter_attributes_match?(value_one, value_two)\n when hash_one[key].to_s == hash_two[key].to_s\n true\n when value_one.is_a?(String) && value_one.start_with?(\"eval:\")\n eval_attribute_value(value_one, value_two)\n else\n false\n end\n end\n end", "def comparable_attributes\n#\t\tHashWithIndifferentAccess[attributes.select {|k,v| \n#\t\t\t!Abstract.incomparable_attribute_names.include?(k)}]\n\t\tHashWithIndifferentAccess[attributes.select {|k,v| db_fields.include?(k)}]\n\tend", "def all_equal?\n a = self.first\n all? { |b| a == b }\n end", "def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end", "def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end", "def attr_set?(cards, attr)\n array = []\n cards.each do |card|\n # evalutes the string 'attr' and returns the value\n array << card.send(attr)\n end\n\n # only return true if it's all the same or totally different\n return true if array.uniq.count == 1\n return true if array.uniq.count == 3\n return false\n end", "def attribute_changed?(attribute_name)\n (self.diff['attributes']['new']||{})[attribute] != (self.diff['attributes']['old']||{})[attribute]\n end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end", "def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end", "def uniquify_attributes(attributes)\n attributes.each do |ka|\n oldval = send(ka)\n next unless String === oldval\n newval = UniquifierCache.instance.get(self, oldval)\n set_property_value(ka, newval)\n logger.debug { \"Reset #{qp} #{ka} from #{oldval} to unique value #{newval}.\" }\n end\n end", "def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end", "def multi_element_attr_check( elements )\n wanted = Array.new\n found = Array.new\n elements.each do |element|\n print \".\"\n e = $driver.find_element(element[0].to_sym, element[1])\n wanted << [ element[1], element[2], element[3] ]\n found << [ element[1], element[2], e.attribute(element[2]) ]\n end\n\n found.should == wanted\n end", "def equals(rule)\n element == rule.element && attributes == rule.attributes\n end", "def attr_reader(*args)\n super\n comparison_attrs.concat(args)\n end", "def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end", "def matches_state_attrs?\n @expected_attrs == state_attrs\n end", "def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left != right, message)\n end", "def eql?(other)\n return false unless super(other)\n return false unless attributes == other.attributes\n return false unless content == other.content\n\n true\n end", "def ==(other)\n return true if other.equal?(self)\n return false unless other.instance_of?(self.class)\n\n self.class.attributes.inject(true) do |memo, attribute|\n attribute_name = attribute.first\n attribute_type = attribute.last[:type]\n\n # Skip associations\n if attribute_type.include?(LazyResource::Resource) || (attribute_type.is_a?(::Array) && attribute_type.first.include?(LazyResource::Resource))\n memo\n else\n memo && self.send(:\"#{attribute_name}\") == other.send(:\"#{attribute_name}\")\n end\n end\n end", "def matches? item, attributes\n\n attributes.map { |attribute, value|\n\n item.send(attribute) == value\n\n }.flatten == [true]\n\n end", "def ==( other ) \n\t\t\tcomparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}\n\t\t\tcomparison_attributes.call( self ) == comparison_attributes.call( other )\n\t\tend", "def all_obs_same_attr?(observations, attr)\n exemplar = observations.first.send(attr)\n observations.all? { |o| o.send(attr) == exemplar }\n end", "def eql?(*) end", "def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end", "def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end", "def ==(val)\n if val.is_a?(Model)\n # Use normal comparison for a model\n super\n else\n # Compare to attributes otherwise\n attributes == val\n end\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n attribute == o.attribute &&\n statistics == o.statistics &&\n other == o.other &&\n total == o.total &&\n missing == o.missing &&\n term_count == o.term_count &&\n term_type == o.term_type &&\n terms == o.terms\n end", "def ==(*several_variants)\n #This is a stub, used for indexing\n end", "def is_equal?(a)\n @amount == a.amount && @code == a.code\n end", "def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left == right, message)\n end", "def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end", "def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end", "def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend", "def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end", "def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end", "def changes(attrs1, attrs2)\n old_attrs = attrs1.slice(*GENERATED_ATTRS)\n new_attrs = attrs2.slice(*GENERATED_ATTRS)\n\n return if old_attrs == new_attrs\n old_attrs.each do |k, v|\n next if new_attrs[k] == v\n @changes << Change.new(nil, k, v, new_attrs[k]) \n end\n end", "def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end", "def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end", "def more_desirable?(attribute_id1, attribute_id2)\n attribute_id1 < attribute_id2\n end", "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end", "def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n end", "def assert_same_values(expected, actual)\n actual.each_pair do |k,v|\n next unless expected[k]\n assert_equal expected[k], v, \"Values for #{k} are not matching\"\n end\n end", "def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end", "def sync_duplicate_obj_attributes(obj1, obj2)\n duplicate_keys.each do |key|\n unless obj1[key].blank? && obj2[key].blank?\n if obj1[key].blank?\n obj1.send(\"#{key}=\", obj2[key])\n elsif obj2[key].blank?\n obj2.send(\"#{key}=\", obj1[key])\n else # Each obj has a value\n if obj1[key] != obj2[key]\n raise ArgumentError, \"#{key} attribute values on the two objects don't match: #{obj1[key]} vs #{obj2[key]}\"\n end\n end\n end\n end\n end", "def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end", "def assert_event_are_light_equal e1, e2\n return false if e1.class != e2.class\n\n [:subject, :event, :moodid,\n :mood, :music, :location, :taglist, :pickeyword,\n :preformatted, :backdated, :comments, :security, :allowmask,\n :screening,].each do |attr|\n return false if e1.send(attr) != e2.send(attr)\n end\n\n e1.compare_time(e2)\n end", "def eql(expected)\n set_relativity(:eql, expected)\n end", "def modified?( original )\n DATA_ATTRIBUTES.any? { |e| send( e ) != original.send( e )}\n end", "def ==(other)\n @name == other.name && @amount == other.amount\n end", "def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end", "def match_same_name_attributes(*options)\n\n options = options.extract_options!\n same_name_attributes = @from_table.columns.map(&:name) & @to_table.columns.map(&:name)\n\n if same_name_attributes\n same_name_attributes = columns_from_options(same_name_attributes, options)\n same_name_attributes.each do |same_name_attribute|\n from same_name_attribute, :to => same_name_attribute\n end\n end\n end", "def equal_pair(key, request)\n if @event[\"required\"][key] == request[\"object_attributes\"][key] || event[\"required\"][key] == \"\"\n true\n else\n false\n end\n end", "def assert_equal(att, value, error = [att, :not_equal])\n assert value === send(att), error\n end", "def validate\n matched = {}\n duplicated_attributes = []\n attributes.each do |attribute|\n if matched.has_key?(attribute.name) && matched[attribute.name] == attribute.name_format\n duplicated_attributes << attribute.name unless duplicated_attributes.include?(attribute.name)\n else\n matched[attribute.name] = attribute.name_format\n end\n end\n if !duplicated_attributes.empty?\n raise ValidationError, \"An attribute with the same name and name format may only be specified once. The following attributes were specified multiple times: #{duplicated_attributes.join(',')}\"\n end\n end" ]
[ "0.7291717", "0.7188103", "0.70395297", "0.7007927", "0.68874705", "0.6861532", "0.6707156", "0.6660597", "0.66147524", "0.658478", "0.6584619", "0.6580019", "0.65543133", "0.6543933", "0.65068495", "0.6479513", "0.6456241", "0.6415999", "0.6412208", "0.6412208", "0.6412208", "0.6411266", "0.6380575", "0.63775986", "0.6260147", "0.6246534", "0.6240681", "0.62150854", "0.62014365", "0.6186426", "0.61837834", "0.6164858", "0.61304426", "0.61149454", "0.6097789", "0.6083095", "0.6078927", "0.6067201", "0.60053444", "0.59974694", "0.5994989", "0.5991373", "0.59856457", "0.5985243", "0.5977118", "0.59521115", "0.59428704", "0.59311265", "0.59247756", "0.5921222", "0.5921222", "0.59095234", "0.58795947", "0.58789194", "0.5870439", "0.58598673", "0.58571184", "0.5856412", "0.5855177", "0.58480394", "0.5847516", "0.58370507", "0.5799985", "0.5795313", "0.57880926", "0.57823527", "0.57788265", "0.5776185", "0.57670164", "0.5759791", "0.5758563", "0.5753949", "0.57518554", "0.5750137", "0.57385117", "0.57309806", "0.5729126", "0.572618", "0.57250285", "0.57210624", "0.5712646", "0.5710082", "0.57059866", "0.57036847", "0.5702592", "0.5690256", "0.5674193", "0.56433815", "0.5641553", "0.56216776", "0.56148046", "0.5591313", "0.5587681", "0.55836356", "0.5569298", "0.5550885", "0.5546161", "0.5545665", "0.55422115", "0.5539372", "0.5529004" ]
0.0
-1
Calculates hash code according to all attributes.
def hash [bank_aba_code, bank_account_name, bank_account_number, bank_account_type, bank_name, bank_owner_type, customer_tax_id, drivers_license_dob, drivers_license_number, drivers_license_state].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\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\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(*) 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_code; end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end", "def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end", "def hash\n @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 hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n size.hash ^ rank.hash\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n @hash || calculate_hash!\n end", "def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def hash\n id.hash + 32 * bs_request.hash\n end", "def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash\n [self.class, self.val, self.attribute].hash\n end", "def hash\n 0\n end", "def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end", "def hash\n self.class.hash ^ key_attributes.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 h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end", "def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end", "def hash\n self.class.hash ^ operand.hash\n end", "def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend", "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end", "def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end", "def hash\n @symbols.hash + 37*positive?.hash\n end", "def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end", "def hash=(_arg0); end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\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 [oct, pc].hash\n end", "def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end", "def hash\n code.hash\n end", "def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end", "def hash\n @vbits.hash\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end", "def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\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 hash\n code.hash\n end", "def hash\n\t\t[@a, @b, self.class::D].hash\n\tend", "def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end", "def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end", "def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end", "def hash\n @rank.hash ^ @suit.hash\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def hash\n @real.hash ^ @image.hash\n end", "def to_hash() end", "def hash_length\n super\n end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def hash() source.hash ^ target.hash; end", "def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end", "def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend", "def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end", "def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end", "def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend", "def hash\n [rank, suit].hash\n end", "def hash\n self.class.hash ^ left.hash ^ right.hash\n end", "def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end", "def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end", "def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end", "def hash\n\n self.h.fei.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end" ]
[ "0.7118691", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.68960655", "0.67847186", "0.6707762", "0.670052", "0.6688737", "0.66705376", "0.6489735", "0.6462376", "0.6462376", "0.64444333", "0.6413127", "0.6395483", "0.63898623", "0.6372129", "0.635671", "0.63370055", "0.62682766", "0.62533766", "0.6246914", "0.6230963", "0.62173444", "0.6214272", "0.6214131", "0.61962456", "0.619165", "0.61866295", "0.6185355", "0.6185355", "0.6153702", "0.6145376", "0.6144877", "0.6139152", "0.6128312", "0.61224943", "0.61217207", "0.61205214", "0.61041045", "0.61000645", "0.60937095", "0.60931146", "0.60818595", "0.60811466", "0.60500103", "0.60322344", "0.6022704", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.60178953", "0.6014942", "0.5997442", "0.59880185", "0.598736", "0.59799886", "0.5972682", "0.5969595", "0.5969411", "0.59594935", "0.5957466", "0.59423596", "0.5942144", "0.59245354", "0.5924357", "0.5904946", "0.59025365", "0.58536685", "0.5847055", "0.58454466", "0.5845053", "0.58447546", "0.5844059", "0.5842638", "0.5840575", "0.58391696", "0.5825819", "0.5824118", "0.5823615", "0.58184344", "0.5815284", "0.58124787", "0.5810309", "0.5808056", "0.5808056", "0.5808056", "0.5806852", "0.5806852" ]
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically from the hash. If the attribute\n # does not already exist, then don't re-add the attribute class and\n # variable, just set it with the value from the hash\n hash.keys.each do |key|\n class_eval { attr_accessor key } unless instance.methods.include?(key.to_sym)\n instance.instance_variable_set \"@#{key}\", hash[key]\n end\n\n instance\n end", "def build(hash, track_changes = true)\n resource = fields.each_with_object(new) do |field, r|\n value = hash.fetch(field.to_s, hash[field.to_sym])\n r.send(\"#{field}=\", value)\n end\n resource.clear_changes! unless track_changes\n resource\n end", "def initialize hash\n @hash = hash\n end", "def build(params)\n return new(params) if params.is_a?(Hash)\n raise(\"unexpected parameter, expected Hash, received #{params.class}\")\n end", "def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend", "def initialize(a_hash)\n from_h(a_hash)\n end", "def initialize\n\t\t\t@hash = {}\n\t\tend", "def initialize(hash)\n @hash = hash\n @converted = {}\n end", "def initialize(hash)\n @short_code = hash[\"short_code\"]\n @name = hash[\"name\"]\n @id = hash[\"id\"]\n end", "def initialize(hash)\n super(hash)\n end", "def initialize\n @h = new_hash\n end", "def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end", "def initialize(hash={})\n @hash = hash\n end", "def initialize\n @hash = {}\n end", "def initialize\n @hash = {}\n end", "def initialize(hash)\r\n hash.each { |k, v|\r\n # Create getters and setters\r\n self.class.attr_accessor(k)\r\n # Set value for created variable\r\n self.send(\"#{k}=\", v)\r\n }\r\n self.class.all.push(self)\r\n end", "def build!(hash)\n hash.must(::Hash) { raise ArgumentError, \"#{self} expects Hash, but got #{hash.class}\" }\n\n if hash.size != variables.size\n keys1 = variables.keys\n keys2 = hash.keys.map(&:to_s)\n minus = (keys1 - keys2).map{|i| \"-#{i}\"}\n plus = (keys2 - keys1).map{|i| \"+#{i}\"}\n \n msg = \"#{self} expects #{variables.size}, but got #{hash.size} (%s)\" % (minus + plus).join(\",\")\n raise Typed::SizeMismatch, msg\n end\n\n # 'build' just ignore unknown fields, but 'build!' raise errors\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v\n end\n return obj\n end", "def initialize(hash)\n @cw_id = hash[\"cw_id\"]\n @cik = hash[\"cik\"]\n @name = hash[\"company_name\"]\n @irs_number = hash[\"irs_number\"]\n @sic_code = hash[\"sic_code\"]\n @industry = hash[\"industry_name\"]\n @sic_sector = hash[\"sic_sector\"]\n @sector_name = hash[\"sector_name\"]\n @source_type = hash[\"source_type\"]\n @address = hash[\"raw_address\"]\n @country = hash[\"country_code\"]\n @state = hash[\"subdiv_code\"]\n @top_parent_id = hash[\"top_parent_id\"]\n @num_parents = hash[\"num_parents\"]\n @num_children = hash[\"num_children\"]\n @max_year = hash[\"max_year\"]\n @min_year = hash[\"min_year\"]\n end", "def from_hash(hash)\n instance = allocate\n instance.instance_variable_set :@attributes, hash.freeze\n instance\n end", "def from_hash(hash)\n hash = DEFAULTS.merge(hash)\n hash['spdx_id'] = hash.delete('spdx-id')\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end", "def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end", "def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end", "def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end", "def initialize(hash)\n @hash = hash\n @data = resourcify_data\n end", "def from_hash hash\n @id= hash['id']\n\n @admin= hash['admin']\n @username= hash['username']\n @timezone= hash['timezone']\n @email_address= hash['email_address']\n\n @password = nil\n\n @created_at= DateTime.parse(hash['created_at'])\n @updated_at= DateTime.parse(hash['updated_at'])\n end", "def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end", "def initialize(hash)\n load_hash(hash)\n end", "def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend", "def initialize(*args)\n super\n # hash = {}\n end", "def build_object(resp)\n return resp unless resp.respond_to?(:merge)\n @build_object ||= final_object_class.new(resp.merge(additional_hash_to_serialize_after_response))\n end", "def from_hash(hash)\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end", "def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end", "def initialize(hash)\n\t\t@id = hash['id']\n\t\t@first_name = hash['first_name']\n\t\t@last_name = hash['last_name']\n\t\t@mentor = hash['mentor']\n\tend", "def initialize(hash={})\n @name = validate_name(hash[:name])\n @description = hash[:description]\n @snmp_opts = hash[:snmp_opts]\n\n save # Save a copy of self to Redis on creation\n end", "def initialize\n @hash_dict = {}\n end", "def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end", "def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end", "def from_hash(hash)\n apply_nested_hash(hash)\n end", "def initialize(hash)\n # @id = hash[\"id\"]\n # @street_address = hash[\"street_address\"]\n # @city = hash[\"city\"]\n # @state = hash[\"state\"]\n # @zipcode = hash[\"zipcode\"]\n # @country = hash[\"country\"]\n\n #add in correct details\n end", "def from_hash(hash)\n @data_object.user_acc_name = hash['user_acc_name']\n @data_object.user_affiliate = hash['user_affiliate']\n @user_over_13 = hash['user_over_13']\n\n contact.from_hash(hash)\n end", "def initialize(hash)\n @name = hash[\"campaign\"] #decided to change it to \"name\" since this is the campaign class\n date_elements = hash[\"date\"].split(\"/\") #date is being passed in as a string, need this array to create the Date object in the next line\n @date = Date.new(date_elements[2].to_i + 2000, date_elements[0].to_i, date_elements[1].to_i) #added 2000 to year since the program was considering it as the year 15; this creates the date object\n @spend = hash[\"spend\"].to_f #use .to_f to make sure spend comes in as a float instead of a string\n @impressions = hash[\"impressions\"].to_i #need it as an integer for counting purposes later\n @actions = JSON.parse(hash[\"actions\"])#ensures that each action comes in as an array instead of a string\n @@all << self #shovels it into the all array\n end", "def initialize(hash)\n hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end\n @id = hash[\"id\"]\n end", "def initialize (hash)\n hash.each {|key, value|\n self.class.attr_accessor(key)\n self.send((\"#{key}=\"), value)\n }\n @@all << self\n end", "def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end", "def create_from_hash(hash, opts={})\n create_opts = update_or_create_options(hash, opts)\n create { |instance| instance.set(create_opts) }\n end", "def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end", "def initialize(hash) #.new\n @name = hash[:name][0]\n @region = hash[:region]\n @population = hash[:population]\n @capital = hash[:capital]\n @flag_link = hash[:flag_link]\n @@all << self\n #binding.pry\n end", "def initialize(hash = {})\n super(hash)\n\n @action = extract_value(hash, :action)\n @clientId = extract_value(hash, :clientId)\n @clientIdAlias = extract_value(hash, :clientIdAlias)\n @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)\n @expiresAt = extract_integer_value(hash, :expiresAt)\n @subject = extract_value(hash, :subject)\n @scopes = extract_value(hash, :scopes)\n @existent = extract_boolean_value(hash, :existent)\n @usable = extract_boolean_value(hash, :usable)\n @sufficient = extract_boolean_value(hash, :sufficient)\n @refreshable = extract_boolean_value(hash, :refreshable)\n @responseContent = extract_value(hash, :responseContent)\n @properties = extract_array_value(hash, :scopes) do |element|\n Authlete::Model::Property.parse(element)\n end\n end", "def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend", "def from_hash(hash)\n super(hash)\n verify\n end", "def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end", "def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end", "def initialize(hash = nil)\n @arguments = 0\n return if hash.nil?\n @name = hash['name']\n @arguments = hash['arguments']\n end", "def _from_hash(hsh)\n hsh.each do |k, v|\n v = restore_hash(v)\n v = v.map { |iv| restore_hash(iv) } if v.is_a?(Array)\n send(:\"#{k}=\", v)\n end\n self\n end", "def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end", "def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end", "def initialize(hash={})\n self.attributes = hash\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def build(base, object, type = nil, selected_fields = nil)\n return object unless object.is_a?(Hash)\n if _loading?\n Factory.from_db(klass, object, nil, selected_fields)\n else\n Factory.build(klass, object)\n end\n end", "def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @cost, @salt, @digest = split_hash(self.to_s)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def instantiate hash, extra_attributes={}\n return hash unless hash.kind_of? Hash\n# init = hash.values_at(*@singulars).compact.first\n init = hash[@singular]\n inits = hash[@plural]\n if init\n new init.merge extra_attributes\n elsif inits\n inits.map {|each| new each.merge extra_attributes}\n else\n hash\n end\n end", "def from_hash(values)\n @data_object.team_challenge = values['team_challenge']\n @data_object.team_level = values['team_level']\n @data_object.team_name = values['team_name']\n\n# @mgr_email = values['mgr_email']\n\n names = values['tm_name']\n\n TeamMember::MEMBERS_PER_TEAM.times do |i|\n if names[i].empty?\n @members[i].clear\n else\n @members[i].tm_name = names[i]\n @members[i].tm_grade = values['tm_grade'][i].to_i\n @members[i].tm_dob_mon = values['tm_dob_mon'][i]\n @members[i].tm_dob_day = values['tm_dob_day'][i]\n @members[i].tm_dob_year = values['tm_dob_year'][i]\n @members[i].tm_sex = values['tm_sex'][i]\n end\n end\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def initialize(raw_hash)\n raise Errors::InvalidHash, 'invalid hash' unless valid_hash?(raw_hash)\n\n replace(raw_hash)\n\n @cost, @salt, @digest = split_hash(to_s)\n end", "def initialize( confighash={} )\n\t\tihash = internify_keys( untaint_values(confighash) )\n\t\tmergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )\n\n\t\t@struct = ConfigStruct.new( mergedhash )\n\t\t@create_time = Time.now\n\t\t@name = nil\n\t\t@loader = nil\n\n\t\tsuper()\n\tend", "def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end", "def create(hash={})\n model = self.new(hash)\n model.save\n model\n end", "def from_hash(hash:, klass:)\n validate_class_kit(klass)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = attribute[:name]\n type = attribute[:type]\n\n #if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type)\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type])\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{key}=\", value)\n end\n\n entity\n end", "def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = convert(v, k, converter) if converter\n instance.instance_variable_set(:\"@#{k}\", v)\n end\n\n instance\n end", "def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend", "def hash_for_merging(hash)\n new_hash = { id: hash['message_id'].to_i,\n date: Time.at(hash['date'].to_i),\n from: User.new(hash['from'], @bot),\n chat: Chat.new(hash['chat'], @bot) }\n\n type = TYPES.find { |t| hash[t.to_s] }\n new_hash[type] = hash[type.to_s] # TODO: fail if type not found\n\n new_hash\n end", "def initialize(hash)\n @header = Msg::Header.new(hash)\n @body = Msg::Body.new(content_is_json?, hash)\n end", "def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end", "def initialize()\n @hash = {}\n @values = []\n end", "def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end", "def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end", "def new_from_hash_marketplace(h)\n self.url = h\n h=h.split('/')\n h=h[h.size-2]\n self.original_id = h\n return self\n end", "def initialize(hash, type, dump)\n self.hash = hash\n self.type = type.to_sym\n self.dump = dump\n end", "def initialize(hash_data, opts: {})\n @hsh = hash_data\n @opts = opts\n\n @title = @hsh[:title]\n @body = @hsh[:body_hash]\n end", "def initialize(hash)\n @color = hash[:color]\n @scent = hash[:scent]\n end", "def initialize(hash = nil)\n hash.each { |key, value| self[key] = value } if !hash.nil? && hash.is_a?(Hash)\n end", "def create(hash)\n NotImplementedError\n end", "def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = instance.convert(v, k, converter) if converter\n instance.send(:\"#{k}=\", v)\n end\n\n instance\n end", "def init_jaxb_json_hash(_o)\n super _o\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @description = String.from_json(_o['description']) unless _o['description'].nil?\n @url = String.from_json(_o['url']) unless _o['url'].nil?\n @name = String.from_json(_o['name']) unless _o['name'].nil?\n @organization = Org::Apache::Archiva::Metadata::Model::Organization.from_json(_o['organization']) unless _o['organization'].nil?\n @issueManagement = Org::Apache::Archiva::Metadata::Model::IssueManagement.from_json(_o['issueManagement']) unless _o['issueManagement'].nil?\n @scm = Org::Apache::Archiva::Metadata::Model::Scm.from_json(_o['scm']) unless _o['scm'].nil?\n @ciManagement = Org::Apache::Archiva::Metadata::Model::CiManagement.from_json(_o['ciManagement']) unless _o['ciManagement'].nil?\n if !_o['licenses'].nil?\n @licenses = Array.new\n _oa = _o['licenses']\n _oa.each { | _item | @licenses.push Org::Apache::Archiva::Metadata::Model::License.from_json(_item) }\n end\n if !_o['mailingLists'].nil?\n @mailingLists = Array.new\n _oa = _o['mailingLists']\n _oa.each { | _item | @mailingLists.push Org::Apache::Archiva::Metadata::Model::MailingList.from_json(_item) }\n end\n if !_o['dependencies'].nil?\n @dependencies = Array.new\n _oa = _o['dependencies']\n _oa.each { | _item | @dependencies.push Org::Apache::Archiva::Metadata::Model::Dependency.from_json(_item) }\n end\n @incomplete = Boolean.from_json(_o['incomplete']) unless _o['incomplete'].nil?\n end", "def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end", "def create_from_hash hash\n values = values_from_hash hash\n unless obj = find(:first, :conditions => values)\n return nil if values[:id]\n obj = create!(values)\n raise ArgumentError, \"#{obj.errors.to_s}\" unless obj.errors.empty?\n end\n obj\n end", "def initialize result_hash={}\n @result_hash = result_hash\n end", "def create_hash(&block); end", "def create_hash(&block); end", "def initialize(attrs={})\n from_hash(attrs)\n end", "def build_request_data(hash)\n {\n :attributes! => {\n addressinfo: { \"xsi:type\" => \"ns2:Map\" },\n },\n username: @username,\n password: @password,\n addressinfo: {\n item: [\n { key: 'name', value: hash[:name] },\n { key: 'address1', value: hash[:address1] },\n { key: 'address2', value: hash[:address2] },\n { key: 'city', value: hash[:city] },\n { key: 'state', value: hash[:state] },\n { key: 'zip', value: hash[:zip] },\n { key: 'fflno', value: hash[:fflno] },\n { key: 'fflexp', value: hash[:fflexp] }\n ]\n },\n testing: @testing\n }\n end", "def init_jaxb_json_hash(_o)\n @groupId = String.from_json(_o['groupId']) unless _o['groupId'].nil?\n @artifactId = String.from_json(_o['artifactId']) unless _o['artifactId'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @packaging = String.from_json(_o['packaging']) unless _o['packaging'].nil?\n @className = String.from_json(_o['className']) unless _o['className'].nil?\n if !_o['repositories'].nil?\n @repositories = Array.new\n _oa = _o['repositories']\n _oa.each { | _item | @repositories.push String.from_json(_item) }\n end\n @bundleVersion = String.from_json(_o['bundleVersion']) unless _o['bundleVersion'].nil?\n @bundleSymbolicName = String.from_json(_o['bundleSymbolicName']) unless _o['bundleSymbolicName'].nil?\n @bundleExportPackage = String.from_json(_o['bundleExportPackage']) unless _o['bundleExportPackage'].nil?\n @bundleExportService = String.from_json(_o['bundleExportService']) unless _o['bundleExportService'].nil?\n @classifier = String.from_json(_o['classifier']) unless _o['classifier'].nil?\n @includePomArtifacts = Boolean.from_json(_o['includePomArtifacts']) unless _o['includePomArtifacts'].nil?\n @queryTerms = String.from_json(_o['queryTerms']) unless _o['queryTerms'].nil?\n @bundleImportPackage = String.from_json(_o['bundleImportPackage']) unless _o['bundleImportPackage'].nil?\n @bundleRequireBundle = String.from_json(_o['bundleRequireBundle']) unless _o['bundleRequireBundle'].nil?\n @pageSize = Fixnum.from_json(_o['pageSize']) unless _o['pageSize'].nil?\n @selectedPage = Fixnum.from_json(_o['selectedPage']) unless _o['selectedPage'].nil?\n end", "def initialize(order_hash)\n @id = order_hash['id']\n @number = order_hash['number']\n @special_instructions = order_hash['special_instructions']\n @total = order_hash['total']\n @total_quantity = order_hash['total_quantity']\n @created_at = order_hash['created_at']\n @updated_at = order_hash['updated_at']\n end", "def from_db_hash *args\n from_hash *args\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end" ]
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.66667664", "0.6623634", "0.661206", "0.66098964", "0.66098964", "0.6591922", "0.65713006", "0.6547411", "0.6524743", "0.6524143", "0.6513636", "0.650189", "0.6498057", "0.6485853", "0.6483371", "0.6475685", "0.6459916", "0.6454491", "0.6440182", "0.6434778", "0.6401363", "0.63977015", "0.6396885", "0.63910425", "0.63720834", "0.6363958", "0.63597506", "0.6313429", "0.6295958", "0.62923384", "0.62915224", "0.62704456", "0.62703115", "0.62622243", "0.62515473", "0.6249854", "0.6242987", "0.6242987", "0.62426233", "0.62408733", "0.62407595", "0.62321323", "0.62298346", "0.622897", "0.622756", "0.62245685", "0.62217826", "0.6218501", "0.6210329", "0.62091905", "0.620342", "0.6201614", "0.6178616", "0.6166234", "0.61611027", "0.6140086", "0.6126761", "0.61154264", "0.61059844", "0.60980254", "0.60971874", "0.6090533", "0.6064119", "0.6061236", "0.6060324", "0.60599816", "0.60420287", "0.6039776", "0.603712", "0.6033585", "0.6030829", "0.6023582", "0.6023582", "0.6016123", "0.60155296", "0.6014705", "0.6008574", "0.60031897", "0.60024095", "0.60024095", "0.60024095" ]
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = UltracartClient.const_get(type).new temp_model.build_from_hash(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Telstra_Messaging.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = FattureInCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = IFClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WineShipping.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n DearInventoryRuby.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Mooncard.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Aimastering.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Harbor1Client.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WellsFargoAchClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ArtikCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Dkron.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Hubspot::Cms::Performance.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SmoochApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SamplifyAPIClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpsgenieClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = LemonWayClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n Nodeum.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TripletexApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = unwiredClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Quandoo.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end" ]
[ "0.7330944", "0.7273544", "0.72500145", "0.72457504", "0.72181696", "0.72135216", "0.71906066", "0.7182661", "0.717915", "0.717915", "0.717915", "0.717915", "0.717915", "0.717915", "0.717915", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7178786", "0.7170971", "0.7170971", "0.7170971", "0.7170971", "0.7170971", "0.71629196", "0.71544087", "0.7147035", "0.7141144", "0.7141144", "0.71406573", "0.71406573", "0.71406573", "0.71332645", "0.71332645", "0.71332645", "0.71332645", "0.71330196", "0.71330196", "0.71274346", "0.71255887", "0.7120486", "0.7120486", "0.7118807", "0.7118151", "0.71136636", "0.7113341", "0.7113341", "0.71130526", "0.71114016", "0.71114016", "0.71114016", "0.7105131", "0.7105131", "0.7105131", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71047056", "0.71022177", "0.71022177", "0.71022177", "0.71011585", "0.71011585", "0.71011585", "0.70990586", "0.70990586", "0.709763", "0.7096882", "0.70959973" ]
0.7228586
16
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end", "def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end", "def to_s\n self.inspect\n end", "def to_s\n toString()\n end", "def to_s\r\n dump\r\n end", "def to_s\n inspect\n end", "def to_s\n toString\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n\t\t\t@string\n\t\tend", "def to_s\n stringify\n end", "def to_s\n to_h.to_s\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def inspect\n serialize.to_s\n end", "def inspect\n to_s\n end", "def to_s\n @string ||= Builder::ToString.new(self).string\n end", "def to_s\n self\n end", "def to_s()\n serialize.to_s()\n end", "def to_s()\n serialize.to_s()\n end", "def to_s\n string\n end", "def to_s\n inspect\n end", "def to_s\n inspect\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n self.to_s\n end", "def inspect\n self.to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def to_s\n end", "def to_s\n end", "def to_s\n end", "def to_s\n end", "def inspect\n to_s.inspect\n end", "def inspect()\n serialize.to_s()\n end", "def inspect()\n serialize.to_s()\n end", "def inspect\n return self.to_s\n end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end" ]
[ "0.901024", "0.89506465", "0.84703195", "0.83409667", "0.8337169", "0.8337169", "0.8332247", "0.82546586", "0.8145818", "0.8144667", "0.81357557", "0.812714", "0.8093436", "0.8086725", "0.8073356", "0.8039774", "0.80308646", "0.80064154", "0.80064154", "0.80064154", "0.80064154", "0.7962831", "0.7962831", "0.7962831", "0.7962831", "0.7954296", "0.79446983", "0.7919419", "0.7909274", "0.78848016", "0.78848016", "0.78841925", "0.788328", "0.788328", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.7866813", "0.7866813", "0.7865939", "0.7865939", "0.7850519", "0.7850519", "0.7850519", "0.7850519", "0.7808076", "0.7784745", "0.7784745", "0.7767656", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824" ]
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.84283537", "0.8347048", "0.8347048" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def to_hash\n @hash\n end", "def to_hash\n @hash\n end", "def hash\n to_s.hash\n end", "def to_hash\n @hash\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @hash\n end", "def to_h\n @hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def as_hash\n @hash\n end", "def __getobj__\n @hashobj\n end", "def to_hash() end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n object_id\n end", "def to_hash\n @_hash_\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def to_hash\n to_a.hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n data.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 [self.class, to_h].hash\n end", "def hash\r\n id.hash\r\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def to_hash\n return self\n end", "def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end", "def hash\n return @id.hash\n end", "def to_h\n Hash[ self ]\n end", "def to_hash\n Hash[self]\n end", "def to_h\n @hash.dup\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def to_h\n @hash.dup\n end", "def hash\n model.hash + key.hash\n end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def hash\n [self.class, to_s].hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n self.atoms.hash\n end", "def to_h\n Hash[self]\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\t\tvalue.hash\n\tend", "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 hash\n @id.hash\n end", "def hash\n id.hash\n end", "def hash\n self.class.name.hash\n end", "def to_h\n @_hash.dup\n end", "def hash\n\t\t[@id].hash\n\tend", "def hash\n [self.class, to_s].hash\n end", "def __hash\n @hash\n end" ]
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7647042", "0.7647042", "0.7626769", "0.760354", "0.7595938", "0.7582562", "0.7579971", "0.7579971", "0.7535553", "0.7495252", "0.7433835", "0.7411177", "0.73843014", "0.73661345", "0.73658615", "0.73658615", "0.73658615", "0.73600674", "0.7359121", "0.73590857", "0.73590857", "0.73590857", "0.7340058", "0.73356754", "0.7329828", "0.7329828", "0.7329828", "0.73170114", "0.730566", "0.73028016", "0.7294603", "0.72854036", "0.72643596", "0.72637254", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.726188", "0.72524244", "0.72511965", "0.72511965", "0.72511965", "0.72511965", "0.72511965", "0.72511965", "0.72479564", "0.72474235", "0.72474235", "0.7241066", "0.7229342", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7224175", "0.72185695", "0.72126305", "0.72116995", "0.71945405", "0.71828544", "0.7181684", "0.7171822", "0.71657544" ]
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @value\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def output_hash; end", "def to_hash() end", "def hash\n return to_s.hash\n end", "def hash\n value_id.hash\n end", "def to_hash\n call\n @hash = @value\n @hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\n to_s.hash\n end", "def to_hash(obj = T.unsafe(nil)); end", "def to_h\n @value\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def value_to_hash(value, options = T.unsafe(nil)); end", "def to_s\r\n to_hash.to_s\r\n end", "def _to_hash(value)\r\n if value.is_a?(Array)\r\n value.compact.map{ |v| _to_hash(v) }\r\n elsif value.is_a?(Hash)\r\n {}.tap do |hash|\r\n value.each { |k, v| hash[k] = _to_hash(v) }\r\n end\r\n elsif value.respond_to? :to_hash\r\n value.to_hash\r\n else\r\n value\r\n end\r\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 to_s\n to_hash.to_s\nend", "def to_s\n to_hash.to_s\nend", "def to_h(value)\n return value unless @to_h\n @to_h.call value\n end", "def to_hash\n Hash[to_a]\n end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end" ]
[ "0.67211187", "0.67211187", "0.666904", "0.6657421", "0.65874577", "0.6453551", "0.64165586", "0.64165586", "0.63830626", "0.63459253", "0.63054734", "0.6224601", "0.6152671", "0.61033845", "0.60806715", "0.60806715", "0.60736424", "0.6036857", "0.60224265", "0.5937387", "0.5905827", "0.5905827", "0.5905827", "0.5905827", "0.5905827", "0.58927", "0.58927", "0.5886888", "0.5886888", "0.5867915", "0.58522296", "0.58380103", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58223355", "0.58030236", "0.58030236", "0.57988733", "0.5784849", "0.577644", "0.577644", "0.577644", "0.577644", "0.577644", "0.577644", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181", "0.5772181" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_news @news = News.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 news_params params.require(:news).permit(:title, :body) 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
and every lowercase letter by its uppercase version. All other characters should be unchanged. You may not use Stringswapcase; write your own version of this method. solution 1
def swapcase(string) swapped_case = string.chars.map do |char| if char =~ /[a-z]/ then char.upcase elsif char =~ /[A-Z]/ then char.downcase else char.downcase end end swapped_case.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swapcase(str)\n result_str = ''\n str.each_char do |char|\n if char.count('a-z') > 0\n result_str += char.upcase\n else\n result_str += char.downcase\n end\n end\n result_str\nend", "def swapcase_bk(str)\n str.gsub(/([a-z]|[A-Z])/) { |letter| letter =~ /[a-z]/ ? letter.upcase : letter.downcase}\n\nend", "def swapcase(str)\n uppercase = (\"A\"..\"Z\").to_a\n lowercase = (\"a\"..\"z\").to_a\n letters = uppercase + lowercase\n \n str.chars.map do |el|\n if !letters.include?(el)\n el\n elsif uppercase.include?(el)\n el.downcase\n else\n el.upcase\n end\n end.join\nend", "def LetterChanges(str)\n\n str=str.tr('a-y','b-z')\n str=str.tr('aeiou','AEIOU')\n return str \n \nend", "def downcase(input); end", "def downcase() end", "def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend", "def downcase!() end", "def LetterChanges(str)\n str = str.split(\"\")\n \n str.each do |c|\n c.next! if c =~ /[a-z]/\n c.upcase! if c =~ /[aeiou]/\n end\n \n return str.join\nend", "def destructive_uppercase(str)\n upcase_only = \"\"\n str.each_char do |char|\n upcase_only += char unless char.downcase == char\n end\n upcase_only\nend", "def staggered_case(str) # moving to new string\n capital_letter = true\n new_str = ''\n str.each_char do |letter|\n if letter =~ /[^a-z]/i\n new_str << letter\n else\n capital_letter ? letter.upcase! : letter.downcase!\n new_str << letter\n capital_letter = !capital_letter\n end\n end\n new_str\nend", "def swapcase(str)\n uppercase = ('A'..'Z').to_a\n lowercase = ('a'..'z').to_a\n str.chars.map do |char|\n if uppercase.include?(char)\n char.downcase\n elsif lowercase.include?(char)\n char.upcase\n else\n char\n end\n end.join\nend", "def destructive_uppercase(str)\n str.each_char {|x| str.delete!(x) if x == x.downcase}\n str\nend", "def swapcase(str)\n str.chars.map { |chr| (/[a-z]/.match(chr))? chr.upcase : chr.downcase }.join('')\nend", "def upcase!() end", "def swapcase(str)\n arry = str.chars\n\n new_arry = arry.map do |char|\n if char =~ /[a-z]/\n char.upcase\n elsif char =~ /[A-Z]/\n char.downcase\n else\n char\n end\n end\n new_arry.join('')\nend", "def destructive_uppercase(str)\n output_str = ''\n\n str.each_char do |char|\n if char.upcase == char\n output_str += char\n end\n end\n output_str\nend", "def swapcase(str)\n str.chars.map do |el|\n if el =~ /[a-z]/\n el.upcase\n elsif el =~ /[A-Z]/\n el.downcase\n else\n el\n end\n end.join\nend", "def downcase; end", "def destructive_uppercase(str)\n result = \"\"\n (0...str.length).each do |idx|\n result << str[idx] if str[idx] != str[idx].downcase\n end\n result\nend", "def swapcase(string)\n characters = string.split('').map do |char|\n if char =~ /[A-Z]/\n char.downcase\n elsif char =~ /[a-z]/\n char.upcase\n else\n char\n end\n end\n characters.join\n\n # new_string = ''\n # string.each_char do |char|\n # if UPPERCASE.include?(char)\n # new_string += char.downcase\n # else\n # new_string += char.upcase\n # end\n # end\n # p new_string\nend", "def swapcase(str)\ncharacters = str.chars.map do |char|\n\tif char =~ /[a-z]/\n\t\tchar.upcase\n\telsif char =~ /[A-Z]/\n\t\tchar.downcase\n\telse\n\t\tchar\n\tend\nend\ncharacters.join\nend", "def upcase() end", "def do_magic(str)\n str.gsub!(/[^A-Z]/, '').to_s #delete small leters and uprinted sumbols\n str.downcase.to_s #make all leters small\nend", "def upcase(input); end", "def swapcase(str)\n str.chars.map do |char|\n if ('A'..'Z').include?(char)\n char.downcase\n elsif ('a'..'z').include?(char)\n char.upcase\n else\n char\n end\n end.join\nend", "def SwapCase(str)\n str.chars.map do |char|\n if (97..122).include?(char.ord)\n diff = char.ord - 'a'.ord\n ('A'.ord + diff).chr \n elsif (65..90).include?(char.ord)\n diff = char.ord - 'A'.ord\n ('a'.ord + diff).chr\n else\n char\n end\n end.join\nend", "def swapcase(string)\n arr = string.chars.map do |char|\n if char.match(/[A-Z]/)\n char.downcase \n elsif char.match(/[a-z]/)\n char.upcase\n else \n char\n end \n end \n arr.join\nend", "def destructive_uppercase(str)\r\n # your code goes here\r\n temp = \"\"\r\n i = 0\r\n while i < str.length\r\n if str[i].upcase.include?(str[i]) == false\r\n temp << str[i]\r\n end\r\n i += 1\r\n end\r\n temp\r\nend", "def swapcase!() end", "def staggered_case(str)\n new_str = str.downcase\n new_str.chars.each_with_index do |el, idx| \n new_str[idx] = el.upcase if idx.even?\n end\n new_str\nend", "def destructive_uppercase(str)\n new_string = str.chars.select {|el| el == el.upcase}\n new_string.join(\"\")\nend", "def swapcase() end", "def staggered_case(str)\narray = str.split(\"\")\nresult = array.each_with_index do |char, index|\n if index % 2 == 0 && char.match(/[a-zA-Z]/)\n char.upcase!\n elsif index % 2 == 1 && char.match(/[a-zA-Z]/)\n char.downcase!\n end\nend\nresult.join(\"\")\nend", "def swapcase(string)\n string.chars.map do |char|\n if char.match(/[a-z]/)\n char.upcase\n else\n char.downcase\n end\n end.join(\"\")\nend", "def swapcase(string)\n string.split('').map do |char|\n if char =~ /[a-z]/\n char.upcase!\n elsif char =~ /[A-Z]/\n char.downcase!\n else\n char\n end\n end.join('')\nend", "def code_letter(name)\nname = name.downcase.tr(\"aeiou\", \"eioua\")\nname = name.downcase.tr(\"bcdfghjklmnpqrstvwxyz\", \"cdfghjklmnpqrstvwxyzb\")\nend", "def swapcase(str)\n str.chars.map { |c| c == c.upcase ? c.downcase : c.upcase }.join\nend", "def swapcase(string)\n string.chars.map do |char|\n case char\n when /[a-z]/\n char.upcase\n when /[A-Z]/\n char.downcase\n else\n char\n end\n end.join\nend", "def swapcase(multi_word_string)\n word_arr = multi_word_string.split\"\" \n modified_arr = word_arr.map do |char|\n if char.match(/[a-z]/)\n char.upcase\n elsif char.match(/[A-Z]/)\n char.downcase\n else\n char\n end\n end\n modified_arr.join\"\"\nend", "def swapcase(str)\n new_str =\n str.chars.map do |element|\n if element =~ /[a-z]/\n element.upcase\n elsif element =~ /[A-Z]/\n element.downcase\n else\n element\n end\n end\n new_str.join\nend", "def staggered_case_include_non_alpha(string, upcase_or_downcase=\"upcase\")\n # new_array = []\n # string.chars.each_with_index do |char, index|\n # new_array[index] = index.even? ? char.upcase : char.downcase\n # end\n # new_array.join\n result = ''\n need_upper = upcase_or_downcase == \"upcase\"\n string.chars.each do |char|\n result += if need_upper\n char.upcase\n else\n char.downcase\n end\n need_upper = !need_upper\n end\n result\nend", "def swapcase(string)\n string.chars.map { |char| char.upcase == char ? char.downcase : char.upcase }\n .join\nend", "def weirdcase(str)\n new_str = \"\"\n str.chars.each_with_index do |c, i|\n if i%2==0 #reverse because odd characters have even indices\n new_str += c.downcase\n else\n new_str += c.upcase\n end\n end\n return new_str\nend", "def swapcase(str)\n str.chars.map do |el|\n if el == el.upcase\n el.downcase\n elsif el == el.downcase\n el.upcase\n else\n el\n end\n end.join\nend", "def staggered_case(str)\narray = str.split(\"\")\nneed_upper = true\nresult = []\narray.each do |char|\n if char.match(/[a-zA-Z]/) && need_upper == true\n result.push(char.upcase)\n need_upper = !need_upper\n elsif char.match(/[a-zA-Z]/)\n result.push(char.downcase)\n need_upper = !need_upper\n else result.push(char) \n end\n \nend\nresult.join(\"\")\nend", "def swapcase(str)\n res_arr = []\n str.chars.each do |chr|\n res_arr << case chr\n when ('a'..'z')\n chr.upcase\n when ('A'..'Z')\n chr.downcase\n else\n chr\n end\n end\n res_arr.join('')\nend", "def swapcase(str)\n swap_chars = str.chars.map do |char|\n if char =~ /[a-z]/\n char.upcase\n elsif char =~ /[A-Z]/\n char.downcase\n else\n char\n end\n end\n swap_chars.join\nend", "def weirdcase(str)\n (0...str.length).each do |idx|\n if idx % 2 == 0\n str[idx] = str[idx].downcase\n else\n str[idx] = str[idx].upcase\n end\n end\n str\nend", "def swapcase(text)\n characters = text.chars.map do |char|\n if char =~ /[a-z]/\n char.upcase\n else\n char.downcase\n end\n end\n characters.join('')\nend", "def swapcase(str)\n str.split(//).map do |chr|\n chr = chr.ord\n if chr.between?(65, 90)\n (chr + 32).chr\n elsif chr.between?(97, 122)\n (chr - 32).chr\n else\n chr.chr\n end\n end.join\nend", "def destructive_uppercase(str)\n str.each_char do |c|\n str.delete!(c) if c == c.downcase\n end\nend", "def LetterChanges(str)\n filtered = \"\"\n result = \"\"\n\n str.each_char do |i|\n if /[a-yA-Y]/ =~ i\n filtered << i.next\n elsif i == \"z\"\n filtered << \"a\"\n elsif i == \"Z\"\n filtered << \"A\"\n else\n filtered << i\n end\n end\n\n filtered.each_char do |i|\n if /[aeiou]/ =~ i\n result << i.upcase\n else\n result << i\n end\n end\n\n result\nend", "def swapcase(str)\n mapped_ary = str.split('').map do |chars|\n if chars == chars.upcase\n chars.downcase\n elsif chars == chars.downcase\n chars.upcase\n end\n end\nmapped_ary.join\nend", "def staggered_case(str)\n arry = str.chars \n\n arry.each_with_index do |ch, index|\n index.odd? ? ch.downcase! : ch.upcase!\n end\n arry.join('')\nend", "def SwapCase(str)\n\n return str.swapcase! \n \nend", "def swapcase(string)\n string.chars.map { |c| c.upcase == c ? c.downcase : c.upcase }.join\nend", "def swapcase(string)\n string.chars.map do |char|\n if char.downcase == char\n char.upcase\n elsif char.upcase == char\n char.downcase\n else\n char\n end\n end.join('')\nend", "def destructive_uppercase(str)\n str.each_char do |chr|\n if chr == chr.downcase\n str.delete!(chr)\n end\n end\nend", "def swapcase(string)\n string.split('').map { |char| char == char.upcase ? char.downcase : char.upcase }.join('')\nend", "def weirdcase(str)\n for i in 0..str.length-1\n if i % 2 != 0\n str[i] = str[i].upcase\n else\n str[i] = str[i].downcase\n end\n end\n str\nend", "def staggered_case(str) \n next_char_is_uppercase = false\n\n new_chars = str.chars.map do |character|\n next_char_is_uppercase = !next_char_is_uppercase\n next_char_is_uppercase ? character.upcase : character.downcase\n end\n\n new_chars.join\nend", "def destructive_uppercase(str)\n\t(str.split(\"\").select { |c| (\"a\"..\"z\").include?(c) == false } ).join\nend", "def destructive_uppercase(str)\n result = \"\"\n str.each_char {|ch| result << ch if ch < \"a\"}\n result\nend", "def letter_changes(str)\n str.each_char.with_index do |char, idx|\n if char =~ /[A-Za-z]/\n if char =~ /[Zz]/\n str[idx] = 'a'\n else\n str[idx] = (char.ord + 1).chr\n end\n end\n end\n str.each_char.with_index do |char, idx|\n str[idx] = char.upcase if char =~ /[aeiou]/\n end\n str\nend", "def swapcase(string)\n string.chars.map {|c| c == c.upcase ? c.downcase : c.upcase}.join\nend", "def swapcase(string)\n output = string.chars.map do |char| \n char == char.upcase ? char.downcase : char.upcase\n end\n output.join\nend", "def destructive_uppercase(str)\n my_str = \"\"\n str.chars{|ch| my_str += ch if ch.upcase == ch}\n my_str\nend", "def swapcase(string)\n swapped_string = ''\n string.each_char do |c|\n if (97..122).cover?(c.ord)\n swapped_string += c.upcase\n else\n swapped_string += c.downcase\n end\n end\nend", "def change_name(name)\n # swapes names\n name = name.split(' ').reverse.join(' ')\n\n #change all consonant's\n name = name.downcase.split('').map do |l|\n if l.match(/[a,e,i,o,u,\\s]/)\n l = l\n #account for edge case\n elsif l == \"z\"\n l = \"b\"\n else\n l = l.next\n #fixes consonant's that changed into vowels\n if l.match(/[a,e,i,o,u]/)\n l.next\n else\n l = l\n end\n end\n end\n#Loop through vowles\n for i in 0..name.length()-1\n case name[i]\n when \"a\"\n name[i] = \"e\"\n when \"e\"\n name[i] = \"i\"\n when \"i\"\n name[i] = \"o\"\n when \"o\"\n name[i] = \"u\"\n when \"u\"\n name[i] = \"a\"\n end\n end\nname = name.join()\nname = name.split.map(&:capitalize).join(' ')\nputs name\nname\nend", "def upcase; end", "def solution(string)\n string\n .split(\"\") # break chars\n .map { |char| char == char.upcase ? \" \" + char : char } # insert whitespace before uppercase chars\n .join(\"\") # reverts array to string\nend", "def staggered_case2(str)\n char_arr = str.chars\n toggle = true\n result = []\n char_arr.each do |char|\n if char.match(/[a-z]/i)\n if toggle\n result << char.upcase\n elsif !toggle\n result << char.downcase\n end\n toggle = !toggle\n else\n result << char\n end\n end\n result.join\nend", "def swapcase(string)\n swapped_string = string.chars.map do | char |\n if char.match(/[A-Z]/)\n char.downcase\n elsif char.match(/[a-z]/)\n char.upcase\n else\n char\n end\n end\n swapped_string.join\nend", "def to_lower_case2(str)\n str.split('').each_with_index do |value, index|\n if !!(/[A-Z]/ =~ value)\n str_asc = value.ord\n low_asc = str_asc + 32\n ac_low_asc = low_asc.chr(\"UTF-8\")\n str[index] = ac_low_asc\n end\n end\n str\nend", "def staggered_case_not_count_non_alphabetic(string)\n need_upper = true\n string.split('').map do |char| \n if char =~ /[a-zA-z]/\n transformed_char = need_upper ? char.upcase : char.downcase\n need_upper = !need_upper\n transformed_char\n else\n char\n end\n end.join\nend", "def StringSwapForUs str\n swap_str = []\n str.split(\"\").each do |val|\n if val == val.upcase\n swap_str << val.downcase\n elsif val == val.downcase\n swap_str << val.upcase\n end\n end\n\n swap_str.join(\"\")\nend", "def weirdcase(str)\n output_str = ''\n str.each_char.with_index do |el, i|\n if i % 2 == 0\n output_str += el.downcase\n else\n output_str += el.upcase\n end\n end\n\n output_str\nend", "def capital str \n cap_arr = str.split(' ')\n cap_arr.map! { |word|\n word[0].upcase + word[1..-1]\n }\n cap_arr.join(' ')\nend", "def staggered_case(str)\n new_str = ''\n to_upcase = true\n str.chars.each do |chr|\n if chr =~ /[a-zA-Z]/\n new_str << (to_upcase ? chr.upcase : chr.downcase)\n to_upcase = !to_upcase\n else\n new_str << chr\n end\n end\n new_str\nend", "def staggered_case(str)\n alt_cap = ''\n need_upper = true\n split_str = str.chars\n split_str.each do |char|\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n alt_cap\nend", "def to_lower_case1(str)\n char_map = Hash[('A'..'Z').zip ('a'..'z')]\n str.each_char.with_index do |c, i|\n if char_map.key?(c)\n str[i] = char_map[c]\n end\n end\n str\nend", "def destructive_uppercase(str)\n letters = (\"a\"..\"z\").to_a\n our_str = str.chars\n x = our_str.select {|x| !letters.include?(x)}\n x.join\nend", "def weirdcase(str)\n result = \"\"\n str.downcase.each_char.with_index do |char, i|\n i.even? ? result += char.downcase : result += char.upcase\n end\n result\nend", "def staggered_case(string)\n need_upper = true\n string.split('').map do |char| \n if char =~ /[a-zA-z]/\n transformed_char = need_upper ? char.upcase : char.downcase\n need_upper = !need_upper\n transformed_char\n else\n char\n end\n end.join\nend", "def swapcase(string)\n string = string.split(' ')\n new_string = \"\"\n\n string.map! do |word|\n word = word.split('').map {|l| UPPERCASE.include?(l) ? l.downcase : l.upcase}\n word.join('')\n end\n\n string.join(' ')\nend", "def weirdcase(str)\n result = ''\n arr_str = str.chars\n arr_str.each_index{|x| x.odd? ? result << arr_str[x].upcase : result << arr_str[x].downcase }\n result\nend", "def swap_letters(sentence, letters)\n # your code goes here\n result = []\n\n l1, l2= letters[0], letters[1]\n sentence.split.each do |word|\n temp = \"\"\n word.chars.each do |ch|\n if ch == l1 || ch == l1.downcase\n ch = l2\n elsif ch == l2 || ch.downcase == l2\n ch = l1.downcase\n end\n temp << ch\n end\n result << temp\n end\n\n result.join(\" \")\nend", "def yeller(s)\n puts s.map(&:upcase).join\n end", "def make_upper_case(str)\n str.upcase\nend", "def weirdcase(str)\n arr = str.split('')\n arr.each_index do |i|\n (i % 2).zero? ? arr[i].downcase! : arr[i].upcase!\n end.join\nend", "def staggered_case(string)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if char =~ /[a-zA-Z]/\n if need_upper\n result << char.upcase\n else\n result << char.downcase\n end\n need_upper = !need_upper \n else\n result << char\n end\n end\n result\nend", "def staggered_case(string)\n result_array = string.chars\n result_array.each_with_index do |item, i|\n i.odd? ? item.downcase! : item.upcase!\n end.join\nend", "def staggered_case(str)\n upcase = true\n str.chars.each_with_object('') do |c, str_2|\n unless c =~ /[a-zA-Z]/\n str_2 << c\n next\n end\n\n if upcase\n str_2 << c.upcase\n upcase = false\n else\n str_2 << c.downcase\n upcase = true\n end\n end\nend", "def staggered_case(string)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if need_upper && char =~ /[a-zA-Z]/\n result += char.upcase\n need_upper = !need_upper\n elsif !need_upper && char =~ /[a-zA-Z]/\n result += char.downcase\n need_upper = !need_upper\n else\n result += char\n end\n end\n result\nend", "def staggered_case(string)\n array = string.split('')\n\n upper = 0\n lower = 1\n\n loop do\n array[upper] = array[upper].upcase\n upper += 2\n\n array[lower] = array[lower].downcase\n lower += 2\n break if lower >= array.size\n end\n \n if array.size.odd?\n array.last.gsub!(array.last, array.last.upcase)\n end\n array.join('')\nend", "def staggered_case(string)\n iterator = 0\n characters = string.chars.map do |char|\n iterator += 1 if char =~ /[a-zA-Z]/\n #if char =~ /[a-z]/i <--LS\n if iterator.odd?\n char.upcase\n elsif iterator.even?\n char.downcase\n else\n char\n end\n end\n characters.join\nend", "def staggered_case(str, start_up_case = true)\n capital = start_up_case\n result_str = \"\"\n str.each_char do |char|\n if char =~ /[a-zA-Z]/\n capital ? char.upcase! : char.downcase!\n end\n result_str << char\n capital = !capital\n end\n p result_str \nend", "def letterCapitalize(str)\n\t#str = str.split(' ')\n\t#str.map! {|word| word.capitalize}\n\t#str.join(' ')\n\tstr.split(' ').map! {|word| word.capitalize}.join(' ')\nend", "def staggered_case(str)\n spongebob_case = str.split('').map.with_index do |char, index|\n if index.odd?\n char.upcase\n elsif index.even?\n char.downcase\n else\n char\n end\n end.join\n\n spongebob_case\nend" ]
[ "0.8157635", "0.8122964", "0.8031129", "0.8013708", "0.7938107", "0.7935862", "0.7905794", "0.7901973", "0.78828865", "0.78770584", "0.7863463", "0.78574294", "0.7839315", "0.7828488", "0.7827201", "0.7826694", "0.7824953", "0.7824405", "0.7817813", "0.78119236", "0.777812", "0.77718997", "0.77660614", "0.77646387", "0.7751424", "0.77512646", "0.77512467", "0.7743915", "0.7709142", "0.77006483", "0.76933", "0.7692878", "0.7688976", "0.76889056", "0.7675442", "0.7668288", "0.7657482", "0.76476526", "0.7641312", "0.7640172", "0.7638319", "0.76380825", "0.7630831", "0.76302314", "0.76291114", "0.7627704", "0.76248306", "0.76215965", "0.76185954", "0.76108134", "0.76009095", "0.7600874", "0.7586802", "0.75866246", "0.75866044", "0.7579507", "0.75775224", "0.7556554", "0.7553971", "0.75512135", "0.75473964", "0.7546439", "0.75406456", "0.75342023", "0.75319153", "0.75273824", "0.7519655", "0.7518918", "0.75165117", "0.7515236", "0.7503473", "0.74968493", "0.7495854", "0.7490832", "0.7490723", "0.748025", "0.7469412", "0.7465977", "0.74601954", "0.7456071", "0.74551797", "0.74519086", "0.7426022", "0.742388", "0.74131083", "0.741269", "0.74050504", "0.7403935", "0.73982185", "0.7388016", "0.7381039", "0.7376447", "0.73702985", "0.7366989", "0.73548824", "0.73495716", "0.73481256", "0.73317146", "0.73266184", "0.7320881" ]
0.7379173
91
the Annual Percentage Rate (APR) the loan duration From the above, you'll need to calculate the following two things: monthly interest rate loan duration in months Given a loan amount of L and APR of y% over z years monthly interest rate v=apr/12 /100 This will give a decimal representing the monthly interest rate. loan duration in months w = x years / 12 to calculate the monthly payment fixed monthly payment (P) required to fully amortize a loan of L dollars over a term of n months at a monthly interest rate of c. [If the quoted rate is 6%, for example, c is .06/12 or .005] P = L[c(1 + c)n]/[(1 + c)n 1] P = x[v(1 + v)w]/[(1 + )w 1] to caluculate remaining loan balance (B) of a fixed payment loan after p months. B = L[(1 + c)n (1 + c)p]/[(1 + c)n 1]
def prompt(message) puts "=> #{message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_apr\n payment_ratio = monthly_payment_with_fees / loan_amount\n f = lambda {|k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio)}\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1))}\n\n root = newton_raphson(f, f_deriv, monthly_interest_rate + 1)\n 100 * 12 * (root - 1).to_f\n end", "def year_to_month_rate_convert(apr_in_decimals, loan_duration)\n ((1 + (apr_in_decimals / loan_duration))**loan_duration) - 1\nend", "def apr\n payment_ratio = self.monthly_payment_with_fees / self.loan_amount\n f = lambda { |k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio) }\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1)) }\n\n root = newton_raphson(f, f_deriv, self.monthly_interest_rate + 1)\n 100 * 12 * (root - 1).to_f\n end", "def calculate_monthly_pay(loan_amount, interest_rate, loan_duration)\n loan_amount * (interest_rate * ( 1 + interest_rate) * loan_duration) /\n (interest_rate * ( 1 + interest_rate) * (loan_duration - 1))\nend", "def calculate_apr\n payment_ratio = pmt / principal_calculation\n duration = @duration\n f = lambda {|k| (k**(duration + 1) - (k**duration * (payment_ratio + 1)) + payment_ratio)}\n f_deriv = lambda { |k| ((duration + 1) * k**duration) - (duration * (payment_ratio + 1) * k**(duration - 1))}\n\n root = newton_raphson(f, f_deriv, monthly_rate + 1)\n 100 * 12 * (root -1).to_f\n end", "def calculation(duration, loan, apr)\n loan * (apr / (1 - (1 + apr)**(-duration)))\nend", "def get_monthly_rate(apr)\n (apr / 100) / 12\nend", "def loan_dur_month(loan_duration)\n loan_duration.to_i * 12\nend", "def calculate_n_months(loan_duration)\n 12 * loan_duration\nend", "def monthly_payment(salary_per_annum)\n return salary_per_annum / 12\nend", "def mortgage_calc principle, annual_interest, years\n n = years * 12\n r = (annual_interest / 100)/ 12 #since this is usually expressed as a percentage\n return (principle * r * (1 + r)**n / ((1 + r)**n - 1)).round(2)\nend", "def calculate_loan(rate, n_periods, total_loan_amount)\n fixed_payment = (rate /\n (1 - ((1 + rate)**(n_periods * - 1)))) * total_loan_amount\n\n fixed_payment.to_f\nend", "def amortize(rate)\n # For the purposes of calculating a payment, the relevant time\n # period is the remaining number of periods in the loan, not\n # necessarily the duration of the rate itself.\n periods = @periods - @period\n amount = Amortization.payment @balance, rate.monthly, periods\n\n pmt = Payment.new(amount, :period => @period)\n if @block then pmt.modify(&@block) end\n \n rate.duration.times do\n # Do this first in case the balance is zero already.\n if @balance.zero? then break end\n\n # Compute and record interest on the outstanding balance.\n int = (@balance * rate.monthly).round(2)\n interest = Interest.new(int, :period => @period)\n @balance += interest.amount\n @transactions << interest.dup\n\n # Record payment. Don't pay more than the outstanding balance.\n if pmt.amount.abs > @balance then pmt.amount = -@balance end\n @transactions << pmt.dup\n @balance += pmt.amount\n \n @period += 1\n end\n end", "def get_monthly_payments(loan, interest, months)\n loan * (interest / (1 - (1 + interest)**(-months)))\nend", "def calculate_monthly_mortgage(rate, principal, years)\n\tnew_rate = rate.to_f / 12\n\tnum_payments = 12 * years\n\tmonthly_payment = principal * ((new_rate * (1 + new_rate) ** num_payments)/((1 + new_rate) ** num_payments - 1))\n\treturn monthly_payment.round(2)\nend", "def monthly_rate(*args)\n if duration.present? && paid?\n rate(*args) / duration_in_months\n else\n rate(*args)\n end\n end", "def pmt(rate, nper, pv)\n\n # =========================================================\n #the required output already accounts for monthly nature by dividing the 0.0404 by 12. it also already puts the percentage in decimal form so no need to adjust for rate on the back end\n part1 = (pv * rate)\n part2 = 1 - (1 + rate)**-nper\n\n monthly_payment = part1 / part2\n\n # Your code to implement the method goes here.\n # You shouldn't have to write or change code anywhere else.\n # =========================================================\nend", "def pmt (interest_rate, nper, pv)\n\t#monthly_payment = 1.00\n\tmonthly_payment = (pv*interest_rate*((1+interest_rate)**nper))/(((1+interest_rate)**nper)-1)\n\treturn monthly_payment\nend", "def loan_calc(loan_amount,interest_rate,loan_term,loan_type)\n if loan_type.downcase == \"pi\"\n r = interest_rate/12\n n = loan_term*12\n d = ( ( ( (1+r)**n) - 1) / (r*(1+r)**n))\n result = loan_amount/d\n\n elsif loan_type.downcase == \"io\"\n r = interest_rate/12\n result = loan_amount * r\n end #end if\nend", "def payment\n loan_amount / 12\n end", "def calculate(quote)\n loan_amt = loan_amount(quote)\n monthly_pmt = loan_amt / pv_of_1_dollar_payments\n {\n debt_rate: debt_rate,\n loan_amount: loan_amt.round(2),\n monthly_payment: monthly_pmt.round(2)\n }\n end", "def rate\n Rate.new(self.interest/100, :apr, duration: self.tenure * 12)\n end", "def loan_amt\n (self.buying_price*1000) * (1 - (self.deposit/100))\n end", "def required_annual_savings\n needed_amount_less_savings / years_to_retirement\n end", "def monthly_rate\n\t\t yearly? ? rate / 12 : rate\n\t\t end", "def pv\n factor = (1.0 + monthly_rate)**duration\n second_factor = (factor - 1) * (1 + monthly_rate * ptype) / monthly_rate\n\n -(future_value + (payment.to_f * second_factor)) / factor\n end", "def pmt(interest_rate,payments,principal)\n numerator =interest_rate*principal*(1 + interest_rate)**payments\n denominator= (1+ interest_rate)**payments - 1\n return numerator/denominator.to_f\nend", "def frm(r, n, po)\n\t## \n\t# interest rate is converted to fraction and made a monthly\n\tr = r.to_f/100/12\n\t##\n\t#number of years is converted to number of months\n\tn = n * 12\n\t##\n\t#monthly payment is calculated\n\tc = (r / (1 - (1+r) ** -n) ) * po\n\treturn c\nend", "def annual_salary\n hourly_rate * 1950\n end", "def monthly_rate\n yearly? ? rate / 12 : rate\n end", "def yearly_rate(*args)\n if paid?\n if yearly?\n rate(*args) / duration_parts[0] #number of years\n else\n rate(*args) / duration_in_months * 12\n end\n else\n nil\n end\n end", "def nb_year(p0, percent, aug, p)\n years = 0\n while p >= p0 do\n p0 += (percent/100.0 * p0) + aug\n years += 1\n end\n p years\nend", "def calculate_interest principle, days_since\n (principle * APR / 365 * days_since).round(2)\n end", "def valoralmidonp\n\t\tvag=(almidon * 70) / 100\n vag.round(2)\n\tend", "def calculate(loan_value, financing_time_months, interest_rate, loan_date = Date.today)\n balance = loan_value\n installment = installment_value(interest_rate, financing_time_months, loan_value)\n installment_date = loan_date.next_month\n iof = 0\n\n financing_time_months.step(1, -1) do |_|\n amortization = installment - interest_part(balance, interest_rate)\n\n days = past_days(loan_date, installment_date)\n\n iof += amortization*(@iof_day*(minimal_days(days)))\n iof += amortization*@iof_additional\n\n balance -= amortization\n installment_date = installment_date.next_month\n end\n\n loan_iof(iof, loan_value)\n end", "def monthly_interest\n\t\tinterest_rate / (100 * 12)\n\tend", "def iralmidonp\n vag=(valoralmidonp * 100) / 90\n vag.round(2)\n end", "def payment(rate, bal, term)\n # Convert annual rate to monthly and make it decimal.\n r = rate / 1200\n\n # Numerator\n n = r * bal\n\n # Denominator\n d = 1 - (1 + r)**-term\n\n # Calc the monthly payment.\n pmt = n / d\n end", "def unit_payment(mort_disc, interest, numberOfMonths,payment)\n (mort_disc * payment) / ((1.0 + interest) ** (numberOfMonths / 12.0))\n end", "def installment_value(interest_rate, financing_time_months, loan_value)\n @installment_calculator.calculate(interest_rate, financing_time_months, loan_value)\n end", "def total_annual_rent_collected\n units.map { |unit| unit.is_vacant ? 0 : unit.monthly_rent }.reduce(:+) * 12\n end", "def annualized_portfolio_amount_needed\n savings_portion_needed * 12.0\n end", "def total_amount_owed(principal, interest_rate_percentage, number_of_years)\n annual_percentage_rate = interest_rate_percentage / 100\n principal * (1 + annual_percentage_rate * number_of_years)\nend", "def adjusted_capital\n return 0.0 if @capital <= 0.0\n return 0.0 if @interest_rate <= 0.0 || @duration <= 0.0\n (@income/ @duration) * ADJ_FACTOR\nend", "def get_almidon\n @_100=((@almidon*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@almidon*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @almidon , @_100 , 0 , @porcion , 0 ]\n end", "def debt_rate\n ten_year_treasury + bps(200)\n end", "def fixed_monthly_payment(amount, months, ir )\n amount*( ir * ( 1 + ir ) **months )/(( 1 + ir )**months - 1 )\nend", "def pmt\n factor = (1.0 + monthly_rate)**duration\n second_factor =\n if monthly_rate.zero?\n duration\n else\n (factor - 1) * (1 + monthly_rate * ptype) / monthly_rate\n end\n\n -((future_value + amount * factor) / second_factor)\n end", "def daily_interest\n @apr / 100.0 / 365\n end", "def nper\n z = payment * (1.0 + monthly_rate * ptype) / monthly_rate\n\n Math.log(-future_value + z / (amount + z)) / Math.log(1.0 + monthly_rate)\n end", "def total_payments\n\t\tammortization * 12\n\tend", "def monthly_payment\n\t\tc = monthly_interest\n\t\tif interest_only?\n\t\t\tc * amount\n\t\telse\n\t\t\tn = total_payments\n\t\t\t(amount * ((c * ((1 + c)**n)) / (((1 + c)**n) - 1))).round(2)\n\t\tend\n\tend", "def calculate_payment\n x = @periodic_rate * @principal * ((1 + @periodic_rate)**@periods)\n y = ((1 + @periodic_rate)**@periods) - 1\n (x / y).round(2)\n end", "def pmt rate, nper, pv\n\n\tpay = 0.0\n\tnumerator = 0.0\n\tdenominator = 0.0\n\n\tnumerator = pv * rate * (1 + rate) ** nper\n\n\tdenominator = ((1 + rate) ** nper) - 1\n\n\tpay = numerator / denominator\n\n\treturn pay.round(2)\n\nend", "def annual_ror(initial_value, final_value, years)\n if years <= 0\n 0\n elsif initial_value == 0\n # BigDecimal::INFINITY\n Float::INFINITY\n else\n 100.to_d * if final_value < 0 # fudge if final value is less than zero\n (((initial_value.to_d - final_value.to_d) / initial_value.to_d) ** (1 / years.to_d)) * -1\n else\n ((final_value.to_d / initial_value.to_d) ** (1 / years.to_d)) - 1\n end\n end\n end", "def work_out_input(array)\n loan_amount = array[0]\n mounthly_rate = array[1]\n n_mounths = array[2]\n mounthly_payment = loan_amount * (\n mounthly_rate / (\n 1 - (1 + mounthly_rate)**-n_mounths))\n mounthly_payment.round(2)\nend", "def calculate_annual_cost_in_cents\n (number_of_positions * hourly_rate_cents * hours_per_week.to_f * number_of_weeks)\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 nb_year(p0, percent, aug, p)\n count = 0\n while p0 < p\n p0 = p0 + (p0 * percent * 0.01).to_i + aug\n count += 1\n end\n \n return count\nend", "def avg_adjusted_payoff\n \tpayoff = []\n \tn_player_adjusted_payoffs.each do |p|\n \t\tpayoff << p.payoff\n \tend\n\n \tpayoff.sum.to_f / payoff.length.to_f\n end", "def average_amount\n (paid_infos.values.inject(:+) / paid_infos.size).round(2)\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 patient_monthly_costs_before_dh\n\t\t$pt_costs_monthy_no_dh = []\n\n\t\t$pokitdok_call.each do |drug|\n\t\t\t$pt_costs_monthy_no_dh << drug['retail']['oop_30_day']['amount'].to_f\n\t\tend\n\n\t\t$pt_costs_monthy_no_dh.inject(:+).round(2)\n\tend", "def calculaEstimativaBatimentos(anos)\n estimativaBatimentos = anos * 365 * 24 * 60 * 80\n return estimativaBatimentos\nend", "def rate_average_price_earnings_ratio(per)\n sum = per.value_three_years_ago + per.value_two_years_ago + per.value_last_year + per.value_this_year + per.value_next_year\n avg = sum / 5\n case \n when avg < 12\n score = 1\n when avg > 16\n score = -1\n else\n score = 0\n end\n per.average = avg\n per.score = score\n return score\n end", "def pv_of_1_dollar_payments\n member = 1.0\n factor = 1.0/(1 + debt_rate/PAYMENTS_PER_YEAR)\n res = 0\n\n TOTAL_PAYMENTS.times do\n member *= factor\n res += member\n end\n\n res\n end", "def paid_principal(amortization=self.amortization, duration=self.holding_period_mth)\n total_payment = -amortization.payments[0...duration].sum\n total_interest = amortization.interest[0...duration].sum\n\n total_payment - total_interest\n end", "def present_given_annuity(annuity, interest, term)\n (annuity.to_f * (((1 + interest.to_f) ** term) -1) / (interest.to_f * (1 + interest.to_f) ** term )).round(4)\n end", "def iralmidon\n vag=(almidon * 100) / 90\n vag.round(2)\n end", "def ipmt\n raise ArgumentError, 'no period given' if period.nil?\n\n ipmt_val = remaining_balance * monthly_rate\n if ptype == PAYMENT_TYPE_MAPPING[:beginning]\n period == 1 ? 0.0 : (ipmt_val / 1 + monthly_rate)\n else\n ipmt_val\n end\n end", "def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end", "def current_annual_load\n (current_daily_load * 365.2425 / 1000).to_i\n end", "def calculate_payment_amount(params, insurance_cost, interest_rate)\n mortgage_principle = params['asking_price'] - params['down_payment'] + insurance_cost\n number_of_payments = SCHEDULE_MAP[params['payment_schedule']] * params['amortization_period']\n nominal_interest_rate = (interest_rate / SCHEDULE_MAP[params['payment_schedule']]) / 100\n\n numerator = (mortgage_principle * nominal_interest_rate * (1 + nominal_interest_rate)**number_of_payments)\n denominator = (1 + nominal_interest_rate)**number_of_payments - 1\n\n (numerator / denominator).round(2)\n end", "def annualy_insurance\n return @capital * @insurance * -1\n end", "def overall_aroma_percentage\n overall_aroma = self.aroma_bundles.inject(0) do |memo, bundle|\n memo += bundle.percent if bundle.percent.is_a?(Integer) || bundle.percent.is_a?(BigDecimal)\n memo\n end\n\n return overall_aroma\n end", "def pmt(rate,n,amount)\n\n\ttop = 0.0\n\ttop = rate*(1+rate)**n\n\tbot = 0.0\n\tbot = (1+rate)**n-1\n\tresult = 0.0\n\tresult =amount*top/bot\n\treturn result \n\nend", "def calculate_max_mortgage(params, interest_rate)\n number_of_payments = SCHEDULE_MAP[params['payment_schedule']] * params['amortization_period']\n nominal_interest_rate = (interest_rate / SCHEDULE_MAP[params['payment_schedule']]) / 100\n\n numerator = params['payment_amount'] * ((1 + nominal_interest_rate)**number_of_payments - 1)\n denominator = nominal_interest_rate * (1 + nominal_interest_rate)**number_of_payments\n\n max_mortgage = (numerator / denominator).round(2)\n max_mortgage += params['down_payment'] if params['down_payment'].present?\n max_mortgage\n end", "def avg_payoff\n payoff = []\n n_player_payoffs.each do |p|\n payoff << p.payoff \n end\n \n payoff.sum / payoff.length.to_f\n end", "def interest\n return (@capital / 100) * @rate\n end", "def us_treas_10_year_rate\n # In real life call a web service to get it, but I will return a constant here\n 0.02124\n end", "def compound_return(periods,present_value,future_value)\n pv = present_value.to_d\n fv = future_value.to_d\n n = periods.to_d\n rate = ((fv / pv)**(1/n))-1\n end", "def prorated_price_for(year,month)\n m_days = amount_of_days_reserved_in(year,month)\n \n return 0 if m_days == 0\n \n if m_days == days_in(month)\n @monthly_price\n elsif m_days == days_in(month).round(-1) / 2\n @monthly_price / 2 # put this in here just to get line 2 of notes to pass ;)\n else\n (@monthly_price / days_in(month)) * m_days\n end\n end", "def total_retirement_saving(your_age)\n child_age = your_age / 2\n saving_per_year = child_age * child_age\n years_to_retire = 65 - child_age\n saving_per_year * years_to_retire\nend", "def future_given_annuity(annuity, interest, term)\n (annuity * (((1 + interest.to_f) ** term) -1) / interest.to_f ).round(4)\n end", "def add_monthly_interest\n\t\t@debt *= 1.015\n\t\t@balance *= 1.0003\n\tend", "def rental_mth\n self.rental*1000/12\n end", "def calculate\n # Percentage of understanding is calculated by following\n self.progress_rate = ((sum_of_point.to_f / total_count.to_f) * 100.00).round(2)\n end", "def yearly_rate\n yearly? ? rate : rate * 12\n end", "def calc_pv()\n i = @i / 100.0\n #Initial contribution\n pvf = @fv / ((1 + i) ** @n)\n #Present value of annuity\n pva = (@pmt/i) * (1-(1/((1+i)**@n)))\n @pv = (pvf + pva) * (-1)\n #Round\n @pv = (@pv*100).round / 100.0\n end", "def yearly_rate\n\t\t yearly? ? rate : rate * 12\n\t\t end", "def salary_advance\n advs = @faculty.employee_advance_payments.belongs_to_month(@generation_date.strftime(\"%b\")).belongs_to_year(@generation_date.strftime(\"%Y\"))\n advs.inject(0){|sum, adv| sum+adv.amount_in_rupees}\n end", "def calc_years_till\n (calc_months_till / 12.00).round(2)\n end", "def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal += income - income * tax\n end\n year\nend", "def loan_calc()\n\t# Initialize variables\n\tp = 0 # - Principal\n\tr = 0 # - Rate of interest\n\tn = 0 # - Number of years\n\n\t# Get the input from the user as floats\n\t# - Get principal amount / loan amount\n\twhile p <= 0 do\n\t\tprint \"Please enter principal amount for loan (must be a positive number):\\n\"\n\t\tp = gets.chomp.to_f\n\tend\n\n\t# - Get rate of interest in percent\n\twhile r <= 0 do\n\t\tprint \"Please enter interest rate for loan (must be a positive number):\\n\"\n\t\tr = gets.chomp.to_f\n\tend\n\n\t# - Get number of years / the duration of the loan\n\twhile n <= 0 do\n\t\tprint \"Please enter duration of the loan in years (must be a positive number):\\n\"\n\t\tn = gets.chomp.to_f\n\tend\n\n\t# Calculate the monthly payment for the loan\n\tm = (p * r / 1200) / (1 - (1.0 + r / 1200.0) ** (-12 * n))\n\n\t# Round to the nearest cent\n\tm = m.round(2)\n\n\t# Give the user their output\n\tprint \"This is the monthly payment for the loan, rounded to the nearest cent:\\n\", m, \"\\n\"\n\t\n\t# Make another call to this same function if the user answered 'Y' for yes, exit if 'N' for no, or prompt again if input is invalid \n\tanswer = \"\"\n\twhile answer != 'y' and answer != 'n' do\n\t\tprint \"Would you like to go again? Y/N\\n\"\n\t\tanswer = gets.chomp.downcase\n\t\tif (answer == 'y')\n\t\t\tloan_calc()\n\t\telsif (answer == 'n')\n\t\t\treturn\n\t\telse\n\t\t\tprint \"Sorry, that doesn't seem to be a valid response. Only type 'Y' or 'N'\\n\"\n\t\tend\n\tend\nend", "def pnl(fake_yahoo_api)\n \"#{((portfolio_value(fake_yahoo_api) - @starting_balance) / @starting_balance * 100).round(2)}%\"\n end", "def round!\n new_monthly_rate = (monthly_rate.cents / 25.0).round * 25\n #get back to full term\n new_rate = duration_in_months * new_monthly_rate\n self.rate = Money.new(new_rate)\n end", "def grow_one_year(starting_balance, growth_rate)\n starting_balance * (1.0 + growth_rate)\nend", "def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n !bankrupt && deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend", "def nb_year(p0, percent, aug, p)\n year_count = 0\n until p0 >= p do\n p0 += (p0 * (percent/100.to_f)) + aug\n year_count += 1\n # binding.pry\n end\n year_count\n # binding.pry\nend", "def two_pt_pct\n return 0.0 if two_pt.zero? || two_pt_a.zero?\n\n (two_pt.to_f/two_pt_a).round(3)\n end", "def univ_paid_ship_rate\n return 0 unless most_recent_payment_good && university_id\n university.number_per_month(most_recent_payment_good.andand.amount)\n end" ]
[ "0.77986", "0.76595396", "0.75249624", "0.7318206", "0.72526187", "0.7088119", "0.6930633", "0.67913395", "0.67086416", "0.6664624", "0.65877956", "0.6523387", "0.6499343", "0.64012754", "0.6324625", "0.6200358", "0.6188956", "0.61625856", "0.61589515", "0.6126233", "0.6085664", "0.6040853", "0.6029699", "0.5963593", "0.59288055", "0.5915462", "0.59096825", "0.5880269", "0.58640075", "0.5823381", "0.5799251", "0.57872814", "0.57748955", "0.57687676", "0.5756763", "0.5756388", "0.5737128", "0.57331324", "0.5725263", "0.57072514", "0.57070476", "0.5701674", "0.56609106", "0.5621457", "0.5618346", "0.5604577", "0.5592395", "0.5579652", "0.5572313", "0.5566127", "0.5561532", "0.5546001", "0.5510682", "0.55062395", "0.5504829", "0.5503477", "0.549462", "0.5478598", "0.5467287", "0.54598945", "0.5456311", "0.544253", "0.5440983", "0.54375774", "0.5429547", "0.54273677", "0.53708035", "0.5341801", "0.53334415", "0.53333455", "0.5324039", "0.5313037", "0.5312779", "0.53111804", "0.52957654", "0.5295442", "0.5282707", "0.5262136", "0.5255544", "0.5239999", "0.52396554", "0.52352905", "0.5232471", "0.52285254", "0.52258545", "0.5217901", "0.5211416", "0.5211064", "0.52083397", "0.5205724", "0.5201735", "0.5200709", "0.51991135", "0.51980895", "0.51943713", "0.5184108", "0.5176428", "0.5174398", "0.5173351", "0.51707596", "0.51683176" ]
0.0
-1
GET /homeworks/1 GET /homeworks/1.json
def show if(filters) #Revisamos si incio sesion if(!session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end #Si no es admin, dueño o participante, chao if( (User.find(session[:user_id]).admin) || (Homework.find(params[:id]).user.id == session[:user_id]) || (Participation.exists?(:user_id => session[:user_id])) ) @homework = Homework.find(params[:id]) @random = rand(10000) @random_hash = Digest::SHA1.hexdigest(@random.to_s) @invitations = Participation.find_all_by_homework_id(@homework.id) respond_to do |format| format.html # show.html.erb format.json { render json: @homework } end else flash[:error] = "Acceso denegado" redirect_to home_path return end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @my_posted_homeworks = MyPostedHomework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_posted_homeworks }\n end\n end", "def show\n @homework_item = HomeworkItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homework_item }\n end\n end", "def show\n @my_posted_homework = MyPostedHomework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_posted_homework }\n end\n end", "def index\n @homeworks = Homework.all\n end", "def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n\n @homeworks = Homework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homeworks }\n end\n end", "def show\n @work = Work.find(params[:id])\n render :json => {:name => @work.name, :desc => @work.description}\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def index\n @homes = Home.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homes }\n end\n end", "def index\n @workshops = Workshop.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshops }\n end\n end", "def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end", "def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end", "def index\n @workouts = Workout.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workouts }\n end\n end", "def show\n @home = Home.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home }\n end\n end", "def show\n @home = Home.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home }\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework }\n end\n end", "def index\n @link_name = \"horas\"\n @time_work = TimeWork.new\n @time_works = TimeWork.all_by_user_session user_web\n\n respond_to do |format|\n respond_msg\n format.html # index.html.erb\n format.json { render json: {time_works: @time_works, time_work: @time_work} }\n end\n end", "def index\n @workouts = Workout.all \n render 'index.json.jbuilder', status: :created\n end", "def show\n @work_id = params[:id]\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work }\n end\n end", "def show\n @work = Work.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work.to_json(:include => {\n :teacher => {},\n :student => {},\n :thesis_changes => {},\n :tasks => {:include => :thesis_changes}\n })}\n end\n end", "def show\n\t\t@work = Work.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @work }\n\t\tend\n\tend", "def index\n @workdetails = Workdetail.where(\"task_id = ?\", params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workdetails }\n end\n end", "def show\r\n @second_work = SecondWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @second_work }\r\n end\r\n end", "def show\n @work_entry = WorkEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_entry }\n end\n end", "def show\n render json: @laboratory\n end", "def index\n workouts = @ws.workouts\n render json: workouts\n end", "def show\n @myworkout = Myworkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @myworkout }\n end\n end", "def show\n @gym_workout = GymWorkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gym_workout }\n end\n end", "def start\n @homes = Home.all\n\n respond_to do |format|\n format.html # start.html.erb\n format.json { render json: @homes }\n end\n end", "def start\n @homes = Home.all\n\n respond_to do |format|\n format.html # start.html.erb\n format.json { render json: @homes }\n end\n end", "def show\r\n @academic_work = AcademicWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @academic_work }\r\n end\r\n end", "def index\n @homepageentries = Homepageentry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homepageentries }\n end\n end", "def index\n @content_homes = ContentHome.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_homes }\n end\n end", "def getwork(data)\n request :getwork, data\n end", "def show\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @homework }\n end\n end", "def show\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @homework }\n end\n end", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def show\n @workshop = Workshop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workshop }\n end\n end", "def show\n @client_workout = ClientWorkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_workout }\n end\n end", "def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end", "def index\n @works = Work.all\n end", "def index\n @works = Work.all\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def getwork(data = nil)\n @api.request 'getwork', data\n end", "def get_work\n client.make_request('/get-work', 'post', params: {})\n end", "def show\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def show\n @work_log = WorkLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_log }\n end\n end", "def show\n @workstation = Workstation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workstation }\n end\n end", "def index\n @journal = Journal.find(params[:journal_id])\n\n render json: @journal.workouts\n end", "def show\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_day }\n end\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @home_index = Home::Index.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_index }\n end\n end", "def show\n @content_home = ContentHome.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_home }\n end\n end", "def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end", "def show\n @homepageentry = Homepageentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homepageentry }\n end\n end", "def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\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 show\n @jam = Jam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jam }\n end\n end", "def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @works }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n # Rails.logger.debug params\n @workspace = Kaiju::WorkspaceJson.as_json(\n params[:id], request.base_url, project_id: params[:project_id], user_id: current_user.id\n )\n @project = Kaiju::ProjectJson.as_json(params[:project_id], request.base_url, user_id: current_user.id)\n @user = Kaiju::UserJson.as_json(current_user.id, request.base_url)\n\n respond_to do |format|\n format.html\n format.json { render json: JSON.pretty_generate(@workspace) }\n end\n end", "def show\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_activity }\n end\n end", "def index\n @projects = Project.all\n render json: @projects\n end", "def latest\n @works = Work.latest\n render :index\n end", "def show\n @programme = Programme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programme }\n end\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def all_works\n #start = numeric( params[:start], DEFAULT_START )\n #limit = numeric( params[:limit], DEFAULT_LIMIT )\n\n works = batched_get( {} )\n respond_to do |format|\n format.json do\n if works.empty?\n render_json_works_response(:not_found )\n else\n # dont provide fileset information here, it takes too long and we just want work information\n render_json_works_response(:ok, work_transform( works, EXCLUDE_FILESETS ) )\n end\n end\n format.csv do\n # provide fileset information here because this is used for work export\n render_csv_works_response( work_transform( works, INCLUDE_FILESETS ) )\n end\n end\n\n end", "def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @house_works = HouseWork.all\n end", "def index\n @hackathons = Hackathon.all\n end", "def index\n @hackathons = Hackathon.all\n end", "def index\n @programmes = Programme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programmes }\n end\n end", "def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end", "def index\n\n if params['filter'] === nil\n @works = Work.all\n else\n @works = Work.where(params['filter'])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @works.to_json(:include => {\n :student => {only: [ :last_name, :name, :middle_name ]},\n :teacher => {only: [ :id ]}\n })}\n end\n end", "def show\r\n @scientific_work = ScientificWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @scientific_work }\r\n end\r\n end", "def find_work\n work_id = params[:id]\n @work = Work.find_by_id(params[:id])\n head :not_found unless @work\nend", "def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end", "def index\n @joys = Joy.all\n render json: @joys\n end", "def search_works\n\n work_search = API::WorkSearch.new.from_json( params )\n if work_search.valid_for_search?\n\n works = do_works_search( work_search )\n respond_to do |format|\n format.json do\n if works.empty?\n render_json_works_response(:not_found )\n else\n # dont provide fileset information here, it takes too long and we just want work information\n render_json_works_response(:ok, work_transform( works, EXCLUDE_FILESETS ) )\n end\n end\n format.csv do\n # provide fileset information here because this is used for work export\n render_csv_works_response( work_transform( works, INCLUDE_FILESETS ) )\n end\n end\n else\n render_json_works_response(:bad_request, nil, 'Missing or incorrect parameter' )\n end\n\n end", "def index\n @programs = Program.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end", "def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end", "def index\n @projects = Project.all\n render json: @projects, status: :ok\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 index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end", "def index\n @admin_workshops = Admin::Workshop::Workshop.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_workshops.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end" ]
[ "0.7221033", "0.7221033", "0.70669985", "0.6909496", "0.68681705", "0.67669284", "0.67596513", "0.6753722", "0.673994", "0.673994", "0.66785383", "0.66776884", "0.66482407", "0.6560151", "0.6539761", "0.6509684", "0.6509684", "0.64965427", "0.64931756", "0.64786094", "0.638988", "0.63838404", "0.6381836", "0.63477856", "0.63444614", "0.6343735", "0.6324692", "0.6318676", "0.6310075", "0.63024473", "0.6279037", "0.6279037", "0.62761146", "0.6272013", "0.6266759", "0.62559134", "0.6232583", "0.6232583", "0.62286776", "0.62201494", "0.62167954", "0.62138027", "0.62086385", "0.62086385", "0.6206527", "0.6201067", "0.6181899", "0.6178024", "0.6163035", "0.6163035", "0.615119", "0.6150933", "0.6150318", "0.614957", "0.61400324", "0.61217916", "0.6111638", "0.6094213", "0.60892045", "0.6088849", "0.60886806", "0.6085445", "0.6085092", "0.6084999", "0.60790807", "0.60779935", "0.60779935", "0.60736316", "0.60721344", "0.60713834", "0.60555553", "0.60534585", "0.60528016", "0.6045897", "0.60444427", "0.603536", "0.6029931", "0.6029931", "0.6025677", "0.6025435", "0.6025245", "0.6022333", "0.6013945", "0.601288", "0.6011233", "0.60088223", "0.6008574", "0.6008195", "0.60077083", "0.6007531", "0.60038084", "0.60038084", "0.60038084", "0.60038084", "0.60038084", "0.60038084", "0.60038084", "0.6003414", "0.5994221", "0.59934926", "0.59807056" ]
0.0
-1
GET /homeworks/new GET /homeworks/new.json
def new if(filters) #Revisamos si incio sesion if(!session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end end @homework = Homework.new respond_to do |format| format.html # new.html.erb format.json { render json: @homework } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @homework_item = HomeworkItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework_item }\n end\n end", "def new\n get_work; get_subject\n @work_has_subject = WorkHasSubject.new(:work => @work, :subject => @subject)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work_has_subject }\n end\n end", "def new\n\t\t@work = Work.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @work }\n\t\tend\n\tend", "def new\n @my_posted_homework = MyPostedHomework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_posted_homework }\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n @home = Home.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home }\n end\n end", "def new\n @home = Home.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home }\n end\n end", "def new\n @work = Work.new\n\n logger.info @work.be.user_projects('nois3lab')\n\n @tags = Tag.all\n @media_asset = MediaAsset.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end", "def new\n @work_day = WorkDay.new\n\n respond_to do |format|\n format.html\n format.json { render json: @work_day }\n end\n end", "def new\n @workstation = Workstation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workstation }\n end\n end", "def new\n @classwork = Classwork.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classwork }\n end\n end", "def new\n @work = Work.new\n \n @title = \"New work\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @work_entry = WorkEntry.new\n @locations = Location.order(:name)\n @initial_codes = Code.where(location_id: @locations.first.id).all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_entry }\n end\n end", "def new\n @myworkout = Myworkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @myworkout }\n end\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 new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end", "def new\r\n @academic_work = AcademicWork.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @academic_work }\r\n end\r\n end", "def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @ourproject = Ourproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ourproject }\n end\n end", "def new\n @work_log = WorkLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_log }\n end\n end", "def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hack }\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @homework }\n format.js { render :layout => false }\n end\n end", "def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @jam = Jam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jam }\n end\n end", "def new\n @client_workout = ClientWorkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_workout }\n end\n end", "def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @gym_workout = GymWorkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @gym_workout }\n end\n end", "def new\n @bookwork = Bookwork.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bookwork }\n end\n end", "def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end", "def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end", "def new\n @work_activity = WorkActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_activity }\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @homework }\n end\n end", "def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @something }\n end\n end", "def new\n @projects_person = ProjectsPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projects_person }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @work_process = WorkProcess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_process }\n end\n end", "def new\r\n @stages_work = StagesWork.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @stages_work }\r\n end\r\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end", "def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @create = Create.new\n @person = Person.find(params[:person_id]) if params[:person_id]\n @work = Work.find(params[:work_id]) if params[:work_id]\n @create.person = @person\n @create.work = @work\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create }\n end\n end", "def new\n @lab_name = LabName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_name }\n end\n end", "def new\n @git_datum = GitDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @git_datum }\n end\n end", "def new\n @workout_day = WorkoutDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout_day }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project }\n end\n end", "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def create\r\n @work = Work.new(work_params)\r\n\r\n respond_to do |format|\r\n if @work.save\r\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\r\n format.json { render action: 'index', status: :created, location: @work }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcher }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @hackplatformrelation = Hackplatformrelation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hackplatformrelation }\n end\n end", "def new\n @homepageentry = Homepageentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homepageentry }\n end\n end", "def new\n @work_plan = WorkPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_plan }\n end\n end", "def new\n @infrastructure = Infrastructure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @infrastructure }\n end\n end", "def new\n @cool = Cool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cool }\n end\n end", "def new\n @projectresource = Projectresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectresource }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end" ]
[ "0.7740934", "0.76035714", "0.7601485", "0.759514", "0.759514", "0.7205977", "0.7186256", "0.7180083", "0.71278244", "0.7060748", "0.7051293", "0.7050734", "0.7049303", "0.7026071", "0.69925964", "0.69300413", "0.6922538", "0.69192827", "0.68677866", "0.6844349", "0.6811454", "0.68061143", "0.6786533", "0.67849463", "0.6757898", "0.67493236", "0.6735081", "0.6735081", "0.6729666", "0.67229754", "0.67079157", "0.67061555", "0.67001235", "0.66938525", "0.6689787", "0.6684591", "0.6683348", "0.6681427", "0.6677352", "0.6674702", "0.6671453", "0.6671453", "0.6666109", "0.66473866", "0.6646895", "0.664563", "0.6625252", "0.6621721", "0.6617488", "0.6616033", "0.6611902", "0.66006786", "0.6598494", "0.6597884", "0.65972817", "0.65917474", "0.65843874", "0.6580466", "0.6575193", "0.6575119", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.65725636", "0.6564387", "0.6564039", "0.65563995", "0.655588", "0.65536207", "0.65536207", "0.65456384", "0.65421194", "0.65332174", "0.65278566", "0.65261817", "0.6525146", "0.65246165", "0.65228546", "0.6520112", "0.6508769", "0.6508769" ]
0.6848242
19
POST /homeworks POST /homeworks.json
def create if(filters) #Revisamos si incio sesion if(!session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end end #Contamos las tareas para asegurarnos de que no tenga sobre 20 userid = session[:user_id] if(User.find(userid).homeworks.count > 20) flash[:error] = "Lo sentimos, no puede tener una cantidad mayor a 20 buzones" redirect_to home_path else @homework = Homework.new(params[:homework]) @homework.user_id = userid uploaded_io = params["file"] begin @homework.filename = uploaded_io.original_filename rescue @homework.filename = params["file"].to_s end respond_to do |format| if @homework.save begin directory = Dir::pwd + "/shared_files/#{userid.to_s}" Dir::mkdir(directory) unless File.exists?(directory) directory = Dir::pwd + "/shared_files/#{userid.to_s}/#{@homework.id.to_s}" Dir::mkdir(directory) unless File.exists?(directory) File.open(Rails.root.join('shared_files', "#{userid.to_s}/#{@homework.id.to_s}", @homework.filename), 'wb') do |file| file.write(uploaded_io.read) end rescue #Este rescue existe para capturar el error de permisos, el cual no afecta el flujo del programa (pues los buzones se crean igual). end format.html { redirect_to @homework, notice: 'Buzón creado exitosamente' } format.json { render json: @homework, status: :created, location: @homework } else format.html { render action: "new" } format.json { render json: @homework.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @homework = current_user.homeworks.new(homework_params)\n\n respond_to do |format|\n if @homework.save\n format.html { redirect_to @homework, notice: 'Homework was successfully created.' }\n format.json { render :show, status: :created, location: @homework }\n else\n format.html { render :new }\n format.json { render json: @homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_posted_homework = MyPostedHomework.new(params[:my_posted_homework])\n\n respond_to do |format|\n if @my_posted_homework.save\n format.html { redirect_to @my_posted_homework, notice: 'My posted homework was successfully created.' }\n format.json { render json: @my_posted_homework, status: :created, location: @my_posted_homework }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_posted_homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @my_posted_homeworks = MyPostedHomework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_posted_homeworks }\n end\n end", "def create_homework(homework)\n homeworks << homework\n end", "def create\n @homework = Homework.new(params[:homework])\n\n respond_to do |format|\n if @homework.save\n format.html { redirect_to(@homework, :notice => 'Homework was successfully created.') }\n format.xml { render :xml => @homework, :status => :created, :location => @homework }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @homework.errors, :status => :unprocessable_entity }\n end\n end\n end", "def do_request(homework)\n uri = URI.parse('https://webhook.site/1e9a10c7-54e0-414b-a1a7-3a7dad38c56d')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {\n homework_source: homework.source_code,\n student: fullname,\n pr_title: homework.pr_title\n }.to_json\n http.request(req)\n end", "def create\n @student_homework = StudentHomework.new(student_homework_params)\n\n respond_to do |format|\n if @student_homework.save\n format.html { redirect_to @student_homework, notice: 'Student homework was successfully created.' }\n format.json { render :show, status: :created, location: @student_homework }\n else\n format.html { render :new }\n format.json { render json: @student_homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @work = Work.new(work_params)\r\n\r\n respond_to do |format|\r\n if @work.save\r\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\r\n format.json { render action: 'index', status: :created, location: @work }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @house_work = HouseWork.new(house_work_params)\n\n respond_to do |format|\n if @house_work.save\n format.html { redirect_to @house_work, notice: 'House work was successfully created.' }\n format.json { render :show, status: :created, location: @house_work }\n else\n format.html { render :new }\n format.json { render json: @house_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work].except(:extra_keys, :extra_values))\n @work.extra = process_extra if params[:extra_keys]\n \n current_dataset.works << @work\n \n Work.create_locations(@work) if @work.places\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully created.' }}\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n process_work_contributors\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render text: \"success\"}\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @homework_item = HomeworkItem.new(params[:homework_item])\n\n respond_to do |format|\n if @homework_item.save\n format.html { redirect_to @homework_item, notice: 'Homework item was successfully created.' }\n format.json { render json: @homework_item, status: :created, location: @homework_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @homework_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @creator.works << Work.where(id: work_ids)\n if @creator.save\n render json: @creator, status: :created, location: @creator\n else\n render json: @creator.errors, status: :unprocessable_entity\n end\n end", "def create\n @homework = Homework.new(params[:homework])\n\n respond_to do |format|\n if @homework.save\n format.html { flash[:notice] = 'Domáca úloha bola uložená.|Deň pred termínom sa ti objaví na nástenke.'; redirect_to(params[:redirect] ? {:controller => params[:redirect]} : homeworks_path) }\n format.xml { render :xml => @homework, :status => :created, :location => @homework }\n format.js { render :layout => false }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @homework.errors, :status => :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end", "def create\n @development_work = DevelopmentWork.new(development_work_params)\n\n respond_to do |format|\n if @development_work.save\n format.html { redirect_to @development_work, notice: 'Development work was successfully created.' }\n format.json { render :show, status: :created, location: @development_work }\n else\n format.html { render :new }\n format.json { render json: @development_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework }\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.work'))\n if @patron\n @patron.works << @work\n end\n format.html { redirect_to @work }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @worklist = Worklist.new(worklist_params)\n\n respond_to do |format|\n if @worklist.save\n format.html { redirect_to @worklist, notice: 'Worklist was successfully created.' }\n format.json { render :show, status: :created, location: @worklist }\n else\n format.html { render :new }\n format.json { render json: @worklist.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end", "def create\n\t\t@work = Work.new(params[:work])\n\n\t\trespond_to do |format|\n\t\t\tif @work.save\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully created.' }\n\t\t\t\tformat.json { render json: @work, status: :created, location: @work }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @workout = Workout.new(name: params[:name], steps: params[:steps], description: params[:description], time: params[:time], image_url: params[:image_url], video_url: params[:video_url], running: params[:running], weightlifting: params[:weightlifting], swimming: params[:swimming], circuit_training: params[:circuit_training], cycling: params[:cycling], creator_id: current_athlete.id, workout_creator: current_athlete.username)\n\n if @workout.save\n AthleteWorkout.create(workout_id: @workout.id, athlete_id: current_athlete.id)\n render 'create.json.jbuilder', status: :created\n else\n render json: { errors: @athlete.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\r\n @stages_work = StagesWork.new(params[:stages_work])\r\n\r\n respond_to do |format|\r\n if @stages_work.save\r\n format.html { redirect_to @stages_work, notice: 'Stages work was successfully created.' }\r\n format.json { render json: @stages_work, status: :created, location: @stages_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @workobject = Workobject.new(params[:workobject])\n\n respond_to do |format|\n if @workobject.save\n format.html { redirect_to @workobject, notice: 'Workobject was successfully created.' }\n format.json { render json: @workobject, status: :created, location: @workobject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home = Home.new(params[:home])\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render json: @home, status: :created, location: @home }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home = Home.new(params[:home])\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render json: @home, status: :created, location: @home }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home = Home.new(params[:home])\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render json: @home, status: :created, location: @home }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @my_posted_homework = MyPostedHomework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_posted_homework }\n end\n end", "def create\n @upwork = Upwork.new(upwork_params)\n\n respond_to do |format|\n if @upwork.save\n format.html { redirect_to @upwork, notice: 'Upwork was successfully created.' }\n format.json { render :show, status: :created, location: @upwork }\n else\n format.html { render :new }\n format.json { render json: @upwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @homework_blog = HomeworkBlog.new(homework_blog_params)\n\n respond_to do |format|\n if @homework_blog.save\n format.html { redirect_to @homework_blog, notice: 'Homework blog was successfully created.' }\n format.json { render :show, status: :created, location: @homework_blog }\n else\n format.html { render :new }\n format.json { render json: @homework_blog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @academic_work = AcademicWork.new(params[:academic_work])\r\n\r\n respond_to do |format|\r\n if @academic_work.save\r\n format.html { redirect_to @academic_work, notice: 'Academic work was successfully created.' }\r\n format.json { render json: @academic_work, status: :created, location: @academic_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @academic_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @home = Home.new(home_params)\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: \"Home was successfully created.\" }\n format.json { render :show, status: :created, location: @home }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def create\n @worksession = parse_worksessions\n respond_to do |format|\n if !@worksession.nil? and @worksession.save\n format.html { redirect_to user_worksessions_path(current_user.id), notice: 'Worksession was successfully created.' }\n format.json { render :show, status: :created, location: @worksession }\n else\n @worksession = Worksession.new\n format.html { render :new }\n format.json { render json: @worksession.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @homeworld = Homeworld.new(homeworld_params)\n\n respond_to do |format|\n if @homeworld.save\n format.html { redirect_to @homeworld, notice: 'Homeworld was successfully created.' }\n format.json { render action: 'show', status: :created, location: @homeworld }\n else\n format.html { render action: 'new' }\n format.json { render json: @homeworld.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home = Home.new(home_params)\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render :show, status: :created, location: @home }\n else\n format.html { render :new }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home = Home.new(home_params)\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render :show, status: :created, location: @home }\n else\n format.html { render :new }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @home = Home.new(home_params)\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render :show, status: :created, location: @home }\n else\n format.html { render :new }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @academic_work = AcademicWork.new(academic_work_params)\n\n respond_to do |format|\n if @academic_work.save\n format.html { redirect_to @academic_work, notice: t('notice.created') }\n format.json { render :show, status: :created, location: @academic_work }\n else\n format.html { render :new }\n format.json { render json: @academic_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @howitwork = Howitwork.new(howitwork_params)\n\n respond_to do |format|\n if @howitwork.save\n format.html { redirect_to admin_howitwork_url(@howitwork), notice: 'Howitwork was successfully created.' }\n format.json { render :show, status: :created, location: @howitwork }\n else\n format.html { render :new }\n format.json { render json: @howitwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hackathon = Hackathon.new(hackathon_params)\n\n respond_to do |format|\n if @hackathon.save\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully created.' }\n format.json { render :show, status: :created, location: @hackathon }\n else\n format.html { render :new }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @work = Work.new(work_params)\n @user = User.find(session[:user_id]) \n \n respond_to do |format|\n if @work.save\n @user.works << @work\n format.html { redirect_to @work, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def homework_params\n params.require(:homework).permit(:name, :description, :standard_id, :attachment, :division_id, :date)\n end", "def create\n @myworkout = Myworkout.new(params[:myworkout])\n\n respond_to do |format|\n if @myworkout.save\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully created.' }\n format.json { render :json => @myworkout, :status => :created, :location => @myworkout }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @myworkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @homeworks = Homework.all\n end", "def create\n @work_and_thema = WorkAndThema.new(work_and_thema_params)\n\n respond_to do |format|\n if @work_and_thema.save\n format.html { redirect_to @work_and_thema, notice: 'Work and thema was successfully created.' }\n format.json { render action: 'show', status: :created, location: @work_and_thema }\n else\n format.html { render action: 'new' }\n format.json { render json: @work_and_thema.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n \n respond_to do |format|\n if @work.save\n format.html { redirect_to works_path, notice: 'Work item was successfully created!'}\n else\n format.html { render :new }\n end\n end\n end", "def create\n if request.xhr?\n @work = current_user.works.build(work_params)\n #@work = Work.new(work_params)\n if @work.save\n puts @work.status\n render :json => {:id => @work.id}\n else\n render :json => {:id => 0}\n end\n else\n render :json => {:id => 0}\n end\n end", "def create\n @our_works = OurWork.new(our_work_params)\n if @our_works.plate_has_an_entry?\n render_default_error 'hay un error, Esta placa ya ha sido ingresada', 401\n else\n @our_works.date_arrival = Date.today.to_date\n @our_works.is_parking = true\n if @our_works.save\n render_success_format('Nueva entrada registrada', @our_works, true)\n end\n end\n rescue Exception => e\n render_default_error e, 401\n end", "def create\n @work_exp = WorkExp.new(work_exp_params)\n\n respond_to do |format|\n if @work_exp.save\n format.html { redirect_to @work_exp, notice: 'Work exp was successfully created.' }\n format.json { render :show, status: :created, location: @work_exp }\n else\n format.html { render :new }\n format.json { render json: @work_exp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gym_workout = GymWorkout.new(params[:gym_workout])\n\n respond_to do |format|\n if @gym_workout.save\n format.html { redirect_to @gym_workout, :notice => 'Gym workout was successfully created.' }\n format.json { render :json => @gym_workout, :status => :created, :location => @gym_workout }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @gym_workout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @work_hour = WorkHour.new(work_hour_params)\n\n respond_to do |format|\n if @work_hour.save\n format.html { redirect_to @work_hour, notice: 'Work hour was successfully created.' }\n format.json { render :show, status: :created, location: @work_hour }\n else\n format.html { render :new }\n format.json { render json: @work_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @scientific_work = ScientificWork.new(params[:scientific_work])\r\n respond_to do |format|\r\n if @scientific_work.save\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully created.' }\r\n format.json { render json: @scientific_work, status: :created, location: @scientific_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def index_create\n @workouts = Workout.where(creator_id: current_athlete.id)\n render 'index_create.json.jbuilder', status: :created\n end", "def create\n @workday = Workday.new(workday_params)\n\n respond_to do |format|\n if @workday.save\n format.html { redirect_to dashboard_path, notice: 'Workday was successfully created.' }\n format.json { render :show, status: :created, location: @workday }\n else\n format.html { render :new }\n format.json { render json: @workday.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @workouts = Workout.all \n render 'index.json.jbuilder', status: :created\n end", "def homework_params\n params.require(:homework).permit(:link_to_homework, :finished, :assignment, :help, :user_id, :assignment_id)\n end", "def create\n \t@homework = Homework.find(params[:homework_id])\n \t@user_homework = UserHomework.new(homework: @homework, user: current_user)\n \tif @user_homework.save\n \t\tredirect_to homeworks_path, notice: 'La tarea a sido seleccionada'\n \telse\n \t\tredirect_to homeworks_path, notice: 'La tarea no ha podido ser seleccionada'\n \tend\n end", "def create\n @pages_home = Pages::Home.new(pages_home_params)\n\n respond_to do |format|\n if @pages_home.save\n format.html { redirect_to @pages_home, notice: 'Home was successfully created.' }\n format.json { render :show, status: :created, location: @pages_home }\n else\n format.html { render :new }\n format.json { render json: @pages_home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params\n )\n if save_and_flash(@work)\n redirect_to works_path\n else\n render :new, status: :bad_request\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end", "def create\n @scientific_work = ScientificWork.new(scientific_work_params)\n\n respond_to do |format|\n if @scientific_work.save\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully created.' }\n format.json { render :show, status: :created, location: @scientific_work }\n else\n format.html { render :new }\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workstation = Workstation.new(params[:workstation])\n\n respond_to do |format|\n if @workstation.save\n format.html { redirect_to @workstation, notice: 'Workstation was successfully created.' }\n format.json { render json: @workstation, status: :created, location: @workstation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workstation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @training_workshop = TrainingWorkshop.new(training_workshop_params)\n\n respond_to do |format|\n if @training_workshop.save\n format.html { redirect_to @training_workshop, notice: 'Training workshop was successfully created.' }\n format.json { render :show, status: :created, location: @training_workshop }\n else\n format.html { render :new }\n format.json { render json: @training_workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workout = Workout.new(workout_params)\n @workout.user = current_user\n\n respond_to do |format|\n if @workout.save\n format.html { redirect_to @workout, notice: \"Workout was successfully created.\" }\n format.json { render :show, status: :created, location: @workout }\n \n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home = Home.new(home_params)\n @home.user = current_user.id\n\n respond_to do |format|\n if @home.save\n format.html { redirect_to @home, notice: 'Home was successfully created.' }\n format.json { render :show, status: :created, location: @home }\n else\n format.html { render :new }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workfile = Workfile.new(workfile_params)\n\n respond_to do |format|\n if @workfile.save\n format.html { redirect_to @workfile, notice: 'Workfile was successfully created.' }\n format.json { render :show, status: :created, location: @workfile }\n else\n format.html { render :new }\n format.json { render json: @workfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @roadwork = Roadwork.new(roadwork_params)\n\n respond_to do |format|\n if @roadwork.save\n format.html { redirect_to @roadwork, notice: 'Roadwork was successfully created.' }\n format.json { render :show, status: :created, location: @roadwork }\n else\n format.html { render :new }\n format.json { render json: @roadwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diploma_work = DiplomaWork.new(diploma_work_params)\n\n respond_to do |format|\n if @diploma_work.save\n format.html { redirect_to @diploma_work, notice: 'Diploma work was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diploma_work }\n else\n format.html { render action: 'new' }\n format.json { render json: @diploma_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @working_operation = WorkingOperation.new(working_operation_params)\n respond_to do |format|\n if @working_operation.save\n format.html { redirect_to staff_worker_path(@working_operation.staff_worker_id), notice: 'Данные сохранены' }\n format.json { render :show, status: :created, location: @working_operation }\n else\n format.html { render :new }\n format.json { render json: @working_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workshare = Workshare.new(workshare_params)\n\n respond_to do |format|\n if @workshare.save\n format.html { redirect_to @workshare, notice: 'Workshare was successfully created.' }\n format.json { render :show, status: :created, location: @workshare }\n else\n format.html { render :new }\n format.json { render json: @workshare.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully created.'\n format.html { redirect_to(@work) }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @laboratory = Laboratory.new(laboratory_params)\n if @laboratory.save\n render json: @laboratory, status: :created\n else\n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def create\n @classwork = Classwork.new(classwork_params)\n\n respond_to do |format|\n if @classwork.save\n format.html { redirect_to @classwork, notice: 'Classwork was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classwork }\n else\n format.html { render action: 'new' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home_info = HomeInfo.new(home_info_params)\n\n respond_to do |format|\n if @home_info.save\n format.html { redirect_to @home_info, notice: 'Home info was successfully created.' }\n format.json { render :show, status: :created, location: @home_info }\n else\n format.html { render :new }\n format.json { render json: @home_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hollywood = Hollywood.new(hollywood_params)\n\n respond_to do |format|\n if @hollywood.save\n format.html { redirect_to @hollywood, notice: 'Hollywood was successfully created.' }\n format.json { render :show, status: :created, location: @hollywood }\n else\n format.html { render :new }\n format.json { render json: @hollywood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hollywood = Hollywood.new(hollywood_params)\n\n respond_to do |format|\n if @hollywood.save\n format.html { redirect_to @hollywood, notice: 'Hollywood was successfully created.' }\n format.json { render :show, status: :created, location: @hollywood }\n else\n format.html { render :new }\n format.json { render json: @hollywood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @scientific_work=ScientificWork.find(params[:scientific_work_id])\r\n @second_work = @scientific_work.second_works.new(params[:second_work])\r\n\r\n respond_to do |format|\r\n if @second_work.save\r\n format.html { redirect_to @second_work, notice: 'Second work was successfully created.' }\r\n format.json { render json: @second_work, status: :created, location: @second_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @second_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end", "def create\n @work_log = WorkLog.new(params[:work_log])\n\n respond_to do |format|\n if @work_log.save\n format.html { redirect_to @work_log, notice: 'Work log was successfully created.' }\n format.json { render json: @work_log, status: :created, location: @work_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home_facility = HomeFacility.new(home_facility_params)\n\n respond_to do |format|\n if @home_facility.save\n format.html { redirect_to @home_facility, notice: 'Home facility was successfully created.' }\n format.json { render :show, status: :created, location: @home_facility }\n else\n format.html { render :new }\n format.json { render json: @home_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tcase request.format\n\t\twhen 'html'\n\t\t\t@whos_home_response = WhosHomeResponse.new(whos_home_response_params)\n\t\twhen 'json'\n\t\t\tresponseHash = ActiveSupport::JSON.decode(request.raw_post)[\"whos_home_response\"]\n\t\t\t@whos_home_response = WhosHomeResponse.new\n\t\t\t@whos_home_response.whos_home_request_id = responseHash[\"whos_home_request_id\"]\n\t\t\t@whos_home_response.user_id = responseHash[\"user_id\"]\n\t\t\t@whos_home_response.is_home = responseHash[\"is_home\"]\n\t\tend\n\n respond_to do |format|\n if @whos_home_response.save\n format.html { redirect_to @whos_home_response, notice: 'Whos home response was successfully created.' }\n format.json { render action: 'show', status: :created, location: @whos_home_response }\n else\n format.html { render action: 'new' }\n format.json { render json: @whos_home_response.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worked_hour.save\n\n respond_with(@worked_hour)\n end", "def create\n @johari = Johari.new(johari_params)\n\n respond_to do |format|\n if @johari.save\n format.html { redirect_to johariscores_url, notice: 'Johari was successfully created.' }\n format.json { render :show, status: :created, location: @johari }\n else\n format.html { render :new }\n format.json { render json: @johari.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work.user_id = current_user.id\n\n respond_to do |format|\n if @work.save\n \n if current_user.roles[0].name != \"Administrador\"\n WorkMailer.new_work_alert(@work).deliver\n end\n \n format.html { redirect_to @work, :notice => 'Obra criada com sucesso!' }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n\n @homeworks = Homework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homeworks }\n end\n end", "def show\n @my_posted_homework = MyPostedHomework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_posted_homework }\n end\n end", "def create\n @home = Home.new(home_params)\n\n @home.creator_id = current_user.id\n if @home.save\n UserHome.create(user_id: current_user.id, home_id: @home.id)\n List.create(name: @home.name, user_id: current_user.id, home_id: @home.id)\n render :show, status: 201\n else\n render :error\n end\n end", "def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end", "def create\n hawkData = {\n # The first value [name:] corresponds to the backend object model\n # The second value [params[:name]] corresponds to the frontend\n name: params[:java_script_name],\n species: params[:java_script_species]\n }\n Hawk.create(hawkData)\n #render json: hawk\n end", "def create\n @workroom = Workroom.new(workroom_params)\n\n respond_to do |format|\n if @workroom.save\n format.html { redirect_to @workroom, notice: 'Workroom was successfully created.' }\n format.json { render :show, status: :created, location: @workroom }\n else\n format.html { render :new }\n format.json { render json: @workroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workpermit = Workpermit.new(workpermit_params)\n\n respond_to do |format|\n if @workpermit.save\n format.html { redirect_to @workpermit, notice: 'Workpermit was successfully created.' }\n format.json { render :show, status: :created, location: @workpermit }\n else\n format.html { render :new }\n format.json { render json: @workpermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_user = current_user\n @user_work_experience = @current_user.user_work_experiences.new(user_work_experience_params)\n\n respond_to do |format|\n if @user_work_experience.save\n format.html { redirect_to action: \"index\", notice: 'User work experience was successfully created.' }\n format.json { render :show, status: :created, location: @user_work_experience }\n else\n format.html { render :new }\n format.json { render json: @user_work_experience.errors, status: :unprocessable_entity }\n end\n end\n end", "def start\n @work = @user.works.new(start: Time.now, user_id: current_user.id)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to root_path, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end \n end", "def create\n @art_work = ArtWork.new(art_work_params)\n\n respond_to do |format|\n if @art_work.save\n format.html { redirect_to @art_work, notice: 'Art work was successfully created.' }\n format.json { render :show, status: :created, location: @art_work }\n else\n format.html { render :new }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end" ]
[ "0.71885186", "0.6889955", "0.66597414", "0.6620454", "0.6558115", "0.65466493", "0.654357", "0.6496788", "0.6496788", "0.6447532", "0.6447532", "0.6430973", "0.63929", "0.6389309", "0.6355741", "0.6348551", "0.6342085", "0.6301178", "0.62824434", "0.62394273", "0.6222122", "0.6190119", "0.61794996", "0.61500025", "0.61380315", "0.6130483", "0.61119395", "0.60895824", "0.6088514", "0.6088514", "0.6088514", "0.6088174", "0.6072929", "0.60683066", "0.60664266", "0.6055303", "0.6050024", "0.6050024", "0.60475504", "0.60443985", "0.6014577", "0.6014577", "0.60088146", "0.59987026", "0.59953666", "0.5959715", "0.59341013", "0.5930168", "0.5928803", "0.59157634", "0.59004694", "0.58994824", "0.5884459", "0.5879415", "0.58706415", "0.58541954", "0.5847815", "0.58381337", "0.5815513", "0.58027714", "0.5786586", "0.57843983", "0.5778593", "0.57721007", "0.57565826", "0.57537645", "0.57358736", "0.573263", "0.57271826", "0.57217896", "0.5716264", "0.57161164", "0.57071525", "0.5690777", "0.5688557", "0.5683174", "0.56782365", "0.5673629", "0.56689095", "0.5650507", "0.56474644", "0.56474644", "0.56452775", "0.5643887", "0.5639942", "0.56368685", "0.5633414", "0.56293875", "0.5613642", "0.5608729", "0.5588268", "0.5588059", "0.5587361", "0.55823106", "0.55812585", "0.5576441", "0.5575915", "0.5571708", "0.55648667", "0.5563856", "0.5561276" ]
0.0
-1
PUT /homeworks/1 PUT /homeworks/1.json
def update if(filters) #Revisamos si incio sesion if(!session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end #Revisamos que sea su tarea if(Homework.find(params[:id]).user.id != session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end end @homework = Homework.find(params[:id]) if(params["file"]) uploaded_io = params["file"] begin @homework.filename = uploaded_io.original_filename rescue @homework.filename = params["file"].to_s end end userid = session[:user_id] respond_to do |format| if @homework.update_attributes(params[:homework]) if(params["file"]) uploaded_io = params["file"] begin directory = Dir::pwd + "/shared_files/#{userid.to_s}" Dir::mkdir(directory) unless File.exists?(directory) directory = Dir::pwd + "/shared_files/#{userid.to_s}/#{@homework.id.to_s}" Dir::mkdir(directory) unless File.exists?(directory) File.open(Rails.root.join('shared_files', "#{userid.to_s}/#{@homework.id.to_s}", @homework.filename), 'wb') do |file| file.write(uploaded_io.read) end rescue #Este rescue existe para capturar el error de permisos, el cual no afecta el flujo del programa (pues los buzones se crean igual). end end format.html { redirect_to @homework, notice: 'Buzón actualizado exitosamente' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @homework.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @homework.update(homework_params)\n format.html { redirect_to @homework, notice: 'Homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @homework }\n else\n format.html { render :edit }\n format.json { render json: @homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @homework.update(homework_params)\n format.html { redirect_to standard_path(@homework.standard), notice: 'Homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @homework }\n else\n format.html { render :edit }\n format.json { render json: @homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n if @homework.update_attributes(params[:homework])\n format.html { redirect_to(@homework, :notice => 'Homework was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @homework.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @homework_item = HomeworkItem.find(params[:id])\n\n respond_to do |format|\n if @homework_item.update_attributes(params[:homework_item])\n format.html { redirect_to @homework_item, notice: 'Homework item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @homework_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_posted_homework = MyPostedHomework.find(params[:id])\n\n respond_to do |format|\n if @my_posted_homework.update_attributes(params[:my_posted_homework])\n format.html { redirect_to @my_posted_homework, notice: 'My posted homework was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_posted_homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @student_homework.update(student_homework_params)\n format.html { redirect_to @student_homework, notice: 'Student homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_homework }\n else\n format.html { render :edit }\n format.json { render json: @student_homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n if @homework.update_attributes(params[:homework])\n flash[:notice] = 'Zmeny sa uložili'\n format.html { redirect_to(homeworks_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @homework.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n respond_to do |format|\n if @scientific_work.update(scientific_work_params)\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully updated.' }\n format.json { render :show, status: :ok, location: @scientific_work }\n else\n format.html { render :edit }\n format.json { render json: @scientific_work.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 @our_works.update_attributes!(our_works_params)\n render_success_format('Entrada actualizada', @our_works, true)\n rescue Exception => e\n render_default_error e, 401\n\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n @workobject = Workobject.find(params[:id])\n\n respond_to do |format|\n if @workobject.update_attributes(params[:workobject])\n format.html { redirect_to @workobject, notice: 'Workobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @house_work.update(house_work_params)\n format.html { redirect_to @house_work, notice: 'House work was successfully updated.' }\n format.json { render :show, status: :ok, location: @house_work }\n else\n format.html { render :edit }\n format.json { render json: @house_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n errors = Work.update(current_user, params[:id], work_params)\n if !errors\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: { error: errors }, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def set_homework\n @homework = Homework.find(params[:homework_id])\n end", "def set_homework\n @homework = Homework.find(params[:homework_id])\n end", "def set_homework\n @homework = Homework.find(params[:id])\n end", "def set_homework\n @homework = Homework.find(params[:id])\n end", "def set_homework\n @homework = Homework.find(params[:id])\n end", "def set_homework\n @homework = Homework.find(params[:id])\n end", "def put!\n request! :put\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @homeworld.update(homeworld_params)\n format.html { redirect_to @homeworld, notice: 'Homeworld was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @homeworld.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @home = Home.find(params[:id])\n\n respond_to do |format|\n if @home.update_attributes(params[:home])\n format.html { redirect_to @home, notice: 'Home was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @home = Home.find(params[:id])\n\n respond_to do |format|\n if @home.update_attributes(params[:home])\n format.html { redirect_to @home, notice: 'Home was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work.extra = process_extra if params[:work][:extra_keys] && params[:work][:extra_keys]!= \"\"\n respond_to do |format|\n if @work.update_attributes(params[:work].except(:extra_keys, :extra_values))\n Work.create_locations(@work) if @work.places#.changed?\n Location.destroy_unused\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @scientific_work = ScientificWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @scientific_work.update_attributes(params[:scientific_work])\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work 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: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: '修改成功!' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to user_work_path(@user.id, @work.id), notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end \n end\n end", "def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def update\n respond_to do |format|\n if @works_item.update(work_params)\n format.html { redirect_to works_url, notice: 'Work Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @works_item}\n else\n format.html { render :edit }\n format.json { render json: @works_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, :notice => 'Obra atualizada com sucesso!' }\n format.json { head :no_content }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.work'))\n format.html { redirect_to work_url(@work) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if cannot? :update, @workout\n redirect_to root_path,\n notice: 'Unauthorized to update workout' and return\n end\n\n workout_offering_id = create_or_update\n @workout.save!\n if workout_offering_id.nil?\n url = url_for(workout_path(id: @workout.id))\n else\n url = url_for(organization_workout_offering_path(\n organization_id: params[:organization_id],\n term_id: params[:term_id],\n course_id: params[:course_id],\n id: workout_offering_id\n )\n )\n end\n\n respond_to do |format|\n format.json { render json: { url: url } }\n end\n end", "def put(*args)\n request :put, *args\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @work.update(work_params)\n process_work_contributors\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @awesome_stuff.update(awesome_stuff_params)\n format.html { redirect_to @awesome_stuff, notice: 'Awesome stuff was successfully updated.' }\n format.json { render :show, status: :ok, location: @awesome_stuff }\n else\n format.html { render :edit }\n format.json { render json: @awesome_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n if params.has_key?(:desc)\n puts \"desc\";\n @work.description = params[:desc]\n elsif params.has_key?(:status)\n @work.status = params[:status]\n puts @work.status\n # num = current_user.works.where(:all, :conditions => [\"status = ?\", params[:status]])\n # puts num\n # count the number of completed tasks \n else\n render :json => {:id => 0}\n end\n\n if @work.save\n puts @work.status\n render :json => {:id => @work.id}\n else\n render :json => {:id => 0}\n end \n\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\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 respond_to do |format|\n if @home.update(home_params)\n format.html { redirect_to @home, notice: 'Home was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shogi.update(shogi_params)\n format.html { redirect_to @shogi, notice: 'Shogi was successfully updated.' }\n format.json { render :show, status: :ok, location: @shogi }\n else\n format.html { render :edit }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def update\n respond_to do |format|\n if @academic_work.update(academic_work_params)\n format.html { redirect_to @academic_work, notice: t('notice.updated') }\n format.json { render :show, status: :ok, location: @academic_work }\n else\n format.html { render :edit }\n format.json { render json: @academic_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @upwork.update(upwork_params)\n format.html { redirect_to @upwork, notice: 'Upwork was successfully updated.' }\n format.json { render :show, status: :ok, location: @upwork }\n else\n format.html { render :edit }\n format.json { render json: @upwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def update\n respond_to do |format|\n if @academy_workshop.update(academy_workshop_params)\n flash[:notice] = \"Workshop actualizado com sucesso.\"\n format.html { redirect_to @academy_workshop, notice: 'Workshop actualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @academy_workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @worklist.update(worklist_params)\n format.html { redirect_to @worklist, notice: 'Worklist was successfully updated.' }\n format.json { render :show, status: :ok, location: @worklist }\n else\n format.html { render :edit }\n format.json { render json: @worklist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @home.update(home_params)\n format.html { redirect_to @home, notice: \"Home was successfully updated.\" }\n format.json { render :show, status: :ok, location: @home }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @second_work = SecondWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @second_work.update_attributes(params[:second_work])\r\n format.html { redirect_to @second_work, notice: 'Second work 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: @second_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\r\n @academic_work = AcademicWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @academic_work.update_attributes(params[:academic_work])\r\n format.html { redirect_to @academic_work, notice: 'Academic work 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: @academic_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @homily.update(homily_params)\n \n format.html { redirect_to @homily, notice: 'Homily was successfully updated.' }\n format.json { render :show, status: :ok, location: @homily }\n else\n format.html { render :edit }\n format.json { render json: @homily.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@work = Work.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @work.update_attributes(params[:work])\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @myworkout = Myworkout.find(params[:id])\n\n respond_to do |format|\n if @myworkout.update_attributes(params[:myworkout])\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @myworkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @workhour.update(workhour_params)\n format.html { redirect_to @workhour, notice: 'Workhour was successfully updated.' }\n format.json { render :show, status: :ok, location: @workhour }\n else\n format.html { render :edit }\n format.json { render json: @workhour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @training_workshop.update(training_workshop_params)\n format.html { redirect_to @training_workshop, notice: 'Training workshop was successfully updated.' }\n format.json { render :show, status: :ok, location: @training_workshop }\n else\n format.html { render :edit }\n format.json { render json: @training_workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, data={})\n request(:put, path, data)\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def create\n @homework = current_user.homeworks.new(homework_params)\n\n respond_to do |format|\n if @homework.save\n format.html { redirect_to @homework, notice: 'Homework was successfully created.' }\n format.json { render :show, status: :created, location: @homework }\n else\n format.html { render :new }\n format.json { render json: @homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @howitwork.update(howitwork_params)\n format.html { redirect_to admin_howitwork_url(@howitwork), notice: 'Howitwork was successfully updated.' }\n format.json { render :show, status: :ok, location: @howitwork }\n else\n format.html { render :edit }\n format.json { render json: @howitwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classwork.update(classwork_params)\n format.html { redirect_to @classwork, notice: 'Classwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @stages_work = StagesWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @stages_work.update_attributes(params[:stages_work])\r\n format.html { redirect_to @stages_work, notice: 'Stages work 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: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @home.update(home_params)\n format.html { redirect_to @home, notice: 'Home was successfully updated.' }\n format.json { render :show, status: :ok, location: @home }\n else\n format.html { render :edit }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @home.update(home_params)\n format.html { redirect_to @home, notice: 'Home was successfully updated.' }\n format.json { render :show, status: :ok, location: @home }\n else\n format.html { render :edit }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @home.update(home_params)\n format.html { redirect_to @home, notice: 'Home was successfully updated.' }\n format.json { render :show, status: :ok, location: @home }\n else\n format.html { render :edit }\n format.json { render json: @home.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work_item = set_work\n\n respond_to do |format|\n if @work_item.update(params.require(:work).permit(:title, :subtitle, :body))\n format.html { redirect_to works_path, notice: 'work was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update_job(job:)\n response = HTTParty.put(\"#{@host}/api/jobs/#{job[:id]}\", body: {job: job, api_key: @api_key})\n \n return response.success?\n end", "def update\n @workstation = Workstation.find(params[:id])\n\n respond_to do |format|\n if @workstation.update_attributes(params[:workstation])\n format.html { redirect_to @workstation, notice: 'Workstation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workstation.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @home_info.update(home_info_params)\n format.html { redirect_to @home_info, notice: 'Home info was successfully updated.' }\n format.json { render :show, status: :ok, location: @home_info }\n else\n format.html { render :edit }\n format.json { render json: @home_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66425145", "0.6622895", "0.6362117", "0.6356922", "0.630972", "0.62722087", "0.62626", "0.62434226", "0.62061757", "0.61460084", "0.6137347", "0.61283636", "0.60916406", "0.605979", "0.605979", "0.605979", "0.605979", "0.60586536", "0.6057261", "0.60353494", "0.60246944", "0.60144776", "0.600991", "0.60084164", "0.60056305", "0.60039747", "0.60039747", "0.60039747", "0.5972698", "0.5972698", "0.5971746", "0.59588134", "0.59588134", "0.59588134", "0.59586126", "0.5955371", "0.5949614", "0.59429485", "0.59429485", "0.591635", "0.5904704", "0.587378", "0.5866522", "0.5866522", "0.5866203", "0.58574766", "0.58478606", "0.5835614", "0.5828249", "0.58249396", "0.5820684", "0.5818636", "0.5806516", "0.58049864", "0.57976913", "0.5795349", "0.57919836", "0.5791671", "0.57913274", "0.57873154", "0.577174", "0.57590365", "0.5754945", "0.5751646", "0.57494164", "0.57460326", "0.57411456", "0.5738608", "0.5724286", "0.5721931", "0.5720639", "0.5718455", "0.57130015", "0.5712501", "0.5706908", "0.57066077", "0.5705152", "0.57041043", "0.570311", "0.5698793", "0.5695224", "0.5694419", "0.5691631", "0.56911135", "0.5689948", "0.5688724", "0.56887186", "0.56887186", "0.56887186", "0.56813806", "0.56793845", "0.56793845", "0.56793845", "0.5671453", "0.5668647", "0.56588393", "0.5656147", "0.5655796", "0.564915", "0.5647209", "0.56457955" ]
0.0
-1
DELETE /homeworks/1 DELETE /homeworks/1.json
def destroy if(filters) #Revisamos si incio sesion if(!session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end #Revisamos que sea su tarea if(Homework.find(params[:id]).user.id != session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end end @homework = Homework.find(params[:id]) #Antes de borrar eliminamos todo lo asociado participations = Participation.find_all_by_homework_id(params[:id]) participations.each do |p| #Borrar achivos subidos p.destroy end @homework.destroy flash[:succes] = "El buzón fue eliminado con éxito" redirect_to home_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @homework = Homework.find(params[:id])\n @homework.destroy\n\n respond_to do |format|\n format.html { redirect_to homeworks_url, notice: \"Homework was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @homework.destroy\n respond_to do |format|\n format.html { redirect_to homeworks_url, notice: 'Homework was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @homework_item = HomeworkItem.find(params[:id])\n @homework_item.destroy\n\n respond_to do |format|\n format.html { redirect_to homework_items_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @my_posted_homework = MyPostedHomework.find(params[:id])\n @my_posted_homework.destroy\n\n respond_to do |format|\n format.html { redirect_to my_posted_homeworks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @homework = Homework.find(params[:id])\n\t@homework.homework_users.each do |hu|\n\t\thu.destroy\n\tend\n @homework.destroy\n\n respond_to do |format|\n format.html { redirect_to homeworks_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 @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(*rest) end", "def 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 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\n # @home.destroy\n # respond_to do |format|\n # format.html { redirect_to homes_url }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @homework = Homework.find(params[:id])\n @homework.destroy\n\n respond_to do |format|\n format.html { redirect_to(homeworks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hjump2.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: 'Eliminado exitosamente' ) }\n format.json { head :no_content }\n end\n end", "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end", "def destroy\n @workfile.destroy\n respond_to do |format|\n format.html { redirect_to workfiles_url, notice: 'Workfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_homework.destroy\n respond_to do |format|\n format.html { redirect_to student_homeworks_url, notice: 'Student homework was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @scientific_work.destroy\n respond_to do |format|\n format.html { redirect_to scientific_works_url, notice: 'Scientific work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @home.destroy\n respond_to do |format|\n format.html { redirect_to homes_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @work.destroy\n respond_to do |format|\n format.html { redirect_to menu_docencia_3_path, notice: 'La actividad se elimino con exito.' }\n format.json { head :no_content }\n end\n\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work.destroy\n respond_to do |format|\n format.html { redirect_to works_url, notice: '删除成功!' }\n format.json { head :no_content }\n end\n end", "def delete\n\n end", "def destroy\n @thirtythree.destroy\n respond_to do |format|\n format.html { redirect_to thirtythrees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @home = Home.find(params[:id])\n @home.destroy\n\n respond_to do |format|\n format.html { redirect_to homes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @home = Home.find(params[:id])\n @home.destroy\n\n respond_to do |format|\n format.html { redirect_to homes_url }\n format.json { head :ok }\n end\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @house_work.destroy\n respond_to do |format|\n format.html { redirect_to house_works_url, notice: 'House work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, data={})\n request(:delete, path, data)\n end", "def delete\n request(:delete)\n end", "def delete\n delete_from_server single_url\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def destroy\n @work_and_thema.destroy\n respond_to do |format|\n format.html { redirect_to work_and_themata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuffs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @workobject = Workobject.find(params[:id])\n @workobject.destroy\n\n respond_to do |format|\n format.html { redirect_to workobjects_url }\n format.json { head :no_content }\n end\n end", "def delete\n end", "def delete(path)\n request(:delete, path)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @diploma_work.destroy\n respond_to do |format|\n format.html { redirect_to diploma_works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz72.destroy\n respond_to do |format|\n format.html { redirect_to baz72s_url, notice: \"Baz72 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def delete(major,minor)\n major = major.to_sym\n if minor\n delete_hash = minor\n else\n if storage.hash_exists?(major)\n delete_hash = storage.find(major)\n else\n puts 'Delete hash not found in storage.'\n puts 'Use: imgurr delete <id> <delete_hash>'\n return\n end\n end\n if ImgurAPI.delete(delete_hash)\n puts 'Successfully deleted image from Imgur'\n storage.delete(major)\n storage.save\n else\n puts 'Unauthorized Access. Wrong delete hash?'\n end\n end", "def delete\n \n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @jobshistory.destroy\n respond_to do |format|\n format.html { redirect_to jobshistories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hackathon.destroy\n respond_to do |format|\n format.html { redirect_to hackathons_url, notice: 'Hackathon was successfully destroyed.' }\n format.json { head :no_content }\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 destroy\n @rh.destroy\n respond_to do |format|\n format.html { redirect_to rhs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work.destroy\n respond_to do |format|\n format.html { redirect_to user_works_url, notice: 'Work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def destroy\n @content_home = ContentHome.find(params[:id])\n @content_home.destroy\n\n respond_to do |format|\n format.html { redirect_to content_homes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbicepshome3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbicepshome3s_url, notice: 'Shouldersbicepshome3 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 @jam = Jam.find(params[:id])\n @jam.destroy\n\n respond_to do |format|\n format.html { redirect_to jams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foo7.destroy\n respond_to do |format|\n format.html { redirect_to foo7s_url, notice: \"Foo7 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\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 @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end" ]
[ "0.7036413", "0.68691933", "0.6853342", "0.68320596", "0.6797311", "0.6794649", "0.67910594", "0.6747574", "0.67384756", "0.6736223", "0.670999", "0.6704891", "0.6663203", "0.6649097", "0.66440535", "0.6643531", "0.6613686", "0.6613686", "0.6613686", "0.6613686", "0.6610697", "0.66070086", "0.66030633", "0.6587461", "0.6583553", "0.65786594", "0.6577582", "0.6552362", "0.6552362", "0.6551369", "0.6551369", "0.6551369", "0.6551369", "0.6551337", "0.65499145", "0.65327805", "0.6527354", "0.6514933", "0.65108746", "0.6506849", "0.6505671", "0.6504203", "0.6503703", "0.6502958", "0.64988637", "0.6498242", "0.64890987", "0.6488081", "0.64849854", "0.6483846", "0.6481384", "0.6476983", "0.64767504", "0.64767504", "0.6475975", "0.6474648", "0.64719397", "0.64713377", "0.6459831", "0.64517987", "0.6442512", "0.64361614", "0.6431807", "0.64317006", "0.64281476", "0.6421378", "0.6419764", "0.6419764", "0.6418746", "0.6416728", "0.64162487", "0.64157224", "0.6412558", "0.64123464", "0.64103824", "0.64100236", "0.6408087", "0.6408087", "0.6408087", "0.6408087", "0.6408087", "0.6408087", "0.6408087", "0.64075446", "0.640496", "0.64026856", "0.63958", "0.6395291", "0.6395278", "0.63934034", "0.6392115", "0.63903093", "0.6390031", "0.6389533", "0.63860834", "0.63791555", "0.63791275", "0.6378554", "0.6376564", "0.6376345", "0.6375848" ]
0.0
-1
Invite people to this homework
def invite if(filters) #Revisamos si incio sesion if(!session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end #Revisamos que sea su tarea if(Homework.find(params[:id]).user.id != session[:user_id]) flash[:error] = "Acceso denegado" redirect_to home_path return end end if(!Homework.exists?(:id=>params[:id])) flash[:error] = "Buzón inexistente" redirect_to home_path return end @homework = Homework.find(params[:id]) render "invite.html.erb" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invite_people\n end", "def invite\n \n end", "def existing_workplace_invite(sender, invite, recipient_email, recipient_name, workplace)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workplace = workplace \n mail(to: \"#{@recipient_email}\", subject: \"#{@sender.name} added you to an Ossemble Workplace\")\n end", "def new_workplace_invite(sender, invite, recipient_email, recipient_name, workplace, token, workplace_id)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workplace = workplace \n @token = token\n @workplace_id = workplace_id\n mail(to: \"#{@recipient_email}\", subject: \"#{@sender.name} invited you to join Ossemble\")\n end", "def invite_hacker(email, team, current_user)\n # you can pass these variables into the text file for the email.\n # I'm pretty sure that you can chang the .text.haml file to .html.haml file\n # in some way to actually implement the styling.\n @team = team\n @name = current_user.first_name ? current_user.first_name : current_user.email\n mail(to: email, subject: \"#{@name} wants you to join a #{HACKATHON} team!\")\n end", "def invite(game)\n @game = game\n mail to: game.invite.strip, subject: \"You've been challenged to play chess!\"\n end", "def invite_friends (owner_name, friend_name, friend_email)\n @greeting = \"Hi\"\n @owner_name=owner_name\n @friend_name=friend_name\n mail to: friend_email\n end", "def invite(person)\n @person = person\n mail(to: person.email, subject: \"welcome\")\n end", "def add_team_mates\n @team = Team.find(params[:id])\n @users = User.find(params[:add])\n @users.each do |user|\n @team.invite(current_user, user)\n end\n flash[:success] = \"Invitations sent\"\n redirect_back_or root_path\n end", "def invite(invite)\n @invite = invite\n mail(:to => invite.email, :subject => \"#{@invite.user.name} has invited you to the \\\"#{invite.idea.name}\\\" idea\", :tag => 'invite') \n end", "def invite_worker(email, agency)\n setup_email\n body[:agency] = agency\n recipients email\n subject \"Invite from #{agency.name} to use on-line timesheets at ClockOff.com\"\n end", "def accept_invitation\n \n end", "def invite(invitation)\n @invite = invitation\n mail :to => invitation.email,\n :subject => \"Welcome to the Panda\"\n end", "def invite(user)\n participation = @tandem.participations.create(\n user:user,\n token: generate_token\n )\n\n send_invitation_mail participation\n true\n end", "def participant_acceptance(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n \n mail to: applicant_email,\n reply_to: schooladmins,\n subject: \"Congratulations! You have been accepted to\" + @school.name + \" !\"\n end", "def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end", "def accepted_invite(user)\n @user = user\n mail(:to => user.email, :subject => \"Welcome to the Secret Santa Society.\")\n end", "def invite_a_friend_to_track(user, email, the_body, the_subject) \n recipients email\n #bcc \"support@habitforge.com\"\n from user.first_name + \" via habitforge <support@habitforge.com>\"\n subject the_subject \n body the_body\n content_type \"text/html\"\n end", "def invite_via_suggestion\n @user = User.create_with_organisation_membership_from_project_invite @invite\n\n if @user.valid?\n RequestMailer.invite_via_suggestion @user, @invite, current_user\n\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"#{@user.email} has been sent an invite\"\n elsif account_has_been_claimed? @user\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"This user has already been invited to Digital Social\" \n else\n redirect_to :dashboard, alert: \"There was an error inviting #{@user.email}, please try again later.\" \n end\n end", "def invite(user, group, mailto)\n @user = user\n @group = group\n mail(to: mailto, subject:'user.name invite you! Join GURUPU')\n end", "def invite\n invite = params[:invite]\n profile.update_attribute(:email, invite[:email])\n invite = Notifier.send_invite(profile, invite[:message])\n invite.deliver\n flash[:notice] = \"An invititation to join YentaFriend was sent to #{profile.name}. Check your dashboard for an update when they join!\"\n end", "def meet\n # Envia pedido de que quer conhecer o animal. \n # Isto mandaria uma proposta para o dono do shelter.\n\n # TODO: É preciso criar uma tabela associativa para saber quem já mandou proposta para o animal.\n # Assim evitaria mandar proposta múltiplas vezes.\n if params[:user_id]\n # friendly_user = User.find(params[:user_id])\n friendly_user = current_user\n AnimalMailer.meet_up_proposal(@animal, friendly_user).deliver\n end\n end", "def invite_user(param)\n email_addresses.set param[:email]\n is_owner.set(true) if param[:owner] == 'true'\n unless nil_or_empty?(param[:apps])\n param[:apps].each_with_index do |item, index|\n app_drop_down.select item\n role_drop_down.select param[:roles][index] if param[:roles]\n site_drop_down.select param[:sites][index] if param[:sites]\n add_new_app.click\n end\n end\n invite_button.click\n end", "def invite_member(github_uid, default_team)\n username = user_name_by_id(github_uid)\n add_user_to_team(default_team, username)\n rescue Octokit::Forbidden => e\n ignore_exception?(e)\n end", "def invite\n Notifications.invite\n end", "def invite_email(user, emails)\n @user = user\n @friend_url = \"http://www.lacquerloveandlend.com/friendships/new?friend_id=#{@user.id}\"\n\n mail(to: emails, subject: \"#{user.name} wants to share with you on Lacquer Love&Lend!\", bcc: \"lacquerloveandlend@gmail.com\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def invite\n parent = {coparent_email: 'lalala@gmail.com', coparent_name: 'Vasco'}\n UserMailer.invite(parent)\n end", "def add_to_team(email)\n @greeting = \"Hi\"\n mail(:to => email, :subject => \"Register to Persona website !\")\n end", "def accepted(invite, user)\n @invite = invite\n @user = user\n mail(:to => invite.user.email, :subject => \"#{@user.name} has accepted your invitation to the \\\"#{invite.idea.name}\\\" idea\", :tag => 'invite-accepted') \n end", "def meet_invitation(root_url, url, user, invitee, message, meet)\n @root_url, @url = root_url, url\n @user, @invitee, @message, @meet = user, invitee, message, meet\n mail(#:cc => user.email, \n :to => invitee.email,\n :subject => \"You've been added to a Kaya Meet\")\n end", "def invite(invitee, inviter)\n @invitee = invitee\n @inviter = inviter\n\n mail to: invitee.email,\n subject: \"Invitation from #{inviter.first_name} to join a kinstagram family\"\n end", "def new_user_waiting_for_approval(faculty)\n @faculty = faculty\n\n mail(to: 'rorteammaker@gmail.com', subject: 'A new faculty member is awaiting approval!', body: 'A new faculty member is awaiting your approval!')\n end", "def invite(invitation)\n @invitation = invitation\n mail(to: invitation.email, subject: \"#{invitation.user.name} invite you to join GURUPU\")\n end", "def invite\n @meal = Meal.find(params[:meal_id])\n authorize @meal, :update?\n @user = if params[:user_id]\n User.find(params[:user_id])\n else\n User.find_by(name: params[:user_name])\n end\n @meal.invite_user @user\n redirect_to @meal\n end", "def invite_user(username)\n pending_msg = \"The reviewer already has a pending invitation.\\n\\n#{username} please accept the invite here: #{invitations_url}\"\n collaborator_msg = \"#{username} already has access.\"\n added_msg = \"OK, invitation sent!\\n\\n#{username} please accept the invite here: #{invitations_url}\"\n error_msg = \"It was not possible to invite #{username}\"\n\n return pending_msg if is_invited? username\n return collaborator_msg if is_collaborator? username\n return added_msg if add_collaborator username\n return error_msg\n end", "def invitation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def invite_neighbor(invitation)\n @invitation = invitation\n @greeting = \"Howdy, neighbor!\"\n mail to: \"#{@invitation.recipient_email}\", subject:\"#{@invitation.sender.username} has invited you to join their group on NeighborShare.\"\n end", "def do_invite(invite)\n if invite.existing_user?\n deliver_email(InviteMailer.existing_user(invite))\n after_invite_existing_user(invite)\n invite.save\n else\n deliver_email(InviteMailer.new_user(invite))\n after_invite_new_user(invite)\n end\n end", "def invite_facebook_friends\n end", "def new_interview(user)\n @user = user\n mail to: user.email, subject: \"New Interview is added\"\n end", "def invite(name, email, token, to)\n @name = name\n @token = token\n mail to: to, subject: \"#{email} invited you to his FamilyFeed\"\n end", "def invite_friend(user, invitation)\n @user = user\n @invitation = invitation\n\n mail to: @invitation.email, subject: \"Invitation to connect@ustksa\"\n end", "def invite_friends(name, email)\n\n @name = name\n @email = email\n to = \"#{@name} <#{@email}>\"\n from = ['do-not-reply@salayhin.wordpress.com']\n\n mail :to => to, :subject => 'Invitation to join', :from => from do |format|\n format.html\n end\n\n end", "def invite\n set_gamer\n\n return unless request.post? # else: JS do the invite\n\n # answered\n if params[:commit] == t(:do_yes)\n @gamer.accept!\n @game.check_play_now(params[:game_js_time].to_i)\n broadcast\n redirect_to play_game_path(@game), game_js_time: params[:game_js_time].to_i\n\n else # params[:commit] == 'no'\n @gamer.reject!\n @game.check_play_now(params[:game_js_time].to_i)\n broadcast\n redirect_to games_path\n\n end\n end", "def invite\n invitation_service.invite(invitation_params)\n end", "def member_invite_to_team(inviter, team, email)\n @team = team\n @user = inviter\n @team_img = @team.logo\n mail(to: email, subject: \"#{@team.name} Team Invitation\")\n end", "def invite_via_suggestion(invited_user, project_invite, authorised_by_user)\n return false unless (@invited_user = invited_user).receive_notifications?\n\n @organisation = project_invite.invited_organisation_resource\n @invited_user = project_invite.invited_user\n @authorised_by_user_name = authorised_by_user.first_name.blank? ? 'Someone' : authorised_by_user.first_name\n @authorised_by_user_email = authorised_by_user.email\n \n mail to: @invited_user.email, subject: \"You've been invited to join an organisation on DigitalSocialInnovation\"\n end", "def join\r\n if @trip.participants.include?(current_person)\r\n redirect_to(@trip, :notice => \"You are already a participant in the #{@trip.name}.\")\r\n return\r\n elsif @trip.organizers.include?(current_person) && request.post?\r\n @trip.participants << current_person\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n else\r\n @token = params[:token]\r\n invitation = Invitation.find_by_token(@token)\r\n if invitation.nil?\r\n redirect_to(person_root_url, :error => \"The invitation link you followed is invalid.\")\r\n return\r\n end\r\n \r\n if request.post?\r\n invitation.accept(current_person)\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n end\r\n end\r\n end", "def add_participants_to_global_competition\n\t\tusers = User.where({:in_grand_competition=>true})\n\t\t\n\t\tinvitation_count = 0\n\t\tusers.each do |user|\n\t\t\tCompetitionParticipant.add_participant(user.id, self.id)\n\t\t\tinvitation_count += 1\n\t\tend\n\t\tAppMailer.global_race_admin_notify(self.id, users.length, invitation_count).deliver\n\t\t\n\t\treturn \"#{self.name} created. #{invitation_count}/#{users.length} users invited.\"\n\tend", "def invite(invitation)\n @invitable = invitation.invitable\n @user = invitation.user\n # TODO: UPDATE the registration URL\n @registration_url = root_url\n\n view = 'invite'\n # invite_project or invite_board if available\n view += ('_%s' % invitation.invitable_type.parameterize) if @invitable\n\n title = @invitable.nil? ? Doers::Config.app_name : @invitable.title\n subject = _('%s invites you to work on %s.') % [invitation.user.name, title]\n\n mail(:to => invitation.email, :subject => subject, :template_name => view)\n end", "def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n omniauth_params = request.env[\"omniauth.params\"]\n\n # if there is an invite token\n if omniauth_params && omniauth_params[\"workingtitle_invite_token\"]\n token = omniauth_params[\"workingtitle_invite_token\"]\n\n # Fetch the invite from the token\n invite = Invite.find_by(token: token)\n\n invite.accept(current_user)\n end\n\n redirect_to profile_path\n else\n redirect_to auth_path(provider: 'github')\n end\n end", "def invite(player, message)\n @player = player\n @message = message\n mail to: @player.email\n end", "def tracker_invite(user)\n\n\n to_list = user.email\n cc_list = []\n subject = \"Your login information for the PCB Design Tracker\"\n\n @reviewer = user\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list\n )\n\n end", "def new_support(challenge, supporter)\n \t@challenge = challenge\n \t@supporter = supporter\n \tmail(to: 'ferblape@gmail.com', \n \t\tsubject: \"New supporter created in challenge #{challenge.title}\")\n end", "def existing_user_invite\n InviteMailer.existing_user_invite(Invite.last)\n end", "def adduser(email, password, first_name, last_name, slug)\n @user = User.invite!(:email => email, :slug => slug) do |u|\n u.skip_invitation = true\n end\n token = @user.instance_variable_get(:@raw_invitation_token)\n User.accept_invitation!(:invitation_token => token,\n :password => password,\n :password_confirmation => password,\n :first_name => first_name,\n :last_name => last_name,\n :slug => slug)\n\n puts \"Created User #{email} with password #{password}\"\n @user\n end", "def participant_user(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n\n mail to: applicant_email,\n reply_to: schooladmins,\n subject: \"Thank you for your recent registration to \" + @school.name\n end", "def invite\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n User.find(params[:user_id]).invites << current_user\n redirect_to friends_path\n end\n end", "def accepted_by(user)\n return false unless self.active?\n # assign user to startup unless they are already part of a startup\n relationship_role = nil\n\n if self.invite_type == Invite::TEAM_MEMBER\n user.startup_id = self.startup_id if !self.startup_id.blank? or !user.startup_id.blank?\n user.set_account_type(:entrepreneur)\n # Bypass forcing user to setup account if they were invited from startup that is setup, also don't suggest startups\n user.setup_complete! if self.startup.account_setup?\n elsif self.invite_type == Invite::STARTUP\n user.set_account_type(:entrepreneur)\n relationship_role = :startup_startup\n elsif self.invite_type == Invite::MENTOR || self.invite_type == Invite::NREDUCE_MENTOR # Add user as mentor to startup\n user.set_account_type(:mentor)\n user.roles << :nreduce_mentor if self.invite_type == Invite::NREDUCE_MENTOR\n relationship_role = :startup_mentor\n elsif self.invite_type == Invite::INVESTOR\n user.set_account_type(:investor)\n relationship_role = :startup_investor\n end\n\n # Add user to startup if invite came from startup\n if !self.startup.blank? and !relationship_role.blank?\n r = Relationship.start_between(user, self.startup, relationship_role, true)\n if r.blank?\n self.errors.add(:user_id, 'could not be added to startup')\n else\n self.errors.add(:user_id, 'could not be added to startup') unless r.approve!\n end\n end\n \n if user.save\n self.to = user\n self.accepted_at = Time.now\n self.save\n else\n false\n end\n end", "def deliver_invite_to_resident(resident, user)\n return\n end", "def accept_invite3\n # find the invitation\n @invitation = Invitation.find_by_verify_email_token(params[:token])\n duplicate_accept_invite = false\n\n # has the invitation already been accepted?\n if @invitation.status.eql?('accepted')\n duplicate_accept_invite = true\n @invitation.accept_count += 1\n @invitation.save\n else\n @invitation.update_attributes(:status => 'accepted')\n end\n # do we know the invitee?\n @person = People.where(\"email => ? AND status => ?\", @invitation.invitee_email, 'active_mobile').first\n if @person\n create_relationships(@invitation)\n end\n end", "def invite(poll, email)\n @poll = poll\n\n mail to: email, subject: \"Zoodle Poll: #{@poll.label}\"\n end", "def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n unless meeting.participants.exists?(participant_id)\n new_participant = User.find(participant_id)\n meeting.participants << new_participant\n # add default vote for the new added participant to each suggestion\n meeting.suggestions.each do |suggestion|\n suggestion.votes << Vote.new(:voter => new_participant, :decision => \"?\")\n end\n\n NotificationService.send_meeting_invitation(user, new_participant, meeting, comment)\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end", "def invite_friend\n friend = params[:invite_friend]\n profile = User.find_by_id(friend[:user_id])\n\n UserMailer.send_invitation(friend, profile).deliver\n redirect_to profile_path(profile)\n end", "def invitation_instructions(record, token, options={})\n\t\t@message = record.invitation_message\n\t\t@collaborator_name = record.full_name\n\t\tinvitation_type = record.invitation_type\n\t\tcollaboration_object_type = invitation_type.class.to_s.downcase\n\t\t@sender_name = record.invited_by.try(:full_name)\n\t\t@collaboration_link = \"#{ENV['DOMAIN']}/users/invitation/accept?invitation_token=#{token}&invitation_type=#{collaboration_object_type}&invitation_type_id=#{invitation_type.id}\"\n\t\tp \"------------------------------------------------------\"\n\t\tp \"New User - Sending CollabInvitation for #{collaboration_object_type} to #{record.email}\"\n\t\tp \"-------------------------------------------------------\"\n\t\tif collaboration_object_type == \"project\"\n\t\t\t@project_title = record.invitation_type.title\n\t\t\tmail(\"new_user_project_collaboration_invitation\",email: record.email)\n\t\telsif collaboration_object_type == \"document\"\n\t\t\t@document_title = record.invitation_type.title\n\t\t\t@project_title = record.invitation_type.project.title\n\t\t\tmail(\"new_user_document_collaboration_invitation\",email: record.email)\n\t\tend\n\tend", "def invitation_instructions(record)\n setup_mail(record, :invitation_instructions)\n end", "def invitation_instructions(record)\n setup_mail(record, :invitation_instructions)\n end", "def invite_users(users_emails_to_invite, studygroup)\n # TODO: send e-mail invitation to user\n # TODO: How do we do error messages in a for loop?\n # TODO: ERROR HANDLING\n\n return_codes = GlobalConstants::SUCCESS\n\n if users_emails_to_invite == nil\n return GlobalConstants::SUCCESS\n end\n\n users_emails_to_invite.each do |email|\n user_to_invite = User.find_by(email: email)\n\n code = GlobalConstants::SUCCESS\n\n if user_to_invite == nil\n code = GlobalConstants::USER_DOES_NOT_EXIST\n else\n unless Validation.user_enrolled_in_course(studygroup.course, user_to_invite)\n code = GlobalConstants::USER_NOT_ALREADY_ENROLLED\n end\n\n unless Validation.user_in_studygroup(studygroup, user_to_invite)\n code = GlobalConstants::USER_ALREADY_IN_STUDYGROUP\n end\n end\n return_codes<< code\n\n if code == GlobalConstants::SUCCESS\n mail = UserMailer.invite_email(self, user_to_invite, studygroup)\n mail.deliver\n end\n end\n\n return_codes\n end", "def invite_no_progress(*params)\n\t\tself.each{|x| safe{x.invite(*params)} if x.respond_to?('invite')}\n\tend", "def invitation_instructions(resource, token, opts={})\n invited_by = resource.invited_by\n invited_by_email = invited_by.email\n invited_to_account = Account.joins(:memberships).where(memberships: {user_id: resource.id, created_by_id: invited_by.id}).limit(1).first.try(:name)\n opts[:subject] = \"#{invited_to_account} Invitation from #{invited_by_email}\"\n super\n end", "def invite\r\n if request.post?\r\n @pi = PrivateInvite.new(params[:pi]) \r\n if @pi.email == User.find(session[:user_id]).email\r\n flash[:notice] = \"you are already listed\"\r\n redirect_to :back\r\n return \r\n end \r\n PrivateInvite.find_all_by_private_event_id(@pi.private_event_id).each do |p|\r\n if p.email == @pi.email\r\n flash[:notice] = \"#{@p.email}is already on the guest list\"\r\n redirect_to :back\r\n return \r\n end\r\n end\r\n \r\n @pi.invited_at = Date.today \r\n invite = Invitation.new\r\n invite.title = PrivateEvent.find(@pi.private_event_id).title\r\n invite.host_email = User.find(session[:user_id]).email\r\n invite.guest_email = @pi.email \r\n email = InvitationMailer.create_invite(invite)\r\n email.set_content_type(\"text/html\")\r\n @guest_list = PrivateInvite.find(:all)\r\n if @pi.save\r\n begin\r\n InvitationMailer.deliver(email) \r\n rescue\r\n @pi.destroy\r\n flash[:notice] = \"address not found\"\r\n end \r\n end \r\n end\r\n redirect_to :back\r\n end", "def accepted_application_moderator(vacancy, user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def match_to_invitation_or_send_email\n if invitation = joinable.membership_invitation_for(user)\n invitation.accept(invitation.user)\n else\n UserMailer.project_membership_request_created_email(joinable.who_can?(:manage), self).deliver\n end\n end", "def invite_friends\n @invite = Invite.new\n end", "def signup(gym, cost, lifter)\n membership = Membership.new(gym, cost)\n self.membership << gym\n end", "def create\n successes = []\n (params[:invitations].split(',') || []).each do |name|\n name.strip!\n invitation = @game.invitations.build(:twitter_login => name, :invited_by => current_user)\n successes << name if invitation.save\n # TODO: send actual invitations as DMs from the user??\n # TODO: verify that the listed people are actually followers of the user?\n end\n flash[:notice] = \"Invitations have been sent to the #{successes.length} people you selected\"\n redirect_to(game_path(@game))\n end", "def interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end", "def invite_user(invitation,subject,message)\n @subject = subject\n @sign_up_url = new_user_registration_url(:token => invitation.token)\n @invitation = invitation\n @message = message\n mail( :from => invitation.user.email,\n :to => invitation.email,\n :subject => subject )\n end", "def remote_invite(sender, body)\n room_hash = MD5::digest(body)[0,8]\n @connection.room_names[room_hash] = body\n @connection.room_ids[body] = room_hash\n if _user_keyhash(sender) != @connection.comm.our_keyhash\n _notice \"You have been invited by #{sender} to join #{body}.\", :notice\n end\nend", "def participant_admins(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n\n mail to: schooladmins,\n from: applicant_email,\n reply_to: applicant_email,\n subject: @applicant.fullname + \" has registered to \" + @school.name + \" and is waiting for acceptance.\"\n end", "def invite(invitation, www_host)\n @invitation = invitation\n @www_host = www_host\n \n mail :to => invitation.email_address\n end", "def find_invitee_and_create_invitation(network_or_survey)\n organization = Organization.find(params[:id])\n return network_or_survey.invitations.create(:invitee => organization, :inviter => current_organization)\n end", "def accept!()\n self.status = Invite::Status::ACCEPTED\n invitable.add_member invitee\n save!\n end", "def invite!(user_from, user_to, note=\"\")\n Invite.send!(user_from, user_to, note, self)\n end", "def send_invite_email(invite)\n @invite = invite\n log_email_sent(\"send invite\", @invite.email)\n mail(:to => @invite.email, :subject => \"You've been invited to a TrueGM League\")\n end", "def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end", "def invite_new_users(users)\n invitations = users.map do |user|\n @current_course.invitations.build(name: user[:name], email: user[:email])\n end\n validate_new_invitation_emails(invitations)\n end", "def new_interview\n UserMailer.new_interview\n end", "def activate\n flash.clear\n return if params[:id].blank? and params[:activation_code].blank?\n activator = params[:activation_code] || params[:id]\n @invite = Invite.find_by_activation_code(activator)\n if @invite\n if @invite.user_id\n flash[:warning] = \"The invitation has been already registered\".t\n elsif user = User.find_by_email(@invite.user_email)\n flash[:warning] = \"The user #{user.login} is already registered with this email address\".t\n else\n # special case for :founder_circle as they can only be accepted by projects\n # so switch the user identity #@invite.circle_id == Invite::TYPES[:founder_circle][:id] &&\n # or should we always switch identity to user when accepting email invite ?? tough one ..\n Invite.transaction do\n if current_user.on_behalf_id != 0\n current_user.on_behalf_id = 0\n current_user.save!\n end\n @invite.user_id = current_actor.id\n @invite.display_name = current_actor.display_name\n @invite.save!\n\n Activity.send_message(@invite, @invite.inviter, :invite_sent)\n end\n flash[:success] = \"The invitation has been registered for %s\" / current_actor.login\n end\n redirect_to(:controller => '/activity', :action => 'list')\n else\n params[:activation_code] = activator\n flash[:warning] = \"Unable to register the invitation. Please make sure that the activation code is correct.\".t\n end\n end", "def candidate_interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Congrats!! You have been selected for an Interview\"\n \n mail to: @candidate.email, subject: subject\n end", "def local_invite(body)\n peer = _pop_token(body)\n room = @var[:room] if body.length < 2\n _remote_control(peer, :invite, room)\n _notice \"#{peer} has been invited to #{room}\"\nend", "def invite_group(email, group_id, user)\n @user = User.find(user)\n @email = email\n @group = Group.find(group_id)\n mail(to: \"#{@email}\", subject: \"#{@user.name} - Invited You to Join Their Scavenger Hunt Awesome Group\")\n end", "def invite_with_notify(swimming_buddy, shares_passages = false, shares_trainings = false, shares_calendars = false)\n if @user.invite(swimming_buddy, shares_passages, shares_trainings, shares_calendars)\n news_feed = NewsFeed.create_social_feed(\n swimming_buddy.id,\n @user.id,\n I18n.t('newsfeed.invite_title'),\n I18n.t('newsfeed.invite_body').gsub('{SWIMMER_NAME}', @user.get_full_name),\n false # (This is no 'temp/achievement' kind of feed, so we'll generate a newsletter mail until it is read)\n )\n # FIXME: [Steve, 20160616] WRONG PLACE HERE TO INVOKE DIRECLTY THE MAILER!\n # For framework vers. 5.0 we aim at a better separation between the presentation\n # layer and the B-L layer. So no presentation-related mailer should be called here.\n # *** TO RESTORE PREVIOUS FUNCTIONALITY, ADD A MAILER CALL TO THE CALLEE OF THIS METHOD ***\n # Generate a nofify mail without delay:\n # NewsletterMailer.community_mail( swimming_buddy, news_feed ).deliver\n end\n end", "def challenges; end", "def invite_resource\n resource_class.invite!(invite_params, current_inviter) do |invitable|\n invitable.company_id = current_user.company_id\n invitable.is_admin = true\n invitable.require_email = true\n invitable.save\n end\n end", "def invite_by_mail\n @user = User.find_by_id(params[:id])\n raise Kroogi::NotPermitted unless @user && @user.active? && permitted?(@user, :profile_edit) # @user is inviter\n\n begin\n invited = []\n Invite.transaction do\n params[:user_emails].split(',').each do |eml|\n eml = eml.strip\n next unless eml.match(User::EMAIL_REGEX)\n next if Invite.find_by_user_email_and_inviter_id(eml, @user.id)\n\n Locale.with_locale(params[:locale]) do\n @invite = Invite.new_for_mail(params[:invite].merge(:join_inviter_to_invited => true), @user, params[:locale])\n @invite.user_email = eml\n @invite.save!\n invited << @invite\n end\n end\n end\n if invited.empty?\n flash[:warning] = \"Unable to send any invites: couldn't parse emails or emails have already been invited\".t\n redirect_to :action => 'new', :id => @user, :user_emails => params[:user_emails], :locale => params[:locale], :invite => {:invitation => params[:invite][:invitation]}\n else\n flash[:success] = invited.size == 1 ? (\"Sent invite to %s\"/[invited.first.user_email]) : (\"Sent invites to: %s\"/[h(invited.map(& :user_email).to_sentence)])\n redirect_to :controller => 'kroogi', :action => 'show_pending', :id => @user, :type => Invite::TYPES[:site_invite][:id], :highlight_invite => invited.map(& :id).join('|')\n end\n rescue ActiveRecord::RecordInvalid\n do_find params\n render :action => 'find'\n end\n end", "def send_mail person, should_send\n post invitations_url, params: {invitation: { email: \"test_mail@lc41.com\",\n invited_by_id: person.id}}\n ##This might cause problems, might want to adjust what invite we grab\n invite = Invitation.last\n if should_send\n should_send_mail invite\n else\n # NOTE: ZH: don't have invites in the database, at this point unless loaded\n # by the scenario so the check doesn't make sense\n # assert invite.invited_by_id != person.id?, \"Invite created by non admin account\"\n assert_redirected_to root_path, \"Bad redirect after failed invite\"\n end\n end", "def add\n # for volunteer to sign up for a project\n # if volunteer signs up, a message or notification gets sent to the administrator\n end", "def in_relation_accepted\n @headhunter = Headhunter.first.id\n @talent = Talent.first.id\n @status = \"Accepter\"\n HeadhunterMailer.in_relation(@headhunter, @talent, @status)\n end", "def invitation_email(user, pot)\n @user = user\n @pot = pot\n mail(subject: \"You're invited to contribute!\", to: user.email)\n end" ]
[ "0.7445946", "0.68268937", "0.6749575", "0.64790535", "0.64690304", "0.6419441", "0.6377431", "0.6339624", "0.62758493", "0.6163723", "0.6158972", "0.6153506", "0.6086437", "0.608313", "0.608025", "0.60781646", "0.60591066", "0.5987101", "0.59848523", "0.59735113", "0.5967652", "0.59612966", "0.59448147", "0.5943001", "0.5940004", "0.59392846", "0.5913949", "0.5909252", "0.5893583", "0.5885677", "0.5876581", "0.58750635", "0.58540976", "0.5851816", "0.584895", "0.5832851", "0.58260584", "0.5819358", "0.5816598", "0.5800398", "0.579795", "0.5772079", "0.575858", "0.5755674", "0.57516515", "0.57476366", "0.5747354", "0.5745466", "0.5732364", "0.5729374", "0.5723616", "0.57009244", "0.56940365", "0.5690339", "0.56875414", "0.5686258", "0.56834996", "0.566882", "0.5663222", "0.5661402", "0.5660518", "0.5654555", "0.56534624", "0.5646043", "0.56418943", "0.5631448", "0.5631448", "0.5630669", "0.5628517", "0.56266946", "0.56246156", "0.56245637", "0.5624094", "0.5617636", "0.5615798", "0.561418", "0.56078154", "0.5604278", "0.5602822", "0.5591265", "0.559103", "0.55889076", "0.55861473", "0.5580781", "0.5580147", "0.557922", "0.55772495", "0.5574542", "0.55683833", "0.556363", "0.55620027", "0.55560696", "0.5555247", "0.5547281", "0.5544471", "0.5535542", "0.55354357", "0.5534978", "0.5532879", "0.5524828" ]
0.589504
28
Good one Shaggy! We all love to watch Scooby Doo, Shaggy Rogers, Fred Jones, Daphne Blake and Velma Dinkley solve the clues and figure out who was the villain. The story plot rarely differed from one episode to the next. Scooby and his team followed the clue then unmasked the villain at the end. Task Your task is to initially solve the clues and then use those clues to unmask the villain. You will be given a string of letters that you must manipulate in a way that the clues guide you. You must then output the villain. You will be given an Array of potential villains and you must only return the correct masked villain. Potential Villains for the example test cases `Black Knights, Puppet Master, Ghost Clowner, Witch Doctors, Waxed Phantom, Manor Phantom, Ghost Bigfoot, Haunted Horse, Davy Crockett, Captain Injun, Greens Gloobs, Ghostly Manor, Netty Crabbes, King Katazuma, Gators Ghouls, Headless Jack, Mambas Wambas, Medicines Man, Demon Sharker, Kelpy Monster, Gramps Vamper, Phantom Racer, Skeletons Men, Moon Monsters` There will be different villains for the main test cases! Clue 1: The first clue is in a 'house' on 'String Class' Avenue.
def scoobydoo(villian, villians) letters = ('a'..'z').to_a numbers = (0..25).to_a letters_to_numbers = letters.zip(numbers).to_h numbers_to_letters = numbers.zip(letters).to_h villians_downcase = villians.map { |v| v.downcase.delete(' ') } villians_hash = (villians_downcase).zip(villians).to_h s = villian.reverse.chars.rotate(5) new = [] (0...s.size).each do |i| if i.even? new[i] = s[i] else num = (letters_to_numbers.fetch(s[i]) + 5) % 26 new[i] = numbers_to_letters.fetch(num) end end villians_hash.fetch(new.join) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reveal_matches(letter)\n hits = []\n i = 0\n @secret.split(\"\").each do |c|\n hits << i if c == letter\n i += 1\n end\n hits.each do |i|\n @solution[i] = letter\n end\n return @solution\n end", "def vogal(str)\n vogals = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n cons = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n# splitting the string given into arrays \n str = str.chars\n str_new = str.map do |char|\n#looping the string into the next letter\n if vogals.include?(char)\n vogals.rotate(1)[vogals.index(char)]\n else cons.include?(char)\n cons.rotate(1)[cons.index(char)]\n end\n end\n#joining the strings back\n str_new.join\nend", "def remove_errant_matches_from(pot_ex_array)\n correct_match_arr = []\n pot_ex_array.each do |example|\n constituents = example.construct_constituents_array\n constituents.each do |const_array|\n if const_array[0] == self.word && const_array[1] == self.hiragana && const_array[3] == self.reading # For this to work, the constituents have to be normalized to dictionary_forms.\n correct_match_arr << example\n end\n end\n end\n return correct_match_arr\n end", "def silly_talk(str)\n vows = \"aeiou\"\n\n new_talk = str.split(\" \").map do |wrd|\n if vows.include?(wrd[-1].downcase)\n wrd + wrd[-1]\n else\n silly = wrd.split(\"\").map do |char|\n if vows.include?(char)\n char + \"b\" + char\n else\n char\n end\n end\n silly.join(\"\")\n end\n end\n\n new_talk.join(\" \")\nend", "def 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 cracklepop1\n def aux x\n /[A-Z]+/i.match(x.to_s).to_s\n end\n (1..100).map do |i|\n x = i%3==0 ? 'crackle' : i\n i%5==0 ? (aux(x)+'pop') : x\n end\nend", "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 candidate_name_scrub (line, matches)\n candidates = Array.new\n case line\n when /CLINTON/ # List full names\n @candidates[1] = \"Hillary Rodham Clinton / Timothy Michael Kaine\"\n @candidates[2] = \"Gary Johnson / Bill Weld\"\n when /TRUMP/ # Single Space, List full names\n @candidates[1] = \"Jill Stein / Ajamu Baraka\"\n @candidates[2] = \"Donald J Trump / Michael R Pence\"\n when /CONLEY/ # Single Space\n @candidates[1] = \"Jason Conley\"\n @candidates[2] = \"Pat Pettey\"\n when /MOLLY/ # Spill over to next line\n @candidates[1] = \"Molly Baumgardner\"\n @candidates[2] = matches[:rx_candidate_2].sub(/\\(.\\)/, '').rstrip.split.map(&:capitalize).join(' ')\n when /AMANDA/ # Spill over to next line\n @candidates[1] = \"Amanda Grosserode\"\n @candidates[2] = matches[:rx_candidate_2].sub(/\\(.\\)/, '').rstrip.split.map(&:capitalize).join(' ')\n when /STEPHANIE/ # Spill over to next line\n @candidates[1] = \"Stepanie Clayton\"\n @candidates[2] = matches[:rx_candidate_2].sub(/\\(.\\)/, '').rstrip.split.map(&:capitalize).join(' ')\n when /CHRISTOPHER/ # Spill over to next line\n @candidates[1] = \"Christopher McQueeny\"\n @candidates[2] = matches[:rx_candidate_2].sub(/\\(.\\)/, '').rstrip.split.map(&:capitalize).join(' ') \n else\n @candidates[1] = matches[:rx_candidate_1].sub(/\\(.\\)/, '').rstrip.split.map(&:capitalize).join(' ')\n if matches[:rx_candidate_2] && !matches[:rx_candidate_2].empty?\n @candidates[2] = matches[:rx_candidate_2].sub(/\\(.\\)/, '').rstrip.split.map(&:capitalize).join(' ')\n end\n end\n\n if !@party_affiliation[@candidates[1]]\n $stderr.puts @candidates[1]\n raise(@candidates[1])\n end\n if @candidates[2] && !@candidates[2].empty?\n if !@party_affiliation[@candidates[2]]\n $stderr.puts @candidates[2]\n @party_affiliation[@candidates[2]]\n end\n end\n end", "def correct_colors(temp_array)\n temp_player_input = temp_array[1]\n temp_secret_code = temp_array[0]\n temp_player_input.each do |item|\n next unless temp_secret_code.include?(item)\n\n @matches.shift\n @matches << 'white'\n temp_secret_code[temp_secret_code.index(item)] = 'O'\n end\n end", "def badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend", "def evaluate\n @misses = @secret_code[0..-1]\n @bulls = 0\n @cows = 0\n\n @guesses.each_with_index do |guess, i|\n if @secret_code[i] == guess\n @misses[i] = \"bull\"\n end\n end\n\n @guesses.each do |guess|\n if @misses.include?(guess)\n @misses[@misses.index(guess)] = \"cow\"\n end\n end\n\n @misses.each do |hit|\n if hit == \"bull\"\n @bulls += 1\n elsif hit == \"cow\"\n @cows += 1\n end\n end\n\n puts \"\\nYou guessed #{@guesses.to_s} and got #{@bulls.to_s} Bulls and #{@cows.to_s} Cows.\"\n end", "def consonant_checker(array)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < consonant_guide.length\n if char == consonant_guide[index]\n char = consonant_guide[index += 1]\n index += 1\n elsif char == \"z\"\n char = \"b\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('').capitalize!\n name_join\n end\n p array\nend", "def breakCam(str)\n chars = str.split('')\n arr = Array.new\n\n chars.each do |i|\n if i.downcase == i\n arr << i\n elsif i.upcase == i\n arr << ' '\n arr << i\n end\n end\n\n return arr.join()\n\nend", "def hipsterfy(sentence) \n sentence = sentence.split(\" \")\n arr = []\n sentence.each do |word|\n result = word.gsub(/[aeiou](?!.*[aeiou])/, '') # Negative Lookahead Regex\n arr << result\n end\n arr.join(\" \")\nend", "def dr_evils_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Check out this method in IRB to see how it works! Also refer to the Ruby docs.\n decoded_sentence = []\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\",\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n\n input.each do |x| # What is #each doing here?\n found_match = false # Why would this be assigned to false from the outset? What happens when it's true?\n cipher.each_key do |y| # What is #each_key doing here?\n if x == y # What is this comparing? Where is it getting x? Where is it getting y? What are those variables really?\n decoded_sentence << cipher[y]\n found_match = true\n break # Why is it breaking here?\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #What the heck is this doing?\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # Try this out in IRB. What does \" (0..9).to_a \" do?\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match # What is this looking for?\n decoded_sentence << x\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n #What is this method returning?\nend", "def cloze_text(text)\n tagger = EngTagger.new\n note_with_tags = tagger.get_readable(text).split(' ')\n # Find the word_pairs in the note that we'll hide.\n candidate_words_to_hide_with_tag = Set.new\n note_with_tags.each do |word_tag_pair|\n _, tag = word_tag_pair.split('/')\n # Hide numbers and proper nouns.\n if tag == 'CD' || tag == 'NNP'\n candidate_words_to_hide_with_tag.add(word_tag_pair)\n end\n end\n # Shuffle the set so that we don't hide the first N words, but randomly dispersed words.\n candidate_words_to_hide_with_tag =\n Set.new(candidate_words_to_hide_with_tag).to_a.sample(MIN_WORDS_TO_HIDE + MAX_WORDS_TO_HIDE)\n # Build the content and hide candidates.\n card_content = ''\n hide_count = 0\n # This is non-sense that I hope we can remove one day.\n # Cloze must have at least 1 deletion so if there are no candidates above we hide the first word.\n note_with_tags.each_with_index do |word_tag_pair, index|\n word, tag = word_tag_pair.split('/')\n is_first_index = index.zero?\n can_add_space = !is_first_index && !POS_PUNCTUATION.include?(tag) # Not punctuation\n if (candidate_words_to_hide_with_tag.member?(word_tag_pair) && hide_count < MAX_WORDS_TO_HIDE) ||\n (candidate_words_to_hide_with_tag.empty? && hide_count == 0)\n hide_count += 1\n word = \"{{c1::#{word}}}\"\n end\n card_content << ' ' if can_add_space\n card_content << word\n end\n card_content\nend", "def censor(string, array)\n new_words = (string.split).map do |word|\n if array.include?(word.downcase)\n star_vowels(word)\n else\n word\n end\n end\n\n new_words.join(\" \")\nend", "def mask_article(str, words_array)\n new_str = str\n words_array.each do |word|\n new_str.gsub! word, strike(word) if new_str.include? word\n end\n\n new_str\nend", "def banana(name)\n\n# For names that start with vowels\nif name.downcase.start_with?('a','e','i','o','u')\n mod_name = name.downcase\n# For names that begin with a 2-letter consonant cluster\nelsif name.downcase.start_with?('bl', 'br', 'cl', 'cr', 'dr', 'fl', 'fr', 'gl', 'gr', 'pl', 'pr', 'sc', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'sw', 'th', 'tr', 'ch')\n mod_name = name.slice(2..-1)\n# For names that begin with a 3-letter consonant cluster\nelsif name.downcase.start_with?('chr', 'thr', 'sch', 'scl', 'scr', 'shr', 'spl', 'spr', 'str', 'squ')\n mod_name = name.slice(3..-1)\n# For all other names\nelse\n mod_name = name.downcase.slice(1..-1)\nend\n\nif name.downcase == \"orange\"\n\tputs \"Nothing rhymes with orange.\"\nelse\nputs name.capitalize + \", \" + name.capitalize + \", bo-\" + (name.downcase.start_with?('b') ? mod_name.downcase.slice(0..-1) : \"b\"+mod_name) + \" \\r\\n\" + \n\"Banana-fana fo-\" + (name.downcase.start_with?('f') ? mod_name.downcase.slice(0..-1) : \"f\"+mod_name) + \" \\r\\n\" + \n\"Fee-Fi-mo-\" + (name.downcase.start_with?('m') ? mod_name.downcase.slice(0..-1) : \"m\"+mod_name) + \" \\r\\n\" + \nname.upcase + \"!\"\nend\n\nend", "def correct_positions\n @matches = Array.new(4) { 'O' }\n temp_player_input = Array.new(1) { @code_breaker_input }.flatten\n temp_secret_code = Array.new(1) { @secret_code_row }.flatten\n temp_secret_code.each_with_index do |_item, index|\n next unless temp_secret_code[index] == temp_player_input[index]\n\n temp_player_input[index] = 'X'\n temp_secret_code[index] = 'O'\n @matches.shift\n @matches << 'black'\n # binding.pry\n end\n temp_array = [temp_secret_code, temp_player_input]\n end", "def name_muddler (array)\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\nconsonant_array = consonants.chars \nnew_name = []\nindex = 0\nwhile index < array.length\n if array[index] == \"u\"\n new_name[index] = \"a\"\n elsif vowels.include?(array[index])\n new_name[index] = vowels[vowels.index(array[index]).next]\n elsif array[index] == \"z\"\n new_name[index] = \"b\"\n else new_name[index] = consonant_array[consonant_array.index(array[index]).next]\n end\n index += 1\nend \nreturn new_name\nend", "def identify(verse_string)\n # 1. Get basic information about input\n v_syllables = syllables(verse_string)\n v_weight = syllables_weights(v_syllables)\n\n # 2. Discover possible meter candidates\n # Should return list of meters with relevant information for generating correction if appropriate.\n # (Including size of match, etc.)\n m = analyze_syllables(v_syllables)\n\n # 3. Explain meter candidates\n\n # 3.1 Exact match => Show meter name, information, split input according to match (if possible).\n\n # 3.2 Fuzzy match => Generate possible corrections between input and candidates\n\n # 4. Output object containing input data, result status, and candidate meters\n # (with corrections if appropriate). No un-necessary results.\n\n meter_candidates = m[:meters]\n v_padas = []\n m_hsh = metercount\n\n if meter_candidates == {}\n m[:status] = \"Verse highly defective , Can't find neter\"\n v_meters = {}\n correct = []\n\n elsif m[:status] == \"exact match\"\n meter = meter_candidates.keys.first\n\n len = m_hsh[meter]\n v_padas << m[:syllables].slice!(0, len[0]).join(\"\")\n v_padas << m[:syllables].slice!(0, len[1]).join(\"\")\n v_padas << m[:syllables].slice!(0, len[2]).join(\"\")\n v_padas << m[:syllables].slice!(0, len[3]).join(\"\")\n\n defect_percentage = nil\n correct = []\n else\n d = 100.0\n pattern = []\n meter_candidates.each do |(key, val)|\n next unless val[0][:edit_distance].to_i < d # multiple verses with same edit distance???\n d = val[0][:edit_distance]\n meter = key\n pattern = val[0][:pattern].split(\"\")\n end\n\n defect_percentage = Rational(d, meter_candidates[meter][0][:pattern].length)\n n = fuzzy_correction(m[:weights], meter, pattern, m[:syllables])\n correct = n[:correct_weights]\n v_padas = n[:correct_padas]\n end\n\n v_corrections = {\n weights: correct.join(\"\"),\n padas: v_padas,\n }\n\n v_meters = {\n name: meter,\n size: \"full/half/pada\",\n defectiveness: defect_percentage,\n corrections: [v_corrections],\n }\n\n result = {\n verse: verse_string,\n syllables: v_syllables,\n weights: v_weight,\n status: m[:status],\n meter: [v_meters],\n }\n\n if result[:status] == \"exact match\"\n result[:meter] = v_meters[:name]\n result[:padas] = v_padas\n end\n\n result\n end", "def on_the_offensive(brd)\n attack = []\n WINNING_LINES.each do |line|\n current_line = brd.values_at(*line)\n if current_line.count(COMPUTER_MARKER) == 2\n attack = line\n end\n attack # returns array that is the best attack vector\nend\n\ndef determine_threat(brd)\n threat_line = []\n WINNING_LINES.each do |line|\n current_line = brd.values_at(*line)\n if current_line.any?(COMPUTER_MARKER)\n next\n elsif current_line.count(PLAYER_MARKER) == 2\n threat_line = line\n end\n end\n threat_line\nend", "def mask_article(string, words)\n words.each { |x| string.gsub!(x, strike(x))}\n string\nend", "def hackerman\r\n\r\n system('clear')\r\n\r\n #Asks for the first input and converts it to downcase\r\n puts \"Enter your first input\"\r\n firstString = gets.chomp\r\n firstString.downcase!\r\n\r\n\r\n #Asks for the second input and converts it to downcase\r\n puts \"Enter your second input\"\r\n secondString = gets.chomp\r\n secondString.downcase!\r\n\r\n\r\n #Converts the first input to an array of words\r\n arr1 = firstString.split\r\n\r\n\r\n #Loops through the first array, searching for words from the second string.\r\n #Replaces those elements with \"HIDDEN\"\r\n arr1.each do |x|\r\n if secondString.include? x \r\n i = arr1.index(x)\r\n arr1[i] = \"HIDDEN\"\r\n end\r\n end\r\n\r\n\r\n #Prints the result\r\n puts \"#{arr1}\"\r\n\r\nend", "def use_eliza_rules(input)\n\n \t\t# process the input into an array of words\n \t\t# want to avoid matching on fragments, like \"no\" of \"if\"\n \t\ttokens = input.downcase.chomp.split(/ /)\n\t\t\n # default response\n \t\tresponse = \"Go on.\"\n\t\t\n \t\t# try all the rules\n \t\t@eliza_rules.keys.each do |curr_key|\n\n \t\t\tcurrent_rule = curr_key.to_s\n\t\t\t\n \t\tif check_match(tokens, current_rule)\n \t\t \n \t\t\t\t# get the list of responses for this rule\n \t\t\t\tresponses = @eliza_rules[current_rule]\n \t\t\n \t\t\t\t# choose a response from the list of responses for the rule \n \t\t\t\tresponse = responses[rand(responses.length)]\n\t\t\t\n \t\t\t\t# pull out the interesting bit of the input - after the word we key in on.\t\n \t\t\t\tstarting_point = input.downcase.index(current_rule)\n\t\n \t\t\t\ttmp_sliced = input.slice(starting_point + current_rule.length + 1, input.length)\n\t\t\t\t\n \t\t\t\tif not(tmp_sliced.eql?(nil))\n \t\t\t\t\t# change the viewpoint of the result\n \t\t\t\t\ttmp_sliced = switch_viewpoint(tmp_sliced)\n\t\t\t\n \t\t\t\t\t# apply the transformation, from ?y to the rest of the text\n \t\t\t\t\tresponse = response.sub(/REPLACEME/, tmp_sliced)\t\n \t\t\t\tend\n \t\t end\n \t\tend\n\t\t\n \t response\n \tend", "def hipsterfy(str)\n finalArray = []\n alphabet = (\"a\"..\"z\").to_a\n wordArray = str.split(\" \")\n wordArray.each do |word|\n firstSeen = false\n reversed = word.split(\"\").reverse\n finalWord = []\n reversed.each do |letter|\n if firstSeen == true || letter != \"a\" && letter != \"e\" && letter != \"i\" && letter != \"o\" && letter != \"u\"\n finalWord.push(letter)\n\n elsif firstSeen == false && letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\"\n # don't add here\n firstSeen = true\n end\n end\n \n newString = \"\"\n finalWord.reverse.each do |element|\n newString += String(element)\n end\n finalArray.push(newString)\n \n end\n \n \n \n # print finalArray\n finalString = \"\"\n \n finalArray.each_with_index do |word, index|\n if index != finalArray.length - 1\n finalString += word + \" \"\n else\n finalString += word\n end\n end\n \n \n \n \n \n \n return finalString\n \n \n\n \nend", "def get_hint(secret, guess)\n bulls = 0\n cows = 0\n\n tracker = Hash.new(0)\n secret.each_char { |char| tracker[char] += 1 }\n guess.each_char.with_index do |char, i|\n if secret[i] == guess[i]\n bulls += 1\n if tracker[char] > 0\n tracker[char] -= 1\n else\n cows -= 1\n end\n elsif tracker[char] > 0\n tracker[char] -= 1\n cows += 1\n end\n end\n\n \"#{bulls}A#{cows}B\"\nend", "def word_with_guesses\n guesses_list = @guesses.to_s\n guesses_rx = /[^ #{guesses_list}]/\n @masked = @word.gsub(guesses_rx, \"-\")\n @masked.scan(/[a-z\\-]/).join\n end", "def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end", "def remove_vowels(array) #Works, but is very long, wordy and non-intuitive.\r\n vowels = [\"a\", \"A\", \"e\", \"E\", \"i\", \"I\", \"o\", \"O\", \"u\", \"U\"]\r\n new_array = []\r\n array.map do |string|\r\n sub_array = string.chars.select do |letter|\r\n letter unless vowels.include?(letter)\r\n end\r\n new_array << sub_array.join\r\n end\r\n new_array\r\nend", "def awesomesauce_infusion(strings)\n i = 0\n infused_strings = []\n strings.length.times do\n infused_strings << strings[i]\n if i < strings.length - 1\n infused_strings << \"awesomesauce\"\n end\n i += 1\n end\n return infused_strings\nend", "def translate(string)\n newArr = []\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # * Split it into words\n words = string.split()\n\n # * For every word in the sentence...\n words.each do |word|\n # * If the word has 'qu'\n if word[1..2].downcase == \"qu\"\n newArr << word[3..-1] + word[0..2] + \"ay\"\n\n elsif word[0..1].downcase == \"qu\"\n newArr << word[2..-1] + word[0..1] + \"ay\"\n\n # * If it starts with a vowel\n elsif vowels.include?(word[0].downcase)\n newArr << word + \"ay\"\n\n # * If the first three consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1]) and not vowels.include?(word[2])\n newArr << word[3..-1] + word[0..2] + \"ay\" \n # * ...or if the first two consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1])\n newArr << word[2..-1] + word[0..1] + \"ay\" \n \n # * After all that, if it starts with one consonant\n else\n newArr << word[1..-1] + word[0] + \"ay\"\n end\n end\n\n newArr.join(\" \")\nend", "def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend", "def vowel_checker(array)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('')\n name_join\n end\n array\nend", "def celebration\n cuddled = [ \"*** What a cuddle! ***\",\n \"*** That's a giant squeeze! ***\",\n \"*** So much love, my heart is full! ***\",\n \"*** I will hug him and squeeze him and call him George! ***\",\n \"*** Hugsy time ***\" ]\n\n cuddled.sample\n end", "def determine_if_consonant(some_guess, some_points, session_points)\n\t@player_guess = some_guess\t\t# guess is the players guess coming from the main\n @player_points = some_points\t\t# set up instance for the players current points\n\t@points_for_round = session_points\t# instance variable for whatever points the player spun for on the wheel\n\n # The if statement is used because only consonants are useful data here\n \n\t# if the player_guess is not equal to a vowel the following code will execute\n\tif @player_guess !~ /A|E|I|O|U/\n counter = 0 # a counter is initialized for use in the .each loop\n @masterWordArray.each do |letter| # this is where the .each loop begins. it uses the @masterWordArray as its object\n # # and this array is used in the .each loop to process the data and sort out which \n # # letters can be matched with the master word and which ones wont\n \n if letter == @player_guess then # This if statement is used to compare the current item being processed in the loop\n @randomWordArray[counter] = @player_guess # and the players guess\n @player_points = @player_points.to_i + @points_for_round.to_i\t\t# add the points the player spun for to the current total\n print @player_points\n\n end # end if statement # If the if statement is true than the players guess is assigned to the\n # # @randomWordArray which is masked and replaces the _ that cooressponds to the master word\n \n counter +=1 # increments the counter\n end # ends the each loop\n \n\telse\n\t\tprint \"Please try again you did not enter a consonant. Press Enter to continue.\"\n\t\tConsole_Screen.pause_program\n\tend\t# end if statement\n\n\tConsole_Screen.cls\n #print @masterWordArray\n #print(\"\\n\\n\")\n #print @randomWordArray\n \n return @player_points\t\t# returns the players new amount of points to the calling statement\n \n end", "def caesar_decode(string, offset)\n string.split(\"\").map do |character| #.map goes through array and creates a new array \n if $array_abc_low.include?(character) #checks if a letter is in the first/second array\n new_character = $array_abc_low[($array_abc_low.index(character)-offset)%26]\n # character_index = ($array_abc_low.index(character)-offset)%26 #adds in the offset number so the letter will change\n # new_character=$array_abc_low[character_index] #returns element in the new index\n elsif $array_abc_up.include?(character) #checks if a letter is in the first/second array\n new_character = $array_abc_up[($array_abc_up.index(character)-offset)%26]\n # character_index = ($array_abc_up.index(character)-offset)%26 #adds in the offset number so the letter will change\n # new_character=$array_abc_up[character_index]\n else character #this is for symbols/number and returns 'nil'\n end\n end.join(\"\")\nend", "def villain; end", "def villain; end", "def villain; end", "def pirates_say_arrrrrrrrr(string)\n\tarray_1 = string.downcase.split\"\"\n\tarray_2 = []\n\nloop do \n\tarrr = array_1.index(\"r\")\n\tbreak if arrr == nil\n\tarray_1.delete_at(arrr)\n\tarray_2 << array_1[arrr]\n\t\nend\n\narray_2.join\n\nend", "def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end", "def function_a(v1)\n\tprint \"Please input an adjective: \"\n\tinput = gets.chomp.downcase.capitalize\n#\tputs input\n\tprint \"Please input a business: \"\n\tinput2 = gets.chomp.downcase\n\ta1 = \"\"\n\ta1 = input2[0].match(/a|e|i|o|u/).nil? ? \"a \" : \"an \"\n#\tputs input2\n\tprint \"Please input an animal: \"\n\tinput3 = gets.chomp.downcase\n\ta2 = \"\"\n\ta2 = input3[0].match(/a|e|i|o|u/).nil? ? \"a \" : \"an \"\n#\tputs input3\n\tprint \"Please input a noise: \"\n\tinput4 = gets.chomp.downcase\n\ta3 = \"\"\n\ta3 = input4[0].match(/a|e|i|o|u/).nil? ? \"a \" : \"an \"\n#\tputs input4, \"\",\n\tputs \"\"\n\tputs v1.upcase,\n\t\tinput + \" Macdonald had \" + a1 + input2 + \", E-I-E-I-O\",\n\t\t\"And on that \" + input2 + \" he had \" + a2 + input3 + \", E-I-E-I-O\",\n\t\t\"With \" + a3 + input4 + \" \" + input4 + \" here\",\n\t\t\"And \" + a3 + input4 + \" \" + input4 + \" there,\",\n\t\t\"Here \" + a3 + input4 + \", there \" + a3 + input4 + \",\",\n\t\t\"Everywhere \" + a3 + input4 + \" \" + input4 + \",\",\n\t\tinput + \" Macdonald had \" + a1 + input2 + \", E-I-E-I-O!\"\nend", "def fivv_buzz(str)\n # array of desired words\n # split string into words (only needed if taking in a string, skip for array.)\n # iterate over words, check that the word starts with e AND is shorter than 6 characters.\n buzzed_words = []\n words = str.split(' ')\n words.each do |word|\n if 'eE'.include?(word[0]) && word.length < 6 \n # (word[0] == 'e' || word[0] == 'E') && word.length < 6\n buzzed_words << word\n end\n end\n return buzzed_words\nend", "def unique_morse_representations(words)\ncode = [\".-\",\"-...\",\"-.-.\",\"-..\",\".\",\"..-.\",\"--.\",\"....\",\"..\",\".---\",\"-.-\",\".-..\",\"--\",\"-.\",\"---\",\".--.\",\"--.-\",\".-.\",\"...\",\"-\",\"..-\",\"...-\",\".--\",\"-..-\",\"-.--\",\"--..\"]\n\n words.map do |word|\n word.split(\"\").map do |w|\n code[(w[0].ord)-97]\n end.join('')\n end.uniq.count\nend", "def pirates_say_arrrrrrrrr(string)\n array_1 = string.downcase.split\"\"\n array_2 = []\n \n loop do\n arrr = array_1.index(\"r\")\n break if arrr == nil\n array_1.delete_at(arrr)\n array_2 << array_1[arrr]\n end\n \narray_2.join\n\nend", "def sanitize()\n equiptment = [\"RNA-P1000\",\"RNA-P200\",\"RNA-P20\", \"Tube Block\", \"Bench Top\", \"Other\"]\n show do\n title \"Isolating RNA Effectively\"\n separator\n warning \"<b>Working with RNA can be tricky, since it is very sensitive to RNases.</b>\"\n note \"To prevent the degradation of our RNA and our hard work we must take care to use our best aseptic technique.\"\n note \"\"\n note \"\"\n check \"Wipe down area and equiptment you will be using with <b>70% EtOH</b> & <b>RNase ZAP</B>\"\n equiptment.each {|e| bullet \"<b>#{e}</b>\"}\n separator\n warning \"<b>Keep RNase ZAP on hand use whenever necessary.</b>\"\n end\n end", "def happy_unhappy_unhappiness\n # The distance between 'i' and 'y' is 0.5. The distance between and two\n # other non-equal phone pairs is 1. This ensures that 'i' and 'y' will tend\n # align with each other.\n happy_unhappy_phones =<<-EOTEXT\n FORM, LETTER, CLASS\n i, i, iy\n y, y, iy\n a, a, a\n e, e, e\n h, h, h\n n, n, n\n p, p, p\n s, s, s\n u, u, u\n EOTEXT\n phone_table = PhoneticAlign::PhoneTable.new(happy_unhappy_phones)\n # Phonetic sequences\n # Meanings\n un_meaning = PhoneticAlign::FeatureValueMatrix[:POL => :neg]\n happy_meaning = PhoneticAlign::FeatureValueMatrix[:LEMMA => :happy]\n ness_meaning = PhoneticAlign::FeatureValueMatrix[:POS => :noun]\n # Morphemes\n un_morph = PhoneticAlign::SurfaceMorpheme.new(un_meaning, phone_table.phone_sequence(\"un\"))\n happy_morph = PhoneticAlign::SurfaceMorpheme.new(happy_meaning, phone_table.phone_sequence(\"happy\"))\n happy_happi_morph = PhoneticAlign::SurfaceMorpheme.new(happy_meaning, phone_table.phone_sequence(\"happi\"), \n [phone_table.phone_sequence(\"happy\"),\n phone_table.phone_sequence(\"happi\")])\n ness_morph = PhoneticAlign::SurfaceMorpheme.new(ness_meaning, phone_table.phone_sequence(\"ness\"))\n # Words consisting of all phones.\n happy_p = PhoneticAlign::Word.new(phone_table.phone_sequence(\"happy\"), happy_meaning)\n unhappy_p = PhoneticAlign::Word.new(phone_table.phone_sequence(\"unhappy\"), un_meaning + happy_meaning)\n unhappiness_p = PhoneticAlign::Word.new(phone_table.phone_sequence(\"unhappiness\"), un_meaning + happy_meaning + ness_meaning)\n # Words consisting of phones and morphemes.\n unhappy_pm = PhoneticAlign::Word.new([un_morph] + phone_table.phone_sequence(\"happy\"), un_meaning + happy_meaning)\n # Words consisting of all morphemes\n happy_m = PhoneticAlign::Word.new([happy_morph], happy_meaning)\n unhappy_m = PhoneticAlign::Word.new([un_morph, happy_morph], un_meaning + happy_meaning)\n happy_happi_ness_m = PhoneticAlign::Word.new([happy_happi_morph, ness_morph], happy_meaning)\n unhappy_happi_ness_m = PhoneticAlign::Word.new([un_morph, happy_happi_morph, ness_morph], un_meaning + happy_meaning + ness_meaning)\n return Struct.new(:phone_table,\n :happy_p, :unhappy_p, :unhappiness_p,\n :unhappy_pm,\n :happy_m, :unhappy_m, :happy_happi_ness_m, :unhappy_happi_ness_m,\n :un_meaning, :happy_meaning, :ness_meaning).new(\n phone_table,\n happy_p, unhappy_p, unhappiness_p,\n unhappy_pm,\n happy_m, unhappy_m, happy_happi_ness_m, unhappy_happi_ness_m,\n un_meaning, happy_meaning, ness_meaning)\nend", "def caesar(tevertalen, nummer)\n alfabet = ('a'..'z').to_a\n vertaalde_string = \"\"\n\nfor i in 0..tevertalen.length-1\n if alfabet.include? tevertalen[i].downcase\n vertaalde_string += nieuwe_letter(tevertalen[i], nummer)\n else\n vertaalde_string += tevertalen[i]\n end\n end\n vertaalde_string\nend", "def morsecode string\n morse = Hash.new\n morse[:a] = \".-\"\n morse[:b] = \"-...\"\n morse[:c] = \"-.-.\"\n morse[:d] = \"-..\"\n morse[:e] = \".\"\n morse[:f] = \"..-.\"\n morse[:g] = \"--.\"\n morse[:h] = \"....\"\n morse[:i] = \"..\"\n morse[:j] = \".---\"\n morse[:k] = \"-.-\"\n morse[:l] = \".-..\"\n morse[:m] = \"--\"\n morse[:n] = \"-.\"\n morse[:o] = \"---\"\n morse[:p] = \".--.\"\n morse[:q] = \"--.-\"\n morse[:r] = \".-.\"\n morse[:s] = \"...\"\n morse[:t] = \"-\"\n morse[:u] = \"..-\"\n morse[:v] = \"...-\"\n morse[:w] = \".--\"\n morse[:x] = \"-..-\"\n morse[:y] = \"-.--\"\n morse[:z] = \"--..\"\n morse[1] = \".----\"\n morse[2] = \"..---\"\n morse[3] = \"...--\"\n morse[4] = \"....-\"\n morse[5] = \".....\"\n morse[6] = \"-....\"\n morse[7] = \"--...\"\n morse[8] = \"---..\"\n morse[9] = \"----.\"\n morse[0] = \"-----\"\n\n morse_string = \"\"\n \n x = 0 \n \n while x < string.length\n \n if string[x] != \" \" && string[x].to_i.to_s != string[x]\n morse_string += morse[string[x].downcase.to_sym].to_s + \" \"\n elsif string[x].to_i.to_s == string[x] \n morse_string += morse[string[x].to_i] + \" \"\n else\n morse_string += \" / \"\n end\n \n x +=1\n end\n \n return morse_string\nend", "def catnip_attack\r\n\t\t# prints string announcing cat has found catnip and is now\r\n\t\t# bouncing off the walls\r\n\t\t\tputs \"Uh oh the cat has found the catnip and is going crazy!\"\r\n\t\tend", "def segment_string(str)\n \n \n #Purpose: Initialize incidence variables\n #\n #Inputs: none\n #\n #Returns: \n #array1 = An Array that contains the component words of the original String. \n #@s = An Integer. The index of the start point of a test word.\n #@e = An Integer. The index of the end point of a test word.\n #@l = An Integer. The length of the string to be separated.\n def setup #initialize incidence variables\n array1 = [] #our word bank \n @s = 0 #start of a test word\n @e = 0 #end of a test word\n @l = str.length\n end\n \n #Purpose: Generate potential words comprised of consecutive letters from a String.\n #\n #Inputs: A String comprised of words without spaces between them.\n #\n #Returns: String comprised of the letters between the start point and end point.\n def make_word_candidates\n while @e <= l \n @word = str[@s..@e]#.join\n end\n end \n \n #Purpose: See if the potential words match entries in a dictionary. Current dictionary is a stub.\n #\n #Inputs: Potential words in String form generated by the Method make_word_candidates.\n #\n #Returns: Return message \"true\" for a dictionary match, \"false\" if not.\n def validate_word_match\n if valid_word?(@word)\n return true\n else return false \n end#this should be returning true or false\n end\n\n #Purpose: Store validated word in Array1\n #\n #Inputs: The Return \"true\" from the Method validate_word_match.\n #\n #Returns: Array containing validated words.\n def bank_valid_word_match(yes)\n if yes == true\n array1 << @word\n else nil\n end\n end\n\n #Purpose: Reset start and end points to begin looking for next word.\n #\n #Inputs: The Return \"true\" from the Method validate_word_match.\n #\n #Return: Start and End points one step beyond the end of the last found word.\n def begin_find_next_word(stepup)\n if stepup == true\n @s = @e+1\n @e += 1\n else nil\n end\n end\n\n #Purpose: Iterate end point to generate a new potential word if the previous potential word is not a word in our dictionary.\n #\n #Inputs: The Return \"false\" from the Method validate_word_match.\n def not_a_match(no)\n if no == false\n @e += 1 \n else nil \n end\n end \n\n #Purpose: Order of operations for segmenting the string.\n #\n #Inputs: none\n #\n #Returns: An Array (array1) containing the separate words that comprised the original string.\n def build_array\n setup\n while @e <= l\n make_word_candidates\n validate_word_match\n bank_valid_word_match(validate_word_match)\n begin_find_next_word(make_word_candidates)\n not_a_match(make_word_candidates)\n return array1\n end\n #return array1\n end\n \n # def output\n # return array1\n # end\n \n end", "def silly_talk(sent)\n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n words.each do |word|\n if vowels.include?(word[-1])\n new_words << word + word[-1] \n else \n new_words << word.split('').map { |c| vowels.include?(c) ? (c + 'b' + c) : c }.join\n end \n end \n\n new_words.join(' ')\n\nend", "def prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants.push(vowel) #To make things easy, add the vowel to the\r\n #list of consonants\r\n\r\n wordArray = word.split(\" \") #Split the secret word into an array\r\n\r\n i = 0 #Initialize index variable to zero\r\n\r\n #Loop once for each letter in the word (stored in an array)\r\n wordArray.each do |letter|\r\n\r\n match = false #Initialize the variable with a starting value of false\r\n\r\n #Loop once for each consonant stored in the consonants array\r\n consonants.each do |character|\r\n\r\n #Compare the current character from the consonants array to the\r\n #current letter in the wordArray array\r\n if character == letter then\r\n match = true #Set variable value to indicate a match\r\n break #Terminate loop execution when a match occurs\r\n end\r\n\r\n end\r\n\r\n #If there is no matching character in the consonants array for the\r\n #current letter in the wordArray array, replace that letter in the\r\n #wordArray with an underscore character\r\n if match == false then\r\n wordArray[i] = \"_\" #Replace the current character with an\r\n end #underscore\r\n\r\n i = i + 1 #Increment the variable's value by 1\r\n\r\n end\r\n\r\n #Once the contents of the array have been formatted with underscores,\r\n #convert the contents of the array back into a word\r\n word = wordArray.join(\" \")\r\n\r\n #Allow the player up to three guesses\r\n 3.times do |i| #i equals 0 on the first iteration of the loop\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Prompt the player to try to guess the secret word\r\n puts \"I am thinking of a word.\\n\\n\\n\\n\\n\\n\"\r\n print \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"What do you think this word is? \"\r\n reply = STDIN.gets #Collect the player's reply\r\n reply.chop! #Remove the end of line marker\r\n reply = reply.upcase #Convert the reply to all uppercase\r\n\r\n #Analyze the players guess\r\n if reply == shortWord then #The player's guessed the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n print \"Correct! Press Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Terminate the execution of the loop\r\n\r\n else #The player did not guess the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Display a message based on how many turns remain\r\n if i == 1 then\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! You have one guess left. Press Enter to \" +\r\n \"try again.\"\r\n elsif i == 2\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n shortWord = shortWord.downcase #converts word to lowercase\r\n print \"Sorry, you lose.\\n\\n\"\r\n print \"The word was \" + shortWord.sub(/^./) {$&.upcase} +\r\n #regex reads as follows: substitute \"beginning\" for \"anything\"\r\n #'contains complete matched text of uppercase= $&.upcase'\r\n #method .capitalize would accomplish this as well\r\n \". Press Enter to continue.\"\r\n else\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! Press Enter to try again.\"\r\n end\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n end\r\n\r\n end\r\n\r\n end", "def tandt_berserk(string, nick_e)\n debug('tandt_berserk string', string)\n\n output = \"1\"\n\n return output unless (m = /(^|\\s)S?((\\d+)[rR]6([\\+\\-\\d]*)(\\[(\\w+)\\])?)(\\s|$)/i.match(string))\n\n debug('tandt_berserk matched')\n\n string = m[2]\n dice_c = m[3].to_i\n bonus = 0\n bonus = parren_killer(\"(0#{m[4]})\").to_i if m[4]\n isHyperBerserk = false\n isHyperBerserk = true if m[5] && (m[6] =~ /[Hh]/)\n dice_arr = []\n dice_now = 0\n dice_str = \"\"\n isFirstLoop = true\n n_max = 0\n total_n = 0\n bonus2 = 0\n\n debug('isHyperBerserk', isHyperBerserk)\n\n # 2回目以降\n dice_arr.push(dice_c)\n\n loop do\n debug('loop dice_arr', dice_arr)\n dice_wk = dice_arr.shift\n\n debug('roll dice_wk d6', dice_wk)\n rollTotal, rollDiceResultText, roll_cnt1, rollDiceMaxCount, roll_n_max, roll_cnt_suc, roll_cnt_re = roll(dice_wk, 6, (sortType & 1))\n\n debug('rollTotal, rollDiceResultText, roll_cnt1, rollDiceMaxCount, roll_n_max, roll_cnt_suc, roll_cnt_re',\n rollTotal, rollDiceResultText, roll_cnt1, rollDiceMaxCount, roll_n_max, roll_cnt_suc, roll_cnt_re)\n\n if dice_wk >= 2 # 骰子が二個以上\n\n dice_num = rollDiceResultText.split(/,/).collect { |i| i.to_i }\n debug('dice_num', dice_num)\n\n diceType = 6\n\n dice_face = []\n diceType.times do |_i|\n dice_face.push(0)\n end\n\n dice_num.each do |dice_o|\n dice_face[dice_o - 1] += 1\n end\n\n dice_face.each do |dice_o|\n if dice_o >= 2\n dice_o += 1 if isHyperBerserk\n dice_arr.push(dice_o)\n end\n end\n\n if isFirstLoop && dice_arr.empty?\n min1 = 0\n min2 = 0\n\n diceType.times do |i|\n index = diceType - i - 1\n debug('diceType index', index)\n if dice_face[index] > 0\n min2 = min1\n min1 = index\n end\n end\n\n debug(\"min1, min2\", min1, min2)\n bonus2 = -(min2 - min1)\n rollDiceMaxCount -= 1 if min2 == 5\n\n if isHyperBerserk\n dice_arr.push(3)\n else\n dice_arr.push(2)\n end\n end\n end\n\n dice_now += rollTotal\n dice_str += \"][\" if dice_str != \"\"\n dice_str += rollDiceResultText\n n_max += rollDiceMaxCount\n isFirstLoop = false\n\n debug('loop last chek dice_arr', dice_arr)\n\n break if dice_arr.empty?\n end\n\n debug('loop breaked')\n\n debug('dice_now, bonus, bonus2', dice_now, bonus, bonus2)\n total_n = dice_now + bonus + bonus2\n\n dice_str = \"[#{dice_str}]\"\n output = \"#{dice_now}#{dice_str}\"\n\n if bonus2 < 0\n debug('bonus2', bonus2)\n output += bonus2.to_s\n end\n\n debug('bonus', bonus)\n if bonus > 0\n output += \"+#{bonus}\"\n elsif bonus < 0\n output += bonus.to_s\n end\n\n if sendMode > 0\n if output =~ /[^\\d\\[\\]]+/\n output = \"#{nick_e}: (#{string}) > #{output} > #{total_n}\"\n else\n output = \"#{nick_e}: (#{string}) > #{total_n}\"\n end\n else\n output = \"#{nick_e}: (#{string}) > #{total_n}\"\n end\n\n output += \" > 悪意#{n_max}\" if n_max > 0\n\n return output\n end", "def decodeMorse2(morseCode)\n letters = []\n words = []\n word = \"\"\n sentence = morseCode.split(\" \")\n\n sentence.each_with_index do |x,i|\n letters[i] = x.split(\" \")\n end\n\n 0.upto(letters.length - 1) do |i|\n word = \"\"\n 0.upto(letters[i].length - 1) do |x|\n case letters[i][x]\n when \"...---...\" then word += \"SOS\"\n when \"-.-.--\" then word += \"!\"\n when \".-.-.-\" then word += \".\"\n when \".-\" then word += \"A\"\n when \"-...\" then word += \"B\"\n when \"-.-.\" then word += \"C\"\n when \"-..\" then word += \"D\"\n when \".\" then word += \"E\"\n when \"..-.\" then word += \"F\"\n when \"--.\" then word += \"G\"\n when \"....\" then word += \"H\"\n when \"..\" then word += \"I\"\n when \".---\" then word += \"J\"\n when \"-.-\" then word += \"K\"\n when \".-..\" then word += \"L\"\n when \"--\" then word += \"M\"\n when \"-.\" then word += \"N\"\n when \"---\" then word += \"O\"\n when \".--.\" then word += \"P\"\n when \"--.-\" then word += \"Q\"\n when \".-.\" then word += \"R\"\n when \"...\" then word += \"S\"\n when \"-\" then word += \"T\"\n when \"..-\" then word += \"U\"\n when \"...-\" then word += \"V\"\n when \".--\" then word += \"W\"\n when \"-..-\" then word += \"X\"\n when \"-.--\" then word += \"Y\"\n when \"--..\" then word += \"Z\"\n when \".----\" then word += \"1\"\n when \"..---\" then word += \"2\"\n when \"...--\" then word += \"3\"\n when \"....-\" then word += \"4\"\n when \".....\" then word += \"5\"\n when \"-....\" then word += \"6\"\n when \"--...\" then word += \"7\"\n when \"---..\" then word += \"8\"\n when \"----.\" then word += \"9\"\n when \"-----\" then word += \"0\"\n end\n end\n words << word if word != \"\"\n end\n words.join(\" \")\nend", "def dr_evils_cipher(coded_message)\n code = coded_message.downcase.split(/[@#$%&*]/)\n decoded_string = []\n cipher = (\"a\"..\"z\").to_a\n \n code.each do |word|\n decoded_word = \"\"\n word.split(//).each do |letter|\n if cipher.include?(letter)\n index = cipher.index(letter) - 4\n decoded_letter = cipher[index]\n decoded_word << decoded_letter\n else\n decoded_word << letter\n end\n end\n decoded_string << decoded_word\n end\n decoded_string.join(\" \")\nend", "def dr_evils_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Check out this method in IRB to see how it works! Also refer to the Ruby docs.\n # it's setting the input to be the coded message that is now lower case and splits each input into a single letter\n decoded_sentence = []\n #setting decoded sentence to be an empty array\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\",\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n# This is where the conversions for the code is stored in a hash.\n input.each do |x| # What is #each doing here?\n found_match = false # Why would this be assigned to false from the outset? What happens when it's true?\n\n # It is iterating over each item that was in the message to be decoded. It's false because it doesn't match the code that deciphers it. It means that it was the same which can't happen.\n\n cipher.each_key do |y| # What is #each_key doing here?\n if x == y # What is this comparing? Where is it getting x? Where is it getting y? What are those variables really?\n\n # It is iterating over the hash keys. It is comparing the message to be decoded to the key to see what letter it should change it too.\n\n decoded_sentence << cipher[y]\n found_match = true\n #When they match it's push the new deciphered lettter to the decoded sentence array.\n break # Why is it breaking here?\n #It's breaking so it can move onto the next letter to decipher.\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #What the heck is this doing?\n #It's making it so if there is a character that's not a letter it won't change it and just push it into the array.\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # Try this out in IRB. What does \" (0..9).to_a \" do?\n #Similar as before but this is for numbers in an array and will add those as well.\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match # What is this looking for?\n decoded_sentence << x\n # If there isn't anything that matches the previous checks it will just add it to decoded sentece.\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n #What is this method returning?\n# It's returning the decoded sentence and joining everything back together.\nend", "def digester(string, missed_cleavages) # Returns an array of chomped sequences\n\tstring.upcase!\n\tarr = (0..(string.upcase.length-1)).map {|i| string[i]}\n\tmisses = 0; splits = []\n\t(0..missed_cleavages).each do |miss_cleav|\n\t\t(0..missed_cleavages).each do |init_num|\n\t\t\tlast, curr, next_item = nil, nil, nil; keeper = \"\"\n\t\t\tmisses = init_num\n\t\t\tarr.each_index do |i|\n\t\t\t\tlast = arr[i-1]; curr = arr[i]; next_item = arr[i+1]\n\t\t#\tputs \"last, curr, next: #{last}, #{curr}, #{next_item}\"\n\t\t\t\tkeeper << curr if curr\n\t\t#\tputs \"keeper: #{keeper}\"\n\t\t\t\tif curr == 'R' or curr == 'K'\n\t\t\t\t\tunless next_item == \"P\"\n\t\t#\t\t\t\tputs \"misses:missed cleavages\t\t\t#{misses}:#{miss_cleav}\"\n\t\t\t\t\t\tif misses < miss_cleav\n\t\t\t\t\t\t\tmisses += 1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsplits << keeper\n\t\t\t\t\t\t\tkeeper = \"\";\tmisses = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tsplits << keeper if next_item == nil\n\t\t#\t\tputs \"Splits looks like: #{splits}\"\n\t\t\tend\n\t\tend\t\t\t\n\tend\n\tsplits.uniq\nend", "def hangman(word, arr)\n #create variables to store incrementers and chars\n result = []\n i = 0\n #make sure we can compare whether given lower case or capitalized letters by making all cases the same\n word = word.upcase\n arr = arr.join(\"\").upcase\n \n # word = word.split(\"\") do we need to split string into array?\n # create a nested loops to iterate over the characters of the word, \n # each arr char should iterate over all word chars \n # push char back into word[i] position if it matches, \n # otherwise push \"_\"\n while i < word.length\n j = 0\n while j < arr.length\n if word[i] == arr[j]\n result.push(arr[j])\n end\n j += 1\n end\n if word[i] == \" \"\n result[i] = word[i]\n elsif result[i] != word[i]\n result[i] = \"_\"\n end\n i += 1\n end\n puts \"\\\"\" + result.join(\"\").downcase + \"\\\"\"\n end", "def silly_syllables(sentence)\n new_arr = []\n sent_arr = sentence.split(' ')\n vowels = 'aeiou'\n sent_arr.each do |word|\n if word.chars.count {|el| vowels.include?(el)} < 2\n new_arr << word\n else\n start = word.chars.index {|el| vowels.include?(el)}\n finish = word.chars.reverse.index {|el| vowels.include?(el)}\n finish_index = word.chars.length - finish - 1\n new_arr << word[start..finish_index]\n end\n\n end\n new_arr.join(' ')\nend", "def north_korean_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Turning every letter into a lower case letter and then splitting it into array\n decoded_sentence = []\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\", # An array would be beeter structure, we can automate the shiffting of the letters\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n\n input.each do |x| # iterating over each input character\n found_match = false #when false the same character will be added to the solution\n cipher.each_key do |y| # iterating thruthe keys of cipher hash\n if x == y #if current character is equal to a hash key\n # puts \"I am comparing x and y. X is #{x} and Y is #{y}.\"\n decoded_sentence << cipher[y]\n found_match = true\n break #it will end the loop once it finds its match\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #If it matach one of these characters it will add a space\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # turns a range into an array and then checks if that array includes the input\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match #If there is no match then add the character to the solution\n decoded_sentence << x\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n\n if decoded_sentence.match(/\\d+/) #Finding all the didgits\n decoded_sentence.gsub!(/\\d+/) { |num| num.to_i / 100 } #Replace and divide by 100\n end\n return decoded_sentence # it sreturning the string\nend", "def cheat!(letters) \n reset_trie!\n letters.chars.each_with_index do |letter, index|\n x, y = index.divmod(4)\n @board[x][y].replace letter\n end\n end", "def good_vs_evil(good, evil)\n g = good.split.map(&:to_i)\n gt = g[0] * 1 + g[1] * 2 + g[2] * 3 + g[3] * 3 + g[4] * 4 + g[5] * 10\n e = evil.split.map(&:to_i)\n et = e[0] * 1 + e[1] * 2 + e[2] * 2 + e[3] * 2 + e[4] * 3 + e[5] * 5 + e[6] * 10\n return 'Battle Result: No victor on this battle field' if gt == et\n return 'Battle Result: Good triumphs over Evil' if gt > et\n return 'Battle Result: Evil eradicates all trace of Good' if gt < et\nend", "def ancientify!\n\t\tself.gsub!(\"CM\", \"DCCCC\")\n\t\tself.gsub!(\"CD\", \"CCCC\")\n\t\tself.gsub!(\"XC\", \"LXXXX\")\n\t\tself.gsub!(\"XL\", \"XXXX\")\n\t\tself.gsub!(\"IX\", \"VIIII\")\n\t\tself.gsub!(\"IV\", \"IIII\")\n\tend", "def master_mind(solution, guess)\n hits = hit(solution, guess)\n pseudo_hits = psuedo_hit(solution, guess)\n \"hits: #{hits}\\n pseudo hits: #{pseudo_hits}\"\nend", "def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend", "def variations(boxid)\n result = []\n 0.upto(boxid.length - 1) do |offset|\n next_offset = offset + 1\n\n # Append the offset of the letter we removed, because when matching the codes\n # the letter has to be removed from the same position\n result << (boxid[0...offset] + boxid[next_offset...boxid.length] + \"[#{offset}]\")\n end\n\n return result\nend", "def good_guess(pattern)\n merge(pattern)\n @dictionary.keep_only_words_that_match(@solution)\n @possible_letters.delete(letter_in(pattern))\n end", "def tiy_fizz_buzz(string)\n special = (0..9).to_a + ('!'..'?').to_a\n arr = string.chars\n arr.map do |a|\n case\n when special.include?(a) == true\n a\n when \"AEIOU\".include?(a) == true\n a = \"Iron Yard\"\n when \"aeiou\".include?(a) == true\n a = \"Yard\"\n when \"BCDFGHJKLMNPQRSTVWXYZ\".include?(a) == true\n a = \"Iron\"\n else\n a\n end\n end.join(\"\")\nend", "def cleanup_noreg(string)\n blocks = string.split\n result = blocks.map do |word|\n word = word.chars.map! do |char|\n if char.downcase == char.downcase.upcase\n ' '\n else \n char\n end\n end\n word = word.join\n # p word\n #p word.squeeze(\" \")\n #word.squeeze(\" \")\n # take note that here +*& is a block or word, and gets replaced by a space without\n # any contiguous letter chars\n # so after join on line 48, there are 3 spaces between my and line, without the squeeze call\n word\n end\n result = result.join(' ').squeeze(' ')#.squeeze\nend", "def pig_latin_name(word)\n \n letters = word.split(\"\")\n \n final_array = letters.clone\n letters.each do |letter| #[p, l, u, m]\n \n \n if is_consonants?(letter)\n final_array.rotate! \n # #puts \".........#{removed_consonant}\"\n # #letters.push(removed_consonant)\n # puts \".........#{final_array}..#{letters}\"\n else \n # puts \"*****#{final_array}.... #{letters}\"\n final_array.push(\"ay\")\n return final_array.join\n end\n end\nend", "def generate_villain_nemesis(villain)\n buffer\n line\n puts \"Who is your villain's nemesis?\"\n line\n choice = gi_string\n villain.nemesis = choice\n buffer\n line\n puts \"Your villain's nemesis is #{villain.nemesis}. If this is correct, press 1. Press 2 if not. Press 3 to go back. Avoid this if you do not want to rewrite your origin story.\"\n line\n choice = gi_integer\n if choice == 1\n Hero.create(name: Faker::Name.name_with_middle, alter_ego: villain.nemesis, super_power: Faker::Superhero.power, power_lvl: Faker::Number.within(range: 50..300), resistance: Faker::Number.within(range: 1..40), hp: Faker::Number.within(range: 500..1000), gender: Faker::Gender.binary_type, race: Faker::Games::DnD.species, origin_story: Faker::Lorem.paragraphs(number: 3), nemesis: nil)\n generate_villain_grievance(villain)\n elsif choice == 2\n generate_villain_nemesis(villain)\n elsif choice == 3\n generate_villain_origin_story(villain)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_villain_nemesis(villain)\n end \n end", "def disemvowl(string)\n vowels = 'aeiou'\n string.each_char { |char|\n string.delete!(char) if vowels.include?(char.titleize)\n }\nend", "def output\n results = ziv_lempel_ordered\n # results.each do |ary|\n # puts \"now: %Q{#{buf_string(ary[0],ary[1][0])}} #{ary.inspect}\"\n # end\n the_output = @buffer.join('')\n variable = \"@a\"\n variables = Array.new\n results.each do |ary|\n string = buf_string(ary[0],ary[1][0])\n count = 0\n re = Regexp.new(Regexp.quote(string))\n the_output.gsub(re) do |s|\n count += 1\n s\n end\n if count >= 2\n variables << [variable.dup, string.dup]\n the_output.gsub!(re, \"\\#\\{#{variable}\\}\")\n variable.succ!\n else\n # puts \"string #{string} /#{re}/ not found\"\n end\n end\n print <<EOF\n#!/usr/local/bin/ruby -w --\n\n# Takes DRY code and soaks it... undoes TumbleDRYer.\nclass WashingMachine\n def initialize\nEOF\n variables.each do |ary|\n puts \" #{ary[0]} = %q{#{ary[1]}}\"\n end\n print <<EOF\n end\n def output\n # We need a string unlikely to be in the input as a terminator.\n print <<BLOBULARIZATION\nEOF\n puts the_output \n print <<EOF\nBLOBULARIZATION\n end\nend\n\nWashingMachine.new.output\nEOF\n end", "def pirates_say_arrrrrrrrr(string)\n\n string_array = string.chars\n indexes = string_array.each_with_index.map {|char, index| char.downcase == 'r' ? index : nil}.compact # gives an array of the indexes we want\n indexes.map {|x| string_array[x+1]}.join # iterates through each index for string_array \n\nend", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend", "def solution(string)\n # lowers = string.scan(/[a-z]+[A-Z]/).join\n uppers = string.scan(/[A-Z][^A-Z]+/).join(' ')\n # lowers + \" \" + uppers\n # require 'pry'; binding.pry\n\nend", "def spell_check(string)\n string.downcase!\n block = ['bo','xk','dq', 'cp','na',\n 'gt' ,'re', 'fs', 'jw', 'hu',\n 'vi', 'ly', 'zm']\n tracker = false\n \n string.chars.each do |char|\n tracker = false # set to false as default value\n block.each do |pair| #check if a pair in the block contains char, returns true if so; otherwise leaves tracker unmodified\n if pair.include?(char)\n block.delete(pair)\n tracker = true \n end\n end\n end\n tracker\nend", "def is_alt(s)\n staging_area = []\n staging_area << s[0]\n\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n\n s.chars[1..-1].each do |letter|\n if consonants.include?(letter)\n staging_area << letter unless consonants.include?(staging_area.last)\n end\n if vowels.include?(letter)\n staging_area << letter unless vowels.include?(staging_area.last)\n end\n end\n\n staging_area.join == s\nend", "def unify_voiced_katakana!(src)\n halfwidth =\n Characters::HALFWIDTH_VOICED_KATAKANA +\n Characters::HALFWIDTH_SEMI_VOICED_KATAKANA\n fullwidth =\n Characters::VOICED_KATAKANA +\n Characters::SEMI_VOICED_KATAKANA\n halfwidth.zip(fullwidth).inject(src) do |str, (h, f)|\n str.gsub!(h, f) || str\n end\n end", "def uses_available_letters?(input, letters_in_hand)\n # edge case\n return false if input.length > 10 || input.length < 1 \n\n temp_in_hand = letters_in_hand.clone\n\n input.upcase!\n tile_split = input.split(\"\") \n\n tile_split.each do |letter|\n return false if !temp_in_hand.include?(letter) \n \n temp_in_hand.delete_at(temp_in_hand.index(letter))\n end \n return true\nend", "def alias_input_pass(input)\n # Each entry is formatted [/Alias match regex/, \"Alias Name\", /gsub replacement regex/, \"replace with string\"]\n alias_input_map = [\n [/\\b\\d+dF\\b/i, 'Fudge', /\\b(\\d+)dF\\b/i, '\\\\1d3 f1 t3'], # Fate fudge dice\n [/\\bSNM\\d+\\b/i, 'Sunsails', /\\bSNM(\\d+)\\b/i, '\\\\1d6 ie6 t4'], # Sunsails: New Milennium; Fourth Edition\n [/\\b\\d+wh\\d+\\+/i, 'Warhammer', /\\b(\\d+)wh(\\d+)\\+/i, '\\\\1d6 t\\\\2'], # Warhammer (AoS/40k)\n [/\\b\\d+WoD\\d+\\b/i, 'WoD', /\\b(\\d+)WoD(\\d+)\\b/i, '\\\\1d10 f1 t\\\\2'], # World of Darkness 4th edition (note: explosions are left off for now)\n [/\\bdd\\d\\d\\b/i, 'Double Digit', /\\bdd(\\d)(\\d)\\b/i, '(1d\\\\1 * 10) + 1d\\\\2'], # Rolling one dice for each digit\n [/\\bage\\b/i, 'AGE System Test', /\\b(age)\\b/i, '2d6 + 1d6'], # 2d6 plus one drama/dragon/stunt die\n [/\\B\\+d\\d+\\b/i, 'Advantage', /\\B\\+d(\\d+)\\b/i, '2d\\\\1 d1'], # Roll two dice of the specified size and keep the highest\n [/\\B-d\\d+\\b/i, 'Disadvantage', /\\B-d(\\d+)\\b/i, '2d\\\\1 kl1'], # Roll two dice of the specified size and keep the lowest\n [/\\B\\+d%\\B/i, 'Advantage on percentile', /\\B\\+d%\\B/i, '((2d10kl1-1) *10) + 1d10'], # Roll two d10s for the tens column and keep the lowest (roll under system) then add a d10 for the ones\n [/\\B-d%\\B/i, 'Disadvantage on percentile', /\\B-d%\\B/i, '((2d10k1-1) *10) + 1d10'], # Roll two d10s for the tens column and keep the highest (roll under system) then add a d10 for the ones\n [/\\b\\d+CoD\\b/i, 'CoD 10-again', /\\b(\\d+)CoD\\b/i, '\\\\1d10 ie10 t8'], # Chronicles of Darkness (default, 10-again)\n [/\\b\\d+CoD8\\b/i, 'CoD 8-again', /\\b(\\d+)CoD8\\b/i, '\\\\1d10 ie9 t8'], # Chronicles of Darkness (8-again)\n [/\\b\\d+CoD9\\b/i, 'CoD 9-again', /\\b(\\d+)CoD9\\b/i, '\\\\1d10 ie8 t8'], # Chronicles of Darkness (9-again)\n [/\\b\\d+CoDR\\b/i, 'CoD rote quality', /\\b(\\d+)CoDR\\b/i, '\\\\1d10 r7 t8'], # Chronicles of Darkness (Rote quality, reroll all failed)\n [/\\bd6s\\d+\\b/i, 'The D6 System', /\\bd6s(\\d+)\\b/i, '\\\\1d6 + 1d6 ie'], # The D6 System\n [/\\bsr\\d+\\b/i, 'Shadowrun', /\\bsr(\\d+)\\b/i, '\\\\1d6 t5'], # Shadowrun system\n [/\\b\\d+d%\\B/i, 'Percentile roll', /\\b(\\d+)d%\\B/i, '\\\\1d100'], # Roll a d100\n [/\\bsp\\d+\\b/i, 'Storypath', /\\bsp(\\d+)\\b/i, 'ul \\\\1d10 ie10 t8'], # storypath system\n [/\\b\\d+yz\\b/i, 'Year Zero', /\\b(\\d+)yz\\b/i, '\\\\1d6 t6'], # year zero system\n [/\\bdndstats\\b/i, 'DnD Stat-roll', /\\b(dndstats)\\b/i, '6 4d6 k3'] # DnD character stats - 4d6 drop lowest 6 times\n ]\n\n @alias_types = []\n new_input = input\n\n # Run through all aliases and record which ones we use\n alias_input_map.each do |alias_entry|\n if input.match?(alias_entry[0])\n @alias_types.append(alias_entry[1])\n new_input.gsub!(alias_entry[2], alias_entry[3])\n end\n end\n\n new_input\nend", "def magiceightball\n\t\t answers = [\"outlook not so good\", \"cloudy, ask again later\", \"it is meant to be\", \"you may rely on it\"]\n\t\t @result = answers[Random.rand(4)]\n\tend", "def vowels_with_if_elsif(letter)\n if vowels.include? letter\n return true\n elsif consonants.include? letter \n # one way to list consonants otherwise would be to take the alphabet (create that array first) and remove the contents of the vowels array\n return false\n else\n return false\n end\nend", "def anagrams(string)\n# enable.txt is a Scrabble dictionary provided/recommended by Viking Code School\n dictionary = File.readlines(\"enable.txt\")\n stringy = string.strip.downcase\n# by SORTing the letters of the source string and the dictionary words you can easily match the results to find anagrams\n testy = stringy.chars.sort.join\n anagrams = []\n dictionary.each do |word|\n word = word.strip\n if word.length == stringy.length\n check = word.chars.sort.join\n if testy == check\n anagrams << word\n end\n end\n end\n if anagrams == []\n puts \"No anagrams were found for #{stringy.upcase}\"\n else\n anagrams.delete_at(anagrams.index(stringy))\n puts \"The following anagrams were found for #{stringy.upcase}\"\n puts \"#{anagrams}\"\n end\nend", "def prompt_for_guess(shortWord, word, consonants, vowel)\n\n\tConsole_Screen.cls #clear the display area\n\n\tconsonants.push(vowel) #to make things easy, add the vowel to the list \n\t #of consonanats\n wordArray = word.split(\" \") #split the secret word into an array\n\n i = 0 #initialize index variable to zero\n\n #loop once for each letter in the word (stored in an array)\n wordArray.each do |letter|\n\n \tmatch = false #initial the variable with a string value of false\n\n \t#loop once for each consonant stored in the consonants array\n \tconsonants.each do |character|\n\n \t\t#compare the current character from the consonants\n \t\t#array to the current letter in the wordArray array\n \t\tif character == letter then\n \t\t\tmatch = true #set variable value to indicate a match\n \t\t\tbreak #terminate loop execution whe a match occurs\n \t\tend\n\n \tend\n\n \t#if there is no matching character in the consonants\n \t#array for the current letter in the wordArray\n \t#array, replace that letter in the wordArray with \n \t#an underscore chracter\n \tif match == false then\n \t\twordArray[i] = \"_\" #replace the current character withunderscore\n \tend\n\n \ti = i + 1 #increment the variable's value by 1\n\n end\n\n #once the contents of the array hve been formatted with underscores\n #convert the contents of the array back into a word\n word = wordArray.join(\" \")\n\n #allow the player up to three guesses\n 3.times do |i| #i equals 0 on the first iteration of the loop\n\n \tConsole_Screen.cls #clear the display area\n\n \t#prompt the player to try to guess the secret word\n \tputs \"I am thinking of a word.\\n\\n\\n\\n\\n\"\n \tprint \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\n \tprint \"What do you think this word is? \"\n \treply = STDIN.gets #collect the player's reply\n \treply.chop! #remove the end of line marker\n \treply = reply.upcase #convert the reply to all uppercase\n\n \t#analyze the player's guess\n \tif reply == shortWord then #the player guessed the secret word\n\n \t\tConsole_Screen.cls print \"Correct! Press Enter to continue\"\n \t\tConsole_Screen.pause #pause the game\n \t\tbreak #terminate the execution of the loop\n\n \telse #the player did not guess the secret word\n\n \t\tConsole_Screen.cls #clear the display area\n\n \t\t#display a message based on how many turns remain\n \t\tif i == 1 then\n \t\t\tprint \"Wrong! You have one guess left. Press Enter to \" +\n \t\t\t\"try again.\"\n\n \t\telsif i == 2 \n \t\tprint \"Sorry, you lose.\\n\\n\"\n \t\tprint \"The word was \" + shortWord.capitalize + \" Press Enter to continue.\"\n \telse\n \t\tprint \"Wrong! Press Enter to try again.\"\n \tend\n\n \tConsole_Screen.pause #pause the game\n end\nend\nend", "def crack_vigenere file\n answer = \"\"\n words = gets_key_word_from_file file, (find_key_lengths_by_file file)\n words.each.with_index do |word, i|\n answer += \"Attempt: #{i + 1} : #{word} \\n\".red + \"#{v_decode_file 'secretcode.txt', word} \\n\"\n end\n answer\nend", "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 reveal(user_input)\n for i in 0..set_word.length-1\n if set_word[i] == user_input\n concealed_word[i] == user_input\n concealed_word\n end\n end\n end", "def summon_captain_planet(array)\n array.map! {|command| command.capitalize + \"!\"}\nend", "def get_consonants\n\n\tlist = Array.new #define an array in which to store the consonants\n\n\t#give the player an idea of what is coming\n\tputs \"Before you try to guess the secret word, you must specify 5 \" +\n\t\"consonants. \\n\\n\"\n\tprint \"Press Enter to continue.\"\n\n\tConsole_Screen.pause #pause the game\n\n\t5.times do #iterate 5 times\n\n\t\tConsole_Screen.cls #clear the display area\n\n\t\t#prompt the player to enter a consonant\n\t\tprint \"\\nPlease enter a consonant and press Enter. \"\n\n\t\tinput = STDIN.gets #collect the player's input\n\t\tinput.chop! #remove the end of line marker\n\n\t\t#only accept consonant characters\n\t\tif input !~/[bcdfghjklmnpqrstvwxyz]/i then \n\t\t\tConsole_Screen.cls #clear display area\n\t\t\tprint \"Error: \" + input + \" is not a consonant.\" +\n\t\t\t\"Press Enter to continue\"\n\t\t\tConsole_Screen.pause #pause the game\n\t\t\tredo #repeat the current iteration of the loop\n\t\tend\n\n\t\t#only accept one character of input per guess\n\t\tif input.length > 1 then\n\t\t\tConsole_Screen.cls\n\t\t\tprint \"Error: You may only enter one character at a time\" +\n\t\t\t\"Press Enter to continue.\"\n\t\t\tConsole_Screen.pause #pause the game\n\t\t\tredo #repeat the current iteration of the loop\n\n\t\tend\n \n #do not allow the player to submit the same guess twice\n if list.include?(input.upcase) == true then\n \tConsole_Screen.cls #clear the display area\n \tprint \"Error: You have already guessed\" + input + \n \t\"Press Enter to continue\"\n \tConsole_Screen.pause #pause the game\n \tredo #repeat the current iteration of the loop\n\n else\n \tlist.push(input.upcase) #convert the consonant to uppercase and add\n \t #it to the list of consonants\n end\nend\n return list #return the list of consonants to the calling statement\n\nend", "def silly_talk(sent)\n vowels = \"aeiou\"\n return_array = []\n sent.split(\" \").each do |word|\n if vowels.include?(word[-1])\n return_array << word + word[-1] \n else\n word.each_char.with_index do |char, idx|\n vowels.include?(char) ? (return_array) : () \n end\n end\n word.each_char \n end\nend", "def flaw_mutations_determination(roll)\n case roll\n when 01..02\n @@flaw_mutations << \"Abnormal Anxiety\"\n when 03..04\n @@flaw_mutations << \"Altered Digestive Tract\"\n when 05..06\n @@flaw_mutations << \"Baldness\"\n when 07..17\n @@flaw_mutations << \"Birth Defect\"\n when 18..19\n @@flaw_mutations << \"Blocked Sinuses\"\n when 20..21\n @@flaw_mutations << \"Chronic Acne\"\n when 22..23\n @@flaw_mutations << \"Chronic Dermatitis\"\n when 24..25\n @@flaw_mutations << \"Chronic IngrownHairs\"\n when 26..27\n @@flaw_mutations << \"Chronic Ulcers\"\n when 28..29\n @@flaw_mutations << \"Coronary Thrombosis\"\n when 30..31\n @@flaw_mutations << \"Degenerated Nervous System\"\n when 32..33\n @@flaw_mutations << \"Dizziness\"\n when 34..35\n @@flaw_mutations << \"Early Menopause (females only)\"\n when 36..37\n @@flaw_mutations << \"Excessive Lung Fluid\"\n when 38..39\n @@flaw_mutations << \"Exhaustion\"\n when 40..41\n @@flaw_mutations << \"Extensive Warts\"\n when 42..43\n @@flaw_mutations << \"Extreme Halitosis\"\n when 44..45\n @@flaw_mutations << \"Faulty Immune System\"\n when 46\n @@flaw_mutations << \"Flammable Tissues\"\n when 47\n @@flaw_mutations << \"Hemophilia\"\n when 48..49\n @@flaw_mutations << \"Hormone Disorder\"\n when 50..51\n @@flaw_mutations << \"Inadequate Nerve Endings\"\n when 52\n @@flaw_mutations << \"Increased Aging\"\n when 53\n @@flaw_mutations << \"Increased Flatulence\"\n when 54..57\n @@flaw_mutations << \"Intense Allergy\"\n when 58..59\n @@flaw_mutations << \"Male Menopause (males only)\"\n when 60..61\n @@flaw_mutations << \"Migraine Headaches\"\n when 62..63\n @@flaw_mutations << \"Osteoporosis\"\n when 64..65\n @@flaw_mutations << \"Permanent Rhinitis\"\n when 66..67\n @@flaw_mutations << \"Perpetual Hiccups\"\n when 68..69\n @@flaw_mutations << \"Pre-Senile Dementia\"\n when 70..71\n @@flaw_mutations << \"Psoriasis\"\n when 72..73\n @@flaw_mutations << \"Reactionary Scent\"\n when 74\n @@flaw_mutations << \"Repeat Paralysis\"\n when 75\n @@flaw_mutations << \"Sonic Intolerance\"\n when 76..77\n @@flaw_mutations << \"Sterility\"\n when 78..79\n @@flaw_mutations << \"Tapeworms\"\n when 80..81\n @@flaw_mutations << \"Tooth Decay\"\n when 82..86\n @@flaw_mutations << \"Toxic Susceptibility\"\n when 87..88\n @@flaw_mutations << \"Tranquilizer Agent\"\n when 89..94\n @@flaw_mutations << \"Visual Disorder\"\n when 95..96\n @@flaw_mutations << \"Voice Disorder\"\n when 97..98\n @@flaw_mutations << \"Weeping\"\n when 99..00\n @@flaw_mutations << \"Whistle Croup\"\n end\n end", "def letter_swap(agent_name)\n vowels = \"aeiou\"\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n letter_swap = agent_name.split(\"\")\n secret_name = []\n letter_swap.map! do |ltr|\n if vowels.include?(ltr)\n secret_name << vowels[vowels.index(ltr)+1]\n elsif consonants.include?(ltr)\n secret_name << consonants [consonants.index(ltr)+1]\n else\n puts \" \"\n end\n end\n\n secret_name.join(\"\").split.map {|ltr| ltr.capitalize}.join(' ').capitalize\n\nend", "def hide_all_sins(string)\n sins_array = string.scan(/\\b\\d{3}-\\d{3}-\\d{3}\\b/)\n if (sins_array.nil? || sins_array.length == 0)\n sins_array = string\n return sins_array\n end\n sins_array.each do |obf_sin|\n obf_sin.gsub!(/\\b\\d{3}-\\d{3}\\b/, \"XXX-XXX\")\n end\n return sins_array.join(\", \")\nend", "def summon_captain_planet(arr)\n arr.map {|word| word.capitalize + \"!\"}\nend", "def abbreviate_sentence(sent)\n # Write your code here\n empty_array = []\n sent.chars.each do |element|\n if element.length > 4\n element.each do |letters|\n letters.gsub(/[aeiou]/i, \" \" )\n letters << empty_array\n end\n end\n end\n p empty_array.join(\"\")\nend", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end" ]
[ "0.5957531", "0.57288206", "0.5694276", "0.5670013", "0.5528298", "0.54866487", "0.5469473", "0.54055536", "0.54025483", "0.5397446", "0.53881043", "0.537353", "0.5345706", "0.53359437", "0.5328988", "0.53200656", "0.5292794", "0.5286432", "0.52838755", "0.52832794", "0.52823657", "0.5259702", "0.52310747", "0.52288395", "0.52249295", "0.5221163", "0.5217815", "0.52104896", "0.52082837", "0.5204421", "0.5196635", "0.51876295", "0.5164449", "0.51602685", "0.5150087", "0.51495236", "0.5142601", "0.51164645", "0.51126", "0.51126", "0.51126", "0.5102758", "0.51025563", "0.5102275", "0.51019126", "0.5100874", "0.5099888", "0.509668", "0.5095407", "0.5090272", "0.508553", "0.50753564", "0.5065462", "0.50605845", "0.50598633", "0.50565827", "0.50473195", "0.50445336", "0.5036653", "0.50355935", "0.5034441", "0.50320077", "0.50308186", "0.502429", "0.5020138", "0.50181615", "0.5013851", "0.5011571", "0.5010235", "0.5005192", "0.5005005", "0.50049394", "0.5004868", "0.50004345", "0.4997722", "0.4994563", "0.49919125", "0.49912527", "0.49838582", "0.49793243", "0.49792358", "0.49762228", "0.4973308", "0.49708292", "0.49694014", "0.49667457", "0.49639875", "0.4962761", "0.49606583", "0.49606454", "0.49603432", "0.4957295", "0.49572802", "0.4955181", "0.49509472", "0.49485043", "0.49471796", "0.4946662", "0.4944298", "0.49442598" ]
0.5669547
4
called after we enter income (we know benefits == no)
def rate_type if state_benefits? if @number_of_shared_care_nights > 0 :nil else :flat end else # work out the rate based on income @calculator_data[:rates].find { |r| capped_income <= r[:max] }[:rate] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonprofit\n end", "def income_not_pending\n return if @income.pending?\n\n flash[:danger] = t \"income.noti.no_edit\"\n return redirect_to admin_incomes_path if current_user.admin?\n\n redirect_to manager_incomes_path\n end", "def pay_interest!(entity)\n owed = interest_owed(entity)\n # This is here so that the log message does not get duplicated.\n if corp_has_new_zealand?(entity) && entity.loans.size.positive?\n @log << \"#{entity.name}'s token in Nieuw Zeeland covers one loan's worth of interest\"\n end\n return super unless owed.negative?\n\n # Negative interest -> corporation has New Zealand\n @log << \"#{entity.name} gets $20 for having a token in Nieuw Zeeland and no loans\"\n entity.spend(owed, bank, check_cash: false, check_positive: false)\n nil\n end", "def is_benefit_out_of_bal\n @cur_pkg = self.get_latest_effective_package\n #@cur_pkg = self.current_package\n if @cur_pkg != nil\n #if false && @cur_pkg\n @bene_bal = ( self.monthly_benefit.to_f -\n ( self.current_package.calc_hourly_benefit.to_f * self.calc_tot_hours.to_f )\n )\n\n else\n @bene_bal = 0.0000\n end\n if @bene_bal > 0.0005 || @bene_bal < -0.0005\n true\n else\n false\n end\n end", "def out_of_money()\n @total_money <= 0\n end", "def profit\n \tself.bid - self.payout\n end", "def check_for_buyout\n if self.is_bought_out\n if self.bought_out_by_team_id\n self.subcontracts.future_years.each do |sub|\n sub.salary_amount *= 0.6\n sub.this_is_a_buyout = true\n sub.save!\n\n # update GM's annual actions to not allow more buyouts\n actions = AnnualGmAction.find_by_team_id_and_year(self.bought_out_by_team_id, current_year)\n actions.has_bought_out = true\n actions.bought_out_player_id = self.player.id\n actions.save!\n end\n end\n end\n end", "def lose_with_insurance\n self.chips += 2 * self.bet_chips\n self.is_complete = true\n \"Dealer hit Blackjack. A lose for #{name}\n #{name} bought an insurance. Pay 2 times of insurance.\"\n end", "def fully_paid?\n amount_owed <= 0\n end", "def after_redeem() end", "def withdraw(amount, atm, pin, acc_no)\n if @balance >= amount && atm.balance >= amount && @pin == pin && acc_no == @account_no\n atm.dispense(amount)\n @balance = @balance - amount\n puts \"your new balance is #{@balance}\"\n else\n puts \"you are too pov\"\n end\n end", "def investment\n if buy_price\n num_of_shares * buy_price\n end\n end", "def offenses_to_check; end", "def not_paid_at_all\n\t\tget_cart_pending_balance == get_cart_price\n\tend", "def extra_cash(db, user_name)\r\n\t# determine extra monies (conditional on + amount)\r\n\tdifference = (current_income(db, user_name) - current_expenses(db, user_name))\r\n\tcache_bonus = difference if difference > 0 || 0\r\nend", "def dispense(amount)\n @balance = @balance - amount\n puts \"hey I gave you #{amount}\"\n end", "def bought?\n # paym\n end", "def withdraw(debit, fee = FEE)\n super(debit, fee)\n if @balance - debit < INITIAL_MIN_BALANCE # @balance 10, 000 - 100 <\n puts \"WARNING!\"\n @balance -= debit - fee\n return @balance\n # need to keep closed until brought back up\n elsif @balance < INITIAL_MIN_BALANCE\n puts \"Pay FEE plus balance\"\n return @balance\n else @balance - debit > INITIAL_MIN_BALANCE\n return @balance\n end\n end", "def prep_for_save\n # what about when doing the set deposited flag ????\n # if @allow_edit\n # @employee_benefit[\"deposit\"] = round_money(@employee_benefit[\"monthly_benefit\"] - tot_current_benefit)\n # end\n # Deposit to make calculation\n self.deposit =\n self.monthly_benefit.to_f - # Required Total Benefit\n self.tot_current_benefit.to_f - # Current Benefit without DBP (Employee Hourly Benefit (rate) * Total Hours (of Benefit record)\n self.tot_deposits_made.to_f # Previous Deposits (sum of all Employee Benefits for this month that have already been deposited)\n if self && !self.reg_hours\n self.reg_hours = 0.0\n end\n if self && !self.ot_hours\n self.ot_hours = 0.0\n end\n end", "def set_prepaid\n credit = 0\n postpaid = 0\n end", "def offenses; end", "def offenses; end", "def offenses; end", "def after_accepted\n # repute points\n self.repute_accept\n \n # cash rewards\n if self.kase && self.kase.offers_reward?\n self.kase.rewards.active.each do |reward|\n reward.cash!\n end\n end\n end", "def still_needed\r\n\t@target_fund - @fund\r\nend", "def gain_interest\n @balance *= (1 + @interest_rate)\n end", "def bar_accepts_fee(fee)\n @bar_cash += fee\n end", "def awaiting_disbursement?\n financial_aid_approved? && !disbursed?\n end", "def present_value\n # Payoff amount = 0, we’re assuming a fully amortizing loan\n payoff_amount = 0\n end", "def apply_discount\n if @discount\n discount = @total * @discount / 100 \n @total = @total - discount\n return \"After the discount, the total comes to $#{@total}.\"\n else # cash register wasn't initiailzied w/ discount\n return \"There is no discount to apply.\"\n end\n end", "def exempted(item_name, price_of_item)\n\t\t@output.no_tax(item_name, price_of_item)\n\t\tadd_item\n\tend", "def apply_discount\n if discount !=0\n self.total = total- (total*(discount/100.to_f)).to_i\n \"After the discount, the total comes to $#{self.total}.\"\n else\n \"There is no discount to apply.\"\n end\n end", "def must_not_be_overdue\n\t\tif self.profile.state == 'Overdue'\n\t\t\terrors.add(:base, \"This person has unpaid charges.\")\n\t\tend\n\tend", "def apply_discount\nif @discount != nil \n @total -= (@total*@discount/100)\n \"After the discount, the total comes to $#{@total}.\"\nelse\n \"There is no discount to apply.\"\nend\nend", "def pick_out(amnt)\n if amount - amnt > CONST::PRODUCT_IN_STOCK && on_sell?\n update(amount: amount - amnt)\n else\n errors.add(\n :base,\n Response::PRODUCT[:PRODUCT_IN_STOCK]\n ); false\n end\n end", "def pre_pay_offered\n end", "def owes_amount\n loans=@loans\n net_worth=@net_worth\n @balance = net_worth-loans\n print \"the balance is : \",balance,\"\\n\"\n is_developer_solvent?\n end", "def set_beneficiary\n @beneficiary = current_user.beneficiary\n end", "def balance_owed\n discounted_price - amount_paid\n end", "def withd amount\n unless amount > @savings_account_balance\n @savings_account_balance -= amount\n \n else\n end\n end", "def entrance_decision_enter_cave_money\n\n puts \"************************************************************\"\n puts \"Bandit: Ha! You sad poor bum! well if you really want to do get into this cave then I need you to do me a favor. interested?\"\n puts \"type yes, no, or what kind of favor?\"\n while user_input = gets.chomp.downcase.rstrip.lstrip # loop while getting user input\n case user_input\n when \"what kind of favor?\"\n puts \"Bandit: Don't worry about it! now are you in or are you out?\"\n puts \"type yes or no\"\n when \"yes\"\n bandit_favor\n break\n when \"no\"\n puts \"Bandit: Get the hell out of here before I get pissed.\"\n run_away_story\n break\n else\n puts \"Please type yes, no, or what kind of favor? only!\"\n # print the prompt, so the user knows to re-enter input\n end\n end\n end", "def buy(amount)\n @bought_amount += amount if amount_remaining >= amount\n end", "def apply_discount\n if @discount == 0\n \"There is no discount to apply.\"\n else\n @discounted_price = (self.total * @discount * 0.01)\n @total -= @discounted_price\n \"After the discount, the total comes to $#{@total.to_i}.\"\n end\n end", "def has_paid (driver, person, amount)\n # debt - amount\n end", "def income_list\n end", "def sell_confirmed\n end", "def money_approved?\n true\n end", "def apply_discount\n if discount != 0\n self.total = (total * ((100.0 - discount.to_f)/100)).to_i\n \"After the discount, the total comes to $#{self.total}.\"\n else\n \"There is no discount to apply.\"\n end\n end", "def check_out\n @cart.each_with_index do |item, i|\n puts \"#{i + 1}) #{item[:name]} - $#{item[:price]}\"\n end\n def tally_up\n @total = @cart.inject(0) {|sum, hash| sum + hash[:price]}\n @totalWithTax = @total * @sales_tax\n puts \"You owe us #{@totalWithTax}!\"\n sleep(2)\n end\n def payment\n if TotalWithTax >= @card_balance\n puts \"Your transaction has been declined\"\n remove_items\n else\n puts \"Thank you for shopping at The Grocery Store\"\n exit\n end\n end\n tally_up\n payment\nend", "def profit\n total_before_tax - total_cost\n end", "def profit\n total_before_tax - total_cost\n end", "def profit_calculation\r\n @total_profit = @cocktail_profit + @beer_profit + @water_profit\r\n end", "def sell_in?\n sell_in > 0\n end", "def money_enough?\n remaining_sum > 0\n end", "def withdraw ( person, amount )\r\n\t\tif @bank_listing[person.id_number][:balance] >= amount\r\n\t\t\t@bank_listing[person.id_number][:balance]-=amount\r\n\t\t\tputs \"#{@bank_name}: Thanks #{person.name}, here's your $#{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry #{person.name}, insufficient funds.\"\r\n\t\tend\r\n\tend", "def can_be_unconfirmed? \n # the reverse adjustment will always increase ready item \n \n return true \n end", "def apply_discount\n\t\t@total -= @discount\n\t\tputs \"Total price expected: £ #{@total.round(3)}\"\n\tend", "def test_for_cheap\r\n if @agent_bargain_limit\r\n @ischeap = true if @price < @agent_bargain_limit\r\n else\r\n @ischeap = true if @price < @cheap\r\n end\r\n end", "def apply_discount\n if self.discount > 0\n self.total = @total - @total * @discount / 100\n return \"After the discount, the total comes to $#{@total}.\"\n else\n return \"There is no discount to apply.\"\n end\n end", "def apply_discount\n if discount > 0 \n @total = @total * 0.8\n \"After the discount, the total comes to $#{@total.to_i}.\"\n else\n \"There is no discount to apply.\"\n end\n end", "def gain_interest\n interest_amount = (@balance * @interest_rate) / 100\n @balance = interest_amount + @balance\n end", "def tot_current_benefit\n if self != nil && self.current_package != nil && self.current_package.calc_hourly_benefit != nil\n (self.calc_tot_hours * self.current_package.calc_hourly_benefit * 100.0).round / 100.0\n else\n 0.00\n end\n # check ?\n # ( @employee_benefit[\"deposit\"] -\n # ( @employee_benefit[\"monthly_benefit\"] - @employee_benefit[\"tot_deposits_made\"] )\n # ) > 0.005\n end", "def can_buy_depot_train?(entity)\n entity.cash >= @depot.upcoming.first.price\n end", "def deposit ( person, amount )\r\n\t\tif person.worth >= amount\r\n\t\t@bank_listing[person.id_number][:balance]+=amount\r\n\t\tputs \"#{@bank_name}: Thanks #{person.name}, you deposited #{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry, you don't have enough on hand.\"\r\n\t\tend\r\n\tend", "def amount_charged\n\t\t@amount = 6000\n\tend", "def fulfilled?\n user.donations.active.count >= quantity\n end", "def sell_pending\n end", "def daily_claim()\n if not @daily\n @daily = true\n @credits = @credits + 250\n val = \"Daily claimed!\"\n else\n val = \"You already claimed your daily!\"\n end\n val\n end", "def overdraft_fee\n @balance -= 30 \n end", "def increase_insurance_premium\n self.insurance_premium += 100\n end", "def set_expense_is_billable\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @previous_final_billed_amount = @tne_invoice_expense_entry.final_expense_amount\n if @tne_invoice_expense_entry.billing_method_type.to_i == 1\n @tne_invoice_expense_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal], :billing_percent => ''})\n else\n @tne_invoice_expense_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal]})\n end\n\n if data[:is_internal].to_s.eql?(\"true\")\n @tne_invoice_expense_entry.update_attributes({:contact_id => '', :matter_id => ''})\n end\n @billed_amount = @tne_invoice_expense_entry.calculate_final_expense_amount\n# flash[:error]= t(:flash_enter_valid_expense_amt)\n end", "def hungry?\r\n @food <= 2\r\n end", "def increase_insurance_premium\n self.insurance_premium += 100\n end", "def can_afford_insurance\n return 1 if (@bet / 2) <= @bankroll\n return nil\n end", "def paid_amount_sufficient?(product, coins_hash)\n expected_price = @products.select { |p| p.name == product.capitalize }.map(&:price)[0]\n change_due = coins_hash[:valid][:total_value] - expected_price\n if change_due > 0\n accept_coins(coins_hash)\n dispense_change(change_due, product)\n elsif change_due.zero?\n accept_coins(coins_hash)\n dispense_product(product)\n else\n return -change_due\n end\n end", "def feeling\n if (@mealCount == 1)\n @mealCount = 0\n return \"Good!\"\n else\n return \"Sad...\"\n end\n end", "def amount_earned\n completed? ? potential_incentive : 0\n end", "def attemp_buying\n\n end", "def estimate(down_payment, annual_income, options={})\n down_payment = down_payment.gsub(',', '').strip\n annual_income = annual_income.gsub(',', '').strip\n hash = self.calculate_affordability(down_payment, 0, annualincome: annual_income)\n return unless hash && hash['affordabilityAmount']\n rounded = hash['affordabilityAmount'].to_i.round(-4) # round to nearist 10k\n rounded < 10000 ? 10000 : rounded\n end", "def paid_in_full?\n !payment_outstanding?\n end", "def paid_up?\n if payment_item.is_a? GeneralPaymentItem\n outstanding_amount <= 0.0\n else\n nil\n end\n end", "def withdraw(exit_date, estimated_return_date, pickup_company, pickup_company_contact, additional_comments, quantity_to_withdraw, folio = '-')\n return status if cannot_withdraw?\n\n if quantity_to_withdraw != '' && quantity_to_withdraw < quantity.to_i\n self.quantity = quantity.to_i - quantity_to_withdraw\n quantity_withdrawn = quantity_to_withdraw\n else\n self.status = InventoryItem::OUT_OF_STOCK\n quantity_withdrawn = quantity\n self.quantity = 0\n end\n\n save\n\n # Withdraw from WarehouseLocations\n withdraw_from_locations(quantity_withdrawn) if warehouse_locations?\n\n CheckOutTransaction.create(\n inventory_item_id: id,\n concept: 'Salida granel',\n additional_comments: additional_comments,\n exit_date: exit_date,\n estimated_return_date: estimated_return_date,\n pickup_company: pickup_company,\n pickup_company_contact: pickup_company_contact,\n quantity: quantity_withdrawn,\n folio: folio\n )\n true\n end", "def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end", "def apply_discount\n # checks if there is any discount\n if discount == 0\n \"There is no discount to apply.\"\n else\n #applies discount\n @total = @total * (1-@discount/100.0)\n # converts back to integer\n @total = @total.to_i\n \"After the discount, the total comes to $#{@total}.\"\n end\n end", "def check_paid\n self.paid_amount = 0\n self.paid = false\n payments.each do |payment|\n self.paid_amount += payment.amount\n end\n \n if self.paid_amount - self.gross_amount >= 0\n self.paid = true\n end\n end", "def apply_discount\n if self.discount == 0\n return \"There is no discount to apply.\"\n else self.total *= (1 - (self.discount.to_f / 100))\n return \"After the discount, the total comes to $#{self.total.to_i}.\"\n end\n end", "def disbursement_remaining_factor\n approved_amount == 0 ? 0 : 1 - (disbursed_amount / approved_amount.to_f)\n end", "def item_effect_no_recovery(item)\r\n # If HP recovery rate and recovery amount are 0\r\n if item.recover_hp_rate == 0 and item.recover_hp == 0\r\n # Set damage to empty string\r\n self.damage = ''\r\n # If SP recovery rate / recovery amount are 0, and parameter increase\r\n # value is ineffective.\r\n if item.recover_sp_rate == 0 and item.recover_sp == 0 and\r\n (item.parameter_type == 0 or item.parameter_points == 0)\r\n # If state is unchanged\r\n unless @state_changed\r\n # Set damage to \"Miss\"\r\n self.damage = 'Miss'\r\n end\r\n end\r\n end\r\n end", "def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n !bankrupt && deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend", "def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend", "def calculate_change\n\t\t## by this point in time the cart has already been set, and prepared, so we know the total pending amount. \n\t\tif self.amount > self.cart.cart_pending_balance\n\t\t\tself.cash_change = self.amount - self.cart.cart_pending_balance\n\t\telse\n\t\t\tself.cash_change = 0\n\t\tend\n\tend", "def purchasing?\n auction.buy_it_now_price == amount\n end", "def donate_blood \n self.status = STATUS_DONATING_BLOOD\n self.health -= 1\n self.balance += select_blood_machine\n self.save\n end", "def offenses=(_); end", "def savings_portion_needed\n adjusted_target_income - (self.social_security + self.pensions + self.other_income)\n end", "def gain(money)\n\t\tself.bank_amount += money\n\t\tself.save\n\tend", "def fixed_price?\n !auction?\n end", "def is_discounted?\n price < 1000 # actually doing self.price\n end", "def deal_with_payment\n if human_amount_due <= 0\n update_attributes!(active: false)\n lease.mark_next_active_from_date(self.due_date)\n else\n true\n end\n end", "def apply_discount\n # if @discount != 20\n discount_percent = ((100.0 - @discount.to_f) / 100.0)\n @total *= discount_percent\n return \"After the discount, the total comes to $#{@total.to_i}.\"\n # else\n # return \"There is no discount to apply.\"\n # end\n end", "def buy_discount\n @buy_discount || rpg_shop.buy_discount\n end" ]
[ "0.6203122", "0.61615586", "0.5987316", "0.59773004", "0.5957404", "0.5946024", "0.592978", "0.58939916", "0.5890423", "0.58793324", "0.58602214", "0.5858547", "0.5848111", "0.5846483", "0.58438784", "0.5832177", "0.5824982", "0.5783358", "0.5755007", "0.57528013", "0.57527", "0.57527", "0.57527", "0.5736482", "0.5736228", "0.5717933", "0.57142663", "0.57116956", "0.5708121", "0.56911397", "0.5680027", "0.5678783", "0.5671284", "0.56679696", "0.566336", "0.56633484", "0.5662657", "0.5638178", "0.5634851", "0.5630476", "0.5629191", "0.56285036", "0.5626255", "0.5623142", "0.5616896", "0.5609198", "0.5595984", "0.5578857", "0.5573554", "0.5571446", "0.5571446", "0.5561606", "0.5556184", "0.55545306", "0.5550158", "0.55488783", "0.5543667", "0.5540498", "0.55341184", "0.55331826", "0.55303955", "0.55219126", "0.55170435", "0.5516601", "0.5507197", "0.55061007", "0.5503598", "0.5502454", "0.5497914", "0.54965854", "0.54847014", "0.5481802", "0.54773635", "0.54735357", "0.5473144", "0.54641885", "0.5459128", "0.5457353", "0.54548645", "0.5453583", "0.5445216", "0.5438426", "0.54365665", "0.5436156", "0.54271334", "0.54226726", "0.54204667", "0.5417552", "0.54150414", "0.5413136", "0.5411873", "0.5405886", "0.54038465", "0.5398086", "0.53958535", "0.5395335", "0.5384986", "0.5383903", "0.5383759", "0.53832257", "0.5380066" ]
0.0
-1
only used in the 2012 scheme
def calculate_basic_plus_rate_payment basic_plus_rate = capped_income - (capped_income * relevant_other_child_multiplier) basic_qualifying_child_amount = (BASIC_PLUS_RATE_THRESHOLD * basic_rate_multiplier) additional_qualifying_child_amount = ((basic_plus_rate - BASIC_PLUS_RATE_THRESHOLD) * basic_plus_rate_multiplier) child_amounts_total = basic_qualifying_child_amount + additional_qualifying_child_amount total = (child_amounts_total - (child_amounts_total * shared_care_multiplier)) if shared_care_multiplier == 0.5 total = total - (@number_of_children * SHARED_CARE_MAX_RELIEF_EXTRA_AMOUNT) end total.round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def schubert; end", "def probers; end", "def schumann; end", "def formation; end", "def stderrs; end", "def verdi; end", "def suivre; end", "def malts; end", "def intensifier; end", "def terpene; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def ismn; end", "def in_law; end", "def lsi; end", "def trd; end", "def villian; end", "def sld; end", "def jack_handey; end", "def celebration; end", "def scheme; end", "def scheme; end", "def scheme; end", "def scheme; end", "def custom; end", "def custom; end", "def berlioz; end", "def anchored; end", "def offences_by; end", "def refutal()\n end", "def tld; end", "def tld; end", "def blg; end", "def cardinal; end", "def isp; end", "def isp; end", "def strain; end", "def operations; end", "def operations; end", "def dh; end", "def transformations; end", "def internal; end", "def king_richard_iii; end", "def scheme=(_arg0); end", "def who_we_are\r\n end", "def mambo_no_5; end", "def rassoc(p0) end", "def isolated; end", "def isolated; end", "def bs; end", "def nasa_space_craft; end", "def silly_adjective; end", "def parts; end", "def parts; end", "def parts; end", "def dv; end", "def nn\n end", "def mitch_hedberg; end", "def probers=(_arg0); end", "def p15\n\t\nend", "def internship_passed; end", "def romeo_and_juliet; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def hiss; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def issn; end", "def user_os_complex\r\n end", "def iso; end", "def appraisals; end", "def appraisals; end", "def values() end", "def yyerrok; end", "def yyerrok; end", "def herald; end", "def production_curtailment; end", "def scientist; end", "def gounod; end", "def starship; end", "def loc; end", "def loc; end", "def loc; end", "def origin; end", "def origin; end", "def origin; end", "def required_positionals; end", "def upc_e_with_composite_symbology; end", "def mathtex(*)\n super\n end", "def operation; end", "def feruchemist; end", "def getc() end", "def getc() end", "def getc() end", "def same; end", "def external; end" ]
[ "0.69243294", "0.6569358", "0.6562518", "0.6445506", "0.6445372", "0.62776935", "0.62731624", "0.6181241", "0.6179366", "0.6173474", "0.6171393", "0.6153712", "0.6153712", "0.6153712", "0.6153712", "0.6081211", "0.60807437", "0.6054048", "0.60005826", "0.59885603", "0.59760594", "0.59221166", "0.59166235", "0.59165", "0.59165", "0.59165", "0.59165", "0.5915863", "0.5915863", "0.58929396", "0.5879396", "0.58506215", "0.582758", "0.58138025", "0.58138025", "0.5775198", "0.57578325", "0.5752869", "0.5752869", "0.5730834", "0.5720057", "0.5720057", "0.5704548", "0.5703218", "0.5695945", "0.5690935", "0.5677287", "0.5671187", "0.5669024", "0.5665278", "0.5608778", "0.5608778", "0.5596787", "0.5596309", "0.5590846", "0.5582985", "0.5582985", "0.5582985", "0.55755055", "0.557274", "0.5568342", "0.55669016", "0.55668867", "0.5559476", "0.5558431", "0.5557442", "0.5557442", "0.55475765", "0.55459976", "0.55459976", "0.55459976", "0.55459976", "0.55450517", "0.55439657", "0.5531788", "0.55317336", "0.55317336", "0.55313164", "0.55306923", "0.55306923", "0.55261207", "0.5523648", "0.5521284", "0.55128413", "0.5512262", "0.5505091", "0.5505091", "0.5505091", "0.5497412", "0.5497412", "0.5497412", "0.5495427", "0.5495055", "0.5482801", "0.54818285", "0.5481061", "0.54588795", "0.54588795", "0.54588795", "0.5458794", "0.5455287" ]
0.0
-1
never use more than the net (or gross) income maximum in calculations
def capped_income max_income = SCHEME_MAX_INCOME @income > max_income ? max_income : @income end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_consumption_price\n dataset_get(:max_consumption_price) || marginal_costs\n end", "def max_profit(prices)\n buy1 = Float::INFINITY\n buy2 = Float::INFINITY\n profit1 = 0\n prices.reduce(0) do |total_profit, price|\n buy1 = [buy1, price].min\n profit1 = [profit1, price - buy1].max\n buy2 = [buy2, price - profit1].min\n [total_profit, price - buy2].max\n end\nend", "def max_profit(prices)\n sum = max = 0\n (0...prices.size - 1).each do |i|\n sum = [0, sum += prices[i + 1] - prices[i]].max\n max = [max, sum].max\n end\n max\nend", "def max_buy\r\n max = $game_party.max_item_number(@item) - $game_party.item_number(@item)\r\n buying_price == 0 ? max : [max, money / buying_price].min\r\n end", "def max_profit(prices)\n calculate(prices, 0)\nend", "def max_profit(prices)\n max = 0\n min = (2**(0.size * 8 -2) -1)\n\n prices.each do |price|\n if price < min\n min = price\n else\n max = [max, price - min].max\n end\n end\n\n max\nend", "def max_stock_profit(stock_prices)\n\tlocal_min = stock_prices[0]\n\tlocal_max = stock_prices[1]\n\tmax_profit_so_far = local_max - local_min\n\n\tstock_prices[2..-1].each do |price|\n\n\t\tif local_max == nil || price > local_max\n\t\t\tlocal_max = price\n\t\t\tprofit = local_max - local_min\n\t\t\tmax_profit_so_far = profit if profit > max_profit_so_far\n\n\t\t# must 'reset' the max when the min is reset\n\t\t# I set the max to nil because you can't buy and sell\n\t\t# at the same time\n\t\telsif price < local_min\n\t\t\tlocal_min = price\n\t\t\tlocal_max = nil \n\t\tend \n\t\t# log(local_min, local_max, max_profit_so_far)\n\tend\n\t\treturn max_profit_so_far\nend", "def get_max\n @max ||= calculate_max\n end", "def max_buy\n max = $game_party.max_item_number(@item) - $game_party.item_number(@item) \n max_crafts = HudellBazaar::get_max_crafts(@item)\n max = [max, max_crafts].min\n\n buying_price == 0 ? max : [max, money / buying_price].min\n end", "def max_profit(prices)\n max_profit = 0\n min_price = prices[0]\n \n prices.each do |price|\n min_price = [min_price, price].min\n max_profit = [max_profit, price - min_price].max\n end\n \n max_profit\nend", "def max_profit(stocks)\n max = 0\n buy = stocks[0]\n\n stocks.each_with_index do |sell, index|\n # ignore the first index just because already set it above\n next if index == 0\n\n current_profit = sell - buy\n\n # if the current profit is less than 0, there is no way the\n # prices could possibly be used to generate the max profit\n # therefore start making new comparisons from this point\n # forward\n if current_profit < 0\n buy = sell\n end\n\n # evaluate the max everytime\n max = [max, current_profit].max\n end\n\n if max == 0\n return -1\n end\n\n return max\nend", "def effective_maximum\n maximum_bound ? maximum_bound.value : Infinity\n end", "def max_profit(stock_prices)\n\tmin_buying_point = stock_prices[0]\n\tmax_profit = 0;\n\n\tstock_prices.each do |price|\n\t\tmin_buying_point = [min_buying_point, price].min()\n\n\t\tcurrent_profit = price - min_buying_point \n\n\t\tmax_profit = [max_profit, current_profit].max()\n\tend\n\n\treturn max_profit\nend", "def get_max_profit(prices)\n raise IndexError(\"Must be at least 2 prices\") if prices.length < 2\n #initialize a current_max_profit and current_min\n current_min = prices[0]\n current_max_profit = prices[1] - prices[0]\n\n prices.each do |price|\n #calculate the potential profit and check if it's larger than current max profit\n potential_profit = price - current_min\n current_max_profit = [potential_profit, current_max_profit].max\n #update current_min\n current_min = [current_min, price].min\n end\n current_max_profit\nend", "def price_at_maximum\n qty = breaks.last.minimum\n qty -= 1 unless breaks.empty?\n brk = breaks.last.marginal.nil? ? breaks[-2] : breaks[-1]\n return nil unless brk\n brk.price_at(qty)\n end", "def max_profit(prices)\n sell_one, sell_two = 0, 0\n buy_one, buy_two = Float::INFINITY, Float::INFINITY\n \n prices.each do |price|\n buy_one = [buy_one, price].min\n sell_one = [sell_one, price - buy_one].max\n buy_two = [buy_two, price - sell_one].min\n sell_two = [sell_two, price - buy_two].max\n end\n sell_two\nend", "def store_credit_maximum_amount\n item_total - 0.01\n end", "def max; end", "def max; end", "def max_profit(prices)\n min_price = prices[0]\n best_profit = 0\n \n prices.each do |price|\n if price < min_price\n min_price = price\n else\n profit = price - min_price\n if profit > best_profit\n best_profit = profit\n end\n end\n end\n \n return best_profit\nend", "def max_price\n Money.new(MAX_OFFER_CENTS, self.default_currency)\n end", "def max\n if valid?\n max_value\n end\n end", "def maximum_wealth(accounts)\n accounts.map {|account| account.sum }.max\nend", "def max_profit(prices)\n min_price = prices[0]\n max_pro = 0 \n price.each do |price|\n if price <= min_price\n min_price = price\n elsif price - min_price > max_pro\n max_pro = price - min_price\n end\n end\n max_pro\nend", "def max_profit(stock_prices_per_day)\n overall_max = 0\n stock_prices_per_day.each_with_index do |current_price,i| # [7,6,4,3,1]\n while (i < stock_prices_per_day.length - 1) do\n net_result = (current_price - stock_prices_per_day[i+1]) * -1 # (7 - 6) * -1\n if net_result > overall_max\n puts \"(#{current_price} - #{stock_prices_per_day[i+1]}) * -1. net_result '#{net_result}' is greater than '#{overall_max}'\"\n overall_max = net_result\n else\n puts \"(#{current_price} - #{stock_prices_per_day[i+1]}) * -1. net_result '#{net_result}' was less than overall_max '#{overall_max}'\"\n end\n i += 1\n end\n end\n overall_max\nend", "def max_profit(prices)\n buy = nil\n profit = 0\n \n prices.each do |p|\n if buy.nil?\n buy = p\n elsif p < buy\n buy = p\n else\n profit = p - buy if p - buy > profit\n end\n end\n profit\nend", "def calculate_max_mortgage(params, interest_rate)\n number_of_payments = SCHEDULE_MAP[params['payment_schedule']] * params['amortization_period']\n nominal_interest_rate = (interest_rate / SCHEDULE_MAP[params['payment_schedule']]) / 100\n\n numerator = params['payment_amount'] * ((1 + nominal_interest_rate)**number_of_payments - 1)\n denominator = nominal_interest_rate * (1 + nominal_interest_rate)**number_of_payments\n\n max_mortgage = (numerator / denominator).round(2)\n max_mortgage += params['down_payment'] if params['down_payment'].present?\n max_mortgage\n end", "def max_profit2(prices)\n max_profit, min_price = 0, +1.0/0.0\n profits_array = [0]*prices.length\n prices.each_with_index do |price,i|\n min_price = [price, min_price].min\n max_profit = [max_profit, price-min_price].max\n profits_array[i] = max_profit\n end\n max_profit, max_price = 0, -1.0/0.0\n reverse_max_profit = [0]*prices.length\n prices.reverse.each_with_index do |price,i|\n max_price = [price,max_price].max\n max_profit = [max_profit, max_price-price].max\n reverse_max_profit[prices.length-i-1] = max_profit\n end\n counter = 0\n max_profit = -1.0/0.0\n profits_array.each_with_index do |el,idx|\n max_profit = [max_profit,el+reverse_max_profit[idx]].max\n end\n max_profit\nend", "def max_money(aid_amount, with_amount, rebel_rate, rebel_limit)\n max_with_amount = 0 \n while rebel_rate < rebel_limit && aid_amount > 0 \n aid_amount -= with_amount\n rebel_rate = rebel_rate * 2 \n max_with_amount += with_amount\n end\n max_with_amount\nend", "def maximum_profit(prices)\n max_profit = 0\n (2..prices.length - 2).to_a.each do |idx|\n first_transaction = max_difference(prices.slice(0, idx))\n second_transaction = max_difference(prices.slice(idx, prices.length))\n profit = first_transaction + second_transaction\n max_profit = profit if profit > max_profit\n end\n max_profit\nend", "def max_profit(prices)\n max_profit = 0\n min_price = 1_000_000\n\n 0.upto(prices.length - 1) do |i|\n if prices[i] < min_price\n min_price = prices[i]\n elsif prices[i] - min_price > max_profit\n max_profit = prices[i] - min_price\n end\n end\n\n max_profit\nend", "def max_profit(prices)\n # Test for boundary conditions\n return 0 if prices.length <= 1\n profit = 0\n for i in 1..(prices.length-1) do\n if prices[i] > prices[i-1]\n profit = profit + (prices[i] - prices[i-1])\n end\n end\n return profit\nend", "def max\n MSPhysics::Newton::Hinge.get_max(@address)\n end", "def total_max_cost_ex_discount_and_vat_cents\n amount = self.quote_activities.sum(:max_amount_cents)\n amount += self.extra_cost_cents if self.extra_cost_cents.present?\n amount\n end", "def max_profit(prices)\n\treturn 0 if prices.nil? || prices.length < 2\n\t\n\tmin_price = prices[0]\n\tmax_profit = 0\n\t\n\tfor i in 1..prices.length - 1\n\t\tmax_profit = [prices[i] - min_price , max_profit].max\n\t\tmin_price = [prices[i], min_price].min\n\tend\n\treturn max_profit\nend", "def item_max() @item_max end", "def get_max()\n end", "def find_max()\r\n self.max\r\n end", "def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end", "def max_limits(sum)\n hash = default_hash\n hash.each do |k, _v|\n hash[k] = sum / k < @money[k] ? sum / k : @money[k]\n end\n hash\n end", "def biggest_investment()\n funding_rounds = self.funding_rounds.select {|funding| funding.amount}\n amount = 0\n\n funding_rounds.select do |funding|\n\n if funding.amount >= amount\n amount = funding.amount\n funding\n end\n \n end\n end", "def get_max_profit_3(array)\n\n min_price = array[0] #sets the minimum price starting at index 0\n max_price = 0\n\n max_profit = 0 #sets current max_profit to 0\n min_loss = 0\n\n\n array.each do |current_price| #simple iteration\n\n # ensure min_price is the lowest price we've seen so far\n min_price = [min_price, current_price].min\n max_price = [min_price, current_price].max\n\n # see what our profit would be if we bought at the\n # min price and sold at the current price\n potential_profit = current_price - min_price\n potential_loss = current_price - max_price\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n min_loss = [min_loss, potential_loss].min\n\n print \"current-price: #{current_price}\\n\"\n print \"min_price: #{min_price}\\n\"\n print \"max_price: #{max_price}\\n\"\n print \"-----------------------------\\n\"\n print \"potential_profit: #{potential_profit}\\n\"\n print \"potential_loss: #{potential_loss}\\n\"\n print \"-----------------------------\\n\"\n print \"max_profit: #{max_profit}\\n\"\n print \"min_loss: #{min_loss}\\n\"\n print \"\\n\"\n end\n\n return max_profit\nend", "def max_profit(arr)\n min = arr.first\n diff = 0\n\n arr.each do |element|\n diff = [element - min, diff].max\n min = [element, min].min\n end\n\n diff\n end", "def biggest_investment\n funding_rounds.max_by {|funding_round| funding_round.investment}\n end", "def max\n end", "def max\n end", "def highest_price\n # CARYN SAYS:the way you describe this above is incorrect! Reread the README\n # It should be the integer price for the most expensive listing of this recipe \n Recipe.all.max { |recipe_a, recipe_b| recipe_a.average_price <=> recipe_b.average_price }\n end", "def get_max_profit(stock_prices)\n return 0 if stock_prices.length < 2\n \n min_stock = stock_prices[0]\n max_profit = stock_prices[1] - stock_prices[0]\n puts \"\\n#{min_stock}\"\n puts \"#{max_profit}\"\n stock_prices[1...stock_prices.length].each do |price|\n min_stock = [min_stock, price].min \n puts \"\\n#{min_stock}\"\n pot_max_profit = price - min_stock\n puts \"#{max_profit}\"\n max_profit = [max_profit, pot_max_profit].max\n puts \"#{max_profit}\"\n end\n \n max_profit\nend", "def get_max_profit_v3(yesterday_stock_prices)\n\n min_price = yesterday_stock_prices[0]\n max_profit = 0\n\n # go through every price on the list\n yesterday_stock_prices.each do |current_price|\n\n # ensure min price is lowest price we've seen so far\n min_price = [min_price, current_price].min\n\n # see what our profit woudl be if we bought at the\n # min price and sold at the current price\n potential_profit = current_price - min_price\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n\n end\n\n max_profit\n\n end", "def get_max\n @max\n end", "def max_profit_brute(num)\n max_profit = 0\n for i in (0...num.length-1)\n for j in (i+1...num.length)\n profit = num[j] - num[i]\n max_profit = profit if profit > max_profit\n end\n end\n max_profit\nend", "def find_max_value(array)\n \n (find_max_value(scale)).to eq(5)\n (find_max_value(scale_2)).to eq(6)\n (find_max_value(hill)).to eq(5)\n (find_max_value(valley)).to eq(5)\n (find_max_value(zig_zag)).to eq(1000)\n end", "def official_answer(input)\n min_price = input[0]\n max_profit = 0\n\n input.each do |current_price|\n min_price = [min_price, current_price].min\n potential_profit = current_price - min_price\n max_profit = [max_profit, potential_profit].max\n end\n max_profit\nend", "def max_amount(array_of_coins)\n case array_of_coins.length\n when 0 then 0\n when 1 then array_of_coins.first\n when 2 then [array_of_coins.first, array_of_coins.last].max\n else\n [\n array_of_coins.last + max_amount(array_of_coins[0..-3]),\n max_amount(array_of_coins[0..-2])\n ].max\n end\nend", "def maximum\n\t\tif course.users.length > 2 and worth > 0\n\t\t\treturn (grades.maximum(:grade).to_f / worth) * 100\n\t\tend\n\tend", "def total_max_cost_incl_discount_and_vat_cents\n total = self.total_max_cost_ex_discount_and_vat_cents\n # Apply discount\n total = total - self.calculate_discount_for(total)\n # Apply VAT\n total = total + self.calculate_tax_for(total)\n \n total.to_i\n end", "def max_profit(num)\n min_val = (2 ** ((0.size * 8) - 1) - 1) # max signed int value\n max_profit = 0\n for i in (0...num.length)\n if num[i] < min_val\n min_val = num[i]\n end\n if max_profit < num[i] - min_val\n max_profit = num[i] - min_val\n end\n end\n max_profit\nend", "def biggest_investment\n self.funding_rounds.max_by {|funding| funding.investment }\n end", "def best_profit( array )\n\n max = 0\n min = nil\n \n array.each do | current |\n min = current if min.nil? || current < min\n max = current - min if ( current - min > max)\n\n puts \"min is #{ min }\"\n end\n\n max\nend", "def gut_max\n Bubs::Guts::GUTS_MAX.to_f\n end", "def max_discount_amount\n\t\tamount = self.original_price - self.original_price * 0.3\n\t\treturn amount\n\tend", "def on_2(prices)\n max_profit = 0\n min_valley = prices.max\n\n prices.each do |number|\n if number < min_valley\n min_valley = number\n elsif number - min_valley > max_profit\n max_profit = number - min_valley\n end\n end\n\n max_profit\n end", "def store_credit_maximum_amount\n item_total\n end", "def max_profit(prices)\n len = prices.length\n dp = Array.new(3) { Array.new(2) }\n dp[0][0] = -prices[0]\n dp[1][0] = 0\n dp[2][0] = 0\n for i in 1...len\n dp[0][i%2] = [dp[0][(i-1)%2], dp[2][(i-1)%2]-prices[i]].max\n dp[1][i%2] = [dp[1][(i-1)%2], prices[i] + dp[0][(i-1)%2]].max\n dp[2][i%2] = [dp[2][(i-1)%2], dp[1][(i-1)%2]].max\n end\n [dp[0][(len-1)%2],dp[1][(len-1)%2],dp[2][(len-1)%2]].max\nend", "def solution(a)\n return 0 if a.count <= 1\n \n max_profit = 0\n min_price = a.first\n a[1..-1].each { |price|\n max_profit = [max_profit, price - min_price].max\n min_price = [min_price, price].min\n }\n max_profit\nend", "def calc_max_doller_value(\n bitcoin:,\n conversion_rate:,\n units:,\n max_value:\n )\n conversion_rate.each_with_index do |value, index|\n if bitcoin * value * units[index] > max_value\n max_value = bitcoin * value * units[index]\n end\n end\n max_value\nend", "def max_profit(prices)\n total = 0\n (0...prices.size - 1).each do |i|\n total += prices[i + 1] - prices[i] if prices[i + 1] > prices[i]\n end\n total\nend", "def on2(prices)\n max_profit = 0\n\n prices.each_with_index do |number, index|\n prices.each_with_index do |another_number, another_index|\n next if index >= another_index\n\n max_profit = [another_number - number, max_profit].max\n end\n end\n\n max_profit\n end", "def getSpecialValue\n maxBonus\n end", "def get_max_over(stat)\n max = 0\n $data_enemies.each { |enemy|\n next if enemy.nil?\n next if enemy.hidden_best\n next unless $game_party.known_enemy?(enemy.id)\n value = enemy.get_stat(stat)\n max = value if value > max\n }\n max\n end", "def max_price\n @set[\"PriceSet\"][\"maxPrice\"]\n end", "def max_profit(stock_prices_yesterday)\n max_diff = stock_prices_yesterday[1] - stock_prices_yesterday[0]\n stock_prices_yesterday[2..-1].each_with_index do |price, index|\n index += 1\n diff = stock_prices_yesterday[0..(index - 1)].map { |x| price - x }.max\n max_diff = diff if diff > max_diff\n end\n max_diff\nend", "def enough_money?(maxAmount)\r\n self.price<=maxAmount\r\n end", "def get_max_profit(stocks)\n min_price = stocks[0]\n biggest_diff = stocks[1] - min_price\n\n # keep track of biggest difference, and smallest price\n stocks.each_with_index do |stock, i|\n next if i == 0 # skip first\n curr_diff = stock - min_price\n biggest_diff = curr_diff if curr_diff > biggest_diff\n\n min_price = stock if stock < min_price\n end\n\n biggest_diff\nend", "def max_profit(prices)\n return 0 if prices.empty?\n total_profit = 0\n idx = 1\n while idx < prices.length\n total_profit += (prices[idx] - prices[idx - 1]) if prices[idx] > prices[idx - 1]\n idx += 1\n end\n \n total_profit\nend", "def max_for_30_percent(price_per_day)\n 6 * (price_per_day - get_decreased_value(price_per_day, PERCENT30))\n end", "def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend", "def maxvalue\n MAXVALUE\n end", "def maximum\n object.maximum.to_f\n end", "def highest_pledge_amount\n pledges.reduce(0) do |highest_pledge_amount, pledge| \n highest_pledge_amount = pledge.amount > highest_pledge_amount ? pledge.amount : highest_pledge_amount\n end \n end", "def max_profit(a)\n\tprofit = 0\n\tfor i in 0..a.size-2 do\n\t\tif a[i] < a[i+1]\n\t\t\tprofit = profit + (a[i+1] - a[i])\n\t\tend\t\n\tend\n\tprofit # Return max profit\nend", "def driver_with_cash(total_earned)\n return total_earned.max_by { |driver_earning| driver_earning[:amount]}\nend", "def weighted_max_score\n max_score * weight\n end", "def max\n data.max\n end", "def t_max\n @temp.max\n end", "def max_profit(prices)\n\n n = prices.length\n return 0 if prices.empty?\n return prices.first if n == 1\n\n #left: buy, right: sell\n left,right = 0, 1\n maxProf = 0\n\n while right < n\n if prices[left] < prices[right]\n profit = prices[right] - prices[left]\n maxProf = [maxProf, profit].max\n else\n left = right\n end\n right += 1\n end\n maxProf\nend", "def get_max_profit(stocks)\n profit = 0\n transaction = Array.new(2)\n stocks.each_with_index do |buy, i|\n stocks[i+1..-1].each do |sell|\n potential_profit = sell - buy\n if potential_profit > profit\n profit = potential_profit \n transaction[0] = buy\n transaction[1] = sell\n end\n end\n end\n p \"Buy: #{transaction[0]}, Sell: #{transaction[1]} for Profit: #{profit}\"\nend", "def get_max_profit(stock_prices_yesterday)\n # check for at least 2 prices\n if stock_prices_yesterday.length < 2\n raise IndexError, 'Need at least 2 prices to test.'\n end\n # initialize first price and the first possible profit\n min_price = stock_prices_yesterday[0]\n max_profit = stock_prices_yesterday[1] - stock_prices_yesterday[0]\n\n stock_prices_yesterday.each_with_index do |current_price, index|\n if index == 0 then next end\n # see what our profit would be if we bought at the\n # min price and sold at the current price\n potential_profit = current_price - min_price\n # update max_profit\n max_profit = [max_profit, potential_profit].max\n # update min_price\n min_price = [min_price, current_price].min\n end\n return max_profit\nend", "def autosizedMaximumOutdoorAirFlowRate\n\n return self.model.getAutosizedValue(self, 'Maximum Outdoor Air Flow Rate', 'm3/s')\n \n end", "def max_profit(prices)\n profit = 0\n 0.upto(prices.size - 2) do |current_pointer|\n next_pointer = current_pointer + 1\n diff = prices[next_pointer] - prices[current_pointer]\n profit += diff > 0 ? diff : 0\n end\n profit\nend", "def maxEndurance\n 0 # implemented by subclasses\n end", "def max_price\n if @stocks.first.opening.nil?\n @stocks.map(&:closing).max\n else\n @stocks.map(&:opening).max\n end\n end", "def bestonetradeprofit(prices)\n # find highest difference between price and subsequent price\n # starting best is second - first\n max = prices[1] - prices[0]\n while prices.length > 1\n e = prices.shift\n prices.each {|v| \n if (v - e) > max \n max=(v-e)\n end\n }\n end\n return max\nend", "def maximum_price(price)\n set_limiting_value(:maximum, :price, price)\n end", "def max_score\n problem.weight\n end", "def find_greatest_profit\n\n @stock_prices_yesterday.each.with_index do |buy_amount, index|\n\n #Set biggest profit to the first transaction to avoid errors caused by a comparision with nil.\n @biggest_profit ||= @stock_prices_yesterday[0] - @stock_prices_yesterday[1]\n\n counter = 1\n while index + counter < 480\n if (@stock_prices_yesterday[index + counter] - buy_amount) > @biggest_profit\n @biggest_profit = @stock_prices_yesterday[index + counter] - buy_amount\n @buy_price = @stock_prices_yesterday[index]\n @buy_time = index\n @sell_price = @stock_prices_yesterday[index + counter]\n @sell_time = index + counter\n counter += 1\n puts counter\n else\n counter +=1\n puts counter\n end\n end\n end\n @biggest_profit\n end", "def find_max_value (array)\n array.max # Add your solution here\nend", "def max\n @n[0]\n end", "def maxy\n main.maxy\n end", "def get_max_profit_2(array)\n\n max_profit = 0\n\n # go through every price (with it's index as the time)\n array.each_with_index do |number, index|\n\n # and go through all the LATER prices\n for later_price in array[index+1..-1]\n\n # see what our profit would be if we bought at the\n # earlier price and sold at the later price\n potential_profit = later_price - number\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n end\n end\n\n return max_profit\nend" ]
[ "0.7039826", "0.69743913", "0.69299847", "0.6902769", "0.6832776", "0.67691475", "0.67678267", "0.6765757", "0.6748349", "0.67467314", "0.67103744", "0.6697186", "0.66824484", "0.66499215", "0.6644036", "0.6616279", "0.6604594", "0.656939", "0.656939", "0.6555219", "0.6547768", "0.65453583", "0.654462", "0.6533999", "0.6515825", "0.6514534", "0.65087706", "0.6508276", "0.65054834", "0.6493131", "0.6472894", "0.64685637", "0.64670265", "0.64566094", "0.6455038", "0.64404136", "0.6433259", "0.64103585", "0.6397093", "0.6389523", "0.63881135", "0.63835025", "0.6376749", "0.6376046", "0.6374636", "0.6374636", "0.63673705", "0.6365948", "0.63595134", "0.6350555", "0.63404304", "0.63144606", "0.6311914", "0.631121", "0.631039", "0.63051486", "0.63019896", "0.6297726", "0.6291441", "0.62906504", "0.62901723", "0.6283781", "0.6283214", "0.62739617", "0.6270031", "0.62692386", "0.6265822", "0.6262213", "0.6259469", "0.6250965", "0.62500316", "0.62466574", "0.6241462", "0.62281126", "0.6225416", "0.6222744", "0.6214531", "0.6213556", "0.6192858", "0.618532", "0.6180265", "0.61779404", "0.61680317", "0.6166332", "0.61662936", "0.6162991", "0.61579007", "0.61479294", "0.61454415", "0.61404425", "0.6139438", "0.6120871", "0.61183476", "0.61130124", "0.61098117", "0.6108382", "0.60987306", "0.6098355", "0.6094098", "0.608761" ]
0.68505913
4
GET /gears GET /gears.json
def index @gears = Gear.all @hash = Gmaps4rails.build_markers(@gears) do |gear , marker| marker.lat gear.latitude marker.lng gear.longitude marker.infowindow gear.title end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lugars = Lugar.all\n\n render json: @lugars\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 @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end", "def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @galaxies.to_json(\n :only => [:id, :galaxy_name, :galaxy_type, :distance, :luminosity, :scale_length,\n :mass_hydrogen, :mass_disk, :velocities_citation, :luminosity_citation, :mass_hydrogen_citation, :scale_length_citation],\n :methods => [:citation_ids_array, :r_last, :vrot_data_last, :velocities_count]\n )\n }\n end\n end", "def index_by_age_sorted_by_price\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\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 @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 @regiones = Region.all\n\n render json: @regiones\n end", "def index\n @lounges = Lounge.all\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 index\n @galaxies = Galaxy.all\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 @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end", "def index\n locations = Location.all\n render json: locations\n end", "def show\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end", "def show\n @lodge = Lodge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lodge }\n end\n end", "def index\n @geometries = Geometry.all\n end", "def index\n @garplies = Garply.all\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def index\n @positions = Position.all.order :id\n @geojson = Hash.new\n\n @points = Position.geopoints\n @geojson = {\n type: 'FeatureCollection',\n features: @points\n }\n\n respond_to do |format|\n format.html\n format.json { render json: @geojson } # respond with the created JSON object\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 @locations = @organization.locations.all\n\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n \n @organization.locations.each do |location|\n @map.markers << \n Cartographer::Gmarker.new(\n :name => 'location_'+Digest::MD5.hexdigest(location.name),\n :marker_type => \"Building\",\n :position => [location.lat, location.lng],\n :info_window_url => \"fixme.org\"\n )\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\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 index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end", "def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end", "def index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\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 locations = @project.locations.all\n render json: { locations: locations }\n end", "def geo(id)\n get \"/geo/id/#{id}.json\"\n end", "def show\n @geopoint = Geopoint.find(params[:id])\n @json = @geopoint.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geopoint }\n end\n end", "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end", "def show\n @galaxy = Galaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxy }\n end\n end", "def index\n @map_versions = MapVersion.order(:position)\n\n @formattedMaps = @map_versions.map do |map|\n {\n 'version' => {'value' => map.version, 'searchable' => true, 'sortable' => true},\n 'position' => {'value' => map.position, 'searchable' => true, 'sortable' => true},\n 'description' => {'value' => map.description, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_map_version_path(map)},\n 'delete' => {'value' => admin_map_version_path(map), 'method' => 'delete'}\n }\n end\n\n gon.map_versions = @formattedMaps;\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @map_versions }\n end\n end", "def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end", "def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end", "def locations\n get('locations')\n end", "def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end", "def show\n render json: @grade\n end", "def index\n @lounges = Lounge.new \n @all_lounges = Lounge.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 get_nearby_food_pictures\n if params[:lat] and params[:lng]\n @restaurants = Restaurant.all\n # @buildings = Building.find( :all, :conditions => [ 'name LIKE ?', '%' + params[:q].downcase + '%'], :limit =&gt; 20)\n \n end\n\n render :json => @restaurants\n end", "def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end", "def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end", "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\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\n @galaxies_elliptical_galaxies = Galaxies::EllipticalGalaxy.all\n end", "def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def badges\n get(\"user/#{user_id}/badges.json\")\n end", "def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end", "def index\n @players = Player.order(:gamertag_lower).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players }\n end\n end", "def show\n render json: @region\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def index\n order = sortable_column_order, \"gage_number desc\"\n @gages = Gage.paginate page: params[:page], order: order, per_page: 50\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gages }\n end\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def show\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl }\n end\n end", "def show\n @locationmap = Locationmap.find(params[:id])\n @json=@locationmap.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locationmap }\n end\n end", "def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end", "def show\n render json: @light\n end", "def index\n @galaxies = policy_scope(Galaxy)\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def index\n \t@posts = Post.all\n\n @geojson = Array.new\n users = User.all\n users.each do |user|\n @geojson << {\n type: 'Feature',\n geometry: {\n type: 'Point',\n coordinates: [user.longitude, user.latitude]\n },\n properties: {\n name: user.restaurant,\n address: user.address,\n :'marker-color' => '#00607d',\n :'marker-symbol' => 'circle',\n :'marker-size' => 'medium'\n }\n }\n end\n \n respond_to do |format|\n format.html\n format.json { render json: @geojson }\n end\n end", "def index\n @lodges = Lodge.all\n end", "def index\r\n markers = Marker.all\r\n render json: markers\r\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def garments\n garments = []\n self.closets.map do |closet|\n closet.garments.map do |garment|\n garments.push({id: garment.id, name: garment.name, garment_style: garment.garment_style, garment_type: garment.garment_type, is_favorite: garment.is_favorite, is_clean: garment.is_clean, closet_id: garment.closet_id, image: garment.image, temperatures: garment.temperatures, user: garment.user, lowest_temp: garment.lowest_temp, highest_temp: garment.highest_temp, garment_weight: garment.garment_weight, temperatures: garment.temperatures, temperature_ranges: garment.temperature_ranges})\n end\n end\n garments\n end", "def index\n @gravities = Gravity.all\n end", "def index\n @sticker = Sticker.find(params[:sticker_id])\n @zones = @sticker.zones\n @user = User.find(params[:user_id])\n declare_sticker\n\n respond_to do |format|\n format.html { gmaps_all_zones_marker }\n format.json { render json: @zones }\n end\n end", "def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def show\n sighting = Sighting.find(params[:id])\n #render json: sighting.to_json(:include => {:bird => {:only =>[:name, :species]}, :location => {:only =>[:latitude, :longitude]}}, :except => [:updated_at])\n end", "def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def index\n @geofences = Geofence.all\n end", "def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end", "def show\n @polygon = Polygon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polygon }\n end\n end", "def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end", "def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\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 index\n @lights = Light.all\n\n render json: @lights\n end", "def index\n @geos = Geo.all\n end", "def index\n @shipments = Shipment.all\n render json: @shipments\n end", "def get_geocloud_json\n { :country => self.country, \n :geo_settings => eval(self.geo_settings),\n :ref_point => eval(self.ref_point),\n :width => self.width,\n :height => self.height,\n :map_src => \"/assets/maps/#{self.map_file}\"}.to_json\n end", "def show\n if user_id_params\n @geopoints = Geopoint.all.where(user_id: @user_id)\n render json: @geopoints\n else\n #not found\n render json: \"empty_error\", status: 423\n end\nend", "def locations\n @client.get('/BikePoint')\n end", "def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def index\n #@gears = Gear.find(:all)\n\n @gears = Gear.paginate(:order => 'created_at DESC', \n :per_page => 10,\n :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @gears }\n end\n end", "def index\n @gmaps = Gmap.all\n end", "def show\n @grocery_list = GroceryList.find(params[:id])\n render json: @grocery_list\n end" ]
[ "0.65027606", "0.61816555", "0.616994", "0.61403424", "0.61261564", "0.61101073", "0.6106715", "0.6047167", "0.6028472", "0.6006025", "0.597696", "0.5968287", "0.5960822", "0.5958917", "0.59413534", "0.5934045", "0.59064263", "0.587133", "0.58640677", "0.5857912", "0.5852912", "0.58512336", "0.5831616", "0.58010805", "0.57933116", "0.57910997", "0.5787803", "0.57736766", "0.57655895", "0.5765224", "0.5748217", "0.5747764", "0.57467663", "0.5742688", "0.57409686", "0.5725623", "0.5724159", "0.5719738", "0.57130164", "0.5712466", "0.5707149", "0.5705875", "0.5703374", "0.5691476", "0.5682776", "0.5673225", "0.56708866", "0.56671184", "0.56663483", "0.5664016", "0.56571716", "0.56510353", "0.56497383", "0.56440747", "0.5641521", "0.56396943", "0.56309116", "0.56246865", "0.5615675", "0.56125575", "0.5589148", "0.55859756", "0.5584459", "0.5582628", "0.5576128", "0.55680954", "0.55592906", "0.55570143", "0.5551193", "0.55486166", "0.5542591", "0.55420494", "0.55402625", "0.5539472", "0.5538037", "0.55313045", "0.55295885", "0.5528737", "0.5526441", "0.5525702", "0.55249155", "0.55204177", "0.5518382", "0.5512311", "0.5511812", "0.5507404", "0.5505912", "0.5494936", "0.5493007", "0.54864204", "0.5484614", "0.54821026", "0.5479249", "0.5478654", "0.5469339", "0.54632306", "0.54585505", "0.5456761", "0.5456371", "0.54510295" ]
0.57244086
36
GET /gears/1 GET /gears/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\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 index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def geo(id)\n get \"/geo/id/#{id}.json\"\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 @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end", "def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end", "def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\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 @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 index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @galaxies.to_json(\n :only => [:id, :galaxy_name, :galaxy_type, :distance, :luminosity, :scale_length,\n :mass_hydrogen, :mass_disk, :velocities_citation, :luminosity_citation, :mass_hydrogen_citation, :scale_length_citation],\n :methods => [:citation_ids_array, :r_last, :vrot_data_last, :velocities_count]\n )\n }\n end\n end", "def show\n @geopoint = Geopoint.find(params[:id])\n @json = @geopoint.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geopoint }\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 @galaxy = Galaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxy }\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 @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end", "def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end", "def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\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\n @regiones = Region.all\n\n render json: @regiones\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 @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 @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 route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end", "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def index\n locations = Location.all\n render json: locations\n end", "def show\n @lodge = Lodge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lodge }\n end\n end", "def show\n @polygon = Polygon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polygon }\n end\n end", "def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end", "def index\n @galaxies = Galaxy.all\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def show\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl }\n end\n end", "def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def index\n @locations = @organization.locations.all\n\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n \n @organization.locations.each do |location|\n @map.markers << \n Cartographer::Gmarker.new(\n :name => 'location_'+Digest::MD5.hexdigest(location.name),\n :marker_type => \"Building\",\n :position => [location.lat, location.lng],\n :info_window_url => \"fixme.org\"\n )\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def show\n @locationmap = Locationmap.find(params[:id])\n @json=@locationmap.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locationmap }\n end\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end", "def show\n render json: @region\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def show\n render json: Location.find(params[\"id\"])\n end", "def index\n @geometries = Geometry.all\n end", "def get_location\n as_json(get_results('/locations.json'))\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_by_age_sorted_by_price\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: false }\n format.json\n format.geojson\n end\n end", "def show\n @outdoor = Outdoor.find(params[:id])\n @json = Outdoor.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outdoor }\n end\n end", "def index\n @map_versions = MapVersion.order(:position)\n\n @formattedMaps = @map_versions.map do |map|\n {\n 'version' => {'value' => map.version, 'searchable' => true, 'sortable' => true},\n 'position' => {'value' => map.position, 'searchable' => true, 'sortable' => true},\n 'description' => {'value' => map.description, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_map_version_path(map)},\n 'delete' => {'value' => admin_map_version_path(map), 'method' => 'delete'}\n }\n end\n\n gon.map_versions = @formattedMaps;\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @map_versions }\n end\n end", "def show\n @star = Star.find(params[:id])\n render :json => @star\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @region }\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 index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end", "def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end", "def show\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lot }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def index\n @air_qualities = AirQuality.all\n\n render json: @air_qualities\n end", "def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end", "def index\n @positions = Position.all.order :id\n @geojson = Hash.new\n\n @points = Position.geopoints\n @geojson = {\n type: 'FeatureCollection',\n features: @points\n }\n\n respond_to do |format|\n format.html\n format.json { render json: @geojson } # respond with the created JSON object\n end\n end", "def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end", "def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def show\n @grocery_list = GroceryList.find(params[:id])\n render json: @grocery_list\n end", "def show\n render json: @light\n end", "def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end", "def show\n @rubygem = Rubygem.find(params[:id])\n\n render json: @rubygem\n end", "def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end", "def show\n lat = @airport.latitude_deg\n lng = @airport.longitude_deg\n \n @map_markers = Gmaps4rails.build_markers(@airport) do |airport,marker|\n marker.lat lat\n marker.lng lng\n end\n response = RestClient.get \"http://api.openweathermap.org/data/2.5/weather\", :params => {:lat => lat, :lon => lng}\n @weather = Crack::JSON.parse(response.body) \n end", "def show\n @dimgeom = Dimgeom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dimgeom }\n end\n end", "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end", "def show\n respond_to do |format|\n format.html do\n gon.stores = [\"AppEstablishmentStore\"] \n gon.jbuilder \n end\n\n format.json { render :show }\n end \n end", "def show\n render :json => Location.find(params[:id])\n end", "def show\n @layer = Layer.find(params[:id])\n areas_json = @layer.areas.map do |area|\n {area_id: area.id, polygon: area.polygon}\n end\n @result = {id: @layer.id, name: @layer.name, number_of_polygons: @layer.areas.count, areas: areas_json }\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/show', @layer, @tolerance)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:layer => @layer, :data_json => @data_json, :permalink => @permalink} }\n format.topojson { render json: @layer.to_topojson }\n end\n end", "def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end", "def show\n # binding.pry\n @place = Place.find(params[:id])\n @place_json = Place.find(params[:id]).as_json({ :properties => :all })\n @json = Place.find(params[:id]).to_gmaps4rails\n @comments = @place.comments\n @rates = @place.rates\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:place_info => @place_json, :comments => @comments, :rating => @place.average_rating} }\n end\n end", "def show\n @estate = Estate.find(params[:id])\n @json = @estate.to_gmaps4rails\n respond_with(@estate)\n \n end", "def show\n if user_id_params\n @geopoints = Geopoint.all.where(user_id: @user_id)\n render json: @geopoints\n else\n #not found\n render json: \"empty_error\", status: 423\n end\nend", "def show\n @gene_name = GeneName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gene_name }\n end\n end", "def show\n sighting = Sighting.find(params[:id])\n #render json: sighting.to_json(:include => {:bird => {:only =>[:name, :species]}, :location => {:only =>[:latitude, :longitude]}}, :except => [:updated_at])\n end", "def show\n @gravity = Gravity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gravity }\n end\n end", "def new\n @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end", "def locations\n get('locations')\n end", "def get_nearby_food_pictures\n if params[:lat] and params[:lng]\n @restaurants = Restaurant.all\n # @buildings = Building.find( :all, :conditions => [ 'name LIKE ?', '%' + params[:q].downcase + '%'], :limit =&gt; 20)\n \n end\n\n render :json => @restaurants\n end", "def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end", "def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end", "def show\n @betraege = Betraege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @betraege }\n end\n end", "def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end", "def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end", "def show\n render json: @grade\n end", "def show\n @admin_village = Admin::Village.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_village }\n end\n end", "def show\n @reading = Reading.find(params[:id])\n @json = @reading.to_gmaps4rails\n end", "def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end" ]
[ "0.6345778", "0.63266045", "0.6292802", "0.61679953", "0.6159783", "0.6118803", "0.6098425", "0.60803026", "0.6062443", "0.6061925", "0.60604405", "0.6047547", "0.60302484", "0.6008703", "0.60005224", "0.5980798", "0.59760755", "0.5957241", "0.59496224", "0.59491116", "0.593892", "0.5931768", "0.59317046", "0.5925449", "0.5915567", "0.5914913", "0.5914236", "0.591392", "0.59096074", "0.5899666", "0.58829725", "0.58722156", "0.586282", "0.5846919", "0.58454055", "0.5830023", "0.57906526", "0.57853806", "0.5779546", "0.57725614", "0.57637215", "0.576189", "0.575935", "0.57528836", "0.575192", "0.5734609", "0.57339716", "0.5733423", "0.5731565", "0.57314336", "0.5730822", "0.5717533", "0.57169735", "0.56960976", "0.5690577", "0.567879", "0.567879", "0.5677721", "0.5677156", "0.5673314", "0.5671194", "0.566785", "0.56663996", "0.5657761", "0.5647606", "0.5646909", "0.563731", "0.5634545", "0.5632059", "0.5623763", "0.56227344", "0.5622487", "0.562173", "0.561307", "0.5608849", "0.560432", "0.56015474", "0.560021", "0.55984634", "0.55958396", "0.55949485", "0.55943835", "0.5592997", "0.5582722", "0.5580508", "0.55766666", "0.5573649", "0.55611765", "0.55586475", "0.5558338", "0.5552504", "0.55448335", "0.55433965", "0.5540719", "0.553459", "0.55319315", "0.55300945", "0.55296624", "0.5529078", "0.552031", "0.55189884" ]
0.0
-1