query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Renders the passed attr with a link to the show action for the current entry. A block may be given to define the link path for the row entry.
def col_show(table, attr, &block) table.attr(attr, table.sort_header(attr)) do |e| link_to(format_attr(e, attr), action_path(e, &block)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def action_col_show(table, &block)\n action_col(table) do |e| \n link_table_action('zoom-in', action_path(e, &block))\n end\n end", "def action_col_show(table, &block)\n action_col(table) { |e| link_table_action('zoom-in', action_path(e, &block)) }\n end", "def apphelp_protected_show_link( obj, name = nil )\n return apphelp_unknown_quantity_warning() if ( obj.nil? )\n\n name = obj.name if ( name.nil? )\n link = apphelp_protected_link_to(\n :show,\n {\n :model => obj.class,\n :method => :url_for\n },\n obj\n ) { h( name ) }\n\n return ( link.empty? ) ? h( name ) : link\n end", "def ar_show_link resource= @resource\n link_to(controller.ardata.labels[:show], ar_resource_path('', resource))\n end", "def build_link(master_u)\n icon_edit = '<span class=\"glyphicon glyphicon-edit\"></span>'\n icon_show = '<span class=\"glyphicon glyphicon-info-sign\"></span>'\n link = link_to(raw(icon_show), master_u)\n link += link_to(raw(icon_edit), edit_master_unit_path(master_u))\n raw('<div class=\"datatable-actions\">'+link+'</div>')\n end", "def html_link(item)\n tag :a, yield, :href => item.url\n end", "def view_edit_link(user, attraction)\n if user.admin\n content_tag(:p, link_to(\"Edit Attraction\", edit_attraction_path(attraction)))\n end\n end", "def show\n respond_to do |format|\n format.html { render :partial => 'show', :locals => { :record => @link }, :layout => 'admin/admin_show' }\n format.xml { render :xml => @link }\n end\n end", "def link_to_show(path)\n link_to image_tag('icons/001_38.png',\n :size => ICON_SIZE,\n :alt => 'Show'), path\n end", "def model_link(item, **opt)\n html_opt = remainder_hash!(opt, *MODEL_LINK_OPTIONS)\n type = (model_type unless item)\n item ||= object\n label = opt[:label] || :label\n label = item.send(label) if label.is_a?(Symbol)\n if opt[:no_link]\n html_span(label, html_opt)\n else\n # noinspection RubyMismatchedArgumentType\n path = (yield(label) if block_given?) || opt[:path] || opt[:path_method]\n path = path.call(item, label) if path.is_a?(Proc)\n html_opt[:title] ||= opt[:tooltip]\n html_opt[:title] ||=\n if (type ||= opt[:scope] || opt[:controller] || Model.for(item))\n I18n.t(\"emma.#{type}.show.tooltip\", default: '')\n end\n # noinspection RubyMismatchedArgumentType\n make_link(label, path, **html_opt)\n end\n end", "def display_link_attributes(link)\n # Interface method\n end", "def link_to(*args, &block)\n if block_given?\n super(*args)\n else\n options = args[1] || {}\n html_options = args[2] || {}\n unless html_options.has_key? :'data-id'\n begin\n path = URI.split(url_for(options) || html_options['href'])[5].split(/\\//).select {|x| !x.empty?}\n if path.size > 0\n max = path.size <= 3 ? path.size : 3\n id = path.last(max).join('_')\n else\n id = 'not_defined'\n end\n rescue Exception => e\n id = 'not_parseable'\n end\n html_options.merge!(:'data-id' => \"aid_#{id}\")\n end\n super(args[0], args[1], html_options)\n end\n end", "def link_to_show(text, path, options={})\n link_to_action(text, path, options.reverse_merge(:action => :show))\n end", "def render_link\n content_tag(:a, **integrated_slat_action_html_options) do\n if icon\n NfgUi::Components::Foundations::Icon.new({ traits: [icon], text: (block_given? ? yield : body), theme: theme }, view_context).render\n else\n (block_given? ? yield : body)\n end\n end\n end", "def link_to( *args, &link_block )\n if block_given?\n name = @template.capture(&link_block)\n options = args.first || {}\n html_options = args.second || {}\n\n link_to_in_block( name, options, html_options, &link_block )\n else\n name = args[0]\n options = args[1] || {}\n html_options = args[2] || {}\n\n link_to_in_html( name, options, html_options )\n end.tap { @item_count += 1 } # Increment the number of links generated (and still return markup)\n end", "def call_for_detail(entity, text, options = {}, html_options = {})\n text ||= \"...\"\n opt = options.dup\n opt[:controller] = options[:force_controller] || entity.controller_name\n opt[:action] = options[:force_action] || \"show\"\n opt[:id] = options[:force_id] || entity.to_param\n opt[:background_params] = @background_params\n if html_options[:popup] || html_options[:target]\n # for the case of new window to render\n opt[:layout] ||= \"base_layout_for_non_collection\"\n end\n link_to text, opt, html_options\n end", "def link(obj)\n return \"<a href='#{R(obj, self.id)}'>#{self.name}</a>\"\n end", "def view_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'view')\n # text to be displayed\n link_text = crud_link_text(options, 'view')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'view-' + link_id(object)\n options[:title] = 'View this ' + resource_name\n\n if defined? CanCan\n link += link_to link_text, url_for(resource), options if can?(:read, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n\n link\n end", "def _link(attribute, text=nil)\n link = \"##{attribute}\"\n %{<a href=\"#{link}\">#{text || attribute}</a>}\nend", "def link_to(name = nil, options = nil, html_options = nil, &block)\n return super if block_given?\n return super if html_options.nil?\n\n if html_options[:icon]\n name = content_tag(:span, name)\n name.prepend(icon(html_options.delete(:icon)))\n end\n\n if html_options[:wrapper]\n wrapper = html_options.delete(:wrapper)\n if wrapper == :cell\n content_tag(:div, super(name, options, html_options, &block), class: 'cell')\n else\n content_tag(wrapper, super(name, options, html_options, &block))\n end\n else\n super(name, options, html_options, &block)\n end\n end", "def active_scaffold_column_download_link(column, record, label = nil)\n return nil if record.send(column.name).nil?\n label ||= as_(:download)\n if column.options[:secure_download]\n url_options = active_scaffold_column_download_link_url_options(column, record)\n else\n url_options = url_for_file_column(record, column.name.to_s)\n end\n link_to( label, url_options, :popup => true)\n end", "def render_show_product_link(product, text = 'View', classname = nil)\n link_to text, custom_product_path(product.store, product), :class => classname\n end", "def link_menu(resource, options={})\n html= ' '\n if permitted_to? :index, table_symbol_from(resource) then\n if resource.is_a? Symbol then\n model_plural = resource.to_s\n else\n model= singular_table_name_from( resource).pluralize \n end\n a = link_to(tmenu(model_plural), eval(model_plural + \"_path\"), options) \n html = wrap_in_html_container a, 'li', 'menuItem'\n end\n #ebugger\n return html.html_safe\n end", "def html_block_show(block)\n title, content = send(block.class.to_s.underscore, block)\n html_blocklike_show(title, content)\n end", "def show_attribute_outside_form(resource, attribute, options=nil, &block)\n if is_date?(resource, attribute)\n resource.send(attribute) # TODO: add the controversial abbr method here, or just use title\n elsif is_document?(resource, attribute)\n if is_document_empty?(resource, attribute)\n t(:no_document)\n else\n if is_image?(resource, attribute)\n image_style = (options.nil? || options[:image_style].nil?)? :thumb : options[:image_style]\n image_tag(resource.send(attribute).url(image_style))\n else\n link_to(resource.send(\"#{attribute}_file_name\"), resource.send(attribute).url)\n end\n end\n else\n yield\n end\n end", "def link_to_edit(path)\n link_to icon('edit'), path, title: 'Edit this record'\n end", "def my_link_to_show(data)\r\n link_to image_tag(\"info.png\", :border=>0), data, :title => \"Details anzeigen\"\r\n end", "def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end", "def link(css: nil, **opt)\n opt[:title] = opt.delete(:tooltip) || opt[:title] || show_tooltip\n prepend_css!(opt, css) if css.present?\n model_link(object, **opt)\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end", "def show_request_access_link\n @attributes[:show_request_access_link]\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def action_link\n if member.kind_of?(Work)\n link_to \"Info\", work_path(member), class: \"btn btn-primary\"\n elsif download_original_only\n link_to \"Download\", download_path(member.file_category, member), class: \"btn btn-brand-main less-padding\", data: {\n \"analytics-category\" => \"Work\",\n \"analytics-action\" => \"download_original\",\n \"analytics-label\" => member.parent.friendlier_id\n }\n else\n render DownloadDropdownComponent.new(member, display_parent_work: member.parent, use_link:true)\n end\n end", "def action_link(action, prefix)\n html_class = \"actions #{action.to_s}_link\"\n block = lambda do |resource|\n compound_resource = [prefix, resource].compact\n compound_resource.flatten! if prefix.kind_of?(Array)\n case action\n when :show\n @template.link_to(link_title(action), compound_resource)\n when :destroy\n @template.link_to(link_title(action), compound_resource,\n :method => :delete, :confirm => confirmation_message)\n else # edit, other resource GET actions\n @template.link_to(link_title(action),\n @template.polymorphic_path(compound_resource, :action => action))\n end\n end\n self.cell(action, :heading => \"\", :cell_html => {:class => html_class}, &block)\n end", "def maybe_view_link_to(member)\n if member.kind_of?(Asset) && member.content_type&.start_with?(\"image/\")\n yield\n else\n # image thumb is in a link, but right next to filename with same link.\n # Suppress image thumb from assistive technology to avoid un-useful double\n # link. https://www.sarasoueidan.com/blog/keyboard-friendlier-article-listings/\n link_to(download_path(member.leaf_representative.file_category, member.leaf_representative, disposition: :inline),\n view_link_attributes.merge(\"aria-hidden\" => \"true\", \"tabindex\" => -1)) do\n yield\n end\n end\n end", "def link\n raise ArgumentError, 'block not supplied' unless block_given?\n define_method { |*args, &block| yield caller, self, args, block }\n end", "def get_linked_full_name\n h.link_to( get_full_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def link_button_to(*args, &block)\n if block_given?\n options = args.first || {}\n html_options = args.second\n link_button_to(capture(&block), options, html_options)\n else\n name = args[0]\n options = args[1] || {}\n html_options = args[2]\n\n url = url_for(options)\n html_options = convert_options_to_data_attributes(options, html_options.merge({ 'data-url' => url }))\n\n content_tag(:button, ERB::Util.html_escape(name || url), html_options)\n end\n end", "def layouts_show_links(*args)\n render \"layouts/show/links\", obj: args.shift, sender: args.shift, args: args \n end", "def link_to_asset(body,model,url_opts={},html={})\n result = String.new\n result << '<a href=\"' + url_for_asset(model,url_opts) + '\">'\n result << body\n result << '</a>'\n end", "def contextual_edit_block_path(block)\n active_model = get_active_model_by_path(block.models)\n active_model ? edit_model_path(active_model, :anchor => 'show_collapseable_BlocksFields') : edit_block_path(block)\n end", "def list_item_attribute attribute, value, url=nil, url_options={}\n unless url.nil?\n value = link_to value, url, url_options\n end\n return \"<p class=\\\"list_item_attribute\\\"><b>#{attribute}</b>: #{value}</p>\"\n end", "def link_to(arg)\n text =\n if arg.respond_to?(:name)\n arg.name\n else arg.to_s\n end\n\n Doc::HTML.escape_html(text)\n end", "def product_action_links(product)\n return %Q{\n #{link_to(image_tag('/images/livia_portal/icon_edit.gif',{:alt =>\"Edit\", :title=>\"Edit\", :border => 0, :hspace => \"0\"}), edit_product_path(:id=>product.id))}\n }\n end", "def admin_display_value(object, attribute, value)\n config = object.class.admin_attributes[attribute]\n return value.to_s unless config&.has_key?(:model)\n\n model_name = config[:model_name]\n unless model_name\n association = object.class.reflect_on_association(attribute)\n return value.to_s unless association\n\n model_name = association.class_name.underscore\n end\n\n link_to(value.to_s,\n admin_item_path(model: model_name, id: value.to_param))\n end", "def build_row_onclick(data_row)\n onclick = nil\n\n # Handle CI based report rows\n if ['EmsCluster', 'ExtManagementSystem', 'Host', 'Storage', 'Vm', 'Service'].include?(db) && data_row['id']\n controller = db == \"ExtManagementSystem\" ? \"management_system\" : db.underscore\n donav = \"DoNav('/#{controller}/show/#{data_row['id']}');\"\n title = data_row['name'] ?\n \"View #{ui_lookup(:model => db)} \\\"#{data_row['name']}\\\"\" :\n \"View this #{ui_lookup(:model => db)}\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='#{title}'\"\n end\n\n # Handle CI performance report rows\n if db.ends_with?(\"Performance\")\n if data_row['resource_id'] && data_row['resource_type'] # Base click thru on the related resource\n donav = \"DoNav('/#{data_row['resource_type'].underscore}/show/#{data_row['resource_id']}');\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='View #{ui_lookup(:model => data_row['resource_type'])} \\\"#{data_row['resource_name']}\\\"'\"\n end\n end\n\n onclick\n end", "def show\n\t\tshow_\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @link }\n\t\tend\n\tend", "def link_helper(note)\n onclick = note.onclick\n unless href = note.link\n href = '#'\n onclick ||= \"footnotes_toogle('#{note.to_sym}_debug_info');return false;\" if note.fieldset?\n end\n\n \"<a href=\\\"#{href}\\\" onclick=\\\"#{onclick}\\\">#{note.title}</a>\"\n end", "def workflow_action_link(title, link, opts={})\n link_to(title, link, {:class=>'btn btn-mini'}.merge(opts))\n end", "def link_to_with_data(*args, &block)\n if block_given?\n options = args.first || {}\n html_options = args.second\n concat(link_to(capture(&block), options, html_options))\n else\n name = args.first\n options = args.second || {}\n html_options = args.third\n\n url = url_for(options)\n\n if html_options\n html_options = html_options.stringify_keys\n href = html_options['href']\n convert_options_to_javascript_with_data!(html_options, url)\n tag_options = tag_options(html_options)\n else\n tag_options = nil\n end\n\n href_attr = \"href=\\\"#{url}\\\"\" unless href\n \"<a #{href_attr}#{tag_options}>#{h(name) || h(url)}</a>\"\n end\n end", "def build_show_helper(resource) \n helper_name = \"show_#{resource.name_prefix}#{resource.singular}#{@@link_helpers_suffix}\"\n return if already_defined?(helper_name)\n @module.module_eval <<-end_eval\n def #{helper_name}(*args)\n opts = args.extract_options!\n label = opts.delete(:label) || #{resource.kind_of?(ActionController::Resources::SingletonResource) ? \"'Show'\" : 'args.last.to_s'}\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}', 'show', *(opts.delete(:class) || '').split)\n opts[:sending] = opts.delete(:parameters) and ResourcefulViews.deprecation_warning('Please use :sending instead of :parameters') if opts[:parameters]\n args << opts.delete(:sending) if opts[:sending]\n link_to(label, #{resource.name_prefix}#{resource.singular}_path(*args), opts)\n end\n end_eval\n end", "def item_link(item)\n if !item.new_record?\n if item.respond_to?(:name)\n content_tag(:li, link_to(item.name, [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:headline)\n content_tag(:li, link_to(item.headline.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:title)\n content_tag(:li, link_to(item.title.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n end\n end\n end", "def link_to_show(roo, controller = controller.controller_name)\n link_to(image_tag('show.png', :alt => 'show'), {:controller => controller, :action => 'show', :id => roo}, :class => 'icon', :title => 'show')\n end", "def show_control(**opt)\n opt[:label] ||= 'Show' # TODO: I18n\n opt[:path] ||= show_path\n button_link(**opt)\n end", "def designed_button_link(&block)\n content_tag :div, :class => \"op-control\" do \n content_tag :ul, :class => \"cf\" do\n content_tag :li do\n content_tag :button do\n yield\n end\n end\n end\n end \n end", "def link_of_item(kind)\n\titem = @items.find { |i| i.attributes()[:kind] == kind }\n\tlink_to(kind.capitalize, @site.config()[:base_url] + item.path) unless item.nil?\nend", "def show(&block)\n respond_with(entry, &block)\n end", "def r_table_cell_action(label, link, link_options = {})\n link_to(label, link, link_options.merge(class: \"text-indigo-600 hover:text-indigo-900\"))\n end", "def create_link(item_nr)\n \"<a href=\\'/item/#{item_nr}\\'>#{self}</a>\"\n end", "def show_button_to(path, text = t('show'))\n link_to path, class: 'button small' do\n concat text\n end\n end", "def get_linked_full_name_with_date\n h.link_to( \"#{get_full_name} (#{get_meeting_date})\", meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def media_link &block\n ASObj.generate :media_link,true,&block\n end", "def emit_link_span(colspan, linktext, href, link_class=nil, options_hash={}, helper_template=nil)\n options_hash[:href] = href\n if link_class\n options_hash[:class] = link_class\n end\n div :class => \"column span-#{colspan}\" do\n if helper_template\n rawtext(helper_template.link_to(linktext,href,options_hash))\n else\n a options_hash do\n text linktext\n end\n end\n end\n end", "def detail_for record, &block\n concat(render_default_css, block.binding) unless @_showhide_css_done\n div_for(record, 'detail_for', :style => 'display: none;', :class => 'detail', &block)\n @_showhide_css_done = true # prevents to print the CSS multiple times\n nil\n end", "def view_button(object, link = nil)\n link_to '<span class=\"glyphicon glyphicon-eye-open\"></span> View'.html_safe,\n link ? link : polymorphic_path(object),\n class: 'btn btn-default',\n title: \"View #{object_title(object)}\"\n end", "def action_link(title, link, icon, options = {})\n icon_tag = content_tag(:i, '', class: \"fa fa-#{icon} fa-fw\")\n default_options = { title: title, data: { tooltip: title } }\n link_to icon_tag, link, default_options.deep_merge(options)\n end", "def link_to_textmate_file(absolute_or_relative_path, options = {})\n label = file_link_label(absolute_or_relative_path, options)\n line = options.delete(:line)\n column = options.delete(:column)\n absolute_path = App::File.absolute_path(absolute_or_relative_path).to_s\n url = \"txmt://open?url=file://#{absolute_path}&line=#{line}&column=#{column}\"\n content_tag(:a, label, options.merge(:href => url)).gsub(\"&amp;\", \"&\").html_safe\n end", "def link_apply url, resource, options={}\n html = \"\"\n if permitted_to? :update, table_symbol_from(resource)\n html = \"<td class='link'>\"+tlink_to(\"apply\",url,{:target=>\"_blank\", :category=>:action})+\"</td>\"\n end\n html.html_safe\n end", "def visit_show_page(model, entry: nil, index: nil, entry_css: nil)\n ctrlr = controller_name(model)\n entry ||=\n if (entry_css ||= property(ctrlr, :index, :entry_css))\n case index\n when Integer then all(entry_css).at(index)\n when :last then all(entry_css).last\n else find(entry_css, match: :first)\n end\n end\n link = entry&.find('.value.field-Title a')\n title = link&.text&.html_safe || 'NO TITLE'\n link&.click\n if block_given?\n yield(title)\n else\n show_url\n end\n assert_valid_show_page(ctrlr, title: title)\n end", "def link_to( *args, &block )\n\t\tif block_given?\n\t\t\toptions = args.first || {}\n\t\t\thtml_options = args.second\n\t\t\tlink_to( capture( &block ), options, html_options )\n\t\telse\n\t\t\tname = args[0]\n\t\t\toptions = args[1] || {}\n\t\t\thtml_options = args[2]\n\t\t\t\n\t\t\thtml_options = convert_options_to_data_attributes( options, html_options )\n\t\t\turl = url_for( options )\n\t\t\t\n\t\t\thref = html_options['href']\n\t\t\ttag_options = tag_options( html_options )\n\t\t\t\n\t\t\thref_attr = \"href=\\\"#{ERB::Util.html_escape( url )}\\\"\" unless href\n\t\t\t\n\t\t\t############################################ CUSTOM {\n\t\t\tif request.env['REMOTE_ADDR'] == '127.0.0.1'\n\t\t\t\t# The request came from a local browser (kiosk browser).\n\t\t\t\tif ((url.to_s[0] != '/') \\\n\t\t\t\t&& (url.to_s[0] != '#') \\\n\t\t\t\t)\n\t\t\t\t\t# +url+ is neither an absolute path nor a fragment.\n\t\t\t\t\t# It's probably a fully qualified URL, including a host.\n\t\t\t\t\t# (It could be a relative path, but that doesn't\n\t\t\t\t\t# happen in our application.)\n\t\t\t\t\t# We don't want fully qualified URLs to be\n\t\t\t\t\t# rendered as a link.\n\t\t\t\t\t\n\t\t\t\t\tif (name || url) == url\n\t\t\t\t\t\t# Link text equals +url+.\n\t\t\t\t\t\treturn \"#{ERB::Util.html_escape( name || url )}\".html_safe\n\t\t\t\t\telse\n\t\t\t\t\t\t# Link text is different from the +url+.\n\t\t\t\t\t\treturn \"#{ERB::Util.html_escape( name || url )} (#{ERB::Util.html_escape( url )})\".html_safe\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t# If we came here it's all good. Either the request\n\t\t\t# came from a remote browser or the +uri+ doesn't\n\t\t\t# point to a different host. We can use the return\n\t\t\t# value of the original +link_to+ method.\n\t\t\t############################################ CUSTOM }\n\t\t\t\n\t\t\t\"<a #{href_attr}#{tag_options}>#{ERB::Util.html_escape( name || url )}</a>\".html_safe\n\t\tend\n\tend", "def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end", "def link_at address , context\n super #just sets the position\n @entry.link_at address , context\n address += @entry.length\n @blocks.each do |block|\n block.link_at(pos , context)\n pos += block.length\n end\n end", "def show_for object, html_options = {}, &block\n html_options = html_options.dup\n\n tag = html_options[:list_tag] || IndexFor.list_tag\n\n html_options[:id] ||= show_for_id(object)\n html_options[:class] = show_for_class(object, html_options)\n\n content = capture(IndexFor::ListColumnBuilder.new(object, html_options, self), &block)\n\n content_tag(tag, content, html_options)\n end", "def nav_menu_item(menu_label, &block)\n \n icon = case menu_label\n when 'category' ; \"<i class='icon-tag'></i>\"\n when 'user' ; \"<i class='icon-user'></i>\"\n when 'post' ; \"<i class='icon-font'></i>\"\n when 'comment' ; \"<i class='icon-comment'></i>\"\n when 'archive' ; \"<i class='icon-upload'></i>\"\n end \n\n menu_label = t(\"activerecord.models.#{menu_label}\")\n content_tag(:li, :class => 'dropdown') do \n link_to(\"#{icon} #{menu_label} <b class='caret'></b>\".html_safe, '#', :class => 'dropdown-toggle', :data => { :toggle => 'dropdown' }) +\n content_tag(:ul, :class => 'dropdown-menu') do \n capture(&block)#yield\n end\n end\n end", "def append_link( output, text, record )\n return ( output << \" \" << link_to(\n text.html_safe,\n {\n :controller => record.auditable_type.downcase.pluralize,\n :action => 'show',\n :id => record.auditable_id\n }\n )\n ).html_safe()\n end", "def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end", "def link_to(*args, &block)\n if block_given?\n options = args.first || {}\n html_options = args.second\n concat(link_to(capture(&block), options, html_options))\n else\n name = t(args.first, {:force => true})\n options = args.second || {}\n html_options = args.third\n\n url = url_for(options)\n\n if html_options\n html_options = html_options.stringify_keys\n href = html_options['href']\n convert_options_to_javascript!(html_options, url)\n tag_options = tag_options(html_options)\n else\n tag_options = nil\n end\n\n href_attr = \"href=\\\"#{url}\\\"\" unless href\n \"<a #{href_attr}#{tag_options}>#{name || url}</a>\"\n end\n end", "def link_to_edit(path, *options)\n link_to path,\n class: \"btn btn-warning btn-sm\",\n title: \"Alterar\",\n style: \"color: #FFF; \" do\n content_tag :span, class: \"fa fa-pencil\" do\n options.first[:label] if options.present? && options.first[:label]\n end\n\n end\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def show_manage_cell_link\n link_to \"Manage\", sentence_show_manage_cell_path(model), remote: true\n end", "def show_link(ems, options = {})\n ems_path(ems.id, options)\n end", "def html(args = nil)\n if args and args[:edit]\n url = self.url_edit\n else\n url = self.url\n end\n\n return \"<a href=\\\"#{Knj::Web.ahref_parse(url)}\\\">#{self.name_html}</a>\"\n end", "def format_as_block_html(name, attr, body, indent); end", "def link_4edit #:nodoc:\n html = ''\n return html unless @opts[:edit_mode] > 1\n \n @opts[:editparams].merge!( { table: 'dc_big_menu', controller: 'cmsedit', action: 'edit' } )\n title = \"#{t('drgcms.edit')}: \"\n @opts[:editparams].merge!( { id: @menu.id, title: \"#{title}#{@menu.name}\" } ) if @menu\n title << t('helpers.label.dc_big_menu.tabletitle')\n @opts[:editparams].merge!( { action: 'index', title: title }) if @menu.nil?\n html << dc_link_for_edit( @opts[:editparams] )\nend", "def link\n Html::Link.new(:href => url) << display_name\n end", "def link_to_page_with_label(label)\n return (\"<a href='/chefs/\" + self.id.to_s + \"'>\" + label + \"</a>\").html_safe\n end", "def crud_links(model, instance_name, actions, args={})\n _html = \"\"\n _options = args.keys.empty? ? '' : \", #{args.map{|k,v| \":#{k} => #{v}\"}}\"\n \n if use_crud_icons\n if actions.include?(:show)\n _html << eval(\"link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}\")\n end\n else\n if actions.include?(:show)\n _html << eval(\"link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}\")\n end\n end\n _html\n end", "def get_linked_short_name\n h.link_to( get_short_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def tab(*args)\n options = {:label => args.first.to_s.humanize}\n if args.last.is_a?(Hash)\n options = options.merge args.pop\n end\n\n url = options[:url] || send(\"admin_#{args.first}_path\")\n link = link_to(options[:label], url)\n \n if respond_to?(:parent_type)\n resource_name = parent_type || model_name\n else\n resource_name = 'dashboard'\n end\n \n if args.include?(resource_name.to_s.pluralize.to_sym)\n css_class = 'on'\n end\n content_tag('span', link, :class => css_class)\n end", "def link\n '-'\n end", "def render_record_in_list(record, controller_path)\n text = render_record_from_config(record)\n if record_select_config.link?\n url_options = {:controller => controller_path, :action => :select, :id => record.id, :escape => false}\n link_to text, url_options, :method => :post, :remote => true, :class => ''\n else\n text\n end\n end", "def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n end \n end\n end" ]
[ "0.6564911", "0.6518258", "0.6518258", "0.6109622", "0.6035642", "0.5927493", "0.59167856", "0.58894664", "0.5859699", "0.5800829", "0.57670516", "0.5765323", "0.57456344", "0.57155037", "0.57113117", "0.5708713", "0.56677127", "0.56396294", "0.5632076", "0.5614726", "0.55943376", "0.55706286", "0.5563566", "0.5546438", "0.5543892", "0.54831684", "0.5480948", "0.5474099", "0.5472755", "0.54619896", "0.5459004", "0.5449994", "0.5439689", "0.5439689", "0.5398276", "0.5392423", "0.53851664", "0.5348524", "0.5348524", "0.5348351", "0.53339005", "0.5329284", "0.5316455", "0.5310068", "0.5303225", "0.52918386", "0.52909523", "0.5249575", "0.5247942", "0.52419436", "0.5235044", "0.52231944", "0.5222951", "0.5217902", "0.52169114", "0.52116245", "0.521006", "0.5203632", "0.52023846", "0.5188648", "0.5185796", "0.51671326", "0.5156304", "0.5154012", "0.51489675", "0.51466763", "0.5138867", "0.51311374", "0.51289916", "0.5117892", "0.5117289", "0.51163566", "0.5112069", "0.51097786", "0.5101067", "0.5099718", "0.50925857", "0.50925463", "0.50911236", "0.5088265", "0.50715554", "0.5071346", "0.50619894", "0.505171", "0.5048336", "0.5048285", "0.5048285", "0.50464004", "0.5044265", "0.5026786", "0.5026601", "0.50245565", "0.50226027", "0.50159705", "0.5013806", "0.50109076", "0.5005127", "0.4997862", "0.4996047", "0.49925873" ]
0.77146125
0
Action link to show the row entry inside a table. A block may be given to define the link path for the row entry.
def action_col_show(table, &block) action_col(table) do |e| link_table_action('zoom-in', action_path(e, &block)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end", "def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end", "def action_col_show(table, &block)\n action_col(table) { |e| link_table_action('zoom-in', action_path(e, &block)) }\n end", "def row\n get_row\n respond_to_action(:row)\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def to_partial_path\n 'row'\n end", "def r_table_cell_action(label, link, link_options = {})\n link_to(label, link, link_options.merge(class: \"text-indigo-600 hover:text-indigo-900\"))\n end", "def show_row(object, method_name)\n content_tag(:tr,\n content_tag(:th, object.class.human_attribute_name(method_name.to_s)) +\n content_tag(:td, h(object.send(method_name))),\n :class => stripe_cycle\n )\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def within_row(*arguments, **options, &block)\n within(:row, *arguments, **options, &block)\n end", "def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n end \n end\n end", "def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end", "def action_link(action, prefix)\n html_class = \"actions #{action.to_s}_link\"\n block = lambda do |resource|\n compound_resource = [prefix, resource].compact\n compound_resource.flatten! if prefix.kind_of?(Array)\n case action\n when :show\n @template.link_to(link_title(action), compound_resource)\n when :destroy\n @template.link_to(link_title(action), compound_resource,\n :method => :delete, :confirm => confirmation_message)\n else # edit, other resource GET actions\n @template.link_to(link_title(action),\n @template.polymorphic_path(compound_resource, :action => action))\n end\n end\n self.cell(action, :heading => \"\", :cell_html => {:class => html_class}, &block)\n end", "def right_click_table_row(table, row_index)\n append_to_script \"right_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end", "def row(&block)\n @inside_row = true\n inner_html = @template.capture &block\n @inside_row = false\n\n @template.content_tag :div, inner_html, class: 'row'\n end", "def goto_row(row)\n \n set RGhost::Cursor.goto_row(row) \n end", "def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end", "def row\n @record = find_if_allowed(params[:id], :read)\n respond_to_action(:row)\n end", "def contextual_edit_block_path(block)\n active_model = get_active_model_by_path(block.models)\n active_model ? edit_model_path(active_model, :anchor => 'show_collapseable_BlocksFields') : edit_block_path(block)\n end", "def build_row_onclick(data_row)\n onclick = nil\n\n # Handle CI based report rows\n if ['EmsCluster', 'ExtManagementSystem', 'Host', 'Storage', 'Vm', 'Service'].include?(db) && data_row['id']\n controller = db == \"ExtManagementSystem\" ? \"management_system\" : db.underscore\n donav = \"DoNav('/#{controller}/show/#{data_row['id']}');\"\n title = data_row['name'] ?\n \"View #{ui_lookup(:model => db)} \\\"#{data_row['name']}\\\"\" :\n \"View this #{ui_lookup(:model => db)}\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='#{title}'\"\n end\n\n # Handle CI performance report rows\n if db.ends_with?(\"Performance\")\n if data_row['resource_id'] && data_row['resource_type'] # Base click thru on the related resource\n donav = \"DoNav('/#{data_row['resource_type'].underscore}/show/#{data_row['resource_id']}');\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='View #{ui_lookup(:model => data_row['resource_type'])} \\\"#{data_row['resource_name']}\\\"'\"\n end\n end\n\n onclick\n end", "def rows\n render 'rows.html'\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def build_link(master_u)\n icon_edit = '<span class=\"glyphicon glyphicon-edit\"></span>'\n icon_show = '<span class=\"glyphicon glyphicon-info-sign\"></span>'\n link = link_to(raw(icon_show), master_u)\n link += link_to(raw(icon_edit), edit_master_unit_path(master_u))\n raw('<div class=\"datatable-actions\">'+link+'</div>')\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def item_table_row(item)\n @fields ||= settings.fields + ['Added On']\n @item = item\n haml :_item, :layout => false\nend", "def get_hyperlink(row)\n URI.join(native_host, row.dig('uri')).to_s\n end", "def link_to_edit(path)\n link_to icon('edit'), path, title: 'Edit this record'\n end", "def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end", "def fb_tr(&block)\n content = capture(&block)\n concat(content_tag(:tr,content),block.binding)\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def datagrid_row(grid, asset, &block)\n HtmlRow.new(self, grid, asset).tap do |row|\n if block_given?\n return capture(row, &block)\n end\n end\n end", "def delete_link\n button_tag(t('.delete_row'), name: 'delete_row', class: 'ds_link', id: \"delete_row_#{index}\",\n value: index, 'aria-label' => \"#{t('.delete_row')} #{index}\")\n end", "def show_manage_cell_link\n link_to \"Manage\", sentence_show_manage_cell_path(model), remote: true\n end", "def each_row_streaming(&block)\n Roo::Utils.each_element(@path, 'row', &block)\n end", "def show\n @row = Row.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @row }\n end\n end", "def within_table_row(position, &block)\n row = find_all(\"table tr\")[position]\n within(row, &block)\nend", "def double_click_table_row(table, row_index)\n append_to_script \"double_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end", "def to_partial_path\n 'documents_submitted_row'\n end", "def ezm_link_to_trash_bin\r\n link_to \"Trash\", trashbin_url\r\n end", "def link_apply url, resource, options={}\n html = \"\"\n if permitted_to? :update, table_symbol_from(resource)\n html = \"<td class='link'>\"+tlink_to(\"apply\",url,{:target=>\"_blank\", :category=>:action})+\"</td>\"\n end\n html.html_safe\n end", "def row\n new_row = RowBuilder.new\n\n yield new_row\n\n @rows << new_row\n end", "def ar_show_link resource= @resource\n link_to(controller.ardata.labels[:show], ar_resource_path('', resource))\n end", "def summary_row(args={})\n\t\t'\n\t\t\t<tr>\n\t\t\t\t<td>' + self.created_at.strftime(\"%b %-d_%Y\") + '</td>\n\t\t\t\t<td>' + (self.payable_to_organization_id || \"-\") + '</td>\n\t\t\t\t<td>' + (self.payable_from_organization_id || \"-\") + '</td>\n\t\t\t\t<td>' + (self.payable_from_patient_id || \"-\") + '</td>\n\t\t\t\t<td>' + self.total.to_s + '</td>\n\t\t\t\t<td>' + self.paid.to_s + '</td>\n\t\t\t\t<td>' + self.pending.to_s + '</td>\n\t\t\t\t<td><div class=\"edit_nested_object\" data-id=' + self.unique_id_for_form_divs + '>Edit</div></td>\n\t\t\t</tr>\n\t\t'\n\tend", "def view_edit_link(user, attraction)\n if user.admin\n content_tag(:p, link_to(\"Edit Attraction\", edit_attraction_path(attraction)))\n end\n end", "def html_link(item)\n tag :a, yield, :href => item.url\n end", "def table_row(row, alignment)\n result = ''\n i = 0\n\n row.each_with_index do |e, k|\n next if alignment[k] == Constants::SEPARATOR\n\n text = inline_code(e, true)\n\n if /\\\\newline/ === text\n text = \"\\\\specialcell[t]{#{text}}\"\n text.gsub!(/\\\\newline/, '\\\\\\\\\\\\\\\\')\n end\n\n result << text\n result << ' & ' if k < row.size - 1\n i += 1\n end\n\n @io << \"#{result} \\\\\\\\\" << nl\n end", "def on_enter_row arow\n return nil if @list.nil? || @list.size == 0\n\n @repaint_footer_required = true\n\n ## can this be done once and stored, and one instance used since a lot of traversal will be done\n require 'canis/core/include/ractionevent'\n aev = TextActionEvent.new self, :ENTER_ROW, current_value().to_s, @current_index, @curpos\n fire_handler :ENTER_ROW, aev\n end", "def link\n raise ArgumentError, 'block not supplied' unless block_given?\n define_method { |*args, &block| yield caller, self, args, block }\n end", "def active_scaffold_column_download_link(column, record, label = nil)\n return nil if record.send(column.name).nil?\n label ||= as_(:download)\n if column.options[:secure_download]\n url_options = active_scaffold_column_download_link_url_options(column, record)\n else\n url_options = url_for_file_column(record, column.name.to_s)\n end\n link_to( label, url_options, :popup => true)\n end", "def table_row(row, alignment)\n\n result = ''\n i = 0\n\n row.each_with_index do |e, k|\n\n next if alignment[k] == Constants::SEPARATOR\n\n text = inline_code(e, true)\n\n if /\\\\newline/ === text\n text = \"\\\\specialcell[t]{#{text}}\"\n text.gsub!(/\\\\newline/, '\\\\\\\\\\\\\\\\')\n end\n\n result << text\n result << ' & ' if k < row.size - 1\n i += 1\n end\n\n @io << \"#{result} \\\\\\\\\" << nl\n end", "def before_row(&block)\n @before_row_handler = block\n end", "def link_menu(resource, options={})\n html= ' '\n if permitted_to? :index, table_symbol_from(resource) then\n if resource.is_a? Symbol then\n model_plural = resource.to_s\n else\n model= singular_table_name_from( resource).pluralize \n end\n a = link_to(tmenu(model_plural), eval(model_plural + \"_path\"), options) \n html = wrap_in_html_container a, 'li', 'menuItem'\n end\n #ebugger\n return html.html_safe\n end", "def rows_for(record, &block)\n [row_for(record)].product(*associated_rows_for(record), &block)\n end", "def link_table_action(icon, url, html_options = {})\n add_css_class html_options, \"icon-#{icon}\"\n link_to('', url, html_options)\n end", "def link_table_action(icon, url, html_options = {})\n add_css_class html_options, \"icon-#{icon}\"\n link_to('', url, html_options)\n end", "def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end", "def show\n respond_to do |format|\n format.html { render :partial => 'show', :locals => { :record => @link }, :layout => 'admin/admin_show' }\n format.xml { render :xml => @link }\n end\n end", "def display_row(row, width = HOLE_SIZE, new_line = true, tab = true)\n\t\tprint \"\\t\" if tab\n\t\trow.each do |hole_color| \n\t\t\tprint SEPARATOR[:vertical]\n\t\t\tprint Mastermind::colorize(\" \" * width, \n\t\t\t\t Mastermind::get_color_code(hole_color))\n\t\tend\n\t\tprint SEPARATOR[:vertical]\n\t\tputs if new_line\n\tend", "def replace_row(&block)\n @replace_row_handler = block\n end", "def row_id(&block)\n @row_id_proc = block\n end", "def view_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'view')\n # text to be displayed\n link_text = crud_link_text(options, 'view')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'view-' + link_id(object)\n options[:title] = 'View this ' + resource_name\n\n if defined? CanCan\n link += link_to link_text, url_for(resource), options if can?(:read, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n\n link\n end", "def action_path(e, &block)\n block_given? ? yield(e) : path_args(e)\n end", "def action_path(e, &block)\n block_given? ? yield(e) : path_args(e)\n end", "def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end", "def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end", "def render_cell(column_name,cell_value,record)\n if column_name == \"show_records\"\n id_string = \"\"\n text = \"show records\"\n keys = record.keys\n keys.each do |key|\n val = \"\"\n if record[key].to_s.index(\" \")!= nil\n val = record[key].to_s.gsub(\" \",\"se2345se\")\n else\n val = record[key].to_s\n end\n if key.to_s.upcase().index(\"COUNT\") == nil && key.to_s.upcase().index(\"AVG\") == nil && key.to_s.upcase().index(\"SUM\") == nil && key.to_s.upcase().index(\"MIN\") == nil && key.to_s.upcase().index(\"MAX\") == nil\n if id_string != \"\"\n id_string += \"!\" + key.to_s + \"-3457-\" + val\n else\n id_string += key.to_s + \"-3457-\" + val\n end\n end\n end\n\n link_url = @env.link_to(text, \"http://\" + @request.host_with_port + \"/\" + \"reports/reports/show_records\" + \"?id=\" + id_string , {:class=>'action_link'})\n return link_url\n end\n return \"\" \n end", "def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end", "def edit_button_table(model, link_args = {})\n link_args[:class] = 'btn-warning btn-xs' + (link_args[:class] || '')\n link_args[:additional_I18n] = 'short'\n action_button :edit, model, link_args\n end", "def table_for(value, options = {}, &block)\n view(value, options.merge(:as => :table), &block)\n end", "def link_to( *args, &link_block )\n if block_given?\n name = @template.capture(&link_block)\n options = args.first || {}\n html_options = args.second || {}\n\n link_to_in_block( name, options, html_options, &link_block )\n else\n name = args[0]\n options = args[1] || {}\n html_options = args[2] || {}\n\n link_to_in_html( name, options, html_options )\n end.tap { @item_count += 1 } # Increment the number of links generated (and still return markup)\n end", "def after_row(&block)\n @after_row_handler = block\n end", "def outputRow (sid, type) \n\n $sumSheet.add_row [ sid, type, \"1\", \"2\", \"3\", \"4\", \"5\" ], :style => $black_cell \n\n if sid.odd?\n link = \"A#{$curRow}\" \n puts \"outputRow: sid: #{sid}, link: #{link}\" \n # Setting the style for the link will apply the xf that we created in the Main Program block\n $sumSheet[link].style = $blue_link\n $sumSheet.add_hyperlink :location => \"'Log'!A#{$curRow}\", :target => :sheet, :ref => link \n end\n $curRow += 1 \nend", "def table(options = {}, &block)\n table_for(collection, options.merge(:class => resource_class), &block)\n end", "def construct_table_row(user)\n result = {}\n result[:id] = user.id\n result[:user_name] = CGI.escapeHTML(user.user_name)\n result[:first_name] = CGI.escapeHTML(user.first_name)\n result[:last_name] = CGI.escapeHTML(user.last_name)\n @render_note_link = false\n if user.student?\n result[:grace_credits] = user.remaining_grace_credits.to_s + '/' + user.grace_credits.to_s\n if user.has_section?\n result[:section] = user.section.name\n else\n result[:section] = '-'\n end\n @render_note_link = true\n end\n result[:hidden] = user.hidden\n result[:filter_table_row_contents] =\n render_to_string :partial => 'users/table_row/filter_table_row',\n :formats => [:html], :handlers => [:erb],\n :locals => {:user => user,\n :controller => self.controller_name,\n :render_note_link => @render_note_link}\n result\n end", "def dt_actions\n edith_path = object.variant.is_master? ? h.edit_admin_product_path(object.product.id) : h.edit_admin_product_variant_path(object.product.id, object.variant_id)\n h.content_tag(:div, class: 'large ui compact icon buttons') do\n h.link_to(edith_path, target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white edit icon')\n end +\n h.link_to(h.admin_product_images_path(object.product.id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white images icon')\n end +\n h.link_to(h.product_path(object.product.id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large icons') do\n h.content_tag(:i, '', class: 'white desktop icon')+\n h.content_tag(:i, '', class: 'top right corner white eye icon')\n end\n end +\n h.link_to(h.stock_admin_product_path(object.product.id, variant: object.variant_id, stock_location: object.stock_location_id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white dolly icon')\n end +\n h.link_to(h.volume_prices_admin_product_variant_path(product_id: object.product.id, id: object.variant_id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large icons') do\n h.content_tag(:i, '', class: 'white clipboard list icon')+\n h.content_tag(:i, '', class: 'top right corner white dollar sign icon')\n end\n end\n end\n end", "def outputRow(sid, type)\n $sumSheet.add_row [sid, type, '1', '2', '3', '4', '5'], style: $black_cell\n\n if sid.odd?\n link = \"A#{$curRow}\"\n puts \"outputRow: sid: #{sid}, link: #{link}\"\n # Setting the style for the link will apply the xf that we created in the Main Program block\n $sumSheet[link].style = $blue_link\n $sumSheet.add_hyperlink location: \"'Log'!A#{$curRow}\", target: :sheet, ref: link\n end\n $curRow += 1\nend", "def action_column(options={}, &block)\n case mode\n when :header\n \"<th>#{I18n.t(:'link.actions')}</th>\".html_safe\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = [td_options[:class]].flatten || []\n td_options[:class] << 'actions'\n td_options[:class] = td_options[:class].compact.join(' ')\n res = \"<td #{ to_attr(td_options) }><ul class='actions'>\"\n res << @template.capture(&block)\n res << \"</ul></td>\"\n res.html_safe\n end\n end", "def render_row (class_prefix, key=nil, value=nil, tooltip=nil)\n\n row_id = if key\n \"r\" + (key.to_s + value.to_s).hash.to_s\n else\n nil\n end\n\n unless key\n key = \"&nbsp;\"\n value = \"&nbsp;\"\n end\n\n key = h(key)\n value = h(value) unless value.to_s[0, 1] == '<'\n\n s = \"\"\n s << \"<div\"\n s << \" class='#{class_prefix}_entry'\"\n\n if row_id\n s << \" id='#{row_id}'\"\n s << \" onmouseover=\\\"\"+omover(row_id, \"#{class_prefix}_entry_over\")+\"\\\"\"\n s << \" onmouseout=\\\"\"+omout(row_id, \"#{class_prefix}_entry_over\")+\"\\\"\"\n end\n\n s << \">\"\n s << \"<div class='#{class_prefix}_key'\"\n s << \" title='#{tooltip}'\" if tooltip\n s << \">#{key}</div>\"\n s << \"<div class='#{class_prefix}_value'>#{value}</div>\"\n s << \"<div style='clear:both;'></div>\"\n s << \"</div>\"\n\n s\n end", "def link_to_show(text, path, options={})\n link_to_action(text, path, options.reverse_merge(:action => :show))\n end", "def entry_link(intended_entry, options = {})\n\n # Since the default in Rails 5 url_helper is moving to *_url not *_path we\n # set the option[:only_path] to true by default\n options[:only_path].nil? && options[:only_path] = true\n\n entry_path(intended_entry, options)\n end", "def to_partial_path\n 'contact_details_row'\n end", "def apphelp_protected_show_link( obj, name = nil )\n return apphelp_unknown_quantity_warning() if ( obj.nil? )\n\n name = obj.name if ( name.nil? )\n link = apphelp_protected_link_to(\n :show,\n {\n :model => obj.class,\n :method => :url_for\n },\n obj\n ) { h( name ) }\n\n return ( link.empty? ) ? h( name ) : link\n end", "def last_row(&block)\n @last_row_handler = block\n end", "def link_to_all_entries(page)\n url = admin_page_entries_path page\n link_to 'View All', url, class: 'button'\n end", "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :confirm => ti(:confirm_delete),\n :method => :delete)\n end\n end", "def show_table\n build_html do\n if paths.keys.length == 0\n div.which_filesets do\n span \"Did not find any shipped files matching #{path}\"\n end\n else\n table.which_filesets do\n thead do\n tr do\n th '#'\n th 'Path'\n th 'Lpp'\n end\n end\n tbody do\n index = 0\n paths.each_pair do |path, lpps|\n lpps.each do |lpp|\n tr do\n td index += 1\n td path\n td link_to(lpp, swinfo_get_path(lpp))\n end\n end\n end\n end\n end\n end\n end\n end", "def crud_table(*attrs, &block)\n options = attrs.extract_options!\n attributes = (block_given? || attrs.present?) ? attrs : default_attrs\n first = attributes.shift\n table(entries, options) do |t|\n col_show(t, first) if first\n t.sortable_attrs(*attributes)\n yield t if block_given?\n add_table_actions(t)\n end\n end", "def on_enter_row arow\n super\n # TODO check if user wants focus to be showed\n ## this results in the row being entered and left being evaluated and repainted\n # which means that the focussed row can be bolded. The renderer's +render+ method will be triggered\n if @should_show_focus\n fire_row_changed @oldindex\n fire_row_changed arow\n end\n end", "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :data => { :confirm => ti(:confirm_delete),\n :method => :delete })\n end\n end", "def show_link(ems, options = {})\n ems_path(ems.id, options)\n end", "def row_for(user, charges)\n\t\n\tend", "def table_for(resources, *args, &block)\n self.table_id += 1\n options = args.extract_options!\n builder = TableFor::TableBuilder.new(self, resources, options, self.table_id)\n yield(builder) if block_given?\n\n self.context.render_page_for(partial: \"table\", locals: { table_builder: builder, resources: resources, page: self })\n end", "def submit_block(link)\n @template.content_tag(:div, :class => \"pull-right\") do\n submit(:class => \"btn btn-primary\") + @template.content_tag(:span, @template.admin_t(:or), :class => \"or\") + @template.cancel_link(link)\n end\n end", "def apphelp_index_actions( name, obj, user_id_or_obj = nil )\n\n if ( user_id_or_obj.nil? )\n show_method = \"#{ name }_path\"\n edit_method = \"edit_#{ name }_path\"\n arg = obj\n elsif ( user_id_or_obj.is_a?( String ) || user_id_or_obj.is_a?( Fixnum ) )\n show_method = \"user_#{ name }_path\"\n edit_method = \"edit_user_#{ name }_path\"\n arg = { :id => obj.id, :user_id => user_id_or_obj }\n else\n resname = user_id_or_obj.class.table_name.singularize\n show_method = \"#{ resname }_#{ name }_path\"\n edit_method = \"edit_#{ resname }_#{ name }_path\"\n arg = { :id => obj.id }\n arg[ \"#{ resname }_id\".to_sym ] = user_id_or_obj.id\n end\n\n show = apphelp_protected_link_to( :show, { :short => true, :method => show_method }, arg )\n edit = apphelp_protected_link_to( :edit, { :short => true, :method => edit_method }, arg )\n\n if ( respond_to? \"delete_#{ name }_path\" )\n dsty = apphelp_protected_link_to( :delete, { :short => true, :method => \"delete_#{ name }_path\" }, obj )\n else\n dsty = apphelp_protected_delete_button( obj )\n end\n\n result = \"<table class=\\\"no_border\\\" border=\\\"0\\\"><tr>\"\n\n result << '<td>' << show << '</td>' unless ( show.empty? )\n result << '<td>' << edit << '</td>' unless ( edit.empty? )\n result << '<td>' << dsty << '</td>' unless ( dsty.empty? )\n\n return result << \"</tr></table>\"\n end", "def form_row(&block)\n @template.concat @template.content_tag(:div, @template.capture(&block), :class => 'box_container')\n end", "def link_at address , context\n super #just sets the position\n @entry.link_at address , context\n address += @entry.length\n @blocks.each do |block|\n block.link_at(pos , context)\n pos += block.length\n end\n end" ]
[ "0.66657925", "0.6494846", "0.6316912", "0.62980616", "0.6172614", "0.6172614", "0.601025", "0.5869467", "0.586942", "0.5764227", "0.5764227", "0.5711135", "0.56855345", "0.5682822", "0.5682309", "0.56200075", "0.55924344", "0.5583496", "0.55549395", "0.55393124", "0.5508647", "0.54961973", "0.54756385", "0.5461766", "0.5410528", "0.5386645", "0.5386645", "0.5377066", "0.53510463", "0.53358144", "0.5314008", "0.53137195", "0.52994084", "0.52994084", "0.52616936", "0.5249223", "0.5225235", "0.5215342", "0.51798016", "0.51746017", "0.517373", "0.5148387", "0.5115441", "0.5109853", "0.51044923", "0.5101468", "0.5100101", "0.5089115", "0.50859135", "0.5076308", "0.50759786", "0.50683343", "0.50662917", "0.5064842", "0.5062813", "0.504889", "0.50482446", "0.50426096", "0.50426096", "0.5034171", "0.5024816", "0.502048", "0.5019421", "0.50159353", "0.50080246", "0.49894395", "0.49894395", "0.49883264", "0.49883264", "0.49841446", "0.49825734", "0.4982292", "0.4979567", "0.49782035", "0.497622", "0.49740022", "0.49621534", "0.495879", "0.49464056", "0.49414527", "0.4938529", "0.49305066", "0.49127027", "0.49118513", "0.48976743", "0.4896756", "0.4892209", "0.48895624", "0.4887989", "0.48782444", "0.4871211", "0.4867468", "0.486396", "0.4863654", "0.4861672", "0.4860337", "0.4853523", "0.48439363", "0.48397142", "0.4824485" ]
0.6368461
2
Action link to edit inside a table. A block may be given to define the link path for the row entry.
def action_col_edit(table, &block) action_col(table) do |e| path = action_path(e, &block) link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def link_to_edit(path)\n link_to icon('edit'), path, title: 'Edit this record'\n end", "def contextual_edit_block_path(block)\n active_model = get_active_model_by_path(block.models)\n active_model ? edit_model_path(active_model, :anchor => 'show_collapseable_BlocksFields') : edit_block_path(block)\n end", "def link_to_edit(path)\n link_to 'Edit', path, class: 'btn btn-default btn-xs'\n end", "def edit_link(obj, options = {})\n if policy(obj).edit?\n url = polymorphic_url([:edit] + Array(obj))\n action_link('Edit', url, 'pencil', options)\n end\n end", "def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end", "def edit_link(path)\n\t\tif user_signed_in? && current_user.editor?\n\t\t\tlink_to(\"<span class='glyphicon glyphicon-pencil'> Editar\".html_safe, path)\n\t\telse\t\n\t\t\t'<a data-toggle=\"modal\" data-target=\"#can-not-edit-modal\"> <span class=\"glyphicon glyphicon-pencil\"> Editar</a>'.html_safe\n\t\tend\n\tend", "def link_to_edit(path, *options)\n link_to path,\n class: \"btn btn-warning btn-sm\",\n title: \"Alterar\",\n style: \"color: #FFF; \" do\n content_tag :span, class: \"fa fa-pencil\" do\n options.first[:label] if options.present? && options.first[:label]\n end\n\n end\n end", "def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end", "def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end", "def link_to_edit(text, path, options={})\n unless path.is_a? String\n path = options.delete(:url) || edit_polymorphic_path(path)\n end\n link_to_action(text, path, options.reverse_merge(:action => :edit))\n end", "def visit_edit_page(model, **opt, &block)\n action = opt[:id] ? :edit : :edit_select\n visit_action_page(model, action, **opt, &block)\n end", "def link_to_edit(path)\n link_to image_tag('icons/001_45.png',\n :size => ICON_SIZE,\n :alt => 'Edit'), path\n end", "def edit_button_table(model, link_args = {})\n link_args[:class] = 'btn-warning btn-xs' + (link_args[:class] || '')\n link_args[:additional_I18n] = 'short'\n action_button :edit, model, link_args\n end", "def link_4edit #:nodoc:\n html = ''\n return html unless @opts[:edit_mode] > 1\n \n @opts[:editparams].merge!( { table: 'dc_big_menu', controller: 'cmsedit', action: 'edit' } )\n title = \"#{t('drgcms.edit')}: \"\n @opts[:editparams].merge!( { id: @menu.id, title: \"#{title}#{@menu.name}\" } ) if @menu\n title << t('helpers.label.dc_big_menu.tabletitle')\n @opts[:editparams].merge!( { action: 'index', title: title }) if @menu.nil?\n html << dc_link_for_edit( @opts[:editparams] )\nend", "def view_edit_link(user, attraction)\n if user.admin\n content_tag(:p, link_to(\"Edit Attraction\", edit_attraction_path(attraction)))\n end\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def button_to_edit(record, options={})\n button_to_action record, :edit, options\n end", "def edit_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'edit')\n # text to be displayed\n link_text = crud_link_text(options, 'edit')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'edit-' + link_id(object)\n options[:title] = 'Edit this ' + resource_name\n\n case true\n when defined? CanCan\n if resource.is_a?(Array)\n # check if we can access directly via a shallow route\n begin\n if url_for([:edit, object])\n link += link_to link_text, url_for([:edit, object]), options if can?(:edit, object)\n else\n link += link_to link_text, url_for(resource.unshift(:edit)), options if can?(:edit, object)\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource.unshift(:edit)), options if can?(:edit, object)\n end\n else\n link += link_to link_text, url_for([:edit, resource]), options if can?(:edit, object)\n end\n else\n if resource.is_a?(Array)\n # check if we can access directly via a shallow route\n begin\n if url_for([:edit, object])\n link += link_to link_text, url_for([:edit, object]), options\n else\n link += link_to link_text, url_for(resource.unshift(:edit)), options\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource.unshift(:edit)), options\n end\n else\n link += link_to link_text, url_for([:edit, resource]), options\n end\n end\n\n link\n end", "def edit\n resource.prepare_links\n\n super\n end", "def edit_item_path(model)\n helper_name = 'edit_admin_'\n helper_name += \"#{current_container.class.to_s.underscore}_\" if current_container\n helper_name += model.to_s.underscore + '_path'\n args = current_container ? [current_container] : []\n send(helper_name, *args)\n end", "def edit_link(obj)\n \tcase obj.class.to_s\n \t when \"Tenant\"\n \t edit_tenant_path(obj)\n \t when \"Semester\"\n \t edit_semester_path(obj)\n \t when \"Department\"\n \t edit_department_path(obj)\n \t when \"Subject\"\n \t edit_subject_path(obj) \t \n \t when \"Faculty\"\n \t edit_faculty_path(obj)\n \t when \"Exam\"\n \t edit_exam_path(obj)\n \t when \"Batch\"\n \t edit_batch_path(obj) \t \t \t \n \t when \"SchoolType\"\n \t edit_school_type_path(obj) \t \n \t when \"Student\"\n \t edit_student_path(obj) \t \t\n \t when \"Section\"\n \t edit_section_path(obj)\n \t when \"BloodGroup\"\n \t edit_blood_group_path(obj)\n \t when \"Resource\"\n \t edit_resource_path(obj)\n \t when \"Role\"\n \t edit_role_path(obj) \t \t \t\n \t when \"UserProfile\"\n \t edit_user_profile_path(obj) \n \t when \"Grade\"\n \t edit_grade_path(obj) \t \t \t \t \t \t \n \t when nil\n \t nil\n end\n end", "def edit_path(path)\n url('/e/' + path)\n end", "def link_to_edit_with_text(resource, options = {})\n name = ('<i class=\"icon-pencil\"></i> '+t(:'gaku_helpers.edit')).html_safe\n attributes = {:class => \"span12 btn edit-link\"}.merge(options)\n link_to name, resource, attributes\n end", "def link_to_edit(resource, options = {})\n name = (\"<i class='icon-white icon-edit'></i>\").html_safe\n attributes = {\n :class => \"mr-xs btn btn-mini btn-inverse edit-link\",\n }.merge(options)\n link_to name, resource, attributes\n end", "def edit_thing_path(model, object)\n id = object['ID'] || object['id']\n send(:\"edit_admin_#{undersingularize(model)}_path\", id: id)\n end", "def click_edit(the_name)\n response.should contain the_name\n click_link_within \"div[id*=\\\"\"+to_html_tag(the_name)+\"\\\"]\", \"Edit\"\n end", "def click_edit(the_name)\n response.should contain the_name\n click_link_within \"div[id*=\\\"\"+to_html_tag(the_name)+\"\\\"]\", \"Edit\"\n end", "def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n end \n end\n end", "def edit_button(destination_path)\n # Consider using:\n # ActionDispatch::Routing::PolymorphicRoutes::edit_polymorphic_path(@object)\n @template.link_to I18n.t('form.edit'), destination_path,\n class: \"btn btn-primary\"\n end", "def link_to_edit_entry_template(page)\n url = admin_page_path page, entries: 1\n link_to 'Edit Entry Template', url, class: 'button'\n end", "def edit_button_to(path, text = t('edit'))\n link_to path, class: 'button small warning' do\n concat text\n end\n end", "def edit_path\n \"/answers/#{object.id}/edit\"\n end", "def edit(&block)\n return @sections[:update] unless block_given?\n [:create, :update].each do |s|\n @sections[s].instance_eval &block\n end\n end", "def content_edit_action_item(text=nil, &block)\n icon = content_tag(:div, '', :class => 'iconEditSmall')\n content_action_item(text, icon, &block)\n end", "def edit(&block)\n respond_with(entry, &block)\n end", "def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end", "def edit(&block)\n instance_eval(&block)\n end", "def link_to_edit_index_template(page)\n url = admin_page_path page\n link_to 'Edit Index Tempate', url, class: 'button'\n end", "def link_to_edit(objeto)\n link_to image_tag(\"icons/pencil.png\", :alt => \"editar objeto\"), \n edit_polymorphic_path(objeto), :title => \"Modificar objeto\"\n end", "def edit\n add_breadcrumb I18n.t('integral.actions.view'), backend_resource_url(@resource)\n add_breadcrumb I18n.t('integral.actions.edit')\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def edit(&block)\n self.instance_eval(&block)\n end", "def edit_button(target:, name: :EDIT.t, **args)\n # necessary if nil/empty string passed\n name = :EDIT.t if name.blank?\n path, identifier, icon, content = button_atts(:edit, target, args, name)\n\n html_options = {\n class: class_names(identifier, args[:class]), # usually also btn\n title: name, data: { toggle: \"tooltip\", placement: \"top\", title: name }\n }.merge(args.except(:class, :back))\n\n link_to(path, html_options) do\n [content, icon].safe_join\n end\n end", "def edit\n\n end", "def action_col_show(table, &block)\n action_col(table) do |e| \n link_table_action('zoom-in', action_path(e, &block))\n end\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\r\n end", "def edit\r\n \r\n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit_page(obj)\n page do\n t = String.new\n form_attr = form_attributes(:action=>url_for(\"update/#{model.primary_key_value(obj)}\"))\n t << Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n model.columns_for(:edit, request).each do |column|\n col_opts = column_options_for(:edit, request, obj, column)\n if html = model.edit_html_for(obj, column, :edit, request)\n col_opts = col_opts.merge(:html=>html)\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Update', :class=>'btn btn-primary')\n end\n if model.supported_action?(:delete, request)\n t << Forme.form(form_attributes(:action=>url_for(\"delete/#{model.primary_key_value(obj)}\")), form_opts) do |f|\n f.button(:value=>'Delete', :class=>'btn btn-danger')\n end\n end\n t << association_links(obj)\n end\n end", "def edit\n\n end", "def edit_resource_url(object)\n send route_prefix_to_method_name(\"edit_#{class_name.model_name.singular_route_key}_url\"),\n object\n end", "def action_col_show(table, &block)\n action_col(table) { |e| link_table_action('zoom-in', action_path(e, &block)) }\n end", "def edit\n\t\t\n\tend", "def r_table_cell_action(label, link, link_options = {})\n link_to(label, link, link_options.merge(class: \"text-indigo-600 hover:text-indigo-900\"))\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" ]
[ "0.7418714", "0.7418714", "0.7009814", "0.6940941", "0.6645491", "0.65837044", "0.6402713", "0.6399663", "0.6365207", "0.63572574", "0.63572574", "0.63283", "0.6326858", "0.62960666", "0.6292471", "0.62249035", "0.620171", "0.6176942", "0.6176942", "0.61269784", "0.61239785", "0.6091775", "0.60271394", "0.59429574", "0.5922219", "0.5908049", "0.5907439", "0.5899907", "0.58845997", "0.58840805", "0.586164", "0.5853467", "0.58509654", "0.58321875", "0.5824472", "0.5783691", "0.57831126", "0.57789385", "0.5778322", "0.57762164", "0.5773894", "0.57678705", "0.5743363", "0.572765", "0.5726026", "0.57217616", "0.57187116", "0.5712823", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.57087785", "0.5706747", "0.57025176", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5700705", "0.5679987", "0.5674454", "0.567282", "0.565431", "0.5643471", "0.56433356", "0.5641891", "0.5641891", "0.5641891", "0.5641891", "0.5641891", "0.5641891", "0.5641891", "0.5641891", "0.5641891" ]
0.8110266
1
Action link to destroy inside a table. A block may be given to define the link path for the row entry.
def action_col_destroy(table, &block) action_col(table) do |e| link_table_action('remove', action_path(e, &block), :data => { :confirm => ti(:confirm_delete), :method => :delete }) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :confirm => ti(:confirm_delete),\n :method => :delete)\n end\n end", "def link_action_destroy(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.delete\"), 'remove', path,\n :confirm => ti(:confirm_delete),\n :method => :delete\n end", "def link_action_destroy(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.delete\"), 'remove', path,\n :data => { :confirm => ti(:confirm_delete),\n :method => :delete }\n end", "def delete_link\n button_tag(t('.delete_row'), name: 'delete_row', class: 'ds_link', id: \"delete_row_#{index}\",\n value: index, 'aria-label' => \"#{t('.delete_row')} #{index}\")\n end", "def destroy_block(user)\n delete \"blocks/destroy/#{user}\"\n end", "def link_to_destroy(path)\n link_to icon('remove-sign'), path, :confirm => 'Are you sure?', :method => :delete, title: 'Delete this record'\n end", "def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end", "def delete_block\n Block.destroy(params[:id])\n render :text => \"Block with ID #{params[:id]} was successfully destroyed.\"\n end", "def destroy_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'destroy')\n # text to be displayed\n link_text = crud_link_text(options, 'destroy')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'delete-' + link_id(object)\n options[:title] = 'Delete this ' + resource_name\n options[:confirm] = \"Are you sure you want to delete this #{resource_name}? This may not be recoverable once destroyed.\"\n options[:method] = :delete\n options[:data] = {\n confirm_fade: true,\n confirm_title: options[:title],\n confirm_cancel: 'Cancel',\n confirm_proceed: 'Got it. Proceed.',\n confirm_proceed_class: 'btn-danger'\n }\n\n if resource.is_a?(Array) && resource.include?(:edit)\n resource.delete(:edit)\n end\n\n if defined? CanCan\n # check if we can access directly via a shallow route\n begin\n if url_for([:destroy, object])\n link += link_to link_text, url_for([:destroy, object]), options if can?(:destroy, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource), options if can?(:destroy, object)\n end\n else\n # check if we can access directly via a shallow route\n begin\n if url_for([:destroy, object])\n link += link_to link_text, url_for([:destroy, object]), options\n else\n link += link_to link_text, url_for(resource), options\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource), options\n end\n end\n\n link\n end", "def link_to_deleting(entity = @entity, text = \"削除する\", options = {}, html_options = {})\n link_to_altering(entity, text, :destroying, options, html_options)\n end", "def destroy\n @block.destroy\n\n head :no_content\n end", "def destroy_link_remote(path)\n\t\tlink_to get_icon('remove'), path, \"data-type\" => :json, :remote => true, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-danger', :title => t('site.destroy')\n\tend", "def delete_link(obj, options = {})\n if policy(obj).destroy?\n default_options = { data: {\n confirm: 'Are you sure? There is no undo for this!',\n tooltip: 'Delete',\n method: 'Delete',\n remote: 'true'\n } }\n url = polymorphic_url(obj)\n action_link('Delete', url, 'trash-o', default_options.deep_merge(options))\n end\n end", "def destroy\n @<%= singular_table_name %>.destroy\n respond_to do |format|\n format.html { redirect_to <%= table_name %>_url }\n format.json { head :no_content }\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def link_to_remove(path)\n link_to path,\n method: \"delete\",\n class: \"btn btn-danger btn-sm\",\n title: \"Excluir\",\n data: { confirm: label_translate(:confirm_delete),\n 'confirm-button-text': \"Confirmar\",\n 'cancel-button-text': \"Cancelar\",\n 'confirm-button-color': \"#66CD00\",\n 'cancel-button-color': \"#ff0000\",\n 'sweet-alert-type': \"warning\",\n },\n style: \"color: #FFF; float: none;\" do\n content_tag :span, class: \"fa fa-trash-o\" do\n end\n end\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n redirect_to :back\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n end\n end", "def destroy(table)\n end", "def destroy\n @userblock = Userblock.find(params[:id])\n @userblock.destroy\n\n respond_to do |format|\n format.html { redirect_to(userblocks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @row.destroy\n respond_to do |format|\n format.html { redirect_to rows_url, notice: 'Row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def admin_delete(text = \"Delete\", url: nil, confirm: \"Are you sure?\", data: {}, **kwargs)\n return unless object.persisted?\n\n link_to(text, url || url_for(action: :destroy),\n class: \"button button--secondary\",\n data: data.reverse_merge(turbo_method: :delete, turbo_confirm: confirm),\n **kwargs)\n end", "def destroy\n @container = @container_row.container\n @container_row.destroy\n respond_to do |format|\n flash[:success] = 'Row was successfully deleted.' \n format.html { redirect_to admin_container_url(@container) }\n format.json { head :no_content }\n end\n end", "def link_to_destroy(path)\n link_to image_tag('icons/001_05.png',\n :size => ICON_SIZE,\n :alt => 'Delete'), path,\n :confirm => 'Are you sure?', :method => :delete\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def api_remove_link(name, model, association, object, confirm, html_options = nil, &block)\n name, model, association, object, html_options = block, name, model, association, object if block_given?\n html_options ||= {}\n id, url, i18n_key = get_api_relationship_info(model, association, :remove)\n new_options = {\n title: t(i18n_key % 'button'),\n data: {\n remote: true, method: :delete, type: :jsonapi,\n params: [type: object.model_name.route_key, id: object.id],\n 'success-message': t((i18n_key % 'message') + 'Success',\n model: get_name_for(model), association: get_name_for(object))\n }\n }\n new_options[:data][:confirm] = t('general.message.confirmRemoveLong', subject: get_name_for(object)) if confirm\n render_button(name, :remove, i18n_key, url, html_options.deep_merge(new_options))\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def delete_content_block(name, div_wrapper_id, existing)\n data = { confirm: 'Are you sure?', content_block: \"#content-block-#{div_wrapper_id}-wrapper\" }\n data[:destroy_field] = \"#destroy-#{div_wrapper_id}\" if existing\n link_to(name, '#', data: data, class: 'small-button delete delete-content-block')\n end", "def delete(name,&block)\n build_resource(name, :delete, &block)\n end", "def destroy\n @users_block.destroy\n respond_to do |format|\n format.html { redirect_to block_path, notice: 'Block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end", "def destroy\n @block = @site.blocks.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @container_row = @row_column.container_row\n @row_column.destroy\n respond_to do |format|\n flash[:success] = 'Column was successfully deleted.'\n format.html { redirect_to admin_container_row_url(@container_row) }\n format.json { head :no_content }\n end\n end", "def delete(&block)\n @block_args.delete(block)\n end", "def destroy\n\n # delete associate block\n Block.where(parent_id: params[:id]).each do |block|\n Block.where(parent_id: block.id).destroy_all\n block.destroy\n end\n\n # delete the main block\n @block.destroy\n\n redirect_to :back\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @twitter_block = TwitterBlock.find(params[:id])\n @twitter_block.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_twitter_blocks_path, :notice => t('twitter_blocks.successfully_deleted') }\n format.json { head :ok }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url, notice: 'Block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_link.destroy\n end", "def link_to_remove_nested_item(fields = nil, class_for_remove = nil)\n new_record = fields.nil? || fields.object.new_record?\n out = ''\n unless new_record\n out << fields.hidden_field(\n :_destroy, class: :destroy,\n value: fields.object.marked_for_destruction? ? 1 : 0\n )\n end\n\n out << link_to(\n '&#x2718;'.html_safe, '#', title: t('label.delete'), class: 'iconic',\n 'data-target' => \".#{class_for_remove || fields.object.class.name.underscore}\",\n 'data-event' => (new_record ? 'removeItem' : 'hideItem')\n )\n\n raw out\n end", "def destroy\n @library_row.destroy\n respond_to do |format|\n format.html { redirect_to library_rows_url, notice: 'Library row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def link_to_delete(path)\n link_to 'Delete', path,\n data: { confirm: 'Are you sure you want to delete?' },\n method: 'delete',\n class: 'btn btn-danger btn-xs'\n end", "def link_to_destroy(objeto)\n link_to image_tag(\"icons/delete.png\", :alt => \"eliminar objeto\"), \n objeto, :method => :delete, :title => \"Destruir objeto\", \n :confirm => 'Eliminaré el registro. ¿Estás segur@?'\n end", "def destroy\n destroy_and_respond(@link)\n end", "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to blocks_url, notice: 'Block was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def visit_delete_page(model, **opt, &block)\n action = opt[:id] ? :delete : :delete_select\n visit_action_page(model, action, **opt, &block)\n end", "def destroy\n @<%= orm_instance.destroy %>\n respond_with @<%= singular_table_name %>\n end", "def destroy\n @task_row = TaskRow.find(params[:id])\n @task_row.destroy\n\n respond_to do |format|\n format.html { redirect_to(task_rows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rowempl = Rowempl.find(params[:id])\n @rowempl.destroy\n\n respond_to do |format|\n format.html { redirect_to rowempls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @row = Row.find(params[:id])\n @row.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n format.json { head :no_content }\n end\n end", "def destroy\n @section_row.destroy\n respond_to do |format|\n flash[:success] = \"Section row was successfully destroyed.\"\n format.html { redirect_to section_rows_url }\n format.json { head :no_content }\n end\n end", "def delete_object_link(pid, asset_type_display=\"asset\")\n result = \"\"\n result << \"<a href=\\\"\\#delete_dialog\\\" class=\\\"inline\\\">Delete this #{asset_type_display}</a>\"\n result << '<div style=\"display:none\"><div id=\"delete_dialog\">'\n result << \"<p>Do you want to permanently delete this object from the repository?</p>\"\n result << form_tag(url_for(:action => \"destroy\", :controller => \"objects\", :id => pid, :method => \"delete\"))\n result << hidden_field_tag(\"_method\", \"delete\")\n result << submit_tag(\"Yes, delete\")\n result << \"</form>\"\n result << '</div></div>'\n\n return result\n end", "def delete_link\n link_to 'Delete', blog_post_path(model), method: :delete\n end", "def link_delete\n @linkalation = Linkalation.find_by_link_id_and_user_id(params[:link], current_user.id)\n\n @linkalation[0].destroy\n\n render :nothing => true\n end", "def destroy_button_to(path, text = t('destroy'))\n link_to path,\n class: 'button small alert',\n data: { confirm: t('are_you_sure') },\n method: :delete do\n concat text\n end\n end", "def destroy\n @table.destroy\n respond_to do |format|\n format.html { redirect_to admin_index_tables_path, notice: 'Table was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @block_log = BlockLog.find(params[:id])\n @block_log.destroy\n\n respond_to do |format|\n format.html { redirect_to block_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tgl_row = TglRow.find(params[:id])\n @tgl_row.destroy\n\n respond_to do |format|\n format.html { redirect_to tgl_rows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_row.destroy\n respond_to do |format|\n format.html { redirect_to invoice_rows_url }\n format.json { head :no_content }\n end\n end", "def destroy(table, id)\n self.post(\"/#{table}/destroy/#{id}\")\n end", "def delete(path, *data, &block)\n map(path, R3::DELETE, *data, &block)\n end", "def destroy\n @visit_block = VisitBlock.find(params[:id])\n @visit_block.destroy\n\n respond_to do |format|\n format.html { redirect_to visit_blocks_url }\n format.json { head :no_content }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM links WHERE id = #{self.id};\")\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def destroy\n @time_block.destroy\n respond_to do |format|\n format.html { redirect_to time_blocks_url, notice: 'Time block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @block_type.destroy\n respond_to do |format|\n format.html { redirect_to block_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block_type.destroy\n respond_to do |format|\n format.html { redirect_to block_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronopay_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(chronopay_links_url,\n :notice => I18n.t('backend.actions.success_destroy',\n :model => I18n.t('activerecord.capitalized_models.chronopay_link'))) }\n format.xml { head :ok }\n end\n end", "def delete_link(object, destructive = false)\n return nil if object.new_record?\n object_name = object.class.to_s.underscore.humanize.downcase\n text = \"Delete #{object_name}\"\n if destructive\n modal = {\n title: \"Listen up!\",\n alert: alert_box(\"This is an <strong>EXTREMELY DESTRUCTIVE</strong> action.\", \"warning\", false),\n body: \"You are about to permanently delete this #{object_name} and all associated objects. This cannot be undone.\",\n button: link_to(\"I understand, delete this #{object_name}\", object, class: \"button alert radius\", method: \"delete\")\n }\n link_to(text, object, class: \"button-link alert modal-trigger\", data: {modal: modal})\n else\n data = { method: \"delete\", confirm: \"Are you sure?\" }\n link_to(text, object, class: \"button-link alert\", data: data)\n end\n end", "def remove_child_link(name, url, f)\n f.hidden_field(:_destroy) + link_to(name, url, :class => \"remove_child\")\n end", "def destroy\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n @<%= orm_instance.destroy %>\n\n respond_to do |format|\n format.html { redirect_to <%= index_helper %>_url }\n format.json { head :ok }\n end", "def destroy\n @table.destroy\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @table.destroy\n respond_to do |format|\n format.html { redirect_to tables_url }\n format.json { head :no_content }\n end\n end", "def destroys(object,*args,&block)\n opts = args.last.is_a?(Hash) ? args.pop.symbolize_keys : {}\n deletes_to(path_for(object,args),opts,&block)\n end", "def delete_member_link(name, member_id)\n\t\tlink_to_function name, \"deleteMember(#{member_id});\", :confirm => \"Are you sure you want to delete this record? This action can not be undone.\"\n\tend", "def destroy\n @system_link.destroy\n respond_to do |format|\n format.html { redirect_to system_links_url, notice: 'System link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n row.delete_attribute(attr_name)\n row.save\n end", "def delete(path, options = {}, &block)\n map(path, options, :delete, &block)\n end", "def delete_link(target, confirm, title, divider)\n if current_user && current_user.admin?\n @link = divider + link_to(\"delete\", target, :method => :delete, :confirm => confirm, :title => title)\n @link.html_safe\n end\n end", "def destroy\n @cp_block.destroy\n respond_to do |format|\n format.html { redirect_to cp_blocks_url, notice: 'Block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def button_to_destroy(record, options={})\n options[:method] = 'delete'\n # We want to emphasize this is dangerous\n options[:data] = { confirm: 'Are you sure?' }\n options[:class] = 'btn-danger'\n button_to_action record, :destroy, options\n end", "def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end", "def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end", "def delete_row(row)\n puts \"---------------------------\"\n puts \"| Delete Row |\"\n puts \"---------------------------\"\n @file.delete('row')\n puts @file\n puts \"\\n\"\n end", "def destroy(&block)\n delete(member_url) do |response, json|\n if block\n block.call response, json\n end\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html do\n redirect_to root_path,\n notice: \"Link was successfully deleted\"\n end\n format.json { head :no_content }\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 @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def link_to_cancel( object )\n path = object.class.name.tableize\n path = if object.new_record?\n send( path.pluralize + '_path' )\n else\n send( path.singularize + '_path', object )\n end\n link_to \"Cancel\", path\n end", "def destroy\n @link = @entity.links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.xml { head :ok }\n end\n end", "def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end", "def link_to_delete(page)\n raw link_to 'Delete', admin_page_path(page),\n method: :delete,\n class: 'delete button',\n confirm: confirm_delete_message\n end", "def destroy(&block)\n super do |tx|\n tx.delete(RDF::Statement(nil, nil, nil, graph_name: subject_uri))\n end\n end", "def destroy\n conn.delete(self_link)\n end", "def destroy\n @schedule_block = ScheduleBlock.find(params[:id])\n @schedule_block.destroy\n\n respond_to do |format|\n format.html { redirect_to period_schedule_path(@period, @schedule) }\n format.json { head :ok }\n end\n end", "def destroy\n @<%= file_name %> = <%= class_name %>.find(params[:id])\n @<%= file_name %>.destroy\n\n respond_to do |format|\n format.html { redirect_to(<%= table_name %>_url) }\n format.xml { head :ok }\n end" ]
[ "0.78386474", "0.70801383", "0.7050985", "0.6635237", "0.6559301", "0.64729893", "0.6380505", "0.6367818", "0.6340585", "0.63159376", "0.6255097", "0.6192836", "0.6137068", "0.6099586", "0.60969186", "0.60541767", "0.60522157", "0.6030391", "0.60214126", "0.6015478", "0.6009959", "0.6002101", "0.59993315", "0.59893405", "0.5954987", "0.59295034", "0.5919459", "0.5913161", "0.59068114", "0.59068114", "0.59067494", "0.5857302", "0.5853164", "0.5853004", "0.5805586", "0.5792405", "0.57760304", "0.5770342", "0.5765316", "0.5765316", "0.5749436", "0.57284707", "0.5724328", "0.5720675", "0.5696929", "0.56944966", "0.5690636", "0.5688669", "0.566868", "0.5660202", "0.5654228", "0.56539166", "0.5646191", "0.56461245", "0.5643784", "0.56285036", "0.5623522", "0.5620944", "0.5620634", "0.56115025", "0.5605362", "0.5600651", "0.5598571", "0.5596717", "0.55807054", "0.55806017", "0.5566293", "0.5563855", "0.5551937", "0.5551686", "0.5551686", "0.5551536", "0.55324095", "0.55302876", "0.55249244", "0.5523495", "0.5523495", "0.5523368", "0.5518483", "0.5513442", "0.55131555", "0.5509952", "0.5499803", "0.54961824", "0.5494457", "0.549027", "0.549002", "0.5488145", "0.5487894", "0.5487122", "0.5477056", "0.5475407", "0.54702973", "0.54641646", "0.54614705", "0.5460494", "0.5460481", "0.54585844", "0.54526335", "0.5449323" ]
0.782632
1
Generic action link inside a table.
def link_table_action(icon, url, html_options = {}) add_css_class html_options, "icon-#{icon}" link_to('', url, html_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n end \n end\n end", "def r_table_cell_action(label, link, link_options = {})\n link_to(label, link, link_options.merge(class: \"text-indigo-600 hover:text-indigo-900\"))\n end", "def action_link(action, prefix)\n html_class = \"actions #{action.to_s}_link\"\n block = lambda do |resource|\n compound_resource = [prefix, resource].compact\n compound_resource.flatten! if prefix.kind_of?(Array)\n case action\n when :show\n @template.link_to(link_title(action), compound_resource)\n when :destroy\n @template.link_to(link_title(action), compound_resource,\n :method => :delete, :confirm => confirmation_message)\n else # edit, other resource GET actions\n @template.link_to(link_title(action),\n @template.polymorphic_path(compound_resource, :action => action))\n end\n end\n self.cell(action, :heading => \"\", :cell_html => {:class => html_class}, &block)\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def table_action(model, item)\n\n condition = true\n\n case params[:action]\n when \"index\"\n action = \"trash\"\n options = { :action => 'destroy', :id => item.id }\n method = :delete\n when \"edit\", \"show\"\n action = \"unrelate\"\n options = { :action => 'unrelate', :id => params[:id], :resource => model, :resource_id => item.id }\n end\n\n title = _(action.titleize)\n\n case params[:action]\n when 'index'\n condition = if model.typus_user_id? && @current_user.is_not_root?\n item.owned_by?(@current_user)\n elsif (@current_user.id.eql?(item.id) && model.eql?(Typus.user_class))\n false\n else\n @current_user.can?('destroy', model)\n end\n confirm = _(\"Remove %{resource}?\", :resource => item.class.model_name.human)\n when 'edit'\n # If we are editing content, we can relate and unrelate always!\n confirm = _(\"Unrelate %{unrelate_model} from %{unrelate_model_from}?\",\n :unrelate_model => model.model_name.human,\n :unrelate_model_from => @resource.model_name.human)\n when 'show'\n # If we are showing content, we only can relate and unrelate if we are\n # the owners of the owner record.\n # If the owner record doesn't have a foreign key (Typus.user_fk) we look\n # each item to verify the ownership.\n condition = if @resource.typus_user_id? && @current_user.is_not_root?\n @item.owned_by?(@current_user)\n end\n confirm = _(\"Unrelate %{unrelate_model} from %{unrelate_model_from}?\",\n :unrelate_model => model.model_name.human,\n :unrelate_model_from => @resource.model_name.human)\n end\n\n message = %(<div class=\"sprite #{action}\">#{action.titleize}</div>)\n\n if condition\n link_to raw(message), options, :title => title, :confirm => confirm, :method => method\n end\n\n end", "def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end", "def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end", "def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end", "def link_apply url, resource, options={}\n html = \"\"\n if permitted_to? :update, table_symbol_from(resource)\n html = \"<td class='link'>\"+tlink_to(\"apply\",url,{:target=>\"_blank\", :category=>:action})+\"</td>\"\n end\n html.html_safe\n end", "def edit_button_table(model, link_args = {})\n link_args[:class] = 'btn-warning btn-xs' + (link_args[:class] || '')\n link_args[:additional_I18n] = 'short'\n action_button :edit, model, link_args\n end", "def action_column(options={}, &block)\n case mode\n when :header\n \"<th>#{I18n.t(:'link.actions')}</th>\".html_safe\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = [td_options[:class]].flatten || []\n td_options[:class] << 'actions'\n td_options[:class] = td_options[:class].compact.join(' ')\n res = \"<td #{ to_attr(td_options) }><ul class='actions'>\"\n res << @template.capture(&block)\n res << \"</ul></td>\"\n res.html_safe\n end\n end", "def build_link(master_u)\n icon_edit = '<span class=\"glyphicon glyphicon-edit\"></span>'\n icon_show = '<span class=\"glyphicon glyphicon-info-sign\"></span>'\n link = link_to(raw(icon_show), master_u)\n link += link_to(raw(icon_edit), edit_master_unit_path(master_u))\n raw('<div class=\"datatable-actions\">'+link+'</div>')\n end", "def action_cells(actions, prefix = nil)\n return if actions.blank?\n actions = [actions] if !actions.respond_to?(:each)\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each_with_index do |action,index|\n if prefix.is_a?(Array)\n prefix_element = prefix[index]\n unless prefix_element\n prefix_element = prefix[0]\n end\n else\n prefix_element = prefix\n end\n action_link(action.to_sym, prefix_element)\n end\n end", "def action_col_show(table, &block)\n action_col(table) do |e| \n link_table_action('zoom-in', action_path(e, &block))\n end\n end", "def standard_table_actions(table)\n table.edit_action_col\n table.destroy_action_col\n end", "def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end", "def link_to_bulk_action(*args)\n args.map! do |arg|\n if arg.kind_of?(Hash)\n data_method = (\n arg.delete(:'data-method') ||\n arg.delete('data-method') ||\n (arg[:data] || {}).delete('method') ||\n (arg[:data] || {}).delete(:method)\n )\n\n # But if the data-method was :get, we add bulk-actions-get-link = true\n if data_method.to_s == 'get'\n arg[:data].present? ? arg[:data]['bulk-actions-get'] = true : arg['data-bulk-actions-get'] = true\n end\n end\n\n arg\n end\n\n link_to(*args)\n end", "def link_actions_for(object)\n link_to_show(object) +\n link_to_edit(edit_polymorphic_path(object)) +\n link_to_destroy(object)\n end", "def sortable_heading(heading, column, id)\n link_to(heading,\n { :controller => :movies,\n :sort_order => column,\n :ratings => @selected_ratings\n },\n :id => id)\n end", "def action_col_show(table, &block)\n action_col(table) { |e| link_table_action('zoom-in', action_path(e, &block)) }\n end", "def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end", "def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end", "def add_table_actions(table)\n action_col_show(table)\n action_col_edit(table)\n action_col_destroy(table)\n end", "def apphelp_index_actions( name, obj, user_id_or_obj = nil )\n\n if ( user_id_or_obj.nil? )\n show_method = \"#{ name }_path\"\n edit_method = \"edit_#{ name }_path\"\n arg = obj\n elsif ( user_id_or_obj.is_a?( String ) || user_id_or_obj.is_a?( Fixnum ) )\n show_method = \"user_#{ name }_path\"\n edit_method = \"edit_user_#{ name }_path\"\n arg = { :id => obj.id, :user_id => user_id_or_obj }\n else\n resname = user_id_or_obj.class.table_name.singularize\n show_method = \"#{ resname }_#{ name }_path\"\n edit_method = \"edit_#{ resname }_#{ name }_path\"\n arg = { :id => obj.id }\n arg[ \"#{ resname }_id\".to_sym ] = user_id_or_obj.id\n end\n\n show = apphelp_protected_link_to( :show, { :short => true, :method => show_method }, arg )\n edit = apphelp_protected_link_to( :edit, { :short => true, :method => edit_method }, arg )\n\n if ( respond_to? \"delete_#{ name }_path\" )\n dsty = apphelp_protected_link_to( :delete, { :short => true, :method => \"delete_#{ name }_path\" }, obj )\n else\n dsty = apphelp_protected_delete_button( obj )\n end\n\n result = \"<table class=\\\"no_border\\\" border=\\\"0\\\"><tr>\"\n\n result << '<td>' << show << '</td>' unless ( show.empty? )\n result << '<td>' << edit << '</td>' unless ( edit.empty? )\n result << '<td>' << dsty << '</td>' unless ( dsty.empty? )\n\n return result << \"</tr></table>\"\n end", "def th_actions(*args)\n return '' if args.empty?\n th_header = <<-END\n<span class=\"actions\">\n #{args.each_slice(2).map do |text,js|\n %Q{<a onclick=\"#{ERB::Util.h js}\">#{ERB::Util.h text}</a>}\n end.join(' - ')}\n</span>\nEND\n return th_header.html_safe\n end", "def dt_actions\n\n links = []\n links << h.link_to(h.project_path(object), class: 'btn btn-success mx-1') do \n h.fa_icon 'rocket', text: h.t('explore')\n end\n links << h.link_to(h.edit_project_path(object), class: 'btn btn-primary mx-1') do \n h.fa_icon 'edit', text: h.t('edit')\n end\n links << h.link_to(h.project_path(object), method: :delete, remote: true, class: 'btn btn-danger', data: h.dataConfirm) do \n h.fa_icon 'remove', text: h.t('remove')\n end\n h.safe_join(links, '')\n end", "def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end", "def scaffold_link(text, action, options={})\n \"<a href='#{scaffold_url(action, options)}'>#{h text}</a>\"\n end", "def crud_links(model, instance_name, actions, args={})\n _html = \"\"\n _options = args.keys.empty? ? '' : \", #{args.map{|k,v| \":#{k} => #{v}\"}}\"\n \n if use_crud_icons\n if actions.include?(:show)\n _html << eval(\"link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}\")\n end\n else\n if actions.include?(:show)\n _html << eval(\"link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}\")\n end\n end\n _html\n end", "def crud_link_text(options, action)\n action_str = action.to_s.downcase\n\n # match the action to an icon\n bootstrap_icon = crud_link_icon(action, options)\n\n if bootstrap_icon.present?\n icon = \"<i class='#{bootstrap_icon}'></i>\"\n else\n icon = ''\n end\n\n # default link text for common CRUD actions/aliases\n case true\n when %w(new create).include?(action_str) then default_link_text = 'Add'\n when %w(update edit).include?(action_str) then default_link_text = 'Edit'\n when %w(show view).include?(action_str) then default_link_text = 'View'\n when %w(delete destroy).include?(action_str) then default_link_text = 'Delete'\n when %w(back).include?(action_str) then default_link_text = 'Back'\n end\n\n # Use the options link_text value if it exists;\n # otherwise use our link_text determined by the action name\n if options.keys.include?(:link_text)\n link_text = \"#{icon} #{options[:link_text]}\".html_safe\n else\n link_text = \"#{icon} #{default_link_text}\".html_safe\n end\n\n link_text\n end", "def link_to(arg)\n text =\n if arg.respond_to?(:name)\n arg.name\n else arg.to_s\n end\n\n Doc::HTML.escape_html(text)\n end", "def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end", "def action_link(action, href, html_options = {})\n # join passed html class (if any) with the default class\n html_options[:class] = [html_options[:class], \"action_link\"].compact.join(\" \")\n \n link_to(content_tag(:i, \"\", :class => \"icon-\" + FONT_AWESOME_ICON_MAPPINGS[action.to_sym]), href, html_options)\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def ezm_link_to_trash_bin\r\n link_to \"Trash\", trashbin_url\r\n end", "def forums_post_link\n $tracer.trace(__method__)\n return ToolTag.new(table.className(\"/table-list/\").tr.className(\"/table-item/\").a.className(\"/view-post forum/\"), __method__)\n end", "def content_comment_action_link(text, comment_or_id, url=nil)\n content_comment_action_item(comment_link_to_function(text, comment_or_id, url))\n end", "def link_menu(resource, options={})\n html= ' '\n if permitted_to? :index, table_symbol_from(resource) then\n if resource.is_a? Symbol then\n model_plural = resource.to_s\n else\n model= singular_table_name_from( resource).pluralize \n end\n a = link_to(tmenu(model_plural), eval(model_plural + \"_path\"), options) \n html = wrap_in_html_container a, 'li', 'menuItem'\n end\n #ebugger\n return html.html_safe\n end", "def make_action_link(controller, action, width, height, text, uri = nil)\n if (uri.nil?)\n\n html = link_to(image_tag(image_path(\"#{controller}/#{action}.png\"), :size => \"#{width}x#{height}\", :border => 0),\n {:controller => controller, :action => action}, :class => 'image')\n\n unless (text.nil? or text.empty?)\n html << tag('br')\n html << link_to(text.html_safe, :controller => controller, :action => action)\n end\n\n else\n\n html = content_tag(\"a\", image_tag(image_path(\"#{controller}/#{action}.png\"), :size => \"#{width}x#{height}\", :border => 0),\n { :href => uri, :class => 'image' })\n unless (text.nil? or text.empty?)\n html << tag('br')\n html << content_tag(\"a\", text.html_safe, { :href => uri })\n end\n\n end\n\n return html\n end", "def link(obj)\n return \"<a href='#{R(obj, self.id)}'>#{self.name}</a>\"\n end", "def workflow_action_link(title, link, opts={})\n link_to(title, link, {:class=>'btn btn-mini'}.merge(opts))\n end", "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :data => { :confirm => ti(:confirm_delete),\n :method => :delete })\n end\n end", "def add_table_actions(table)\n action_col_edit(table)\n action_col_destroy(table)\n end", "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :confirm => ti(:confirm_delete),\n :method => :delete)\n end\n end", "def dt_actions\n edith_path = object.variant.is_master? ? h.edit_admin_product_path(object.product.id) : h.edit_admin_product_variant_path(object.product.id, object.variant_id)\n h.content_tag(:div, class: 'large ui compact icon buttons') do\n h.link_to(edith_path, target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white edit icon')\n end +\n h.link_to(h.admin_product_images_path(object.product.id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white images icon')\n end +\n h.link_to(h.product_path(object.product.id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large icons') do\n h.content_tag(:i, '', class: 'white desktop icon')+\n h.content_tag(:i, '', class: 'top right corner white eye icon')\n end\n end +\n h.link_to(h.stock_admin_product_path(object.product.id, variant: object.variant_id, stock_location: object.stock_location_id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white dolly icon')\n end +\n h.link_to(h.volume_prices_admin_product_variant_path(product_id: object.product.id, id: object.variant_id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large icons') do\n h.content_tag(:i, '', class: 'white clipboard list icon')+\n h.content_tag(:i, '', class: 'top right corner white dollar sign icon')\n end\n end\n end\n end", "def action_link(\n action = nil,\n current: nil,\n label: nil,\n css: '.page-action',\n **opt\n )\n action = opt.delete(:action) || action\n entry = action_entry(action, current: current, **opt)\n action, current = entry.values_at(:action, :current)\n\n return if (action == current) && current&.start_with?('list_')\n return unless can?(action, object_class)\n\n label = (label || entry[:label]).presence\n label = label ? (label % entry) : labelize(action)\n\n html_tag(:li, prepend_css(css)) do\n link_to_action(label, action: action)\n end\n end", "def link_to_page_with_label(label)\n return (\"<a href='/chefs/\" + self.id.to_s + \"'>\" + label + \"</a>\").html_safe\n end", "def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end", "def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end", "def build_row_onclick(data_row)\n onclick = nil\n\n # Handle CI based report rows\n if ['EmsCluster', 'ExtManagementSystem', 'Host', 'Storage', 'Vm', 'Service'].include?(db) && data_row['id']\n controller = db == \"ExtManagementSystem\" ? \"management_system\" : db.underscore\n donav = \"DoNav('/#{controller}/show/#{data_row['id']}');\"\n title = data_row['name'] ?\n \"View #{ui_lookup(:model => db)} \\\"#{data_row['name']}\\\"\" :\n \"View this #{ui_lookup(:model => db)}\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='#{title}'\"\n end\n\n # Handle CI performance report rows\n if db.ends_with?(\"Performance\")\n if data_row['resource_id'] && data_row['resource_type'] # Base click thru on the related resource\n donav = \"DoNav('/#{data_row['resource_type'].underscore}/show/#{data_row['resource_id']}');\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='View #{ui_lookup(:model => data_row['resource_type'])} \\\"#{data_row['resource_name']}\\\"'\"\n end\n end\n\n onclick\n end", "def get_action_link\n if controller_path == 'admin/articles'\n case action_name\n when 'index' then t('buttons/all_articles').html_safe\n when 'new' then t('buttons/new_article').html_safe\n when 'edit' then t('buttons/edit_article').html_safe\n when 'show' then t('buttons/preview').html_safe\n end\n elsif controller_path == 'admin/authors'\n case action_name\n when 'index' then t('buttons/all_authors').html_safe\n when 'new' then t('buttons/new_author').html_safe\n when 'edit' then t('buttons/edit_author').html_safe\n when 'show' then t('buttons/author').html_safe\n end\n end\n end", "def action_target()\n \n end", "def sort_link(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'\n icon = sort_direction == 'asc' ? 'fas fa-caret-up' : 'fas fa-caret-down'\n icon = column == sort_column ? icon : ''\n\n parameter = params.permit(:id, :q, :classes, :byquery, :column, :direction)\n .merge(column: column, direction: direction)\n link_to \"#{title} <i class='#{icon}'></i>\".html_safe, parameter\n end", "def action_link_to(label, options = nil, html_options = nil)\n options ||= {}\n html_options = convert_options_to_data_attributes(options, html_options)\n action_class = html_options.delete('action_class')\n content_tag(:li, link_to(content_tag(:span, label), options, html_options), class: action_class)\n end", "def view_button(object, link = nil)\n link_to '<span class=\"glyphicon glyphicon-eye-open\"></span> View'.html_safe,\n link ? link : polymorphic_path(object),\n class: 'btn btn-default',\n title: \"View #{object_title(object)}\"\n end", "def click(link); end", "def link_to_identifier; end", "def link_to_identifier; end", "def show_manage_cell_link\n link_to \"Manage\", sentence_show_manage_cell_path(model), remote: true\n end", "def delete_link\n button_tag(t('.delete_row'), name: 'delete_row', class: 'ds_link', id: \"delete_row_#{index}\",\n value: index, 'aria-label' => \"#{t('.delete_row')} #{index}\")\n end", "def batch_op_link(options)\n button_to(options[:name], \"#\", \n :onclick => \"batch_submit({path: '#{options[:path]}', confirm: '#{options[:confirm]}'}); return false;\",\n :class => \"batch_op_link\")\n end", "def view_edit_link(user, attraction)\n if user.admin\n content_tag(:p, link_to(\"Edit Attraction\", edit_attraction_path(attraction)))\n end\n end", "def association_link(mc, assoc_obj)\n if mc\n t = h(mc.object_display_name(:association, request, assoc_obj))\n if mc.supported_action?(type, request)\n t = \"<a href=\\\"#{base_url_for(\"#{mc.link}/#{type}/#{mc.primary_key_value(assoc_obj)}\")}\\\">#{t}</a>\"\n end\n t\n else\n h(model.default_object_display_name(assoc_obj))\n end\n end", "def action_link(title, link, icon, options = {})\n icon_tag = content_tag(:i, '', class: \"fa fa-#{icon} fa-fw\")\n default_options = { title: title, data: { tooltip: title } }\n link_to icon_tag, link, default_options.deep_merge(options)\n end", "def table_sort(column, title = nil)\n title ||= column.titleize\n direction = (column == sort_column_string && sort_direction_string == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end", "def link_to_action(\n label,\n ctrlr:,\n action:,\n link_opt: nil,\n css: '.control',\n **path_opt\n )\n ctrlr = path_opt.delete(:controller) || ctrlr # Just in case.\n path = get_path_for(ctrlr, action, **path_opt) or return\n label ||= config_lookup(\"#{action}.label\", ctrlr: ctrlr) || path\n html_opt = prepend_css(link_opt, css)\n html_opt[:method] ||= :delete if action.to_s == 'destroy'\n html_opt[:title] ||= config_lookup(\"#{action}.tooltip\", ctrlr: ctrlr)\n # noinspection RubyMismatchedArgumentType\n if path.match?(/^https?:/)\n external_link(label, path, **html_opt)\n else\n make_link(label, path, **html_opt)\n end\n end", "def append_link( output, text, record )\n return ( output << \" \" << link_to(\n text.html_safe,\n {\n :controller => record.auditable_type.downcase.pluralize,\n :action => 'show',\n :id => record.auditable_id\n }\n )\n ).html_safe()\n end", "def link_to_edit_index_template(page)\n url = admin_page_path page\n link_to 'Edit Index Tempate', url, class: 'button'\n end", "def day_link(text, date, day_action)\n link_to(text, params.merge(:action => day_action, :year => date.year, :month => date.month, :day => date.day), :class => 'ec-day-link')\n end", "def action_link\n if member.kind_of?(Work)\n link_to \"Info\", work_path(member), class: \"btn btn-primary\"\n elsif download_original_only\n link_to \"Download\", download_path(member.file_category, member), class: \"btn btn-brand-main less-padding\", data: {\n \"analytics-category\" => \"Work\",\n \"analytics-action\" => \"download_original\",\n \"analytics-label\" => member.parent.friendlier_id\n }\n else\n render DownloadDropdownComponent.new(member, display_parent_work: member.parent, use_link:true)\n end\n end", "def sort_link_for(title, sort_method, action=:list)\n link_to title, {:action => action, :order_by => sort_method, :order => (@order_by == sort_method) ? 'desc' : 'asc'},\n {:class => 'tooltip', :title => \"Sort By #{title}\", :id => \"header-#{title.downcase.gsub(' ', '-')}\"}\n end", "def table_for(value, options = {}, &block)\n view(value, options.merge(:as => :table), &block)\n end", "def table_list(objetos, show_all_actions = true, options = {})\n render :partial => '/admin/shared/table_list', :locals => { :objetos => objetos, :show_all_actions => show_all_actions, :options => options }\n end", "def link_to_edit(path)\n link_to icon('edit'), path, title: 'Edit this record'\n end", "def table_for(collection, options = {}, *attr_list)\n actions = false\n classes = options[:classes] || \"\"\n model_class_name = options[:model_name] || collection.name\n table_id = options[:id] || model_class_name.tableize\n table_klazz = model_class_name.constantize\n table_headers = []\n\n attr_list.flatten.each do |attr_name|\n if attr_name.class == Hash && !attr_name[:actions].nil?\n actions = attr_name[:actions]\n else\n header_content = table_klazz.human_attribute_name(attr_name)\n header = content_tag(:th, header_content)\n table_headers << header\n end\n end\n\n if actions\n table_headers << content_tag(:th, t('actions'), class: 'table_actions')\n end\n\n thead = content_tag :thead, content_tag(:tr, table_headers.join(\" \").html_safe)\n table_content = \"\"\n if options[:partial].present?\n table_content = render partial: options[:partial], collection: collection\n else\n table_content = render collection\n end\n tbody = content_tag :tbody, table_content\n table = content_tag(:table, \"#{thead} #{tbody}\".html_safe, id: table_id, class: \"table table-hover #{classes}\")\n table.html_safe\n end", "def action_links(obj, options)\n route_key = obj.class.model_name.singular_route_key\n links = %w(edit destroy).collect do |action|\n options[:exclude] = [options[:exclude]] unless options[:exclude].is_a?(Array)\n next if options[:exclude] && options[:exclude].include?(action.to_sym)\n key = \"#{obj.class.table_name}##{action}\"\n case action\n when \"edit\"\n can?(:update, obj) ? action_link(action, send(\"edit_#{route_key}_path\", obj), :title => t(\"common.edit\")) : nil\n when \"destroy\"\n # build a delete warning\n obj_description = options[:obj_name] ? \"#{obj.class.model_name.human} '#{options[:obj_name]}'\" : options[:obj_description]\n warning = t(\"layout.delete_warning\", :obj_description => obj_description)\n \n can?(:destroy, obj) ? action_link(action, send(\"#{route_key}_path\", obj), :method => :delete, \n :confirm => warning, :title => t(\"common.delete\")) : nil\n end\n end.compact\n links.join(\"\").html_safe\n end", "def create_table_actions atable, todo, data, categ\n #@new_act = Action.new(\"New Row\", \"mnemonic\"=>\"N\") { \n @new_act = Action.new(\"&New Row\") { \n cc = atable.get_table_column_model.column_count\n if atable.row_count < 1\n categ = nil\n frow = 0\n else\n frow = atable.focussed_row\n categ = atable.get_value_at(frow,1)\n frow += 1\n end\n tmp = [nil, categ, \"\", 5, \"\", \"TODO\", Time.now]\n tm = atable.table_model\n tm.insert frow, tmp\n atable.set_focus_on frow\n @status_row.text = \"Added a row. Please press Save before changing Category.\"\n alert(\"Added a row below current one. Use C-k to clear task.\")\n }\n @new_act.accelerator \"Alt-N\"\n @save_cmd = lambda {\n todo.set_tasks_for_category categ, data\n todo.dump\n alert(\"Rewritten yaml file\")\n }\n @del_cmd = lambda { \n row = atable.focussed_row\n if confirm(\"Do your really want to delete row #{row+1}?\")== :YES\n tm = atable.table_model\n tm.delete_at row\n else\n @status_row.text = \"Delete cancelled\"\n end\n }\n\n end", "def orderable_link(contents, field)\n return contents if @object_name.empty?\n field = field.to_s\n\n order_params = (template.params['order'] || {})[@table_name]\n fields = Hash[*order_params.to_a.collect { |field_and_dir| field_and_dir.split(':') }.flatten]\n if @object && @object.default_order[:field].to_s == field\n # TODO: this should technically be fields.empty? && @object.default_order[:options][:stable],\n # but it lends itself to a little bit of an odd behavior unless you're expecting the additive ordering\n fields[field] = fields[field] || @object.default_order[:direction].to_s if fields.empty?\n end\n\n order_params = (template.params['order'] || {}).clone.\n merge({@table_name => [\"#{field}:#{\"#{fields[field] == 'asc' ? 'desc' : 'asc'}\"}\"]})\n\n query = template.params.reject{ |param, value| ['action', 'controller'].include?(param) }\n query.merge!('order' => order_params)\n\n template.content_tag(:a, contents,\n :href => \"?#{query.to_query}\",\n :class => \"#{fields[field] ? fields[field] == 'asc' ? 'ascending' : 'descending' : ''}\")\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end", "def _cell_click\n render :js => handle_cell_click(param(:id).to_i, param(:table), param(:cell_column).to_i, param(:table_view))\n end", "def order_info_link\n h.link_to 'Информация о заказе', h.admin_order_path(order.id)\n end", "def active_scaffold_column_download_link(column, record, label = nil)\n return nil if record.send(column.name).nil?\n label ||= as_(:download)\n if column.options[:secure_download]\n url_options = active_scaffold_column_download_link_url_options(column, record)\n else\n url_options = url_for_file_column(record, column.name.to_s)\n end\n link_to( label, url_options, :popup => true)\n end", "def row\n get_row\n respond_to_action(:row)\n end", "def action\n end", "def sort_column(title, path, table, field, order, ascending)\n path = path[0..(path.index(\"table=\")-2)] if path.index(\"table=\")\n if path.index(\"?\").nil?\n path = path + \"?\"\n else\n path = path + \"&\"\n end\n return link_to title, path + \n \"table=#{table}&order=#{field}&current_order=#{order}&ascending=#{ascending}\"\n end", "def sortable(column,title=nil)\n title ||=column.titleize\n direction = column==sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, :sort => column,:direction => direction\nend", "def sortable(column, title = nil, direction)\n title ||= column.titleize\n link_to title, {sort: column, sort_type: direction}, {\"data-remote\" => \"true\"}\n end", "def action\n action_name.to_sym\n end", "def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end", "def href; end", "def effective_logging_object_link_to(obj, action = :show)\n if obj.kind_of?(User)\n if action == :show && defined?(admin_user_path)\n link_to('View', admin_user_path(obj))\n elsif action == :edit && defined?(edit_admin_user_path)\n link_to('Edit', edit_admin_user_path(obj))\n end\n end\n end" ]
[ "0.7599486", "0.7441103", "0.74272674", "0.6810069", "0.6810069", "0.66832507", "0.66182244", "0.66063905", "0.64828694", "0.64828694", "0.6332754", "0.6296523", "0.6293951", "0.6220653", "0.61772686", "0.6142519", "0.6115107", "0.60924137", "0.6052146", "0.6036665", "0.60336095", "0.60032916", "0.5994851", "0.5994851", "0.5993687", "0.5989161", "0.5974299", "0.5945132", "0.5940405", "0.59305036", "0.5909962", "0.58816826", "0.58732206", "0.5870664", "0.58440906", "0.5813518", "0.5813518", "0.5798795", "0.575998", "0.5757139", "0.5748247", "0.5742399", "0.5738713", "0.5737999", "0.57362306", "0.57299215", "0.5727804", "0.57089037", "0.568715", "0.56865805", "0.56796503", "0.56796503", "0.5660432", "0.5659912", "0.56405455", "0.5624708", "0.5618963", "0.56182235", "0.56164753", "0.5616164", "0.5616164", "0.5605183", "0.5604477", "0.5604311", "0.55977577", "0.55961484", "0.55873513", "0.55809313", "0.55780256", "0.55687445", "0.55645293", "0.5557725", "0.55565643", "0.5555133", "0.5539847", "0.5527837", "0.55207837", "0.5517885", "0.5514157", "0.5513882", "0.55116695", "0.5511445", "0.5511445", "0.5511445", "0.5511445", "0.5511445", "0.5499935", "0.5499672", "0.5491741", "0.5485993", "0.54726815", "0.54599327", "0.5453218", "0.54517305", "0.5450859", "0.5443469", "0.54396194", "0.54327184", "0.54258126" ]
0.74432373
2
Defines a column with an action link.
def action_col(table, &block) table.col('', :class => 'action', &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_column(options={}, &block)\n case mode\n when :header\n \"<th>#{I18n.t(:'link.actions')}</th>\".html_safe\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = [td_options[:class]].flatten || []\n td_options[:class] << 'actions'\n td_options[:class] = td_options[:class].compact.join(' ')\n res = \"<td #{ to_attr(td_options) }><ul class='actions'>\"\n res << @template.capture(&block)\n res << \"</ul></td>\"\n res.html_safe\n end\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end", "def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end", "def action_column(options={}, &block)\n self.current_column_number += 1\n\n case mode\n when :counter\n self.number_of_columns ||= 0\n self.number_of_columns += 1\n nil\n when :header\n options = { :align => :left }\n if self.current_column_number == 1\n options[:class] = 'first'\n elsif self.current_column_number == self.number_of_columns\n options[:class] = 'last'\n end\n\n @template.haml_tag :th, options do\n @template.haml_concat I18n.t(:'link.actions')\n end\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = td_options[:class].to_a || []\n td_options[:class] << 'actions'\n @template.haml_tag :td, td_options do\n @template.haml_tag :ul, :class => 'actions' do\n @template.haml_concat @template.capture_haml(&block)\n end\n end\n end\n end", "def r_table_cell_action(label, link, link_options = {})\n link_to(label, link, link_options.merge(class: \"text-indigo-600 hover:text-indigo-900\"))\n end", "def link_table_action(icon, url, html_options = {})\n add_css_class html_options, \"icon-#{icon}\"\n link_to('', url, html_options)\n end", "def link_table_action(icon, url, html_options = {})\n add_css_class html_options, \"icon-#{icon}\"\n link_to('', url, html_options)\n end", "def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n end \n end\n end", "def action_col_show(table, &block)\n action_col(table) do |e| \n link_table_action('zoom-in', action_path(e, &block))\n end\n end", "def action_col_show(table, &block)\n action_col(table) { |e| link_table_action('zoom-in', action_path(e, &block)) }\n end", "def active_scaffold_column_download_link(column, record, label = nil)\n return nil if record.send(column.name).nil?\n label ||= as_(:download)\n if column.options[:secure_download]\n url_options = active_scaffold_column_download_link_url_options(column, record)\n else\n url_options = url_for_file_column(record, column.name.to_s)\n end\n link_to( label, url_options, :popup => true)\n end", "def set_link(action, options = {})\n if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || (action.is_a? Proc)\n @link = action\n else\n options[:label] ||= label\n options[:position] ||= :after unless options.key?(:position)\n options[:type] ||= :member\n @link = ActiveScaffold::DataStructures::ActionLink.new(action, options)\n end\n end", "def link_to_sortable_column_header(field, order_by, sort_order, name)\n if order_by == field.to_s\n sort_order = (sort_order || '').upcase == 'DESC' ? 'ASC' : 'DESC'\n arrow = (sort_order == 'ASC') ? 'down' : 'up' \n else\n sort_order = 'ASC'\n arrow = nil\n end\n new_params = params.merge(:order_by => field.to_s, :sort_order => sort_order)\n html = link_to(name, new_params)\n html << image_tag(\"/tog_core/images/ico/arrow-#{arrow}.gif\") if arrow\n html\n end", "def sortable(column, title = nil, direction)\n title ||= column.titleize\n link_to title, {sort: column, sort_type: direction}, {\"data-remote\" => \"true\"}\n end", "def sort_link(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'\n icon = sort_direction == 'asc' ? 'fas fa-caret-up' : 'fas fa-caret-down'\n icon = column == sort_column ? icon : ''\n\n parameter = params.permit(:id, :q, :classes, :byquery, :column, :direction)\n .merge(column: column, direction: direction)\n link_to \"#{title} <i class='#{icon}'></i>\".html_safe, parameter\n end", "def action_link(action, prefix)\n html_class = \"actions #{action.to_s}_link\"\n block = lambda do |resource|\n compound_resource = [prefix, resource].compact\n compound_resource.flatten! if prefix.kind_of?(Array)\n case action\n when :show\n @template.link_to(link_title(action), compound_resource)\n when :destroy\n @template.link_to(link_title(action), compound_resource,\n :method => :delete, :confirm => confirmation_message)\n else # edit, other resource GET actions\n @template.link_to(link_title(action),\n @template.polymorphic_path(compound_resource, :action => action))\n end\n end\n self.cell(action, :heading => \"\", :cell_html => {:class => html_class}, &block)\n end", "def default_columns\n [LinkColumn.new(self, :show), LinkColumn.new(self, :edit)]\n end", "def link_apply url, resource, options={}\n html = \"\"\n if permitted_to? :update, table_symbol_from(resource)\n html = \"<td class='link'>\"+tlink_to(\"apply\",url,{:target=>\"_blank\", :category=>:action})+\"</td>\"\n end\n html.html_safe\n end", "def sortable(column, title)\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end", "def build_link(master_u)\n icon_edit = '<span class=\"glyphicon glyphicon-edit\"></span>'\n icon_show = '<span class=\"glyphicon glyphicon-info-sign\"></span>'\n link = link_to(raw(icon_show), master_u)\n link += link_to(raw(icon_edit), edit_master_unit_path(master_u))\n raw('<div class=\"datatable-actions\">'+link+'</div>')\n end", "def sortable(column,title=nil)\n title ||=column.titleize\n direction = column==sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, :sort => column,:direction => direction\nend", "def sortable(column, title = nil)\n title ||= column.titleize\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end", "def content_comment_action_link(text, comment_or_id, url=nil)\n content_comment_action_item(comment_link_to_function(text, comment_or_id, url))\n end", "def issue_sortable(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column(Issue.column_names, \"title\") && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, { sort: column, direction: direction,\n search: params[:search],\n status: params[:status],\n assigned_user_id: params[:assigned_user_id],\n creator_user_id: params[:creator_user_id] }\n end", "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :data => { :confirm => ti(:confirm_delete),\n :method => :delete })\n end\n end", "def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :confirm => ti(:confirm_delete),\n :method => :delete)\n end\n end", "def add_table_actions(table)\n action_col_show(table)\n action_col_edit(table)\n action_col_destroy(table)\n end", "def table_sort(column, title = nil)\n title ||= column.titleize\n direction = (column == sort_column_string && sort_direction_string == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end", "def standard_table_actions(table)\n table.edit_action_col\n table.destroy_action_col\n end", "def active_scaffold_input_url(column, options)\n active_scaffold_text_input :url_field, column, options\n end", "def show_manage_cell_link\n link_to \"Manage\", sentence_show_manage_cell_path(model), remote: true\n end", "def show_text_link_column(*methods)\n self.show_method_link_column(*methods) do |value|\n self.safe_html_string(value)\n end\n end", "def action_links(action: nil, **opt)\n opt[:action] = action || :index\n config_lookup('action_links', **opt) || {}\n end", "def sort_column(title, path, table, field, order, ascending)\n path = path[0..(path.index(\"table=\")-2)] if path.index(\"table=\")\n if path.index(\"?\").nil?\n path = path + \"?\"\n else\n path = path + \"&\"\n end\n return link_to title, path + \n \"table=#{table}&order=#{field}&current_order=#{order}&ascending=#{ascending}\"\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, url_for(params.merge(:sort => column, :direction => direction)) , {:class => css_class}\n end", "def link_to_bulk_action(*args)\n args.map! do |arg|\n if arg.kind_of?(Hash)\n data_method = (\n arg.delete(:'data-method') ||\n arg.delete('data-method') ||\n (arg[:data] || {}).delete('method') ||\n (arg[:data] || {}).delete(:method)\n )\n\n # But if the data-method was :get, we add bulk-actions-get-link = true\n if data_method.to_s == 'get'\n arg[:data].present? ? arg[:data]['bulk-actions-get'] = true : arg['data-bulk-actions-get'] = true\n end\n end\n\n arg\n end\n\n link_to(*args)\n end", "def edit_button_table(model, link_args = {})\n link_args[:class] = 'btn-warning btn-xs' + (link_args[:class] || '')\n link_args[:additional_I18n] = 'short'\n action_button :edit, model, link_args\n end", "def add_table_actions(table)\n action_col_edit(table)\n action_col_destroy(table)\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end", "def view_edit_link(user, attraction)\n if user.admin\n content_tag(:p, link_to(\"Edit Attraction\", edit_attraction_path(attraction)))\n end\n end", "def data_grid_header(data_grid, column)\n if column.sortable\n col_index = data_grid.columns.index(column)\n link_to(raw(column.title), data_grid.params.merge(\n \"sort_#{data_grid.name}\" => slug(column.title) + '_' + col_index.to_s,\n \"sort_direction_#{data_grid.name}\" => ((data_grid.sort == col_index) and (data_grid.sort_direction == 'ASC')) ? 'DESC' : 'ASC'), :class => 'underline sorting ' + ((data_grid.sort == col_index) ? ((data_grid.sort_direction == 'ASC') ? 'up' : 'down') : '')) \n else\n raw column.title\n end\n end", "def action_link(action, href, html_options = {})\n # join passed html class (if any) with the default class\n html_options[:class] = [html_options[:class], \"action_link\"].compact.join(\" \")\n \n link_to(content_tag(:i, \"\", :class => \"icon-\" + FONT_AWESOME_ICON_MAPPINGS[action.to_sym]), href, html_options)\n end", "def fb_action(name, url)\n \"<fb:action href=\\\"#{url_for(url)}\\\">#{name}</fb:action>\"\n end", "def fb_action(name, url)\n \"<fb:action href=\\\"#{url_for(url)}\\\">#{name}</fb:action>\"\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end", "def column_sort_link(title, column, paramval, width, align, options = {},stage=nil,column_name=nil,assigned_to=nil,dropdown=nil)\n params.merge!(:paramval=>paramval)\n options.merge!({:letter => params[:letter]}) unless (params[:letter].nil? || params[:letter].empty?) \n if assigned_to && column==column_name\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'>#{eval(dropdown)}</div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n elsif stage && column==column_name\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'>#{eval(dropdown)}</div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n else\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'><input type='text' style=#{options[:search_items] ? \"width:60px;\" : \"width:60px;display:none;\"} size='5' value='#{params[:search] ? params[:search][column.sub(\".\",\"--\")] || params[:search][column] : \"\"}' name='search[#{column.sub(\".\",\"--\")}]' id= 'search_#{column.sub(\".\",\"--\")}' /></div></div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n end\n end", "def action_link(title, link, icon, options = {})\n icon_tag = content_tag(:i, '', class: \"fa fa-#{icon} fa-fw\")\n default_options = { title: title, data: { tooltip: title } }\n link_to icon_tag, link, default_options.deep_merge(options)\n end", "def scaffold_link(text, action, options={})\n \"<a href='#{scaffold_url(action, options)}'>#{h text}</a>\"\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column) && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end", "def action_cells(actions, prefix = nil)\n return if actions.blank?\n actions = [actions] if !actions.respond_to?(:each)\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each_with_index do |action,index|\n if prefix.is_a?(Array)\n prefix_element = prefix[index]\n unless prefix_element\n prefix_element = prefix[0]\n end\n else\n prefix_element = prefix\n end\n action_link(action.to_sym, prefix_element)\n end\n end", "def sortable_heading(heading, column, id)\n link_to(heading,\n { :controller => :movies,\n :sort_order => column,\n :ratings => @selected_ratings\n },\n :id => id)\n end", "def workflow_action_link(title, link, opts={})\n link_to(title, link, {:class=>'btn btn-mini'}.merge(opts))\n end", "def crud_link_text(options, action)\n action_str = action.to_s.downcase\n\n # match the action to an icon\n bootstrap_icon = crud_link_icon(action, options)\n\n if bootstrap_icon.present?\n icon = \"<i class='#{bootstrap_icon}'></i>\"\n else\n icon = ''\n end\n\n # default link text for common CRUD actions/aliases\n case true\n when %w(new create).include?(action_str) then default_link_text = 'Add'\n when %w(update edit).include?(action_str) then default_link_text = 'Edit'\n when %w(show view).include?(action_str) then default_link_text = 'View'\n when %w(delete destroy).include?(action_str) then default_link_text = 'Delete'\n when %w(back).include?(action_str) then default_link_text = 'Back'\n end\n\n # Use the options link_text value if it exists;\n # otherwise use our link_text determined by the action name\n if options.keys.include?(:link_text)\n link_text = \"#{icon} #{options[:link_text]}\".html_safe\n else\n link_text = \"#{icon} #{default_link_text}\".html_safe\n end\n\n link_text\n end", "def people_involved_column(r)\n '<span class=\"loan\">' +\n \"<font color='darkgreen'>#{link_to(r.ower, r.ower, :border => 0 )}</font>&nbsp;--&gt;&nbsp;\" +\n \"<font color='darkred'>#{link_to r.creditor,r.creditor}</font>\" +\n '</span>' \n end", "def association_link(mc, assoc_obj)\n if mc\n t = h(mc.object_display_name(:association, request, assoc_obj))\n if mc.supported_action?(type, request)\n t = \"<a href=\\\"#{base_url_for(\"#{mc.link}/#{type}/#{mc.primary_key_value(assoc_obj)}\")}\\\">#{t}</a>\"\n end\n t\n else\n h(model.default_object_display_name(assoc_obj))\n end\n end", "def document_show_link_field\n Blacklight.config[:index][:show_link].to_sym\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def th_actions(*args)\n return '' if args.empty?\n th_header = <<-END\n<span class=\"actions\">\n #{args.each_slice(2).map do |text,js|\n %Q{<a onclick=\"#{ERB::Util.h js}\">#{ERB::Util.h text}</a>}\n end.join(' - ')}\n</span>\nEND\n return th_header.html_safe\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_asc_or_desc}\" : nil\n direction = column == sort_column && sort_asc_or_desc == \"asc\" ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :asc_or_desc => direction}, {:class => css_class}\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n direction = (column == params[:sort] && params[:direction] == \"asc\") ? \"desc\" : \"asc\"\n if column == params[:sort]\n link_to title, { sort: column, direction: direction }, class: params[:direction]\n else\n link_to title, sort: column, direction: direction\n end\n end", "def td_content record, col\n content = col.count ? record.send(col.data_index).count : record.send(col.data_index)\n unless content.nil?\n content = content.strftime(col.date_format) unless col.date_format.nil?\n content = link_to content, action.inject_url(col.link, record) unless col.link.nil?\n content = col.format.call(@store.records, record) unless col.format.nil?\n content\n end\n end", "def link_sort_header(column_translation_code )\n #title ||= column.titleize\n if column_translation_code.index('.') then\n column=column_translation_code.split.last\n else\n column=column_translation_code\n end\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n # need to add back the sqlinjection protection here\n #css_class = \"current #{sort_direction}\" \n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to tlabel(column_translation_code), {:sort => column, :direction => direction}, {:class => css_class}\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n direction_icon = (direction.eql? \"desc\") ? :sort_desc : :sort_asc\n html = link_to(title, users_url(sort: column, direction: direction, page: nil, id: \"\"), { class: css_class })\n html << icon_tag(direction_icon) if column == sort_column\n return html\n end", "def manageable_sortable(column, title = nil, options = {})\n title ||= column.titleize\n\n if respond_to?(:sort_column) && respond_to?(:sort_direction)\n css_class = column && sort_column && column.to_sym == sort_column.to_sym ? \"sort_#{sort_direction}\" : nil\n direction = column && sort_column && column.to_sym == sort_column.to_sym && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n options[:class] = [options[:class], css_class].compact.join(\" \")\n\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), options\n else\n title\n end\n end", "def sort_link(title, column=nil, options = {})\n condition = options[:unless] if options.has_key?(:unless)\n\n unless column.nil?\n current_column = (params[:sort_column] == column.to_s) || params[:sort_column].blank? && options[:sort_default]\n css_class = current_column ? \"current\" : nil\n if current_column # explicitly or implicitly doing the existing sorting, so we need to toggle\n if params[:sort_direction]\n direction = params[:sort_direction].to_s.upcase == 'ASC' ? 'DESC' : 'ASC'\n else \n direction = options[:desc_default] ? 'ASC' : 'DESC'\n end\n else\n direction = options[:desc_default] ? 'DESC' : 'ASC'\n end\n link_to_unless condition, ((direction == 'ASC' ? '&#8593;<span class=\"landmark\">ascending</span>&#160;' : '&#8595;<span class=\"landmark\">descending</span>&#160;') + title).html_safe, \n request.parameters.merge( {:sort_column => column, :sort_direction => direction} ), {:class => css_class}\n else\n link_to_unless params[:sort_column].nil?, title, url_for(params.merge :sort_column => nil, :sort_direction => nil)\n end\n end", "def column(name, *args)\n if relation = args.detect {|arg| arg.is_a? Arel::Relation}\n args.delete(relation)\n args.map! {|arg| arg.is_a?(Arel::Attribute) ? relation[arg] : arg}\n end\n args.push(arel_table[name]) unless args.any? {|arg| arg.is_a? Arel::Attribute}\n report_columns[name.to_sym] = Reportkit::ColumnDefinition.new(name, *args.compact)\n end", "def column(data_index = nil, options = nil, html_options = nil, &block)\n @columns << Column.new(data_index, options, html_options, &block)\n end", "def link_cell\n @link_cell ||= false\n end", "def dt_actions\n\n links = []\n links << h.link_to(h.project_path(object), class: 'btn btn-success mx-1') do \n h.fa_icon 'rocket', text: h.t('explore')\n end\n links << h.link_to(h.edit_project_path(object), class: 'btn btn-primary mx-1') do \n h.fa_icon 'edit', text: h.t('edit')\n end\n links << h.link_to(h.project_path(object), method: :delete, remote: true, class: 'btn btn-danger', data: h.dataConfirm) do \n h.fa_icon 'remove', text: h.t('remove')\n end\n h.safe_join(links, '')\n end", "def ccolumn(type, label)\n self.columns << [type, label]\n end", "def column(*args,&block)\n columns.column(*args, &block)\n end", "def sortable(column, title = nil) \n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n # In the link to below we added the :product and :versino aprameters\n # these parameters are added to urls by the search function. For example, see the Execute and Versions page\n # We preserve them for use when a search and then order is selected\n link_to title, {:sort => column, :direction => direction, :product => params[:product], :version => params[:version]}, {:class => css_class}\n end", "def action\n ::HubEdos::Common::Reference::Descriptor.new(@data['action']) if @data['action']\n end", "def get_action_link\n if controller_path == 'admin/articles'\n case action_name\n when 'index' then t('buttons/all_articles').html_safe\n when 'new' then t('buttons/new_article').html_safe\n when 'edit' then t('buttons/edit_article').html_safe\n when 'show' then t('buttons/preview').html_safe\n end\n elsif controller_path == 'admin/authors'\n case action_name\n when 'index' then t('buttons/all_authors').html_safe\n when 'new' then t('buttons/new_author').html_safe\n when 'edit' then t('buttons/edit_author').html_safe\n when 'show' then t('buttons/author').html_safe\n end\n end\n end", "def action_alias url, action\n ((@action_aliases||={})[action]||=[]) << url\n end", "def side_column_links\n str = \"<h3 class=\\\"head\\\">#{link_to 'Communications THL', '#nogo', {:hreflang => 'Fathom Communications THL.'}}</h3>\\n<ul>\\n\"\n str += \"<li>#{link_to 'Home', root_path, {:hreflang => 'Home communications.'}}</li>\\n\"\n #str += \"<li>#{link_to 'My Profile', me_path, {:hreflang => 'My Profile.'}}</li>\\n\" if logged_in?\n #str += \"<li>#{link_to 'People', people_path, {:hreflang => 'Manage People'}}</li>\\n\"\n #str += \"<li>#{link_to 'Projects', projects_path, {:hreflang => 'Manage Projects.'}}</li>\\n\"\n #str += \"<li>#{link_to 'Organizations', organizations_path, {:hreflang => 'Manage Organizations.'}}</li>\\n\"\n #str += \"<li>#{link_to 'Tools', tools_path, {:hreflang => 'Manage Tools.'}}</li>\\n\"\n str += \"</ul>\"\n return str\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : \"current\"\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n #link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n end", "def action_definition(defaults, model)\n ACTION_DEFINITIONS[defaults[:action]] % {\n name: model.name.titleize.downcase,\n names: model.name.titleize.pluralize.downcase,\n associated: defaults[:associated].to_s.pluralize.tr('_', ' '),\n remoted: defaults[:remoted]\n }\n end", "def content_reply_comment_action_link(text, comment)\n content_reply_comment_action_item(comment_link_to_function(text, comment))\n end", "def get_hyperlink(row)\n URI.join(native_host, row.dig('uri')).to_s\n end", "def display_link_to?(action)\n @display_link.include?(action)\n end", "def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end", "def sort_column(column, title, options = {})\n if params[:sort_order]\n c = params[:sort_order][:c]\n d = params[:sort_order][:d]\n else\n c = controller.default_sort_column\n d = controller.default_sort_direction\n end\n condition = options[:unless] if options.has_key?(:unless)\n sort_dir = d == 'up' ? 'down' : 'up'\n link_class = (d == 'up' ? 'headerSortDown' : 'headerSortUp') if c == column.to_s\n html = []\n html << \"<th class=\\\"header #{link_class}\\\">\"\n html << link_to_unless(condition, title, request.parameters.merge( :sort_order => {:c => column, :d => sort_dir}))\n html << \"</th>\"\n html.join('').html_safe\n end", "def sortable(column, title = nil)\n \ttitle ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n \tdirection = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n \tlink_to title, params.merge(:sort => column, :direction => direction, :page => nil),\n \t\t\t\t {:title => \"Sort by #{title}\", :class => css_class}\n end", "def linkbutton\n config[\"linkbutton\"]\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def sortable(column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n #link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n #link_to title, {:sort => column, :direction => direction}, {:class => css_class}\n end", "def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end", "def build_row_onclick(data_row)\n onclick = nil\n\n # Handle CI based report rows\n if ['EmsCluster', 'ExtManagementSystem', 'Host', 'Storage', 'Vm', 'Service'].include?(db) && data_row['id']\n controller = db == \"ExtManagementSystem\" ? \"management_system\" : db.underscore\n donav = \"DoNav('/#{controller}/show/#{data_row['id']}');\"\n title = data_row['name'] ?\n \"View #{ui_lookup(:model => db)} \\\"#{data_row['name']}\\\"\" :\n \"View this #{ui_lookup(:model => db)}\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='#{title}'\"\n end\n\n # Handle CI performance report rows\n if db.ends_with?(\"Performance\")\n if data_row['resource_id'] && data_row['resource_type'] # Base click thru on the related resource\n donav = \"DoNav('/#{data_row['resource_type'].underscore}/show/#{data_row['resource_id']}');\"\n onclick = \"onclick=\\\"#{donav}\\\" onKeyPress=\\\"#{donav}\\\" tabindex='0' style='cursor:hand' title='View #{ui_lookup(:model => data_row['resource_type'])} \\\"#{data_row['resource_name']}\\\"'\"\n end\n end\n\n onclick\n end", "def association_class_link(mc, assoc)\n assoc_name = humanize(assoc)\n if mc && mc.supported_action?(:browse, request)\n \"<a href=\\\"#{base_url_for(\"#{mc.link}/browse\")}\\\">#{assoc_name}</a>\"\n else\n assoc_name\n end\n end", "def screenshot_column(record)\n if (!record.screenshot.nil?)\n return link_to(image_tag(url_for({ :controller => \"urls\",\n :action => \"screenshot_small\",\n :id => record.id }),\n :alt => \"Screenshot (Small)\"),\n { :controller => \"urls\",\n :action => \"screenshot_large\",\n :id => record.id },\n :popup => true)\n else\n return \"-\"\n end\n end", "def sortable(sort_sym, column, title = nil)\n title ||= column.titleize\n css_class = column == sort_column(sort_sym) ? \"current #{sort_direction}\" : nil\n direction = column == sort_column(sort_sym) && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}\n end", "def append_link( output, text, record )\n return ( output << \" \" << link_to(\n text.html_safe,\n {\n :controller => record.auditable_type.downcase.pluralize,\n :action => 'show',\n :id => record.auditable_id\n }\n )\n ).html_safe()\n end" ]
[ "0.68659335", "0.6676235", "0.6676235", "0.6626017", "0.65914094", "0.65518653", "0.64810014", "0.64810014", "0.6111127", "0.6082752", "0.60673535", "0.6035074", "0.6002753", "0.5996383", "0.59883153", "0.5952024", "0.59111124", "0.59095824", "0.5807181", "0.5792581", "0.5704532", "0.568391", "0.56760055", "0.56547207", "0.56412226", "0.5589909", "0.5584455", "0.5583085", "0.55746305", "0.5531209", "0.5522422", "0.551703", "0.5481322", "0.5475504", "0.5475459", "0.5423872", "0.54231024", "0.54182273", "0.54056495", "0.5389987", "0.53757536", "0.5373348", "0.5365126", "0.5348844", "0.5348844", "0.53473485", "0.53473485", "0.5344422", "0.53365237", "0.5329085", "0.5327315", "0.53228176", "0.53228176", "0.53228176", "0.5316849", "0.53077966", "0.5302889", "0.52979624", "0.5290525", "0.52849364", "0.5278865", "0.52671355", "0.52658707", "0.5257879", "0.52511644", "0.5230475", "0.52296805", "0.5229431", "0.5212247", "0.5197702", "0.5181663", "0.5157833", "0.5154275", "0.51528823", "0.51413417", "0.51396877", "0.51260996", "0.51123196", "0.5110612", "0.5097238", "0.5093073", "0.5077094", "0.5066153", "0.506411", "0.5063749", "0.50588644", "0.50438774", "0.50261086", "0.5025552", "0.5023042", "0.50222206", "0.50222206", "0.502074", "0.5018658", "0.5015086", "0.50012463", "0.49889266", "0.49884647", "0.49866953" ]
0.7094079
1
ACTION LINKS :nodoc: Standard link action to the show page of a given record. Uses the current record if none is given.
def link_action_show(path = nil) path ||= path_args(entry) link_action ti(:"link.show"), 'zoom-in', path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end", "def link_to_show(text, path, options={})\n link_to_action(text, path, options.reverse_merge(:action => :show))\n end", "def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend", "def apphelp_protected_show_link( obj, name = nil )\n return apphelp_unknown_quantity_warning() if ( obj.nil? )\n\n name = obj.name if ( name.nil? )\n link = apphelp_protected_link_to(\n :show,\n {\n :model => obj.class,\n :method => :url_for\n },\n obj\n ) { h( name ) }\n\n return ( link.empty? ) ? h( name ) : link\n end", "def call_for_detail(entity, text, options = {}, html_options = {})\n text ||= \"...\"\n opt = options.dup\n opt[:controller] = options[:force_controller] || entity.controller_name\n opt[:action] = options[:force_action] || \"show\"\n opt[:id] = options[:force_id] || entity.to_param\n opt[:background_params] = @background_params\n if html_options[:popup] || html_options[:target]\n # for the case of new window to render\n opt[:layout] ||= \"base_layout_for_non_collection\"\n end\n link_to text, opt, html_options\n end", "def show\n if @link\n @link.clicked!(:referrer => request.referrer)\n redirect_to @link.url\n else\n render text: \"No such link.\", status: 404\n end\n end", "def show\n\t\t@current_link = Rlink.find(params[:id])\n\tend", "def handle_show\n if request.id\n show_page(model.with_pk(normalized_type, request, request.id))\n else\n list_page(:show)\n end\n end", "def show\n @link = Link.find_by_short_name(params[:short_name])\n\n if @link\n @link.clicked!\n redirect_to @link.url\n else\n render text: 'No such link.', status: 404\n end\n end", "def show\n respond_to do |format|\n format.html { render :partial => 'show', :locals => { :record => @link }, :layout => 'admin/admin_show' }\n format.xml { render :xml => @link }\n end\n end", "def ar_show_link resource= @resource\n link_to(controller.ardata.labels[:show], ar_resource_path('', resource))\n end", "def action_link(\n action = nil,\n current: nil,\n label: nil,\n css: '.page-action',\n **opt\n )\n action = opt.delete(:action) || action\n entry = action_entry(action, current: current, **opt)\n action, current = entry.values_at(:action, :current)\n\n return if (action == current) && current&.start_with?('list_')\n return unless can?(action, object_class)\n\n label = (label || entry[:label]).presence\n label = label ? (label % entry) : labelize(action)\n\n html_tag(:li, prepend_css(css)) do\n link_to_action(label, action: action)\n end\n end", "def link_to_show(roo, controller = controller.controller_name)\n link_to(image_tag('show.png', :alt => 'show'), {:controller => controller, :action => 'show', :id => roo}, :class => 'icon', :title => 'show')\n end", "def show\n show! {\n page[:title] = t(\"#{controller_catalog}.show.page_title\", {:name => resource.name})\n record_action!(:read, resource)\n }\n end", "def link_to_edit_campaign(record)\n link_to_edit_resource(record) unless record.is_a?(NoCampaign)\n end", "def show\n @action = \"show\"\n end", "def show\n @record = Service.find(params[:id].to_i)\n @lastaction = \"show\"\n\n @gtl_url = \"/show\"\n\n set_display\n\n case @display\n when 'generic_objects'\n show_generic_object\n return\n when 'custom_button_events'\n display_nested_list(@display)\n return\n end\n\n unless @explorer\n tree_node_id = TreeBuilder.build_node_id(@record)\n redirect_to(:controller => \"service\",\n :action => \"explorer\",\n :id => tree_node_id)\n return\n end\n redirect_to(:action => 'show', :controller => @record.class.base_model.to_s.underscore, :id => @record.id)\n end", "def list_page_for model\n param_hash_to_link_hash( (session[:admin_list_params] || {})[model] || {} ).merge( :action => 'list', :model => model )\n end", "def a_href(controller_or_record, action_name, parent_record = nil)\n if controller_or_record.is_a?(Sequel::Model) \n controller_name = controller_or_record.class.name.to_sym\n record = controller_or_record\n else\n controller_name = controller_or_record.to_sym\n record = Object.const_get(controller_name).new\n end\n \n action_props = SSControllerBase.controllers[controller_name][action_name]\n if !action_props\n raise \"UNKNOWN PROPS FOR ACTION: #{controller_name.inspect} #{action_name.inspect}\"\n end\n \n if action_name == :new\n raise ArguementError, \"Parent record required for :new action.\" if !parent_record\n ancestor_records = parent_record.ancestor_records + [parent_record]\n new_path = action_props[:path]\n else\n raise ArguementError, \"Record required.\" if !record\n ancestor_records = record.ancestor_records\n new_path = action_props[:path].sub(':id', record[:id])\n end\n \n ancestor_records.inject(new_path) { |m, rec|\n m.sub(\":#{rec.class.name.underscore}_id\", rec[:id])\n }\n end", "def page_link(records, opts = {})\n uri = URI.parse(request.original_url)\n query = Rack::Utils.parse_query(uri.query)\n query['page'] = records.send(\"#{opts[:page]}_page\")\n uri.query = Rack::Utils.build_query(query)\n uri.to_s\n end", "def item_link(record)\n doi_link = doi_generator(record)\n\n # Return DOI link, in one exists\n return doi_link if doi_link\n\n # Query OpenURL resolve service for results\n open_url_links = open_url_generator(record)\n if open_url_links.size.positive?\n # If there is only one result, return it\n return open_url_links[0] if open_url_links.size == 1\n\n # If there are multiple results, return a \"Citation Finder\" link\n return citation_generator(record)\n end\n\n # Default -- return link to the catalog detail page\n catalog_generator(record)\n end", "def view_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'view')\n # text to be displayed\n link_text = crud_link_text(options, 'view')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'view-' + link_id(object)\n options[:title] = 'View this ' + resource_name\n\n if defined? CanCan\n link += link_to link_text, url_for(resource), options if can?(:read, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n\n link\n end", "def nav_link(text, action=\"index\", controller)\n\t\treturn link_to_unless_current text, :id => nil, :controller => controller, :action => action\n\tend", "def layouts_show_links(*args)\n render \"layouts/show/links\", obj: args.shift, sender: args.shift, args: args \n end", "def href(params = nil)\n \"#{controller.url}/#{name}\" << (params ? \"?#{params.to_url_query}\" : \"\")\n end", "def show\n\t\t@link = Link.find(params[:id])\n\tend", "def render_record_in_list(record, controller_path)\n text = render_record_from_config(record)\n if record_select_config.link?\n url_options = {:controller => controller_path, :action => :select, :id => record.id, :escape => false}\n link_to text, url_options, :method => :post, :remote => true, :class => ''\n else\n text\n end\n end", "def url_for_me(action)\n if action == 'show'\n \"/articles/#{to_param}\"\n else\n \"/articles/#{to_param}/#{action}\"\n end\n end", "def show\n\t\tshow_\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @link }\n\t\tend\n\tend", "def visit_show_page(model, entry: nil, index: nil, entry_css: nil)\n ctrlr = controller_name(model)\n entry ||=\n if (entry_css ||= property(ctrlr, :index, :entry_css))\n case index\n when Integer then all(entry_css).at(index)\n when :last then all(entry_css).last\n else find(entry_css, match: :first)\n end\n end\n link = entry&.find('.value.field-Title a')\n title = link&.text&.html_safe || 'NO TITLE'\n link&.click\n if block_given?\n yield(title)\n else\n show_url\n end\n assert_valid_show_page(ctrlr, title: title)\n end", "def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end", "def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end", "def link_to_page_with_label(label)\n return (\"<a href='/chefs/\" + self.id.to_s + \"'>\" + label + \"</a>\").html_safe\n end", "def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end", "def display_link_to?(action)\n @display_link.include?(action)\n end", "def nav_link(text,controller,action=\"index\")\n link_to_unless_current text,:id=>nil,:controller=>controller,:action=>action\n end", "def show_link(ems, options = {})\n ems_path(ems.id, options)\n end", "def crud_links(model, instance_name, actions, args={})\n _html = \"\"\n _options = args.keys.empty? ? '' : \", #{args.map{|k,v| \":#{k} => #{v}\"}}\"\n \n if use_crud_icons\n if actions.include?(:show)\n _html << eval(\"link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}\")\n end\n else\n if actions.include?(:show)\n _html << eval(\"link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}\")\n end\n end\n _html\n end", "def show\n return if perfmenu_click?\n @sb[:action] = params[:display]\n @display = params[:display] || \"main\" unless pagination_or_gtl_request?\n\n identify_container(params[:id])\n if @display == \"performance\"\n @showtype = \"performance\"\n perf_gen_init_options\n @refresh_partial = \"layouts/performance\"\n end\n\n node_type = TreeBuilder.get_prefix_for_model(@record.class.base_model)\n redirect_to :action => 'explorer',\n :controller => @record.class.base_model.to_s.underscore,\n :id => \"#{node_type}-#{@record.id}\" unless @display == \"performance\"\n end", "def show\n @link = Link.find_by_url(params[:id].gsub(/\\++$/, ''))\n if @link.nil?\n redirect_to links_path\n else\n if params[:id][-1] == '+'\n render 'show'\n else\n @link.turn_counter\n redirect_to @link.origin\n end\n end\n end", "def show_links\n @resume = current_user.resumes.find(params[:id])\n end", "def effective_logging_object_link_to(obj, action = :show)\n if obj.kind_of?(User)\n if action == :show && defined?(admin_user_path)\n link_to('View', admin_user_path(obj))\n elsif action == :edit && defined?(edit_admin_user_path)\n link_to('Edit', edit_admin_user_path(obj))\n end\n end\n end", "def effective_logging_object_link_to(obj, action = :show)\n if obj.kind_of?(User)\n if action == :show && defined?(admin_user_path)\n link_to('View', admin_user_path(obj))\n elsif action == :edit && defined?(edit_admin_user_path)\n link_to('Edit', edit_admin_user_path(obj))\n end\n end\n end", "def show\n case params[:flow]\n when \"next\"\n redirect_to_next_object(:next, Herbarium, params[:id].to_s)\n when \"prev\"\n redirect_to_next_object(:prev, Herbarium, params[:id].to_s)\n else\n @canonical_url = herbarium_url(params[:id])\n @herbarium = find_or_goto_index(Herbarium, params[:id])\n end\n end", "def nav_link(text,controller,action=\"index\")\n\t\t\tlink_to_unless_current text,:controller=>controller,:action=>action\n\t\tend", "def url_for_me(action)\n if action == 'show'\n \"/projects/#{project.to_param}/documents/#{to_param}\"\n else\n \"/projects/#{project.to_param}/documents/#{to_param}/#{action}\"\n end\n end", "def show\n render :action => params[:id]\n end", "def link_menu(resource, options={})\n html= ' '\n if permitted_to? :index, table_symbol_from(resource) then\n if resource.is_a? Symbol then\n model_plural = resource.to_s\n else\n model= singular_table_name_from( resource).pluralize \n end\n a = link_to(tmenu(model_plural), eval(model_plural + \"_path\"), options) \n html = wrap_in_html_container a, 'li', 'menuItem'\n end\n #ebugger\n return html.html_safe\n end", "def link_to_page(page, *args, title_key: DEFAULT_TITLE_KEY, **kwargs, &block)\n if block_given?\n link_to page.request_path, *args, **kwargs, &block\n else\n link_to page.data[DEFAULT_TITLE_KEY], page.request_path, *args, **kwargs\n end\n end", "def link(obj)\n return \"<a href='#{R(obj, self.id)}'>#{self.name}</a>\"\n end", "def next_link_for(records)\n page_link(records, page: 'next')\n end", "def show\n @link = @panel.links.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @link }\n end\n end", "def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end", "def show\n instance_exec(&resource.before_actions[:show]) if resource.before_actions[:show]\n end", "def show\n Rails.logger.debug \"======== Enter RecordsController::show ========\"\n\n # Each of these calls to get resources can result in a redirection for \n # authorization. Don't continue if we redirect - we'll get called again \n # later after authorization is complete.\n\n query = \"?patient=\" + params[:id]\n\n success = get_resource(\"patient/@\" + params[:id])\n\n success &&= get_resource(\"condition\" + query) if success\n success &&= get_resource(\"medication\" + query) if success\n success &&= get_resource(\"encounter\" + query) if success\n success &&= get_resource(\"observation\" + query) if success\n end", "def link_to_document(doc, field_or_opts = nil, opts={:label=>nil, :counter => nil, :results_view => true})\n # opts[:label] ||= blacklight_config.index.show_link.to_sym unless blacklight_config.index.show_link == nil\n # label = _cornell_render_document_index_label doc, opts\n if params[:controller] == 'bookmarks'\n label = field_or_opts\n docID = doc.id\n link_to label, '/bookmarks/' + docID\n else\n # link_to label, doc, { :'data-counter' => opts[:counter] }.merge(opts.reject { |k,v| [:label, :counter, :results_view].include? k })\n super\n end\n end", "def nav_link(text, controller, action=\"index\", id=nil)\n link_to_unless_current text, :id => nil, :controller => controller, :action => action, :id => id\n end", "def show\n @page = Page.find(params[:page_id])\n # @url = Url.find(params[:id]) # set_url\n end", "def show\n store_location\n return unless (@project = find_or_goto_index(Project, params[:id].to_s))\n\n case params[:flow]\n when \"next\"\n redirect_to_next_object(:next, Project, params[:id]) and return\n when \"prev\"\n redirect_to_next_object(:prev, Project, params[:id]) and return\n end\n\n set_ivars_for_show\n end", "def show\n @page = Page.find_by_permalink(params[:id]) or current_user ? redirect_to(action: :new, id: params[:id]) : redirect_to(root_url, flash: {alert: \"Page not found\"})\n end", "def show\n name = params[:name]\n action = params[:id] ? \"show\" : \"index\"\n action = params[:view] if params[:view].present?\n\n @page = (\"Workflows::#{name.to_s.capitalize}::#{action.capitalize}\").constantize.new(params, { user: current_user, cookies: cookies })\n\n render(html: @page.item.display) and return if params[:view].present?\n\n render :template => \"#{name}/#{action}\"\n end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def show\n\t\tredirect_to :action => \"edit\", :id => params[:id]\n\tend", "def show\n redirect_to show_path(:id=>@dataclip.link_token)\n end", "def show\t\t\t\t\n\t\t\tend", "def nav_link(text, controller, action=\"index\", rel=false)\n return link_to_unless_current(text, :controller => controller, :action => action, :rel => rel)\n end", "def get_action_link\n if controller_path == 'admin/articles'\n case action_name\n when 'index' then t('buttons/all_articles').html_safe\n when 'new' then t('buttons/new_article').html_safe\n when 'edit' then t('buttons/edit_article').html_safe\n when 'show' then t('buttons/preview').html_safe\n end\n elsif controller_path == 'admin/authors'\n case action_name\n when 'index' then t('buttons/all_authors').html_safe\n when 'new' then t('buttons/new_author').html_safe\n when 'edit' then t('buttons/edit_author').html_safe\n when 'show' then t('buttons/author').html_safe\n end\n end\n end", "def show\n do_show\n end", "def show\n __log_activity(anonymous: true)\n __debug_route\n err = nil\n @item = index_record(record_id: @record_id)\n err = @item.exec_report if @item.error?\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values }\n end\n rescue => error\n err = error\n ensure\n failure_status(err)\n end", "def show\n\n\tend", "def show\n\n\tend", "def show\n\n\tend", "def action_link\n if member.kind_of?(Work)\n link_to \"Info\", work_path(member), class: \"btn btn-primary\"\n elsif download_original_only\n link_to \"Download\", download_path(member.file_category, member), class: \"btn btn-brand-main less-padding\", data: {\n \"analytics-category\" => \"Work\",\n \"analytics-action\" => \"download_original\",\n \"analytics-label\" => member.parent.friendlier_id\n }\n else\n render DownloadDropdownComponent.new(member, display_parent_work: member.parent, use_link:true)\n end\n end", "def add_show_action(options = {})\n get '/:id' do\n item = model.find params[:id]\n authorize item, :show? if options[:authorize]\n present item, with: entity_class\n end\n end", "def show\n \tend", "def show\n \tend", "def link_actions_for(object)\n link_to_show(object) +\n link_to_edit(edit_polymorphic_path(object)) +\n link_to_destroy(object)\n end", "def show\n @record = user_scoped.find(params[:id])\n #add_topic_path\n respond_to do |format|\n format.html {\n prepare_list\n @search = page_info.record\n render :action=>'index'\n }\n format.js\n end\n end", "def show\n breadcrumbs_for :show\n end", "def url\n\n # TODO bug with controllers without models e.g. StaticPages\n if controller_id.blank?\n \"#\"\n elsif instance_id.nil? || instance_id == 0\n url_for :controller => controller_id, :action => action_id, :only_path => true\n else\n # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n klass = controller_id.classify.constantize\n if instance_id.present?\n instance = klass.find(instance_id)\n\n if [\"show\"].include? action_id\n polymorphic_path(instance, :only_path => true)\n else\n polymorphic_path(instance, :action => action_id, :only_path => true)\n end\n end\n end\n\n # # Media Link only:\n # # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n # klass = controller_id.classify.constantize\n # action_id = 'show'\n # if instance_id.present?\n # instance = klass.find(instance_id)\n\n # if [\"show\"].include? action_id\n # polymorphic_path(instance, :only_path => true)\n # else\n # polymorphic_path(instance, :action => action_id, :only_path => true)\n # end\n # end\n end", "def section_link(name,options)\n if options[:action].include?(@current_action) && options[:controller] == @current_controller\n link_to(name, \"/\"+ options[:url], :class => 'current')\n else\n link_to(name, \"/\"+ options[:url])\n end\n end", "def show\n breadcrumb\n end", "def url_for_me(action)\n if action == 'show'\n \"/projects/#{to_param}\"\n else\n \"/projects/#{to_param}/#{action}\"\n end\n end", "def link_to_document_query(doc, options={:label=>Blacklight.config[:index][:show_link].to_sym})\n label = case options[:label]\n when Symbol\n doc.get(options[:label])\n when String\n options[:label]\n else\n raise 'Invalid label argument'\n end \n if params[:f].nil? or params[:f]['worknum_s'].nil? \n link_to_unless(options[:suppress_link], label, add_facet_params_and_redirect(\"worknum_s\", doc[\"id\"])) \n else\n doc[\"worktitle_display\"]\n end\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def show\n \t\tshort_url = 'http://localhost:3000/'+params[:shortened_link]\n \t\turl = Link.find_by(shortened_link: short_url)\n \t\tif url\n \t\t\toriginal_url = url.given_link\n \t\t\tredirect_to \"#{original_url}\"\n \t\telse\n \t\t\trender json: \"Not found\"\n \t\tend\n \tend", "def link_to_previous_advanced_search(params)\n link_to(parseHistoryShowString(params), parseHistoryQueryString(params))\n end", "def url\n cname = self.class.classname.to_s.downcase\n return \"?show=#{cname}_show&#{cname}_id=#{self.id}\"\n end", "def show\r\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend", "def show\n\tend" ]
[ "0.6470081", "0.64369476", "0.6305149", "0.62784165", "0.6152702", "0.61308247", "0.61293757", "0.6118188", "0.610357", "0.60206217", "0.60050935", "0.59638166", "0.5927874", "0.59247965", "0.59086144", "0.58844644", "0.5835034", "0.58156013", "0.5803757", "0.57960385", "0.5794184", "0.5787046", "0.5768124", "0.5746827", "0.57426524", "0.5735772", "0.5732795", "0.5723057", "0.5710295", "0.5689677", "0.5681747", "0.5681747", "0.5672789", "0.5667359", "0.5651186", "0.56423324", "0.5626999", "0.5625985", "0.5619905", "0.561641", "0.56133616", "0.56131905", "0.56131905", "0.56129336", "0.561005", "0.56092715", "0.55981517", "0.55877393", "0.5575171", "0.55536115", "0.5546459", "0.5539406", "0.552434", "0.5512409", "0.5512308", "0.5500536", "0.5498234", "0.54966134", "0.5493586", "0.5488884", "0.54427737", "0.54277617", "0.5426496", "0.5424232", "0.542366", "0.5414965", "0.5413468", "0.5413329", "0.54080254", "0.54067546", "0.54067546", "0.54067546", "0.5406654", "0.54033023", "0.5396963", "0.5396963", "0.5396487", "0.5389547", "0.53866", "0.53749406", "0.53744406", "0.5373155", "0.53716135", "0.537012", "0.5369557", "0.5364863", "0.5361864", "0.53595704", "0.53570145", "0.53483284", "0.53483284", "0.53483284", "0.53483284", "0.53483284", "0.53483284", "0.53483284", "0.53483284", "0.53483284", "0.53483284" ]
0.6059773
10
Standard link action to the edit page of a given record. Uses the current record if none is given.
def link_action_edit(path = nil) path ||= path_args(entry) link_action ti(:"link.edit"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_to_edit(record, options={})\n button_to_action record, :edit, options\n end", "def edit\n @record = Record.find(params[:id])\n end", "def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end", "def edit_link(obj, options = {})\n if policy(obj).edit?\n url = polymorphic_url([:edit] + Array(obj))\n action_link('Edit', url, 'pencil', options)\n end\n end", "def visit_edit_page(model, **opt, &block)\n action = opt[:id] ? :edit : :edit_select\n visit_action_page(model, action, **opt, &block)\n end", "def edit_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'edit')\n # text to be displayed\n link_text = crud_link_text(options, 'edit')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'edit-' + link_id(object)\n options[:title] = 'Edit this ' + resource_name\n\n case true\n when defined? CanCan\n if resource.is_a?(Array)\n # check if we can access directly via a shallow route\n begin\n if url_for([:edit, object])\n link += link_to link_text, url_for([:edit, object]), options if can?(:edit, object)\n else\n link += link_to link_text, url_for(resource.unshift(:edit)), options if can?(:edit, object)\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource.unshift(:edit)), options if can?(:edit, object)\n end\n else\n link += link_to link_text, url_for([:edit, resource]), options if can?(:edit, object)\n end\n else\n if resource.is_a?(Array)\n # check if we can access directly via a shallow route\n begin\n if url_for([:edit, object])\n link += link_to link_text, url_for([:edit, object]), options\n else\n link += link_to link_text, url_for(resource.unshift(:edit)), options\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource.unshift(:edit)), options\n end\n else\n link += link_to link_text, url_for([:edit, resource]), options\n end\n end\n\n link\n end", "def do_edit\n @record = find_if_allowed(params[:id], :update)\n end", "def edit\n \tredirect_to action: \"show\"\n end", "def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end", "def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end", "def edit\r\n end", "def link_to_edit(path)\n link_to icon('edit'), path, title: 'Edit this record'\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\n end", "def display_edit_link(entry)\n if entry.user == current_user\n link_to (image_tag 'edit.png'), edit_entry_path(entry)\n end\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 link_to_edit_campaign(record)\n link_to_edit_resource(record) unless record.is_a?(NoCampaign)\n end", "def edit\n\t\t@page_name = \" - Edit Show\"\n\tend", "def edit\r\n \r\n end", "def edit\n\n end", "def edit\n\n end", "def edit \n end", "def edit \n end", "def edit\nend", "def edit\nend", "def edit\nend", "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", "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.7420026", "0.7184157", "0.71270794", "0.7106863", "0.7043936", "0.69979936", "0.69696784", "0.68517655", "0.6795488", "0.6795488", "0.67942053", "0.6750367", "0.67334473", "0.67334473", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6726495", "0.6725826", "0.6723748", "0.67114824", "0.6696953", "0.6689772", "0.6673666", "0.6673666", "0.6655579", "0.6655579", "0.6655579", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916", "0.66370916" ]
0.7035757
6
Standard link action to the destroy action of a given record. Uses the current record if none is given.
def link_action_destroy(path = nil) path ||= path_args(entry) link_action ti(:"link.delete"), 'remove', path, :data => { :confirm => ti(:confirm_delete), :method => :delete } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'destroy')\n # text to be displayed\n link_text = crud_link_text(options, 'destroy')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'delete-' + link_id(object)\n options[:title] = 'Delete this ' + resource_name\n options[:confirm] = \"Are you sure you want to delete this #{resource_name}? This may not be recoverable once destroyed.\"\n options[:method] = :delete\n options[:data] = {\n confirm_fade: true,\n confirm_title: options[:title],\n confirm_cancel: 'Cancel',\n confirm_proceed: 'Got it. Proceed.',\n confirm_proceed_class: 'btn-danger'\n }\n\n if resource.is_a?(Array) && resource.include?(:edit)\n resource.delete(:edit)\n end\n\n if defined? CanCan\n # check if we can access directly via a shallow route\n begin\n if url_for([:destroy, object])\n link += link_to link_text, url_for([:destroy, object]), options if can?(:destroy, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource), options if can?(:destroy, object)\n end\n else\n # check if we can access directly via a shallow route\n begin\n if url_for([:destroy, object])\n link += link_to link_text, url_for([:destroy, object]), options\n else\n link += link_to link_text, url_for(resource), options\n end\n rescue Exception => e\n link += link_to link_text, url_for(resource), options\n end\n end\n\n link\n end", "def destroy(record)\n record.destroy\n end", "def do_destroy\n @record = find_if_allowed(params[:id], :destroy)\n self.successful = @record.destroy\n end", "def link_action_destroy(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.delete\"), 'remove', path,\n :confirm => ti(:confirm_delete),\n :method => :delete\n end", "def button_to_destroy(record, options={})\n options[:method] = 'delete'\n # We want to emphasize this is dangerous\n options[:data] = { confirm: 'Are you sure?' }\n options[:class] = 'btn-danger'\n button_to_action record, :destroy, options\n end", "def destroy\n @record = Record.find(params[:id])\n @record.destroy\n redirect_to(records_path)\n end", "def destroy\n if @record.destroy\n flash[:success] = \"Record deleted successfully.\"\n redirect_to polymorphic_path([app_kit, model])\n end\n end", "def destroy_record(record)\n record&.destroy\n end", "def destroy\n @record = Record.find(params[:id])\n @record.destroy\n\n respond_to do |format|\n format.html { redirect_to records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @record = find_record\n @record.destroy\n\n respond_to do |format|\n format.html { redirect_to records_url }\n format.json { head :no_content }\n format.js # destroy.js\n end\n end", "def delete\n @record = find_if_allowed(params[:id], :destroy)\n render :action => 'delete'\n end", "def destroy\n @record = Record.find(params[:id])\n @record.destroy\n\n respond_to do |format|\n format.html { redirect_to records_url }\n format.json { head :ok }\n end\n end", "def delete_link(obj, options = {})\n if policy(obj).destroy?\n default_options = { data: {\n confirm: 'Are you sure? There is no undo for this!',\n tooltip: 'Delete',\n method: 'Delete',\n remote: 'true'\n } }\n url = polymorphic_url(obj)\n action_link('Delete', url, 'trash-o', default_options.deep_merge(options))\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to record_class, notice: \"#{record_class.model_name.singular.humanize} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def record_destroy\n paper_trail.record_destroy\n end", "def destroy\n @record = Umbra::Record.find(params[:id])\n @record.destroy\n\n respond_with(@record)\n end", "def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url,\n notice: (crud_notice('destroyed', @time_record) + \"#{undo_link(@time_record)}\").html_safe }\n format.json { head :no_content }\n end\n end", "def destroy\n m = model.find(user_scoped.find(params[:id]).id)\n @record_saved = m # copy for possible later use\n m.destroy\n\n prepare_list\n @record = model.new\n @flash_notice = t('delete_ok')\n end", "def destroy\n @record = Record.find(params[:id])\n if @record\n @record.destroy\n render json: {message: \"Record deleted\"}, status: :ok\n else\n render json: {error: \"Unable to delete the record\"}, status: :400\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n index_url = (request.referer.include?('backend_search')) ? request.referer : obj_index_url\n\n # check object can be removed by \"deletable\"\n if obj.respond_to?(:deletable) && obj.deletable == false\n respond_to do |format|\n redirect_back(format, index_url, CommonTranslation.not_deleted(obj))\n end and return\n end\n\n respond_to do |format|\n if obj.destroy\n redirect_back(format, index_url, CommonTranslation.deleted(obj))\n else\n redirect_back(format, index_url, CommonTranslation.not_deleted(obj))\n end\n end\n end", "def destroy! #TODO\n destroy || raise(ActiveRecord::RecordNotDestroyed)\n end", "def destroy\n\t\trlink = Rlink.find(params[:id])\n\t\trlink.destroy\n\n\t\tredirect_to action: :index\n\tend", "def link_to_deleting(entity = @entity, text = \"削除する\", options = {}, html_options = {})\n link_to_altering(entity, text, :destroying, options, html_options)\n end", "def link_to_destroy(path)\n link_to icon('remove-sign'), path, :confirm => 'Are you sure?', :method => :delete, title: 'Delete this record'\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url }\n format.json { render :json => true }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to records_url, notice: '削除しました' }\n format.json { head :no_content }\n end\n end", "def delete(record)\n record.del\n end", "def destroy\n @record.destroy\n respond_to do |format|\n flash[:success] = \"<strong>Confirmation</strong>\".html_safe + \n \": Record successfully deleted.\"\n format.html { redirect_to user_show_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tLOG.info(\"#{self.class.name}.#{__method__}\") { \"params=#{params}\" }\n\t\t@link = Link.find(params[:id])\n\t\tif @link.destroy\n\t\t\tflash[:notice] = t(:ctrl_object_deleted, :typeobj => t(:ctrl_link), :ident => @link.ident)\n\t\telse\n\t\t\tflash[:error] = t(:ctrl_object_not_deleted, :typeobj => t(:ctrl_link), :ident => @link.ident)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(links_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n eval(\"@#{controller_name.singularize} = #{controller_name.classify}.find(params[:id])\")\n\t\t\n\t\tdestroy_callback_before_object\n\t\t\n eval(\"@#{controller_name.singularize}.destroy\")\n\t\t\n\t\tdestroy_callback\n\t\t\n respond_to do |format|\n format.html { redirect_to( eval(\"#{controller_name}_url\") ) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n end", "def destroy\r\n end", "def destroyRecord(id)\n item = Todo.find(id)\n item.destroy\nend", "def destroy; delete end", "def link_to_destroy(objeto)\n link_to image_tag(\"icons/delete.png\", :alt => \"eliminar objeto\"), \n objeto, :method => :delete, :title => \"Destruir objeto\", \n :confirm => 'Eliminaré el registro. ¿Estás segur@?'\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n execute_before_destroy_callbacks(queried_record)\n queried_record.destroy!\n execute_after_destroy_callbacks(queried_record)\n\n head :no_content\n end", "def destroy!\n destroy || raise(RecordNotDestroyed)\n end", "def destroy\n @vegetable_record.destroy\n redirect_to vegetable_records_path\n end", "def destroy\n @list_record = ListRecord.find(params[:id])\n @list_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(list_records_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @record_object.destroy\n respond_to do |format|\n format.html { redirect_to record_objects_url, notice: 'RecordObject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_records_url(access_token: params[:access_token]) }\n format.json { head :no_content }\n end\n end", "def destroy\n\n end", "def destroy\n\n end", "def destroy\n @record.destroy\n respond_to do |format|\n format.html { redirect_to new_subscription_record_url(@subscription), notice: 'Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def handle_destroy\n obj = model.with_pk(normalized_type, request, request.id)\n model.hook(:before_destroy, request, obj)\n model.destroy(obj)\n model.hook(:after_destroy, request, obj)\n request.set_flash_notice(\"Deleted #{model.class_name}\")\n redirect(:delete, obj)\n end", "def destroy\r\n end", "def destroy!\n destroy || raise(ActiveRecord::RecordNotDestroyed)\n end", "def destroy\n destroy_and_respond(@link)\n end", "def destroy\n nil\n end", "def destroy\n __log_activity\n __debug_route\n back = delete_select_account_path\n @list = destroy_records\n #user_authorize!(@list) # TODO: authorize :destroy\n post_response(:ok, @list, redirect: back)\n rescue Record::SubmitError => error\n post_response(:conflict, error, redirect: back)\n rescue => error\n post_response(error, redirect: back)\n end", "def destroy_action\n redirect_to resource_location\n end", "def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end", "def destroy!\n destroy || _raise_record_not_destroyed\n end", "def undestroy\n @resource = resource_proxy(true).find(params[:id])\n set_resource_instance\n\n @resource.deleted_at = nil\n @resource.save\n\n respond_with(@resource, location: { action: :index })\n\n # flash[:notice] = \"#{resource_name} has been undeleted\"\n # redirect_to action: :index\n end", "def destroy\n @account_record.destroy\n respond_to do |format|\n format.html { redirect_to account_records_url, notice: 'Account record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_resource object\n object.destroy\n end", "def destroy\n @chronopay_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(chronopay_links_url,\n :notice => I18n.t('backend.actions.success_destroy',\n :model => I18n.t('activerecord.capitalized_models.chronopay_link'))) }\n format.xml { head :ok }\n end\n end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end", "def destroy(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :delete)\n end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n @vote_record = VoteRecord.find(params[:id])\n @vote_record.destroy\n\n respond_to do |format|\n format.html { redirect_to vote_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n do_without_exception(:destroy!)\r\n end", "def destroy\n @fee_record = FeeRecord.find(params[:id])\n @fee_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_fee_records_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n destroy_resource(resource)\n head :no_content\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end" ]
[ "0.7412957", "0.7224197", "0.7184262", "0.7108367", "0.69561446", "0.6939046", "0.6910096", "0.6895957", "0.68707764", "0.6851649", "0.6802576", "0.6799156", "0.67861605", "0.67856103", "0.67788965", "0.6772118", "0.67546374", "0.6745191", "0.6743206", "0.67142135", "0.66591555", "0.66591555", "0.66591555", "0.66591555", "0.66591555", "0.66591555", "0.6635248", "0.6627472", "0.6617532", "0.66174906", "0.66017675", "0.65849155", "0.6571498", "0.6556796", "0.6509518", "0.6497084", "0.64961565", "0.64677984", "0.64677984", "0.6460372", "0.64588046", "0.64566445", "0.6455592", "0.6455592", "0.6455592", "0.6455592", "0.6455592", "0.64458454", "0.6442371", "0.64393204", "0.6436393", "0.64337254", "0.6420102", "0.6420066", "0.6420066", "0.6417113", "0.6416897", "0.64142895", "0.64114374", "0.6409571", "0.64083594", "0.6404716", "0.6401951", "0.6396017", "0.63928074", "0.6385299", "0.6384131", "0.63830185", "0.63824135", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6347223", "0.6342344", "0.6339873", "0.63398546", "0.63375026", "0.63375026", "0.63366866", "0.6326892", "0.63266987", "0.6313161", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434", "0.63118434" ]
0.7077149
4
Standard link action to the list page. Links to the current model_class if no path is given.
def link_action_index(path = nil, url_options = {:returning => true}) path ||= path_args(model_class) link_action ti(:"link.list"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_page_for model\n param_hash_to_link_hash( (session[:admin_list_params] || {})[model] || {} ).merge( :action => 'list', :model => model )\n end", "def list_page_for_current\n list_page_for params[:model]\n end", "def list_in_path(model, path)\n @true_class.list_in_path(model, path)\n end", "def list_in_path(model, parent_path)\n model.list_children build_path(parent_path)\n end", "def nav_item(target, model_class = nil)\n model_class ||= target.to_s.classify.constantize\n if can? :read, model_class\n content_tag :li do\n link_to target do\n if block_given?\n yield\n else\n t(target)\n end\n end\n end\n end\n end", "def list(parent)\n list_in_path parent.model, parent.path\n end", "def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end", "def list\n redirect_to action: \"index\"\n end", "def action_link(\n action = nil,\n current: nil,\n label: nil,\n css: '.page-action',\n **opt\n )\n action = opt.delete(:action) || action\n entry = action_entry(action, current: current, **opt)\n action, current = entry.values_at(:action, :current)\n\n return if (action == current) && current&.start_with?('list_')\n return unless can?(action, object_class)\n\n label = (label || entry[:label]).presence\n label = label ? (label % entry) : labelize(action)\n\n html_tag(:li, prepend_css(css)) do\n link_to_action(label, action: action)\n end\n end", "def list_group_link_to(label, path, opts = {})\n # Regular link item\n opts[:class] = if request.fullpath.include?(path)\n [opts[:class], 'list-group-item active'].compact.join(' ')\n else\n [opts[:class], 'list-group-item'].compact.join(' ')\n end\n\n link_to(label.to_s, path, opts)\n end", "def index; redirect_to :action => 'list'; end", "def index_view\n 'list'\n end", "def menu_link_to(name,path,options={})\n style = \"page_item\"\n style = \"current_page_item\" if current_page?(path)\n options.merge!( { :class => \"#{style} btn btn-small\" } )\n link_to( name, path, options )\n end", "def do_list\n # id: nil needed in params_for because rails reuse it even\n # if it was deleted from params (like do_refresh_list does)\n @remove_id_from_list_links = params[:id].blank?\n @page = current_page\n @records = @page.items\n cache_column_counts @records\n end", "def index\n redirect_to :action => :list\n end", "def index\n \n redirect_to ( :action => \"list\")\n end", "def list\n @view.listing\n end", "def index\r\n list\r\n render_action 'list'\r\n end", "def menu_for(parent, abstract_model = nil, object = nil) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select{ |action| action.http_methods.include?(:get) }\n actions.map do |action|\n %{\n <li class=\"#{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a href=\"#{url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => object.try(:id) })}\">\n #{wording_for(:menu, action)}\n </a>\n </li>\n }\n end.join.html_safe\n end", "def list\n # an oncases handler would be nice TODO\n# if !@permitted\n# render :action => :reserved\n# return\n# end\n @page = params[:page] # get @note_notes, @notes = paginate :notes, :per_note => 10 # paginate\n @show = params[:show] # ?show all,related,min,tree,local\n @style = params[:style] # ?style thumb,list\n @notes = nil\n @notes = @note.find_children if @note\n render :action => \"list\"\n end", "def link_to_all_entries(page)\n url = admin_page_entries_path page\n link_to 'View All', url, class: 'button'\n end", "def index\n list\n render_action 'list'\n end", "def index\n redirect_to :action => \"list\"\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def show\n add_breadcrumb \"Listings\", :listings_path\n add_breadcrumb \"Current Listing\", :listing_path\n end", "def index\n redirect_to :action => 'list'\n end", "def navigation_list_link_to(name, options = {}, html_options = {})\n content_tag(\"li\", navigation_link_to(name, options, html_options))\n end", "def index_url\n polymorphic_url(path_args(model_class), returning: true)\n end", "def index\n @recommend_recommend_subjects = Recommend::RecommendSubject.paginate(:page => params[:page])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_subjects_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recommend_recommend_subjects }\n end\n end", "def current_list_page\n param_hash_to_link_hash params\n end", "def link_to_show(text, path, options={})\n link_to_action(text, path, options.reverse_merge(:action => :show))\n end", "def content_path(model=get_allowed_item_types(@current_container).first, cont=nil)\n\t\t\tif model.nil?\n\t\t\t\tp \"=============== No item accessible inside for content_path ...\"\n\t\t\tend\n\t\t\tcont ||= @current_container\n\t\t\tif cont\n\t\t\t\tcontainer_path(cont)+\"?item_type=#{model.to_s.underscore.pluralize}\"\n else\n admin_content_url(:item_type => model.to_s.underscore.pluralize)\n end\n\t\tend", "def items_path(model)\n model = model.table_name unless model.is_a?(String) \n if current_container\n\t\t\t\tcontainer_path(current_container)+\"/#{model.underscore.pluralize}\"\n else\n admin_root_url+\"/#{model.underscore.pluralize}\"\n end\n end", "def index\n list\n #render :action => 'list'\n\n end", "def list\n redirect_to controller: :content_pages, action: :view if current_user.nil?\n redirect_to controller: :student_task, action: :list if current_user.try(:student?)\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 list\n @currCtlr = params[:currCtlr]\n redirect_to controller: :content_pages, action: :view unless user_logged_in?\n\n redirect_to controller: :student_task, action: :list if current_user.try(:student?)\n end", "def url_for_list(type); end", "def menu_link_to(text, options = {}, html_options = {})\n if (options[:controller] == controller.controller_name && options[:action] == controller.action_name)\n html_options['class'] = 'UbcCurrent'\n end\n link_to(text, options, html_options)\n end", "def collection_path\n send route_prefix_to_method_name(\"#{class_name.model_name.route_key}_path\")\n end", "def index\n \tlist\n \t#this renders out the list view template, you can make it any other if you want \n \trender('list')\n end", "def magic_links(model, options = 'crudhib', opts = {} )\n separator = ' '\n verbose = opts.fetch(:verbose, false ) #!= false\n lnks = %( <span class=\"magic_links\" ><small>\\n )\n lnks += link_to( icon('icons/add') + (verbose ? \"Add new #{model.class}\" : ''), :action => \"new\" ) + separator if options.match( /[ac]/i )\n lnks += link_to( icon('icons/edit') + (verbose ? \"Edit #{model}\" : ''), edit_polymorphic_path(model) ) + separator rescue \"ML_Exc(Edit #{model})\" if options.match( /[ue]/i )\n lnks += link_to( icon('icons/delete')+ (verbose ? \"Delete #{model}\" : ''), model, :confirm => 'Are you sure?', :method => :delete ) + separator if options.match( /[xd]/i )\n lnks += link_to( icon('icons/schema')+ (verbose ? \"Index for #{model.class}\": ''), model, :action => \"index\" ) + separator if options.match( /i/i )\n lnks += link_to( icon('icons/back') + (verbose ? \"Back to previous page\" : ''), url_for( :back ) ) + separator if options.match( /b/i )\n lnks += link_to( icon('icons/home2') + (verbose ? \"Home for RicLife\" : ''), '/' ) + separator if options.match( /h/i )\n #lnks += \"ESPERIMENTO (((#{url_for(model.class.new)} , #{url_for(Gms)})))\"\n lnks += '</small></span>'\n return lnks\n end", "def list\n @title = \"Content List\"\n # Get all content node types\n @list_options = ContentNodeType.all_type_names\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view]\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[1]\n end\n\n # Find the id of the content node type we're viewing by\n type = ContentNodeType.find(:first, :conditions => [\"name = ?\", @viewing_by])\n\n # Paginate content\n @content_node_pages,\n @content_nodes = paginate :content_node,\n :per_page => 10,\n :conditions => [\"content_node_type_id = ?\", type.id],\n :order => \"display_on DESC, name ASC\"\n session[:last_content_list_view] = @viewing_by\n end", "def navigation_helper(label, link_path, link_opts={})\n li_opts = {}\n li_opts = request.path.eql?(link_path) ? { class: \"selected\" } : {}\n content_tag(:li, link_to(label, link_path, link_opts), li_opts)\n end", "def link_actions_for(object)\n link_to_show(object) +\n link_to_edit(edit_polymorphic_path(object)) +\n link_to_destroy(object)\n end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def item_link(item)\n if !item.new_record?\n if item.respond_to?(:name)\n content_tag(:li, link_to(item.name, [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:headline)\n content_tag(:li, link_to(item.headline.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:title)\n content_tag(:li, link_to(item.title.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n end\n end\n end", "def tab_to(*args)\n name = args[0]\n url_options = args[1] || {}\n html_options = args[2]\n url = url_for(url_options)\n\n link = link_to(name, url, html_options)\n\n if request.path == url\n raw \"<li class ='selected'>\" + link + \"</li>\"\n else\n raw \"<li>\" + link + \"</li>\"\n end\n end", "def url\n\n # TODO bug with controllers without models e.g. StaticPages\n if controller_id.blank?\n \"#\"\n elsif instance_id.nil? || instance_id == 0\n url_for :controller => controller_id, :action => action_id, :only_path => true\n else\n # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n klass = controller_id.classify.constantize\n if instance_id.present?\n instance = klass.find(instance_id)\n\n if [\"show\"].include? action_id\n polymorphic_path(instance, :only_path => true)\n else\n polymorphic_path(instance, :action => action_id, :only_path => true)\n end\n end\n end\n\n # # Media Link only:\n # # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n # klass = controller_id.classify.constantize\n # action_id = 'show'\n # if instance_id.present?\n # instance = klass.find(instance_id)\n\n # if [\"show\"].include? action_id\n # polymorphic_path(instance, :only_path => true)\n # else\n # polymorphic_path(instance, :action => action_id, :only_path => true)\n # end\n # end\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def link_menu(resource, options={})\n html= ' '\n if permitted_to? :index, table_symbol_from(resource) then\n if resource.is_a? Symbol then\n model_plural = resource.to_s\n else\n model= singular_table_name_from( resource).pluralize \n end\n a = link_to(tmenu(model_plural), eval(model_plural + \"_path\"), options) \n html = wrap_in_html_container a, 'li', 'menuItem'\n end\n #ebugger\n return html.html_safe\n end", "def show\n breadcrumb\n end", "def menu_for(parent, abstract_model = nil, object = nil, only_icon = true) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) }\n actions.collect do |action|\n next unless authorized?(action.action_name, abstract_model)\n wording = wording_for(:menu, action)\n href_url = case action.action_name.to_s\n when \"export\"\n \"/admin/#{abstract_model.try(:to_param)}.xls\"\n when \"import\"\n \"/admin/#{abstract_model.try(:to_param)}/import\"\n else\n url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))\n end\n case action.key.to_s\n when \"new\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\" style=\"float:left\">\n <a class=\"btn btn-primary\"}\" href=\"#{href_url}\">#{wording}</a>\n </li>\n )\n when \"import\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\" style=\"float:left;\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n when \"export\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\" style=\"float:right\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\" style=\"float:left;\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n when \"index\"\n else\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n end\n end.join.html_safe\n end", "def index\n #@links = Link.all\n @links = Link.find_all_by_user_id(current_user.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end", "def index\n @list_items = ListItem.all\n end", "def index\n @list_items = ListItem.all\n end", "def bonsai_method_path(m, klass)\n k = klass.class.to_s.underscore.pluralize.singularize\n case(m)\n when \"new\" then link_to \"nuevo\", send(\"new_#{k}_path\", klass)\n when \"show\" then link_to \"ver\", klass, :class => \"show_icon\", :title => \"Ver\"\n when \"edit\" then link_to \"editar\", send(\"edit_#{k}_path\", klass), :class => \"edit\", :title => \"Editar\"\n when \"destroy\" then link_to \"borrar\", klass, :method => :delete, :class => \"delete\", :title => \"Borrar\", :confirm => 'Esta seguro de borrar el item seleccionado', :remote => true\n else \"\"\n end\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def nav_link(text, action=\"index\", controller)\n\t\treturn link_to_unless_current text, :id => nil, :controller => controller, :action => action\n\tend", "def list\n @title = \"Content List\"\n # Get all content node types\n @list_options = ContentNode::TYPES\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n else\n @viewing_by = ContentNode::TYPES[0]\n end\n \n if params[:sort] == 'name' then\n sort = \"name ASC\"\n else\n sort = \"created_on DESC\"\n end\n\n @title << \" - #{@viewing_by}\"\n @content_nodes = ContentNode.paginate(\n :order => sort,\n :page => params[:page],\n :conditions => [\"#{ContentNode.connection.quote_column_name(\"type\")} = ?\", @viewing_by],\n :per_page => 10\n )\n session[:last_content_list_view] = @viewing_by\n end", "def index\n\t\tlist\n\t\trender('list')\n\tend", "def index\n\t\tlist\n\t\trender('list')\n\tend", "def tab(name, path, options)\n if (options[:controllers].blank? or options[:controllers].include?(params[:controller])) and\n (options[:actions].blank? or options[:actions].include?(params[:action]) and\n not (options[:except]||[]).include?(params[:action]))\n if (options[:actions]||['index']).include?(params[:action])\n contents = content_tag('span', name)\n elsif path.include?('/') or path.is_a?(Hash)\n contents = link_to(name, path, options[:html])\n else\n contents = link_to_function(name, path, options[:html])\n end\n content_tag('li', contents, { :class => options[:class] ? \"active #{options[:class]}\" : \"active\" })\n elsif path.include?('/') or path.is_a?(Hash)\n content_tag('li', link_to(name, path, options[:html]), { :class => options[:class] })\n else\n content_tag('li', link_to_function(name, path, options[:html]), { :class => options[:class] })\n end\n end", "def index\n @system_links = SystemLink.all\n end", "def nav_link(text,controller,action=\"index\")\n\t\t\tlink_to_unless_current text,:controller=>controller,:action=>action\n\t\tend", "def index\n list\n render(\"list\")\n end", "def linked_tasks\n @matter = Matter.find(params[:id])\n @matter_tasks = @matter.matter_tasks\n @task_type = params[:task_type]\n @path = params[:path]\n case @task_type\n when 'matter_research'\n object = MatterResearch.find(params[:matter_research_id])\n when 'document_home'\n object = DocumentHome.find(params[:matter_document_id])\n end\n @submodel = object\n @matter_taskid = object.matter_tasks.find(:all, :select => ['id']).collect{|a| a.id}\n if params[:link]\n object.link_submodule(params, :matter_task_ids)\n redirect_to params[:path]\n else\n render :partial => \"linked_tasks\", :layout => false\n end\n end", "def nav_link(text,controller,action=\"index\")\n link_to_unless_current text,:id=>nil,:controller=>controller,:action=>action\n end", "def list\n add_breadcrumb :list\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: PersonsDatatable.new(view_context) }\n end\n end", "def model_link(item, **opt)\n html_opt = remainder_hash!(opt, *MODEL_LINK_OPTIONS)\n type = (model_type unless item)\n item ||= object\n label = opt[:label] || :label\n label = item.send(label) if label.is_a?(Symbol)\n if opt[:no_link]\n html_span(label, html_opt)\n else\n # noinspection RubyMismatchedArgumentType\n path = (yield(label) if block_given?) || opt[:path] || opt[:path_method]\n path = path.call(item, label) if path.is_a?(Proc)\n html_opt[:title] ||= opt[:tooltip]\n html_opt[:title] ||=\n if (type ||= opt[:scope] || opt[:controller] || Model.for(item))\n I18n.t(\"emma.#{type}.show.tooltip\", default: '')\n end\n # noinspection RubyMismatchedArgumentType\n make_link(label, path, **html_opt)\n end\n end", "def list_css_class\n \"#{model_type}-list\"\n end", "def index\n list\n\trender('list')\n end", "def index\n # display text and links\n end", "def add_model_to_list\n Resources::Models.add self unless abstract_class || instance_methods.include?(:add_model_to_list)\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 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 index\n @model_lists = ModelList.all\n end", "def nav_link_to(label, path, opts = {})\n if @_nav_mode == :dropdown # We insert dropdown-items\n return link_to(label, path, merge_class_key(opts, 'dropdown-item'))\n end\n\n strict = opts.delete(:strict)\n active = (strict ? (request.fullpath == path) : request.fullpath.include?(path))\n\n # Regular nav link item\n content_tag(:li, class: (active ? 'nav-item active' : 'nav-item')) do\n link_to(label, path, merge_class_key(opts, 'nav-link'))\n end\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 route\n # Page exists?\n if @node and @node.has_page?\n # Redirect to This Item's first category listing if it exists. To ensure the menus display correctly\n if @node.page_type=='Item' and @node.page.has_better_url?\n redirect_to shortcut_path(:shortcut => @node.page.better_url, :display_item => @node.page_id)\n return false\n else\n page_type = (@node.page_type == 'ItemCategory' ? 'Item' : @node.page_type)\n @item = Item.find(params[:display_item]) unless params[:display_item].blank?\n #render(\"#{page_type.tableize.pluralize}/show\", :layout => @node.layout)\n #render :action => \"#{page_type.tableize.pluralize}/show\", :layout => @node.layout\n render_page_from_node(\"#{page_type.tableize.pluralize}/show\", @node.layout)\n end\n else\n return error_redirect\n end\n end", "def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end", "def list(klass, params)\n DSpaceObj.get(self, self.link + klass::PATH, params)\n end", "def show\n @list = List.find(params[:id])\n end", "def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end", "def link_of_item(kind)\n\titem = @items.find { |i| i.attributes()[:kind] == kind }\n\tlink_to(kind.capitalize, @site.config()[:base_url] + item.path) unless item.nil?\nend", "def show\n add_breadcrumb I18n.t('integral.navigation.list'), list_backend_resources_url\n add_breadcrumb I18n.t('integral.actions.view')\n end" ]
[ "0.7021258", "0.65458167", "0.6489672", "0.61265", "0.5941287", "0.5863582", "0.586167", "0.5833222", "0.57725334", "0.57609385", "0.57283396", "0.5647914", "0.5589933", "0.55824786", "0.555384", "0.55421025", "0.55359024", "0.5532612", "0.5523689", "0.55061024", "0.5492093", "0.5474235", "0.5472825", "0.5446516", "0.5446516", "0.5446516", "0.5446516", "0.5446516", "0.5446516", "0.5446516", "0.5439437", "0.5427213", "0.53626657", "0.53486204", "0.53245544", "0.5294335", "0.5274549", "0.52705204", "0.5268624", "0.5266395", "0.52636254", "0.52612233", "0.5257027", "0.5254529", "0.52252966", "0.5205533", "0.52053356", "0.5204147", "0.5200796", "0.5184934", "0.5175769", "0.5159676", "0.5156011", "0.51481634", "0.51285505", "0.5127945", "0.5127945", "0.5127945", "0.5127945", "0.5127945", "0.5127945", "0.5127945", "0.5127945", "0.5123668", "0.5122773", "0.5121061", "0.5113088", "0.51114607", "0.51114607", "0.5107273", "0.5101106", "0.5100544", "0.5099408", "0.50977767", "0.50977767", "0.50848264", "0.50842357", "0.5082047", "0.5081722", "0.50721765", "0.5055114", "0.50513875", "0.5045307", "0.50370073", "0.50324917", "0.50320876", "0.50316525", "0.502222", "0.5015734", "0.5014761", "0.50077003", "0.50074255", "0.5004616", "0.49987355", "0.49981463", "0.49950898", "0.4994469", "0.49928328", "0.4992265" ]
0.7388719
1
Standard link action to the new page. Links to the current model_class if no path is given.
def link_action_add(path = nil, url_options = {}) path ||= path_args(model_class) link_action ti(:"link.add"), 'plus', path.is_a?(String) ? path : new_polymorphic_path(path, url_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_new(text, path, options={})\n if path.is_a? Class\n text ||= t(\"app.actions.new\", :default => \"New\") + ' ' + path.try(:human_name).to_s.downcase\n path = options.delete(:url) || new_polymorphic_path(path) unless path.is_a? String\n end\n link_to_action(text, path, options.reverse_merge(:action => :new))\n end", "def handle_new\n obj = model.new(request.params[model.link], request)\n model.hook(:before_new, request, obj)\n new_page(obj)\n end", "def visit_new_page(model, **opt, &block)\n visit_action_page(model, :new, **opt, &block)\n end", "def link_new(text = t(\"admin.common.new_link\"), url = new_resource_url)\n link_to text, url, :class => 'new'\n end", "def new\n redirect_to lato_pages.pages_path\n end", "def create_link(klass, options = {})\n # get the link target path. honor the js option.\n href = options[:js] ? \"#\" : send(\"new_#{klass.model_name.singular_route_key}_path\")\n \n link_to(t(\"#{klass.model_name.i18n_key}.create_link\"), href, :class => \"create_#{klass.model_name.param_key}\")\n end", "def new\n redirect_to edit_page_path(find_or_create_page)\n end", "def new\n add_breadcrumb I18n.t('integral.navigation.new'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new\n end", "def new\n add_breadcrumb I18n.t('integral.navigation.new'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new\n end", "def new_page\n page = Page.new\n page.url = params[:id] if Page.url?(params[:id]) && params[:id] != 'new-page'\n page\n end", "def quest_new_page\n \"/#{user_path}/#{objective_path}/#{controller}/new\"\n end", "def new_with_defaults\n page = new\n end", "def new\n @page = Page.new\n # render :new app/views/pages/new.html.erb\n end", "def new\n new_object Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :layout => \"default\" }\n end\n end", "def new\n @page = @offering.pages.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n\t\t@link = Link.new\n\tend", "def attribute_new_page\n \"/#{user_path}/#{controller}/new\"\n end", "def end_view_new(objects_path=nil)\n end_view(link_to_back(objects_path))\n end", "def link_to_new(path, message = '')\n message = icon('plus-sign') + ' ' + message\n link_to message, path, title: 'Create a new record'\n end", "def guides_newpages_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"sort-options\").a(\"/New Pages/\"), __method__)\n end", "def new\n @page = Page.new\n #render :new - app/views/pages/new.html.erb\n end", "def new\n @link = Link.new\n end", "def new\n\t\t@link = Link.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @link }\n\t\tend\n\tend", "def new\n \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 rezm_link_to_create_message\n link_to \"Write\", new_message_path\n end", "def new_item_path(model)\n helper_name = 'new_admin_'\n helper_name += \"#{current_container.class.to_s.underscore}_\" if current_container\n helper_name += model.to_s.underscore + '_path'\n args = current_container ? [current_container] : []\n send(helper_name, *args)\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 @recommend_recommend_subject = Recommend::RecommendSubject.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_subject_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_subject }\n end\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n end", "def new\n @page = Page.new\n # render new.html.erb\n end", "def new\n @page = Page.new\n # render new.html.erb\n end", "def remote_link_to_new(text = \"新規追加\", options = {}, html_options = {})\n if registered? && (at_present? || simulation_mode?) && allow_to_add_new_entity?(options)\n options[:controller] ||= controller_name\n options[:url] = {:controller => options[:controller], :action => \"new\"}\n options[:params] = options[:params].to_h.merge( :background_params => @background_params )\n html_options[:class] ||= \"op-control\"\n link_to_remote_with_params( text, options, html_options ) \n end\n end", "def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n redirect_to static_pages_home_url\n end", "def new\n @recommend_recommend_other = Recommend::RecommendOther.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_other_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_other }\n end\n end", "def new_link\n @link = Link.new\n end", "def menu_item_link(m)\n options = {}\n if m.new_page\n options = {:target => \"_blank\"}\n end\n link_to m.title, m.url, options\n end", "def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end", "def new\n\t\t@path = [link_to_ideas, link_to_new_idea]\n\t\t@subnavigation = [active_link_to_new_idea,link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\n @idea = Idea.new\n\t\t@categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @idea }\n end\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new_resource_path(options={})\n options.merge! :action => :new\n super_path(with_chain(resource_class), options)\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 new\n @link = current_user.links.new\n # @link = Link.new\n end", "def new\n build_breadcrumbs\n end", "def new\n build_breadcrumbs\n end", "def new\n @submit_text = \"Create Post\"\n @node = Node.new(:title => params[:title])\n @topic_id = params[:topic_id]\n @source_id = params[:source_id]\n\n # Set path to redirect to after node is created.\n\n flash[:page_to_redirect_to] = request.referer\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new_resource_path\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_path\")\n end", "def new_resource_url\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_url\")\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 create\n redirect_to pages_path\n end", "def end_view_index(new_object_path=nil)\n end_view(link_to_create(new_object_path))\n end", "def new\n @link = current_user.links.new\n end", "def link_to_add_entry(page)\n url = new_admin_page_path parent_id: page.id, type: page_set_type(page)\n raw link_to 'Add Entry', url, class: 'button add-child'\n end", "def redirect_after_model_created(model)\n url = caller_url\n if url\n redirect_to url\n else\n redirect_to model\n end\n end", "def new\n @links = Links.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def path_for_new(ps = {})\n home_path\n end", "def new\n if params[:parent]\n parent = Page.find(params[:parent])\n if parent\n position = parent.children.length\n session[:page][@page_id] = {parent_id: params[:parent], position: position}\n redirect_to management_site_page_step_path(id: 'title')\n else\n redirect_to management_site_page_step_path(id: 'position')\n end\n else\n redirect_to management_site_page_step_path(id: 'position')\n end\n end", "def new\n add_breadcrumb t('new'), @user ? new_member_message_path(@user) : new_group_message_path(@group)\n \n respond_to do |format|\n format.html # new.html\n end\n end", "def link_to_add_entry page\n url = new_admin_page_path parent_id: @page.id, type: page_set_type(page)\n raw link_to 'Add Entry', url, class: 'button add', id: 'add-entry'\n end", "def new\n @question = @page.questions.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def new_page(obj, opts={})\n page do\n form_attr = form_attributes(:action=>url_for(\"create\"))\n Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n model.columns_for(:new, request).each do |column|\n col_opts = column_options_for(:new, request, obj, column)\n if html = model.edit_html_for(obj, column, :new, request)\n col_opts = col_opts.merge(:html=>html)\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Create', :class=>'btn btn-primary')\n end\n end\n end", "def new\n # Agrega el breadcrumb de la pagina new de proyecto\n add_breadcrumb I18n.t('project.new'), :controller => \"projects\", :action => \"new\"\n @project = Project.new\n end", "def new\n get_system\n @parent = NavEntry.find(params[:parent_id]) unless params[:parent_id].nil?\n @nav_entry = NavEntry.new(:system => @system, :parent => @parent)\n get_parents\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nav_entry }\n end\n end", "def new\n @procurement = Procurement.new\n\n breadcrumbs.add 'Procurements', procurements_path\n breadcrumbs.add 'New'\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @procurement }\n end\n end", "def new\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page = ComatosePage.new params[:page]\n @page.author = fetch_author_name\n if @page.save\n flash[:notice] = \"Created page '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n else\n @page = ComatosePage.new :title=>'New Page', :parent_id=>(params[:parent] || nil)\n end\n end", "def new_thing_path(model)\n send(:\"new_admin_#{undersingularize(model)}_path\")\n end", "def new\n @recommend_recommend_tag = Recommend::RecommendTag.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_recommend_recommend_tag_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommend_recommend_tag }\n end\n end", "def new\n render 'new'\n end", "def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end", "def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\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 @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @tag_identity = Identity.new\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_tag_identity_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag_identity }\n end\n end", "def link_to_add_child(page)\n url = new_admin_page_path parent_id: page.id\n raw link_to 'Add Child', url, class: 'button add-child'\n end", "def menu_link_to(name,path,options={})\n style = \"page_item\"\n style = \"current_page_item\" if current_page?(path)\n options.merge!( { :class => \"#{style} btn btn-small\" } )\n link_to( name, path, options )\n end", "def new\n redirect_to static_pages_notactive_path\n end", "def dynamic_link_path(link, options = {})\n if link.relative && !link.target_id.blank?\n model_instance = model_class(link.resource).find(link.target_id)\n model_instance.is_a?(Page) ? nice_page_path(model_instance) : model_path(model_instance, options)\n elsif link.relative && link.target_id.blank?\n model_index_path(model_name(link.resource), options)\n else\n link.path\n end\n end", "def dynamic_link_path(link, options = {})\n if link.relative && !link.target_id.blank?\n model_instance = model_class(link.resource).find(link.target_id)\n model_instance.is_a?(Page) ? nice_page_path(model_instance) : model_path(model_instance, options)\n elsif link.relative && link.target_id.blank?\n model_index_path(model_name(link.resource), options)\n else\n link.path\n end\n end", "def new\n @title = t :new_model_title\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model }\n end\n end", "def new\n @object = @model_class.new\n respond_to do |format|\n format.html { render :template => views_directory + '/form' }\n format.xml { render :xml => @object }\n end\n end", "def new\n\t\tfname= \"#{controller_class_name}.#{__method__}\"\n\t\t@relation = Relation.new\n\t\t@datas = @relation.datas\n\t\t@views = View.all\n\t\t#LOG.debug (fname) {\"#{[email protected]}\"}\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @relation }\n\t\tend\n\tend", "def new\n @page_title = t('branches.new.title')\n @branches = Branch.all \n @branch = Branch.new\n respond_to do |format|\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch }\n end\n end", "def new\n\t\t# no code needed here; all handled in the view\n\tend", "def new\n @page = Page.find_by_title('Huren bij Xposers')\n end", "def new\n @page = Page.new\n @user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n @pagelist = @club.all_pages\n \n @page_title = \"New Page\"\n @site_section = \"admin\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @pages = Page.new\n #renders new.html.erb\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end" ]
[ "0.7442898", "0.70447654", "0.6716493", "0.65565366", "0.62060285", "0.6186592", "0.61531603", "0.60233366", "0.60233366", "0.5979654", "0.59704185", "0.5963542", "0.59425706", "0.5907352", "0.590151", "0.58893704", "0.587151", "0.5866565", "0.5856044", "0.5841805", "0.5833671", "0.5829388", "0.58291173", "0.5803676", "0.5801428", "0.5797271", "0.5792301", "0.5792301", "0.57837987", "0.5772136", "0.5772136", "0.5772136", "0.5772052", "0.5757577", "0.5757577", "0.574714", "0.572446", "0.57203853", "0.57107246", "0.5708441", "0.57008624", "0.5689359", "0.56859124", "0.56821597", "0.56821597", "0.56821597", "0.56821597", "0.56809", "0.5675448", "0.56684446", "0.563738", "0.563738", "0.56263673", "0.5619947", "0.56110233", "0.5606439", "0.5606439", "0.5606439", "0.5606439", "0.56045866", "0.56033117", "0.5555644", "0.55435085", "0.5543399", "0.5528136", "0.5520269", "0.5516845", "0.5514453", "0.55094266", "0.55088836", "0.5504276", "0.5501042", "0.54990494", "0.54967505", "0.54958504", "0.54876417", "0.54818904", "0.5473607", "0.54713815", "0.54713815", "0.5468129", "0.5467037", "0.5466223", "0.5464539", "0.5463769", "0.54500437", "0.5447473", "0.5447473", "0.5446719", "0.5436254", "0.54302007", "0.5428165", "0.54265994", "0.54261047", "0.541995", "0.5412944", "0.54103017", "0.5408174", "0.5408174" ]
0.6121125
8
Get the cancel url for the given object considering options: 1. Use :cancel_url_new or :cancel_url_edit option, if present 2. Use :cancel_url option, if present 3. Use polymorphic_path(object)
def get_cancel_url(object, options) record = Array(object).last cancel_url = options.delete(:cancel_url) cancel_url_new = options.delete(:cancel_url_new) cancel_url_edit = options.delete(:cancel_url_edit) url = record.new_record? ? cancel_url_new : cancel_url_edit url || cancel_url || polymorphic_path(object, :returning => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_cancel( object, options={})\n path = object.class.name.tableize\n path = if object.new_record?\n send( path.pluralize + '_path' )\n else\n send( path.singularize + '_path', object )\n end\n link_to \"Cancel\", path, options\n end", "def link_to_cancel( object )\n path = object.class.name.tableize\n path = if object.new_record?\n send( path.pluralize + '_path' )\n else\n send( path.singularize + '_path', object )\n end\n link_to \"Cancel\", path\n end", "def cancel(path, edit_path = nil, options ={})\n options[:class] ||= ''\n options[:class] << \"btn btn-default\"\n options[:data] = { confirm: \"Cancel without saving?\"}\n\n if edit_path && object.persisted?\n path = edit_path\n end\n @template.link_to('Cancel', path, options)\n end", "def cancel(*args)\n options = args.extract_options!\n text = options.delete(:text) || (args.first if args.first.is_a?(String)) || 'Cancel'\n path = options.delete(:path) || @template.request.env['HTTP_REFERER'] || @template.send(\"#{@object_name.to_s.pluralize}_path\")\n attrs = { :class => 'cancel' }.merge!(options.delete(:attrs) || {})\n \n wrapper(:span, attrs, @template.link_to(text, path, options))\n end", "def link_to_cancel(url)\n link_to_remote(\"Cancel\", :url => url, :method => :get, :with => \"{ cancel: true }\")\n end", "def link_to_cancel_new_deal (comment)\n link_to t('.cancel_new_deal'),\n util_cancel_new_deal_path(:comment_id => comment.id, :giftid => comment.gift.id),\n link_to_comment_options(comment, 'cancel')\n end", "def cancel_link(path_or_label, path = nil)\n label = path ? path_or_label : 'Cancel'\n path ||= path_or_label\n\n template.content_tag(:li, template.link_to(label, path), :class => 'link')\n end", "def edit_resource_url(object)\n send route_prefix_to_method_name(\"edit_#{class_name.model_name.singular_route_key}_url\"),\n object\n end", "def cancel_button_form options\n label = options[:label] ? options[:label] : \"Cancelar\"\n url = options[:url] ? options[:url] : \"#\"\n myclass = options[:class] ? \"btn-action btn-cancel #{options[:class]}\" : \"btn-action btn-cancel\"\n link = options[:fancybox] ? link_to_function(label, \"$.fancybox.close()\") : link_to(label, url)\n \"<li><div class='#{myclass}'>#{link}</div></li>\".html_safe\n end", "def set_CancelURL(value)\n set_input(\"CancelURL\", value)\n end", "def cancel_tag(url, options = {})\n link_to((tag :input, { \"type\" => \"button\", \"value\" => \"Cancel\"}.update(options.stringify_keys)), url, :style => \"text-decoration: none;\")\n end", "def cancel_link\n return_uri = controller.params[:_return_to]\n return_uri ||= controller.request.env['HTTP_REFERER']\n return_uri ||= controller.request.request_uri.gsub(%r{/[^/]+/?$}, \"\")\n return_uri = '/' if return_uri.empty?\n\n \"<input type='hidden' name='_return_to' value='#{return_uri}'></input><a href='#{return_uri}'>Cancel</a>\"\n end", "def cancel_url=(cancel_url)\n if !cancel_url.nil? && cancel_url.to_s.length > 255\n fail ArgumentError, 'invalid value for \"cancel_url\", the character length must be smaller than or equal to 255.'\n end\n\n if !cancel_url.nil? && cancel_url.to_s.length < 0\n fail ArgumentError, 'invalid value for \"cancel_url\", the character length must be great than or equal to 0.'\n end\n\n @cancel_url = cancel_url\n end", "def edit_link(obj, options = {})\n if policy(obj).edit?\n url = polymorphic_url([:edit] + Array(obj))\n action_link('Edit', url, 'pencil', options)\n end\n end", "def cancel_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(a.id(\"/CancelLinkButton$/\"), format_method(__method__), @spec)\n end", "def foreign_url_for(obj, opt={})\n host, path = nil, nil\n text, target = opt.values_at(:text, :target)\n case obj\n when IcuPlayer\n host = \"www.icu.ie\"\n path = \"admin/players/#{obj.id}\"\n text ||= obj.id\n target ||= \"_icu_ie\"\n when FidePlayer\n host = \"ratings.fide.com\"\n path = \"card.phtml?event=#{obj.id}\"\n text ||= obj.id\n target ||= \"_fide_com\"\n end\n return nil unless host && path\n link_to text, \"http://#{host}/#{path}\", target: target, class: \"external\"\n end", "def cancel_button(destination_path)\n @template.link_to I18n.t('form.cancel'), destination_path,\n class: \"btn btn-default\"\n end", "def check_for_cancel\n if params[:commit] == t('dri.views.objects.buttons.cancel')\n if params[:id]\n redirect_to controller: 'my_collections', action: 'show', id: params[:id]\n else\n redirect_to controller: 'workspace', action: 'index'\n end\n end\n end", "def check_for_cancel\n if params[:commit] == t('dri.views.objects.buttons.cancel')\n if params[:id]\n redirect_to controller: 'my_collections', action: 'show', id: params[:id]\n else\n redirect_to controller: 'workspace', action: 'index'\n end\n end\n end", "def resource_url options={}\n r=request.path\n id=params[:id]\n options = case params[:action]\n when 'create','update','delete','destroy'; \"\"\n else resource_options(options)\n end\n return \"%s%s\" % [r,options] if r.match \"#{resource.class.to_s.tableize}\\/#{id}$\"\n \"%s%s\" % [ r.split(\"/#{params[:action]}\")[0], options]\n rescue Exception => e\n scoop_from_error e\n end", "def action_links(obj, options)\n route_key = obj.class.model_name.singular_route_key\n links = %w(edit destroy).collect do |action|\n options[:exclude] = [options[:exclude]] unless options[:exclude].is_a?(Array)\n next if options[:exclude] && options[:exclude].include?(action.to_sym)\n key = \"#{obj.class.table_name}##{action}\"\n case action\n when \"edit\"\n can?(:update, obj) ? action_link(action, send(\"edit_#{route_key}_path\", obj), :title => t(\"common.edit\")) : nil\n when \"destroy\"\n # build a delete warning\n obj_description = options[:obj_name] ? \"#{obj.class.model_name.human} '#{options[:obj_name]}'\" : options[:obj_description]\n warning = t(\"layout.delete_warning\", :obj_description => obj_description)\n \n can?(:destroy, obj) ? action_link(action, send(\"#{route_key}_path\", obj), :method => :delete, \n :confirm => warning, :title => t(\"common.delete\")) : nil\n end\n end.compact\n links.join(\"\").html_safe\n end", "def cancel_btn(path=root_path, options={})\n btn_class = 'btn btn-warning'\n btn_class << ' ' << options[:class] if options[:class].present?\n\n link_to t('btn.cancel'), path, class: btn_class\n end", "def canonical_url(resource, options = {})\n polymorphic_url(resource, options)\n end", "def cancel\n redirect_to checkid_request.cancel_url\n end", "def delete_link(obj, options = {})\n if policy(obj).destroy?\n default_options = { data: {\n confirm: 'Are you sure? There is no undo for this!',\n tooltip: 'Delete',\n method: 'Delete',\n remote: 'true'\n } }\n url = polymorphic_url(obj)\n action_link('Delete', url, 'trash-o', default_options.deep_merge(options))\n end\n end", "def polymorphic_url(record_or_hash_or_array, options = {})\n { href: @controller.polymorphic_url(record_or_hash_or_array, options = {}) }\n end", "def cancellation_reason_string\n CANCELATION_REASONS[cancellation_reason]\n end", "def get_object_url(obj)\n routes = Rails.application.routes.url_helpers\n if Setting.host_name.to_s =~ /\\A(https?\\:\\/\\/)?(.+?)(\\:(\\d+))?(\\/.+)?\\z/i\n host, port, prefix = $2, $4, $5\n routes.url_for(obj.event_url({\n :host => host,\n :protocol => Setting.protocol,\n :port => port,\n :script_name => prefix\n }))\n else\n routes.url_for(obj.event_url({\n :host => Setting.host_name,\n :protocol => Setting.protocol\n }))\n end\n end", "def cancel_btn(path = root_path, options = {})\n btn_class = ['btn btn-warning waves-effect waves-light']\n btn_class << options[:class] if options[:class].present?\n\n link_to t('btn.cancel'), path, class: btn_class.join(' ')\n end", "def initialize_context(**opt)\n super.tap do |ctx|\n ctx[:cancel] ||= index_path\n end\n end", "def url_for(options = {})\n options ||= {}\n url = case options\n when String\n options\n when Hash\n options = options.symbolize_keys\n if request.host[Regexp.new(@@retailer_server)] \n# route = options[:use_route]\n options = options.merge!({:only_path => false})\n# debugger\n# options = options.merge!({:use_route => \"proxy\", :extra_data => route}) if route\n elsif (request.domain && request.domain(4)[Regexp.new(@@embedded_optemo_server)]) \n options = options.merge!({:only_path => false}) # reverse merge host and port here as necessary\n else\n options = options.reverse_merge!(:only_path => options[:host].nil?)\n end\n super\n when :back\n controller.request.env[\"HTTP_REFERER\"] || 'javascript:history.back()'\n else\n polymorphic_path(options)\n end\n url\n end", "def cancel\n redirect_to( default_path ) if params[:commit] == 'cancel'\n end", "def wiki_page_edit_cancel_path(page)\n if page.new_record?\n if parent = page.parent\n project_wiki_page_path(parent.project, parent.title)\n else\n project_wiki_index_path(page.project)\n end\n else\n project_wiki_page_path(page.project, page.title)\n end\n end", "def url_for_with_co(params, context_object)\n url = url_for(params)\n if (url.include?('?'))\n url += '&'\n else\n url += '?'\n end\n \n url += context_object.kev \n\n return url\n end", "def cc_url(curation_concern)\n # if curation_concern.is_a? ::Collection\n # curation_concern.collection_url\n # else\n # Rails.application.routes.url_helpers.polymorphic_url(curation_concern)\n # end\n ::Deepblue::EmailHelper.curation_concern_url( curation_concern: curation_concern )\n end", "def href_url_helper(options={})\n if represented_url.nil?\n options = options.except(:format)\n result = url_for(options.merge(only_path: true)) rescue nil\n if represented.parent\n result ||= polymorphic_path([:api, represented.parent, represented.item_class], options) rescue nil\n end\n result ||= polymorphic_path([:api, represented.item_class], options) rescue nil\n return result\n end\n\n if represented_url.respond_to?(:call, true)\n instance_exec(options, &represented_url)\n elsif respond_to?(represented_url, true)\n send(represented_url, options)\n else\n represented_url.to_s\n end\n end", "def preferred_url(e)\n if !e.url.blank?\n url_escape(e.url.address)\n else\n \"https://www.contactimprov.net/events/view/#{e.id}\"\n end\n end", "def link_to_edit(text, path, options={})\n unless path.is_a? String\n path = options.delete(:url) || edit_polymorphic_path(path)\n end\n link_to_action(text, path, options.reverse_merge(:action => :edit))\n end", "def cancel_button(project:, deploy:, **options)\n raise if !project || !deploy\n link_to(\n 'Cancel',\n [project, deploy, {redirect_to: request.fullpath}],\n options.merge(method: :delete, class: options.fetch(:class, 'btn btn-danger btn-xl'))\n )\n end", "def url_for_event(type, options)\n options.reverse_merge!(:type => type)\n \n apotomo_event_path(apotomo_request_processor.address_for(options))\n end", "def retrieve_cancel_icon_path\n\t\tpath = ActionController::Base.helpers.asset_path(\"cancel.png\")\n\t\trender html: path\n\tend", "def edit_resource_path(object)\n send route_prefix_to_method_name(\"edit_#{class_name.model_name.singular_route_key}_path\"),\n object\n end", "def url_for(*args)\n case args[0]\n when String\n return args[0]\n when :back\n # url = controller.request.env['HTTP_REFERER'] if controller\n url ||= 'javascript: history.back();'\n else \n return \"/aurita/#{resource_url_for(*args)}\"\n end\n end", "def edit_link(obj)\n \tcase obj.class.to_s\n \t when \"Tenant\"\n \t edit_tenant_path(obj)\n \t when \"Semester\"\n \t edit_semester_path(obj)\n \t when \"Department\"\n \t edit_department_path(obj)\n \t when \"Subject\"\n \t edit_subject_path(obj) \t \n \t when \"Faculty\"\n \t edit_faculty_path(obj)\n \t when \"Exam\"\n \t edit_exam_path(obj)\n \t when \"Batch\"\n \t edit_batch_path(obj) \t \t \t \n \t when \"SchoolType\"\n \t edit_school_type_path(obj) \t \n \t when \"Student\"\n \t edit_student_path(obj) \t \t\n \t when \"Section\"\n \t edit_section_path(obj)\n \t when \"BloodGroup\"\n \t edit_blood_group_path(obj)\n \t when \"Resource\"\n \t edit_resource_path(obj)\n \t when \"Role\"\n \t edit_role_path(obj) \t \t \t\n \t when \"UserProfile\"\n \t edit_user_profile_path(obj) \n \t when \"Grade\"\n \t edit_grade_path(obj) \t \t \t \t \t \t \n \t when nil\n \t nil\n end\n end", "def edit_url(receiver)\n show_url(receiver)\n end", "def cta_url(cta)\n orzoro_cta_url(cta)\n end", "def cancel_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(a.id(\"/btnClose$/\"), format_method(__method__))\n end", "def cancel_display_video360_advertiser_link_proposal request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_cancel_display_video360_advertiser_link_proposal_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::DisplayVideo360AdvertiserLinkProposal.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def resources_url options={}\n r=request.path\n options = case params[:action]\n when 'create','update','delete','destroy'; \"\"\n else resource_options(options)\n end\n return \"%s%s\" % [r,options] if r.match \"#{resource.class.to_s.tableize}$\"\n \"%s%s%s\" % [ r.split( resource.class.to_s.tableize)[0],resource.class.to_s.tableize, options]\n rescue Exception => e\n scoop_from_error e\n end", "def url_for(options = {})\n url = if options == :back\n 'javascript:history.back()'\n elsif options.kind_of?(String) and respond_to?(:page_find) and path = page_find(options)\n path[\"url\"]\n elsif options.kind_of?(String)\n options\n else\n '#'\n end\n end", "def delete_cancel_button(**opt)\n opt[:action] ||= :delete\n cancel_button(**opt)\n end", "def cancel(reason, info = {})\n @cancelled = true\n @cancelled_by = caller(1, 1)\n @cancelled_reason = reason\n @cancelled_info = info\n cancel_notification\n nil\n end", "def url_for_object(object, parent_object)\n raise NotImplementedError, \"#{self.class} must implement method: #{__callee__}\"\n end", "def check_cancel_submit\n redirect_to matters_path if params[:cancel]\n end", "def cancel?\n self.type == :cancel\n end", "def link_actions_for(object)\n link_to_show(object) +\n link_to_edit(edit_polymorphic_path(object)) +\n link_to_destroy(object)\n end", "def event_url(options = {}) \n\t option = Proc.new {|o| {:controller => 'wkexpense', :action => 'reportdetail', :project_id => o.project, :issue_id => o.issue}} \t \n\t if option.is_a?(Proc)\n\t\toption.call(self)\n\t end\n\tend", "def cancel(params)\n request(Resources::RESOURCE_CANCEL, HTTP_METHOD_POST, params)\n end", "def context_url\n if params[:context_type] == 'countries'\n admin_country_url(@country)\n else\n admin_market_url(@market)\n end\n end", "def cancel(reputable, action, receiver, options={})\n result = nil\n options.symbolize_keys!\n sender = options.delete(:sender)\n tier = options.delete(:tier)\n # adds receiver's reputation\n if receiver_points = find_reputation_points(reputable, :receiver, action, tier)\n reputation = find_for_cancel(reputable, action, receiver, receiver_points, tier)\n reputation.cancel! if reputation\n result = reputation\n end\n if sender && (sender_points = find_reputation_points(reputable, :sender, action, tier))\n reputation = find_for_cancel(reputable, action, sender, sender_points, tier)\n reputation.cancel! if reputation\n result = reputation\n end\n result\n end", "def check_for_cancel\n if params[:commit] == \"Cancel\"\n redirect_to forms_path\n end\n end", "def cancel_and_redirect\r\n redirect_back\r\n end", "def edit_and_delete_options(object, confirmation_msg=nil)\n if confirmation_msg == nil\n confirmation_msg = \"Are you sure you want to delete this #{object.class.to_s.underscore.humanize.downcase}?\"\n end\n html = \"<div class=\\\"options\\\">\\n\"\n html += link_to(image_tag('edit.gif', :title => \"Edit #{object.class.to_s.underscore.humanize.downcase}\"),\n {:action => 'edit', :id => object})\n if object.respond_to? :is_active\n if object.is_active\n title = \"Deactivate #{object.class.to_s.underscore.humanize.downcase}\"\n else\n title = \"Delete #{object.class.to_s.underscore.humanize.downcase}\"\n end\n else\n title = \"Delete #{object.class.to_s.underscore.humanize.downcase}\"\n end\n html += link_to(image_tag('delete.gif', :title => title), \n {:action => 'destroy', :id => object },\n :confirm => confirmation_msg, :method => \"post\")\n html += \"\\n</div>\"\n return html\n end", "def url_for(options = {})\n url = super options\n if params[:popup] == \"true\"\n if url.include? \"?\"\n url + \"&popup=true\"\n else\n url + \"?popup=true\"\n end\n else\n url\n end\n end", "def context_url\n if params[:context_type] == 'countries'\n admin_country_url(@country)\n else\n admin_zone_url(@zone)\n end\n end", "def canonical_path(resource, options = {})\n canonical_url(resource, options.merge(routing_type: :path))\n end", "def cancel\n begin\n $results.log_action(\"button(#{@params[0]})\")\n # Cancel button can be either a link or an actual button object\n begin\n if @driver.find_element(:id, \"lnk-cancel\").displayed?\n @driver.find_element(:id, \"lnk-cancel\").click\n $results.success\n end\n rescue\n if @driver.find_element(:id, \"btn-cancel\").displayed?\n @driver.find_element(:id, \"btn-cancel\").click\n $results.success\n end\n end\n rescue => ex\n $results.fail(\"button(#{@params[0..-1].join(' ')})\", ex)\n end\n end", "def check_for_cancel\n return unless params[:commit] == 'Cancel'\n\n if current_user.is_admin? || params.dig(:institute, :action) == 'new'\n redirect_to workspace_url\n else\n redirect_to manage_users_url\n end\n end", "def on_cancel &b\n @cancel_proc = b\n self\n end", "def call_cancel_handler; call_handler(:cancel); end", "def url_for(options = T.unsafe(nil)); end", "def url_for(options = T.unsafe(nil)); end", "def url_for(options = T.unsafe(nil)); end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def check_for_cancel\n redirect_to @article if params[:commit] == 'Cancel'\n end", "def url_for options = {}\n @controller.url_for options\n end", "def do_object_path(object, action_or_options = nil, options = {})\n return unless object\n\n if action_or_options.is_a?(Hash)\n options = action_or_options\n action = nil\n else\n action = action_or_options\n end\n\n route_method, route_params, engine, path_prefix = [nil, [], nil, nil]\n\n singular_route = false\n if object.respond_to?(:as_object_path)\n o = object.as_object_path\n route_method = o[:route_method] || nil\n route_params = o[:route_params] || []\n singular_route = o[:singular] || false\n engine = o[:engine] || nil\n\n if o[:path_prefix]\n p = o[:path_prefix]\n prefix_route_method = p[:route_method] || nil\n prefix_route_params = p[:route_params] || []\n prefix_engine = p[:engine] || nil\n path_prefix = yield prefix_route_method, \"\", prefix_route_params, prefix_engine\n end\n end\n\n route_params << object unless singular_route\n\n route = route_method || try_produce_route(route_params)\n if ! object.is_a?(Class) && object.new_record? || action.to_s == 'new'\n action = :new\n route_params.pop\n end\n\n prefix = action ? \"#{action}_\" : \"\"\n\n # add options\n case route_params\n when Hash\n route_params.merge!(options)\n when Array\n route_params << options\n end\n\n [path_prefix, yield(route, prefix, route_params, engine)].compact.join(\"\")\n end", "def cancel\n @confirmation_header = \"confirm cancellation\"\n @confirmation_body = \"Are you Sure to cancel this subscription?\"\n @cancel = \"No, Thank you\"\n @submit = \"Confirm cancellation\"\n end", "def inquests_url(options)\n url_for({:controller => :inquests, :action => :create}.merge(options))\n end", "def cancel_trip\n label = request_label(:cancel, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/cancel_trip\", \n :delete,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label)\n end", "def cancel_reason\n @subscription_purchase.cancel_reason\n end", "def things_path(object = nil)\n object ||= @route_name || controller_name\n send(:\"admin_#{underpluralize(object)}_path\")\n end", "def invitation_url(type, employee)\n if type == :invite\n new_account_organization_invitation_path(current_account, current_organization, invitation: { employee_id: employee.id })\n else\n edit_account_organization_invitation_path(current_account, current_organization, employee.invitation)\n end\n end", "def link_to_trackable(object, object_type, title=nil)\n translate_model_type = I18n.t(\"activerecord.models.#{object_type.downcase}\")\n if object\n if title\n link = link_to title, object\n [translate_model_type, link].join(' ').html_safe\n else\n link_to translate_model_type, object\n end\n else\n \"#{translate_model_type} который (-ая) больше не существует\"\n end\n end", "def context_url\n if params[:context_type] == 'countries'\n admin_country_url(@country)\n else\n admin_province_url(@province)\n end\n end", "def cancel(params)\n Ciirus::Commands::Cancel.new(credentials).call(params[:reference_number])\n end", "def inline_cancel_button(class_extras = 'pull-right')\n \"<a class=\\\"show-entity show-#{hyphenated_name} #{class_extras} glyphicon glyphicon-remove-sign dropup\\\"\n title=\\\"cancel\\\"\n data-target=\\\"[data-subscription='#{hyphenated_name}-edit-form--#{@container.id}']\\\"\n data-toggle=\\\"clear-content\\\"></a>\".html_safe\n end", "def generate_path_from options\n options.path || view_model_path\n end", "def cancel(params={})\n self.request(__method__, params)\n end", "def cancel( address )\n body = { address: address }\n post(\"/cancelpending\", { body: body } )\n end", "def cancel\n sanitized = whitelist(params, :complete)\n travel = Travels::Travel.find(sanitized[:id])\n\n unless travel.submitted? && travel.customer == current_user.becomes(Users::Customer)\n fail(:any, :bad_request, \"Sorry! You're not eligible to cancel travels other than just submitted!\")\n return\n end\n\n respond_to do |format|\n if travel.cancel\n format.html { redirect_to status_travel_path(travel) }\n format.json { render json: travel.as_json, status: :ok }\n else\n format.html { redirect_to status_travel_path(travel), alert: \"Failed to complete! Errors: #{travel.errors.full_messages}\" }\n format.json { render json: travel.as_json, status: :unprocessable_entity }\n end\n end\n end", "def link_to_edit(resource, options = {})\n name = (\"<i class='icon-white icon-edit'></i>\").html_safe\n attributes = {\n :class => \"mr-xs btn btn-mini btn-inverse edit-link\",\n }.merge(options)\n link_to name, resource, attributes\n end", "def link_to_trackable(object, object_type)\n if object\n link_to object_type.downcase, object\n else\n \"a #{object_type.downcase} which does not exist anymore\"\n end\n end", "def link_to_item(item, options = {})\n case item\n when Collection\n collection_url(item, options)\n when Community\n community_url(item, options)\n when DataObject\n data_object_url(item.latest_published_version_in_same_language || item, options)\n when User\n user_url(item, options)\n when TaxonConcept\n taxon_url(item, options)\n when UserAddedData\n options.merge!(anchor: item.anchor)\n taxon_data_url(item.taxon_concept, options)\n when DataPointUri\n options.merge!(anchor: item.anchor)\n taxon_data_url(item.taxon_concept, options)\n when Resource\n content_partner_resource_url(options[:content_partner], item)\n else\n raise EOL::Exceptions::ObjectNotFound\n end\n end", "def new_flag_path(object=nil)\n selector = [@tier]\n if object\n if object.is_a?(Comment)\n if object.commentable.is_a?(Response)\n selector << object.commentable.kase\n selector << object.commentable\n selector << object\n elsif object.commentable.is_a?(Kase)\n selector << object.commentable\n selector << object\n end\n elsif object.is_a?(Response)\n # /kase/:kase_id/responses/:response_id/flags/new\n selector << object.kase\n selector << object\n elsif object.is_a?(Kase)\n # /kase/:kase_id/flags/new\n selector << object\n elsif object.is_a?(Person)\n # /people/:person_id/flags/new\n selector << object\n end\n end\n selector << :flag\n collection_url(selector.compact, :new)\n end", "def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end", "def edit_path\n \"/answers/#{object.id}/edit\"\n end", "def cancel_order_reference(\n amazon_order_reference_id,\n cancelation_reason: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'CancelOrderReference',\n 'SellerId' => merchant_id,\n 'AmazonOrderReferenceId' => amazon_order_reference_id\n }\n\n optional = {\n 'CancelationReason' => cancelation_reason,\n 'MWSAuthToken' => mws_auth_token\n }\n\n operation(parameters, optional)\n end", "def cancel\n @ride = Ride.find_by_id(params[:ride])\n current_user.cancel!(@ride)\n redirect_to root_path\n end", "def find_for_cancel(reputable, action, receiver, points, tier=nil)\n conditions = unless tier\n [\"reputations.status = ? AND reputations.reputable_id = ? AND reputations.reputable_type = ? AND reputations.action = ? AND reputations.receiver_id = ? AND reputations.points = ?\", \n 'active', reputable.id, reputable.class.base_class.name, action.to_s, receiver.id, points]\n else\n tier = tier.parent ? tier.parent : tier\n [\"reputations.status = ? AND reputations.reputable_id = ? AND reputations.reputable_type = ? AND reputations.action = ? AND reputations.receiver_id = ? AND reputations.points = ? AND reputations.tier_id = ?\", \n 'active', reputable.id, reputable.class.base_class.name, action.to_s, receiver.id, points, tier.id]\n end\n result = find(:all, \n :conditions => conditions,\n :order => \"activated_at DESC, created_at DESC\",\n :limit => 1)\n result.first unless result.empty?\n end" ]
[ "0.75616986", "0.7237853", "0.65782756", "0.6402849", "0.5894265", "0.5657138", "0.5649547", "0.56070155", "0.55972683", "0.5594955", "0.55717987", "0.55168355", "0.5480481", "0.54286695", "0.5401311", "0.5359663", "0.5353586", "0.52714837", "0.52714837", "0.5189978", "0.5183773", "0.515042", "0.51480675", "0.51346815", "0.51115817", "0.50096774", "0.500075", "0.49875736", "0.497642", "0.49565068", "0.49483466", "0.49467182", "0.49380752", "0.49326017", "0.4907483", "0.48863533", "0.48670354", "0.48628658", "0.4857536", "0.4856914", "0.48507497", "0.48329282", "0.4830105", "0.48235765", "0.47969535", "0.47941202", "0.47937503", "0.47895253", "0.4785094", "0.4752453", "0.4751172", "0.474684", "0.47272044", "0.4707325", "0.47000313", "0.46999082", "0.4694752", "0.46902168", "0.46837285", "0.46823347", "0.46576372", "0.46551365", "0.46400863", "0.46346408", "0.4595816", "0.458978", "0.45804822", "0.4574918", "0.45738158", "0.45703608", "0.45567197", "0.45567197", "0.45567197", "0.45420113", "0.45391753", "0.45374507", "0.45271948", "0.45259392", "0.45240876", "0.4520923", "0.45145226", "0.45028585", "0.44977534", "0.44968835", "0.44935948", "0.44892025", "0.44843945", "0.44843316", "0.44828555", "0.44792318", "0.4473748", "0.4471209", "0.44659907", "0.44583532", "0.44572106", "0.44549805", "0.44466323", "0.4438432", "0.44355965", "0.44325164" ]
0.9175337
0
If a block is given, call it to get the path for the current row entry. Otherwise, return the standard path args.
def action_path(e, &block) block_given? ? yield(e) : path_args(e) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_path(cell, &block)\n current_cell = cell\n begin\n current_cell = yield(current_cell)\n return current_cell if is_intersection?(current_cell)\n end while is_navigable_space?(current_cell)\n nil\n end", "def contextual_edit_block_path(block)\n active_model = get_active_model_by_path(block.models)\n active_model ? edit_model_path(active_model, :anchor => 'show_collapseable_BlocksFields') : edit_block_path(block)\n end", "def path!\n model.dataset.select(:path).get_unfiltered_raw(id).try(:[], :path)\n end", "def find_left_path(cell)\n find_path(cell) { | cell | left_cell(cell) }\n end", "def find_right_path(cell)\n find_path(cell) { | cell | right_cell(cell) }\n end", "def find_bottom_path(cell)\n find_path(cell) { | cell | bottom_cell(cell) }\n end", "def path(arg=nil)\n # set_or_return is a magic function from Chef that does most of the heavy\n # lifting for attribute access.\n set_or_return(:path, arg, kind_of: [String])\n end", "def find_top_path(cell)\n find_path(cell) { | cell | top_cell(cell) }\n end", "def path(*) end", "def path_block(klass)\n # RODA4: Remove\n if opts[:path_class_by_name]\n klass = klass.name\n end\n path_classes[klass]\n end", "def get_path( source_node, *path )\n h = source_node.to_hash\n path.inject(h) { |obj, item| obj[item.to_s] || break }\nend", "def partitioned_path(*args)\n [attachment_path_id.to_s] + args\n end", "def path(value = nil, &block)\n __define__(:path, value, block)\n end", "def __get_block_source_location(&block)\n return {} unless block_given?\n\n r, l = block.source_location\n { ref: r, line: l }\n rescue MethodSource::SourceNotFoundError\n {}\n end", "def calc_path\n endpoint = grid.target\n while endpoint\n search.path[endpoint] = true\n endpoint = search.came_from[endpoint]\n end\n end", "def path\n # FIXME: Do this without exception!\n #\"#{ @parent.path unless @parent == self }##{ ident }\"\n # rescue base path\n \"#{@parent.path rescue ''}##{ident}\"\n end", "def path=(_arg0); end", "def path=(_arg0); end", "def path=(_arg0); end", "def path=(_arg0); end", "def path=(_arg0); end", "def computed_path(context)\n @_path ||= case @path\n when String, Hash\n @path\n when Symbol\n context.public_send(@path) # todo\n when Proc\n context.instance_exec(&@path)\n else\n raise ArgumentError,\n \"Expected one of String, Symbol, or Proc, \" \\\n \"got #{@path.class}\"\n end\n end", "def file_and_line\n path, line = *@proc.inspect.match(PROC_PATTERN)[1..2]\n path = File.expand_path(path)\n pwd = File.expand_path(PWD)\n if path.index(pwd)\n path = path[pwd.length+1..-1]\n elsif path =~ /.*\\/gems\\/(.*\\.rb)$/\n path = $1\n end\n [path, line.to_i]\n end", "def path\n @path ||= [ path_only ].concat( [*matrix].delete_if { |v| v.respond_to?(:empty?) and v.empty? } ).join('')\n end", "def path(*args, &block)\n Path.new(self, *args, &block)\n end", "def current_path(*path_params)\n if path_params.last.is_a?(Hash)\n path_params[-1] = params.merge(path_params[-1])\n else\n path_params << params\n end\n\n path_params[-1] = Utils.symbolize_keys(path_params[-1])\n @route.path(*path_params)\n end", "def fetch_path(*args)\n args = args.first if args.length == 1 && args.first.kind_of?(Array)\n raise ArgumentError, \"must pass at least one key\" if args.empty?\n\n result = self\n args.each_with_index do |key, i|\n raise ArgumentError, \"must be a number\" if result.kind_of?(Array) && !key.kind_of?(Numeric)\n\n result = result[key]\n if !result.respond_to?(:fetch_path) && (i + 1) != args.size\n result = nil\n break\n end\n end\n result\n end", "def default_path str = nil, &block\n (class << self; self; end).send :define_method, :default_path do \n block_given? ? instance_eval(&block) : str\n end\n end", "def path() end", "def path() end", "def path() end", "def get_row(csv_file, row)\n csv_data = CSV.read(csv_file)\n path = File.dirname(csv_file)\n\n csv_data[row-1]\n end", "def spot_call_for_args\n _nd_recv, _mid, nd_args = @node.children\n if nd_args && nd_args.first_lineno == nd_args.last_lineno\n fetch_line(nd_args.first_lineno)\n @beg_column = nd_args.first_column\n @end_column = nd_args.last_column\n end\n # TODO: support @arg\n end", "def path(path = nil, &block)\n return @path unless path\n @path = path\n if PATH_PARAMETER_REGEX.match path\n set_path_parameters(path, &block)\n elsif block_given?\n raise 'A path block was provided but no URL parameter was found.'\n end\n end", "def whole_path(p, &blk)\n path(p) { complete(&blk) }\n end", "def new_paths(path, block)\n if path.nil? || path.respond_to?(:to_str)\n vs = versions.empty? ? [\"/\"] : versions\n ps = prefixes.empty? ? [\"/\"] : prefixes\n\n vs.product(ps).map do |v, p|\n new_block = Proc.new { env['enron.api.version']=v; env['enron.api.prefix']=p; instance_eval &block }\n new_path = case path\n when \"/\"\n ::File.join(v, p)\n when \"*\", nil\n ::File.join(v, p) + \"*\"\n else\n ::File.join(v, p, path)\n end\n [new_path, new_block]\n end\n else\n [path, block]\n end\n end", "def paths(path_to_record='', data=nil, &block)\n data ||= tree\n data.each do |name, content|\n new_path = File.join(path_to_record, name.to_s)\n case content\n when Hash\n paths(new_path, content, &block)\n else\n yield(new_path, content)\n end\n end\n end", "def extract_file_path(files_args, label)\n files_args.find { |file_args| file_args[:label] == label }\n .yield_self { |it| it.nil? ? nil : it[:path] }\n end", "def path(options={}, &block)\n cur_page.path(options, &block)\n end", "def path\n if value.is_a?(String)\n value\n else\n value.send(path_method, *path_arguments)\n end\n end", "def attachment_path_id\n ((respond_to?(:parent_id) and parent_id) or id) or 0\n end", "def each_path(&block)\n return to_enum(__method__) unless block\n\n descendants = []\n last = self\n loop do\n last = last.children.first\n break if last.nil?\n\n descendants << last\n break unless last.const_type?\n end\n descendants.reverse_each(&block)\n\n self\n end", "def return_path(value = nil)\n if value.nil?\n @return_path\n else\n @return_path = value\n end\n end", "def full_path=(_arg0); end", "def path(*a)\n return @path if a.empty?\n ret = File.join(@path, *(a.map { |arg| arg.to_s }))\n ret = File.expand_path(ret) # Try to fix some heroku issues (?)\n File.exists?(ret) ? ret : nil\n end", "def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next if path.include? n\n path.push(n)\n search[n]\n path.pop\n end\n end\n\n [*follow[self]].each do |n| \n path.push(n)\n search[n] \n path.pop\n end\n\n paths\n end", "def path( *args, &block )\n rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)\n if block\n begin\n $LOAD_PATH.unshift PATH\n rv = block.call\n ensure\n $LOAD_PATH.shift\n end\n end\n return rv\n end", "def find_path\n current_node = @cells_visited.last\n while current_node.parent != nil do\n @solved_path << current_node.cell\n current_node = current_node.parent\n end\n @solved_path << current_node.cell\n end", "def method_missing(method, *args)\n if method =~ /current_(.*)/\n return path_part( @parts[$1.to_sym] ) if @parts.has_key?($1.to_sym)\n end\n\n super\n end", "def enum_paths(&block)\n @maze.connections_from(@at, @subset_mask, &block)\n end", "def private_show_path(*args)\n model = \"part\"\n options = args.extract_options!\n methods = []\n if parent.blank?\n options = options.merge(site: cur_site || site, id: self)\n methods << \"cms_#{model}_path\"\n else\n options = options.merge(site: cur_site || site, cid: parent, id: self)\n methods << \"node_#{model}_path\"\n end\n\n helper_mod = Rails.application.routes.url_helpers\n methods.each do |method|\n path = helper_mod.send(method, *args, options) rescue nil\n return path if path.present?\n end\n\n nil\n end", "def yield_path\n room = @maze[:path]\n while room.parent\n yield room.x, room.y\n room = room.parent\n end\n end", "def path\n ([*@options['path']].first.split(',').first || '/').strip\n end", "def draw_paths=(_arg0); end", "def attachment_path_id\n ((respond_to?(:parent_id) && parent_id) || id).to_s\n end", "def attachment_path_id\n ((respond_to?(:parent_id) && parent_id) || id).to_s\n end", "def backup_path instance_id, cluster_id, backup_id\n Admin::V2::BigtableTableAdmin::Paths.backup_path project: project_id,\n instance: instance_id,\n cluster: cluster_id,\n backup: backup_id\n end", "def path(parent)\n return name if not parent\n build_path(parent.path)\n end", "def last_operation_path\n last_operation['path']\n end", "def ltree_path_in_database\n public_send :attribute_in_database, ltree_path_column\n end", "def each(path = nil, &block)\r\n @specs.each do |k, v|\r\n next if !path.nil? && k.first != path\r\n block.call(v) if block.arity == 1\r\n block.call(k.last, v) if block.arity == 2\r\n block.call(k.first, k.last, v)\r\n end\r\n end", "def extract_block_arg\n if args.last.is_a?(Sexp) and args.last.type == :block_pass\n block_arg = args.pop\n block_arg = block_arg[1][1].to_sym\n end\n end", "def lsblk_path(p)\n return unless !p['path'] && p['name']\n\n if File.exist?(\"/dev/#{p['name']}\")\n p['path'] = \"/dev/#{p['name']}\"\n elsif File.exist?(\"/dev/mapper/#{p['name']}\")\n p['path'] = \"/dev/mapper/#{p['name']}\"\n end\n end", "def block_to_loc(block)\n @block_to_loc[block]\n end", "def each_request_target_with_path(&block)\n\t\ttarget_requests('AND requests.path IS NOT NULL').each do |req|\n\t\t\tblock.call(req)\n\t\tend\n\tend", "def path\n @path ||= \n (@path_proc && @path_proc.call(self)) || \n default_path\n end", "def path(resource, &block)\n if block\n path_object = Skeleton::Path.new\n yield(path_object)\n paths[resource] = path_object\n else\n paths[resource]\n end\n end", "def get_parent_of(record, path)\n parent_object = path[0..-2].reduce(record) { |a, e| a.is_a?(Hash) ? a[e] : nil }\n [parent_object, path[-1]]\n end", "def source_location\n [@block.file.to_s, @block.line]\n end", "def path; @path_stack end", "def path\n @data[\"path\"].to_s\n end", "def return_path( val = nil )\n default :return_path, val\n end", "def path\n metadata.fetch(:path) do\n return if request_response_pairs.empty?\n request_response_pairs.first.first.path\n end\n end", "def file_path_proc\n return @attachment_options[:dropbox_options][:path] if @attachment_options[:dropbox_options][:path]\n\n if @attachment_options[:dropbox_options][:unique_filename]\n eval %(proc { |style| \"\\#{ActiveModel::Naming.param_key(self.class)}_\\#{id}_\\#{#{@attachment.name}.name}\" })\n else\n eval %(proc { |style| #{@attachment.name}.original_filename })\n end\n end", "def path(current)\n output = \" \"\n path = [[current.x, current.y]]\n while current.parent != nil\n path << [current.parent.x, current.parent.y]\n current = current.parent\n end\n path.reverse!\n path.each do |space|\n output += \"#{space} \"\n @board.update_board(space)\n end\n output\n end", "def paths\n @table[:paths] || {}\n end", "def menu_path()\n path, parent = [], self\n while parent\n path << parent.id\n parent = parent._parent\n end \n path.reverse\nend", "def partitioned_path(*args)\n #(\"%08d\" % attachment_path_id).scan(/..../) + args\n args\n end", "def path( *args )\n rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)\n if block_given?\n begin\n $LOAD_PATH.unshift PATH\n rv = yield\n ensure\n $LOAD_PATH.shift\n end\n end\n return rv\n end", "def path(*args)\n @path = args.map(&:to_sym)\n self\n end", "def partitioned_path(*args)\n if respond_to?(:attachment_options) && attachment_options[:partition] == false\n args\n else\n (\"%08d\" % attachment_path_id).scan(/..../) + args\n end\n end", "def block_paths\n raise NotImplementedError, 'Implement this method in a child class'\n end", "def nested_path_by(field, opts = {})\n options = {delimiter: \"/\", prefix: \"\"}\n options.merge!(opts)\n delimiter = options[:delimiter]\n prefix = options[:prefix].empty? ? \"\" : \"#{options[:prefix]}#{delimiter}\"\n path = ([self] + ancestors).reverse.collect {|a| a.send(field)}.join(delimiter).gsub(prefix,\"\")\n return delimiter + path\n end", "def commentable_path\n eval(\"%s(%s)\" % find_path_and_parts)\n end", "def get(*args, &block)\n return @mappings.get_path(*args, &block)\n end", "def path\n Especie.where(id: path_ids)\n end", "def attachment_path_id\n ((respond_to?(:parent_id) && parent_id) || id).to_i\n end", "def path( *args )\n rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)\n if block_given?\n begin\n $LOAD_PATH.unshift PATH\n rv = yield\n ensure\n $LOAD_PATH.shift\n end\n end\n return rv\n end", "def path(value = nil)\n @path = value if value\n\n return @path if @path\n\n superclass.respond_to?(:path) ? superclass.path : nil\n end", "def args_path\n scope_definition.parameters.each_with_index.map do |parameter, i| \n if args[i].is_a? ActiveRecord::Base\n [parameter.to_s, args[i].send(args[i].class.primary_key).to_s]\n else\n [parameter.to_s, args[i].to_s] \n end\n end.flatten\n end", "def main_path_to_return\n if params[:return_to]\n params[:return_to]\n else\n parameters = {}\n if params[:parent_controller]\n parameters[:controller] = params[:parent_controller]\n parameters[:eid] = params[:parent_controller]\n end\n if nested?\n parameters[:controller] = nested.parent_scaffold.controller_path\n parameters[:eid] = nil\n end\n if params[:parent_sti]\n parameters[:controller] = params[:parent_sti]\n parameters[:eid] = nil\n end\n parameters[:parent_column] = nil\n parameters[:parent_id] = nil\n parameters[:action] = \"index\"\n parameters[:id] = nil\n parameters[:associated_id] = nil\n parameters[:utf8] = nil\n params_for(parameters)\n end\n end", "def pathmap(spec=nil, &block)\n collect { |fn| fn.pathmap(spec, &block) }\n end", "def render_path\n # If the star and target are disconnected there will only be one path\n # The path should not render in that case\n unless search.path.size == 1\n search.path.each_key do | cell |\n # Renders path on both grids\n outputs.solids << [scale_up(cell), path_color]\n end\n end\n end", "def identifying_path_part(ident=:default)\n File.join identify(ident).map{|sym| send(sym).to_s}\n end", "def define_paths_for(path, &block)\n path_part = root_defined_path_part[path]\n if path_part.nil?\n raise ArgumentError.new \"can not define paths for #{path} since it has not yet been defined\"\n end\n \n yield path_part\n end", "def path\n @path || []\n end", "def each_request_target_with_path(&block)\n\t\ttarget_requests('AND wmap_requests.path IS NOT NULL').each do |req|\n\t\t\tblock.call(req)\n\t\tend\n\tend", "def path\n return get_path self\n end", "def path_with_keys()\n path = []\n\n for part in @path\n if part.is_a? String\n path << part\n elsif part.is_a? Symbol\n path << (yield part)\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n '/' + path.join('/')\n end" ]
[ "0.5891314", "0.55897903", "0.5582664", "0.5563171", "0.5515973", "0.54829067", "0.5437429", "0.5399933", "0.5287319", "0.5262655", "0.5236643", "0.51250136", "0.51234734", "0.51191664", "0.51136595", "0.5113634", "0.51100683", "0.51100683", "0.51100683", "0.51100683", "0.51100683", "0.5091143", "0.5064171", "0.5039528", "0.50366056", "0.5034591", "0.502459", "0.5018967", "0.5016393", "0.5016393", "0.5016393", "0.50087655", "0.49983677", "0.49790174", "0.49789238", "0.49788892", "0.4977758", "0.49739975", "0.49728796", "0.49635115", "0.49222395", "0.491718", "0.49121535", "0.4908783", "0.4907839", "0.490551", "0.49006176", "0.48908177", "0.4877804", "0.48763254", "0.48709393", "0.4856437", "0.48454112", "0.48421693", "0.4824624", "0.4824624", "0.48217806", "0.48169127", "0.48149964", "0.48088792", "0.4802755", "0.47982484", "0.47927973", "0.47900057", "0.4788385", "0.47819644", "0.47749415", "0.47748047", "0.4770546", "0.47675562", "0.47551757", "0.47510982", "0.4741065", "0.47349668", "0.47323903", "0.4729329", "0.47289258", "0.47284842", "0.47241634", "0.47197425", "0.4715905", "0.47093314", "0.47090137", "0.4707351", "0.4703107", "0.47007942", "0.46907857", "0.46899182", "0.4687707", "0.46874794", "0.46865624", "0.46774244", "0.4670759", "0.4664261", "0.46622908", "0.46527958", "0.46489033", "0.4642072", "0.46350622" ]
0.58819824
2
GET /applications/1 GET /applications/1.json
def show @application = Application.find(params[:id]) if @application.nil? or @application.job.nil? redirect_to "/", :alert=>"You do not have access to this page" return false end return unless appAccess?(@application.job.id) @job = @application.job respond_to do |format| format.html # show.html.erb format.json { render json: @application } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applications_list\n get \"applications\"\n end", "def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.json { render json: @application }\n end\n end", "def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end", "def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def index\n respond_with @applications = Application.all\n end", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def show\n #表示は誰でもできる\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def show\n respond_with @application = Application.find(params[:id])\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def show\n @application = Application.find(params[:id])\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend", "def show\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newapp }\n end\n end", "def show\n @application = Application.find(params[:id])\n end", "def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def get_applications_of_project\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:project_id => Project.find_by_id(param[:id]))\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_app }\n end\n end", "def app data={}\n get '/app', data\n end", "def get_applications_of_user\n respond_to do |format|\n format.json {\n @project_applications = ProjectApplication.where(:user_id => @current_user.id)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def show\n render json: @application\n end", "def show\n @application_status = ApplicationStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application_status }\n end\n end", "def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\n end", "def show\n @app = App.find_by_id(params[:id])\n if (@app)\n Rabl.render(@app, 'api/apps/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid app\"}\n end\n end", "def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end", "def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end", "def applications\n get(PLURAL_PATH, RESOURCE)\n end", "def show\n @app = current_user.apps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def show\n render json: @app\n end", "def show\n respond_to do |format|\n format.json {\n\n @project_application = ProjectApplication.find_by_id(params[:id])\n\n if @project_application\n render :json => @project_application\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobileapp }\n end\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def index\n @client_applications = ClientApplication.all\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n format.json { render :json => @app } \n end\n end", "def get id\n apps.select do |app|\n app.id == id\n end.first\n end", "def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end", "def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_config }\n end\n end", "def show\n @web_app = WebApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_app }\n end\n end", "def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def show\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_application }\n end\n end", "def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end", "def index\n @applications = Application.find(:all,:conditions=>['user_id=?',current_user.id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applications }\n end\n end", "def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end", "def show\n @applicationlog = Applicationlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicationlog }\n end\n end", "def index\n @applications = @opportunity.applications\n end", "def index\n @app_configs = AppConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_configs }\n end\n end", "def show\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end", "def show\n params[:page_size] = params[:page_size] || PAGE_SIZE\n\t\t@mobile_apps = MobileApp.where(id: params[:id]).page(params[:page] || DEFAULT_PAGE).per(params[:page_size] || PAGE_SIZE)\n\t\trespond_to do |format|\n\t\t\tformat.json { render \"show\" }\n\t\tend\t\t\n\tend", "def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def get_application_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_application_list ...'\n end\n # resource path\n local_var_path = '/appManagement/applications'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\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 => 'ApplicationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_application_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_applications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_applications, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2003' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @applications = @application_scope\n end", "def stub_api_applications_get(request_params: default_applications_filter, response:, tenant_header: user_tenant_header)\n stub_api_common_get('applications', request_params, response, tenant_header)\n end", "def index\n set_records_count_header(filterBySearch(applications_scope))\n @applications = filterBySearch(applications_scope).offset(params[:offset] || 0).limit(params[:limit] || 6)\n render json: @applications.all\n end", "def show\n @app_role = AppRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_role }\n end\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 index\n @apps = current_user.apps.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @apps }\n end\n end", "def get_applications(opts = {})\n data, _status_code, _headers = get_applications_with_http_info(opts)\n data\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end", "def fetch_user_application\n @user_application = UserApplication.find(params[:id])\n end", "def application(applicant_id)\n request(:get, \"applicant_tracking/applications/#{applicant_id}\")\n end", "def show\n @second_rails_app = SecondRailsApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @second_rails_app }\n end\n end", "def oauth_application(token)\n request(\n __method__,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end", "def index\n @user_applications = UserApplication.all\n end", "def get_app_spec\n # App should exist and be accessible\n app = App.accessible_by(@context).find_by_uid(unsafe_params[:id])\n fail \"Invalid app id\" if app.nil?\n\n render json: { spec: app.spec, assets: app.ordered_assets, packages: app.packages }\n end", "def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end", "def show\n @program = Program.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program }\n end\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end", "def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def index\n @apps = Application.order(:name).all\n end" ]
[ "0.8114244", "0.7810009", "0.7691295", "0.7680003", "0.7680003", "0.75518596", "0.74795187", "0.7417034", "0.7405294", "0.7366823", "0.7303719", "0.7295216", "0.7287319", "0.7275292", "0.7260817", "0.7242591", "0.7242591", "0.7242591", "0.7239261", "0.72133744", "0.7209267", "0.7166907", "0.716674", "0.7109535", "0.7109535", "0.7109535", "0.7109535", "0.7050289", "0.70193756", "0.6987199", "0.6986455", "0.69687295", "0.69496095", "0.6949443", "0.6926825", "0.69134396", "0.6909554", "0.6879114", "0.68194324", "0.6776715", "0.6771772", "0.67466795", "0.6724111", "0.67091864", "0.6677461", "0.66175014", "0.66045475", "0.6600832", "0.6586472", "0.658272", "0.6566295", "0.6553009", "0.6521418", "0.65135705", "0.6511008", "0.650111", "0.6495977", "0.64726347", "0.6463675", "0.642635", "0.6425443", "0.6425245", "0.6423966", "0.6412045", "0.6406144", "0.639945", "0.6399154", "0.6396198", "0.6381853", "0.6380758", "0.6380758", "0.6380758", "0.63712573", "0.63432175", "0.6333564", "0.63224494", "0.63026536", "0.6268211", "0.6249784", "0.6233883", "0.62311643", "0.6224602", "0.62061125", "0.6202458", "0.6200211", "0.61966264", "0.6191867", "0.61874646", "0.61748445", "0.61706996", "0.61706996", "0.6164015", "0.6164015", "0.6164015", "0.6164015", "0.6164015", "0.6151432", "0.6147721", "0.6147508", "0.613315" ]
0.6419915
63
GET /applications/new GET /applications/new.json
def new if params[:id].nil? redirect_to "/", :alert=>"You need to apply through a job" return end @job = Job.find(params[:id]) @company = @job.company.name @title = @job.title @application = Application.new respond_to do |format| format.html# new.html.erb format.json { render json: @application } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @app = current_user.apps.new\n @app.app_versions << AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def show\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @user_app = UserApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_app }\n end\n end", "def new\n\n #申請は誰でもできる\n @application = Application.new\n user = User.find_by_user(@login_user)\n puts user\n\n @application['user_id'] = user.id\n @application['user'] = user\n\n @instances = get_all_instances\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def new\n @application_status = ApplicationStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_status }\n end\n end", "def new\n @web_app = WebApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @web_app }\n end\n end", "def new\n respond_with @application = Application.new\n end", "def new\n @mobileapp = Mobileapp.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mobileapp }\n end\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @app_role = AppRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app_role }\n end\n end", "def new\n @planning_application = PlanningApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planning_application }\n end\n end", "def new\n @app = Mms::App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def new\n @application_event=ApplicationsEvent.find(params[:applications_event_id])\n @applications_application = ApplicationsApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applications_application }\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @student_application = StudentApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_application }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def new\n @program = Program.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end", "def new\n @program = Program.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end", "def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html {\n flash[:success] = 'Application ' + @application.name + ' was successfully created.'\n redirect_to [:admin, @application]\n }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"new\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\n end", "def create\n @application = Application.new()\n @application.name = params[:application][:name].to_s.downcase\n # true - доступ запрещен, false - разрешен\n @application.default = true\n respond_to do |format|\n if @application.save\n format.html { redirect_to applications_path, notice: 'Приложение создано.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n flash[:success] = 'App was successfully saved.'\n format.html { redirect_to @app }\n format.json { render :show, status: :created, location: @app }\n else\n flash[:danger] = 'There was a problem creating the App Catalog Page.'\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def new\n @applicationlog = Applicationlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicationlog }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @app }\n end\n end", "def new\n @application = Application.new\n range = [*'0'..'9', *'a'..'z', *'A'..'Z']\n @application.api_key = Array.new(30){range.sample}.join\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @application }\n end\n end", "def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @app_var = AppVar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app_var }\n end\n end", "def new\n @boot = Boot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @boot }\n end\n end", "def new\n submenu_item 'applications-new'\n @app = App.new(:type_id => params[:type_id], :host_id => params[:host_id])\n @groups = Group.all :conditions=>{:tenant_id=>current_user.tenant_id},:order=>:name\n unless @app.type\n redirect_to params.update(:action => \"types\")\n return\n end\n dictionary\n respond_to do |format|\n format.html{\n }\n format.xml { render :xml => @app }\n end\n end", "def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @candidate_app = CandidateApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate_app }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant }\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def create\n application = Application.new(app_params)\n if application.save\n flash[:success] = 'Application was successfully created.'\n redirect_to application_path(application)\n else\n error_message = application.errors.full_messages.to_sentence\n flash[:alert] = 'Application could not be created. Do better'\n #another option would be render :new\n redirect_to new_application_path\n end\n end", "def create\n if not view_context.can_apply?\n flash[:error] = 'You are not allowed to create new applications. If you have already applied to the guild, you can find a link to your application on your profile page.'\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @app = App.new\n #@ec2_sg_filtered = ec2_sg_filtered\n load_ec2_sg_filtered\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def new\n @second_rails_app = SecondRailsApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @second_rails_app }\n end\n end", "def new\n @app_version = @app.app_versions.build\n # @app_version = AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app_version }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @applicant }\n end\n end", "def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end", "def new\n @client_app = ClientApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seed }\n end\n end", "def new\n @deployment = Deployment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deployment }\n end\n end", "def new\n @application = Application.find(params[:application_id])\n @received_update = @application.received_updates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @received_update }\n end\n end", "def create\n\t\tbegin\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\t@application = Application.create!(name: params[:name])\n end\n rescue => e #ActiveRecord::RecordNotUnique\n p e.message\n p e.backtrace\n\t\t\tActiveRecord::Rollback\n\t\t\trender plain: e.message, status: :unprocessable_entity and return\n end\n render json:\" Application created with token = #{@application.token}\", status: :created\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n current_user.application = @application\n current_user.save\n format.html { redirect_to @application, notice: 'Application successfully sent in.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n @program = @event.programs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end", "def create\n @newaplication = Newaplication.new(newaplication_params)\n\n respond_to do |format|\n if @newaplication.save\n format.html { redirect_to @newaplication, notice: 'Newaplication was successfully created.' }\n format.json { render :show, status: :created, location: @newaplication }\n else\n format.html { render :new }\n format.json { render json: @newaplication.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end", "def new\n @user_account_app = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_account_app }\n end\n end", "def new\n @programa = Programa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programa }\n end\n end", "def create\n @application = Application.new(params[:application])\n @application.job = Job.find(params[:id])\n respond_to do |format|\n if @application.save\n format.html { redirect_to '/', notice: 'Application was received.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html do \n redirect_to root_path \n flash[:application_success] = \"true\"\n end\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html do \n render action: \"new\"\n flash[:notice] = 'Looks like there are still some areas to be fixed' \n end \n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_application(application)\n load_resources(application)\n @title = 'New Job Applicant'\n mail( subject: 'New Applicant', to: company_administrators, track_opens: 'true' )\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def applications_list\n get \"applications\"\n end", "def new\n @manifest_item = ManifestItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manifest_item }\n end\n end", "def new\n @environment = Environment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @environment }\n end\n end", "def new\n @userapp = Userapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @userapp }\n end\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def new\n\tif user_signed_in?\n\t\t@program = Program.new\n\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render json: @program }\n\t\tend\n\telse\n\t\tflash[:notice] = \"You don't have access to do that\"\n\t\tredirect_to :controller=>'home', :action => 'index'\n\tend\n end", "def new\n @apprentice = Apprentice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apprentice }\n end\n end", "def create\n @visa_application = VisaApplication.new(visa_application_params)\n\n respond_to do |format|\n if @visa_application.save\n format.html { redirect_to @visa_application, notice: 'Visa application was successfully created.' }\n format.json { render :show, status: :created, location: @visa_application }\n else\n format.html { render :new }\n format.json { render json: @visa_application.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.80625165", "0.7869684", "0.7869684", "0.7869684", "0.76236117", "0.76236117", "0.76236117", "0.76236117", "0.7623116", "0.71835846", "0.7132159", "0.71160907", "0.70642376", "0.70039517", "0.6994037", "0.6959962", "0.6938884", "0.6912392", "0.6904323", "0.6895807", "0.68756706", "0.68746394", "0.6865741", "0.68300605", "0.6826013", "0.67993474", "0.6797347", "0.6797347", "0.6797347", "0.67914236", "0.67914236", "0.6770537", "0.676971", "0.67695737", "0.6764865", "0.67478174", "0.6741435", "0.6729043", "0.6728105", "0.67058855", "0.66994447", "0.66688836", "0.6628808", "0.6628808", "0.66037345", "0.6589909", "0.657328", "0.656215", "0.6545426", "0.653839", "0.6520831", "0.65203226", "0.6503406", "0.6483546", "0.647919", "0.64711326", "0.6467949", "0.64613706", "0.6459376", "0.6459376", "0.6458162", "0.6418633", "0.6399793", "0.6398122", "0.63971025", "0.638966", "0.63864756", "0.637715", "0.63744324", "0.6361242", "0.6357985", "0.6354717", "0.63498825", "0.6345975", "0.63382727", "0.63305914", "0.6327716", "0.63274777", "0.632478", "0.6299935", "0.6297862", "0.6288848", "0.6287843", "0.62760997", "0.62738127", "0.6267063", "0.6266551", "0.6259547", "0.6250126", "0.6250126", "0.6241773", "0.6230188", "0.6225224", "0.6224723", "0.6223206", "0.62218165", "0.62080485", "0.6201831", "0.62016994", "0.6198013" ]
0.68693525
22
POST /applications POST /applications.json
def create @application = Application.new(params[:application]) @application.job = Job.find(params[:id]) respond_to do |format| if @application.save format.html { redirect_to '/', notice: 'Application was received.' } format.json { render json: @application, status: :created, location: @application } else @job = Job.find(params[:id]) @company = @job.company.name @title = @job.title format.html { render action: "new" } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html {\n flash[:success] = 'Application ' + @application.name + ' was successfully created.'\n redirect_to [:admin, @application]\n }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"new\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n current_user.application = @application\n current_user.save\n format.html { redirect_to @application, notice: 'Application successfully sent in.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_application = UserApplication.new(user_application_params)\n\n respond_to do |format|\n if @user_application.save\n format.html { redirect_to @user_application, notice: 'User application was successfully created.' }\n format.json { render :show, status: :created, location: @user_application }\n else\n format.html { render :new }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n key = application_keys.add(params[:key])\n\n respond_with(key, serialize: application)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n @client_application = ClientApplication.new(client_application_params)\n\n respond_to do |format|\n if @client_application.save\n format.html { redirect_to @client_application, notice: 'Client application was successfully created.' }\n format.json { render :show, status: :created, location: @client_application }\n else\n format.html { render :new }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def applications_list\n get \"applications\"\n end", "def create\n @application = Application.new()\n @application.name = params[:application][:name].to_s.downcase\n # true - доступ запрещен, false - разрешен\n @application.default = true\n respond_to do |format|\n if @application.save\n format.html { redirect_to applications_path, notice: 'Приложение создано.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n flash[:success] = 'App was successfully saved.'\n format.html { redirect_to @app }\n format.json { render :show, status: :created, location: @app }\n else\n flash[:danger] = 'There was a problem creating the App Catalog Page.'\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def create\n megam_rest.post_appreq(to_hash)\n end", "def create\n @application_form = ApplicationForm.new(application_form_params)\n authorize @application_form\n\n if @application_form.save\n render json: @application_form, status: :created, location: nil\n else\n render json: @application_form.errors, status: :unprocessable_entity\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def update_app data={}\n put '/app', data\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tbegin\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\t@application = Application.create!(name: params[:name])\n end\n rescue => e #ActiveRecord::RecordNotUnique\n p e.message\n p e.backtrace\n\t\t\tActiveRecord::Rollback\n\t\t\trender plain: e.message, status: :unprocessable_entity and return\n end\n render json:\" Application created with token = #{@application.token}\", status: :created\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def create_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend", "def app data={}\n get '/app', data\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @visa_application = VisaApplication.new(visa_application_params)\n\n respond_to do |format|\n if @visa_application.save\n format.html { redirect_to @visa_application, notice: 'Visa application was successfully created.' }\n format.json { render :show, status: :created, location: @visa_application }\n else\n format.html { render :new }\n format.json { render json: @visa_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html do \n redirect_to root_path \n flash[:application_success] = \"true\"\n end\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html do \n render action: \"new\"\n flash[:notice] = 'Looks like there are still some areas to be fixed' \n end \n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_app = App.new(admin_app_params)\n\n respond_to do |format|\n if @admin_app.save\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_app] }\n else\n format.html { render :new }\n format.json { render json: [:admin, @admin_app].errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end", "def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully created.' }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n session[:current_api_token] = @app.api_token\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { \n @apps = App.all\n render action: \"index\" \n }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n @application.offer = current_user.offers.find(params.require(:offer)[:id])\n\n # @application.company = Company.new(company_params)\n # @application.contact = Contact.new(contact_params)\n # @application.agent = Agent.find_by(agent_params)\n #\n respond_to do |format|\n if @application.save\n # current_user.applications << @application\n format.html { redirect_to action: :index, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userapplication = Userapplication.new(userapplication_params)\n\n respond_to do |format|\n if @userapplication.save\n format.html { redirect_to @userapplication, info: 'La aplicación de usuario se creó con éxito.' }\n format.json { render :show, status: :created, location: @userapplication }\n else\n format.html { render :new }\n format.json { render json: @userapplication.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create\n @phone_app = PhoneApp.new(phone_app_params)\n\n respond_to do |format|\n if @phone_app.save\n format.html { redirect_to @phone_app, notice: 'Phone app was successfully created.' }\n format.json { render :show, status: :created, location: @phone_app }\n else\n format.html { render :new }\n format.json { render json: @phone_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application_with_http_info(application_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.create_application ...'\n end\n # verify the required parameter 'application_name' is set\n if @api_client.config.client_side_validation && application_name.nil?\n fail ArgumentError, \"Missing the required parameter 'application_name' when calling ApplicationManagementApi.create_application\"\n end\n # resource path\n local_var_path = '/appManagement/applications'\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(application_name)\n auth_names = ['APP_MANAGEMENT', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ApplicationSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#create_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def create\n @project_application = ProjectApplication.new(project_application_params)\n\n respond_to do |format|\n if @project_application.save\n format.html { redirect_to @project_application, notice: 'Project application was successfully created.' }\n format.json { render :show, status: :created, location: @project_application }\n else\n format.html { render :new }\n format.json { render json: @project_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n Notifier.application_confirmation(@application).deliver\n format.html { render 'application_success', :locals => { :first_name => @application.first_name } }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @herga_application = HergaApplication.new(herga_application_params)\n\n respond_to do |format|\n if @herga_application.save\n format.html { redirect_to @herga_application, notice: 'Herga application was successfully created.' }\n format.json { render :show, status: :created, location: @herga_application }\n else\n format.html { render :new }\n format.json { render json: @herga_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def apply(application, params={})\n response = @http.post(\"/application/submit\", application.to_xml)\n check_status(response)\n response_application_parser.parse(response.body).first\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\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 create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @task_application = TaskApplication.new(task_application_params)\n\n respond_to do |format|\n if @task_application.save\n format.html { redirect_to @task_application, notice: 'Task application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @residential_application = ResidentialApplication.new(residential_application_params)\n\n respond_to do |format|\n if @residential_application.save\n format.html { redirect_to @residential_application, notice: 'Residential application was successfully created.' }\n format.json { render :show, status: :created, location: @residential_application }\n else\n format.html { render :new }\n format.json { render json: @residential_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_application(name, options)\n debug \"Adding application #{name} to domain #{id}\"\n\n payload = {:name => name}\n options.each{ |key, value| payload[key.to_sym] = value }\n\n cartridges = Array(payload.delete(:cartridge)).concat(Array(payload.delete(:cartridges))).map do |cart|\n if cart.is_a? String or cart.respond_to? :[]\n cart\n else\n cart.url ? {:url => cart.url} : cart.name\n end\n end.compact.uniq\n\n if cartridges.any?{ |c| c.is_a?(Hash) and c[:url] } and !has_param?('ADD_APPLICATION', 'cartridges[][url]')\n raise RHC::Rest::DownloadingCartridgesNotSupported, \"The server does not support downloading cartridges.\"\n end\n\n if client.api_version_negotiated >= 1.3\n payload[:cartridges] = cartridges\n else\n raise RHC::Rest::MultipleCartridgeCreationNotSupported, \"The server only supports creating an application with a single web cartridge.\" if cartridges.length > 1\n payload[:cartridge] = cartridges.first\n end\n\n if payload[:initial_git_url] and !has_param?('ADD_APPLICATION', 'initial_git_url')\n raise RHC::Rest::InitialGitUrlNotSupported, \"The server does not support creating applications from a source repository.\"\n end\n\n options = {:timeout => options[:scale] && 0 || nil}\n rest_method \"ADD_APPLICATION\", payload, options\n end", "def create\n\t\t@application = current_user.collaboration_applications.build(application_params)\n\t\t\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n else\n format.html { render partial: 'errors' }\n end\n end\n end", "def create\n # Receives a Facebook username and a list of Android package names.\n # The list of package names are delimited by newlines.\n \n @user = User.find_for_facebook_token(params[:token].strip)\n\n # List will be delimited by newlines\n packages_list = params[:apps].strip.split(\"\\n\")\n\n # Packages that were successfully associated created with user\n @apps = []\n @user_apps = []\n packages_list.each do |package_name|\n app = App.find(:first, :conditions => [ \"app_id = ?\", package_name ])\n valid_app = !app.nil?\n\n # If app doesn't exist on our system, add it\n if app.nil?\n app = App.new({ app_id: package_name })\n valid_app = app.save\n end\n\n if valid_app\n user_app = UserApp.where(:user_id => @user.id, :app_id => app.id)\n if user_app.size == 0\n user_app = UserApp.new({ user_id: @user.id, app_id: \n app.id, installed: true })\n else\n user_app = user_app[0]\n user_app.installed = true\n end\n if user_app.save\n @apps << app\n @user_apps << user_app\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { render json: { user: @user, apps: @apps }, \n status: :created }\n end\n end", "def create\n if not view_context.can_apply?\n flash[:error] = 'You are not allowed to create new applications. If you have already applied to the guild, you can find a link to your application on your profile page.'\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applist = Applist.new(applist_params)\n\n respond_to do |format|\n if @applist.save\n format.html { redirect_to @applist, notice: 'Applist was successfully created.' }\n format.json { render :show, status: :created, location: @applist }\n else\n format.html { render :new }\n format.json { render json: @applist.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def create(name=nil, options={})\n\t\toptions[:name] = name if name\n\t\txml(post('/apps', :app => options)).elements[\"//app/name\"].text\n\tend", "def register_application(app_name, namespace, public_hostname)\n # curl -X POST https://dnsapi.cn/Record.Create -d '[email protected]&login_password=password&format=json&domain_id=2317346&sub_domain=@&record_type=A&record_line=默认&value=1.1.1.1'\n\n # create an A record for the application in the domain\n hostname = \"#{app_name}-#{namespace}\"\n url = \"https://dnsapi.cn/Record.Create\"\n params = common_params.merge({\n :domain_id => @domain_id,\n :sub_domain => hostname,\n :record_type => 'A',\n :record_line => '默认',\n :value => public_hostname\n })\n\n res = @http.post(url, params)\n res = JSON.parse(res.content)\n puts res\n\n result = JSON.parse(response.body)\n result.status['message']\n #{\n # \"status\": {\n # \"code\":\"1\",\n # \"message\":\"Action completed successful\",\n # \"created_at\":\"2012-11-23 22:17:47\"\n #},\n # \"record\": {\n # \"id\":\"16894439\",\n # \"name\":\"@\",\n # \"status\":\"enable\"\n #}\n #}\n\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create\n @activity_application = @meetup_event.activity_applications.new(activity_application_params_for_create)\n\n respond_to do |format|\n if @activity_application.save\n format.html {redirect_to [@meetup_event, @activity_application], notice: 'Activity application was successfully created.'}\n format.json {render :show, status: :created, location: meetup_event_activity_application_path(@meetup_event, @activity_application)}\n else\n format.html {render :new}\n format.json {render json: @activity_application.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n application = Application.new(app_params)\n if application.save\n flash[:success] = 'Application was successfully created.'\n redirect_to application_path(application)\n else\n error_message = application.errors.full_messages.to_sentence\n flash[:alert] = 'Application could not be created. Do better'\n #another option would be render :new\n redirect_to new_application_path\n end\n end", "def create_application(application_entity)\n # handle runtimes / cartridges\n fail_with(:only_one_runtime) if application_entity[:runtimes].length > 1\n fail_with(:must_have_runtime) if application_entity[:runtimes].empty?\n application_entity[:cartridge] = cartridge(application_entity.delete(:runtimes)[0])\n\n # updates the application with a valid region identity\n retrieve_region(application_entity) if application_entity.key?(:region)\n\n # enable application scaling by default\n application_entity[:scale] = true unless application_entity.key?(:scale)\n created_application = post(\"/domains/#{app_domain}/applications\", body: application_entity).body\n # now make sure we keep at least 2 deployments, allows proper identification of application state\n updated_application = put(\"/application/#{created_application[:data][:id]}\",\n body: { keep_deployments: 2, auto_deploy: false }).body\n to_nucleus_app(updated_application[:data])\n end", "def create\n @mobileapp = Mobileapp.new(params[:mobileapp])\n \n respond_to do |format|\n if @mobileapp.save\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully created.' }\n format.json { render json: @mobileapp, status: :created, location: @mobileapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @merchant_application = MerchantApplication.new(merchant_application_params)\n\n respond_to do |format|\n if @merchant_application.save\n format.html { redirect_to merchant_applications_path, notice: 'Merchant application was successfully created.' }\n format.json { render :show, status: :created, location: @merchant_application }\n else\n format.html { render :new }\n format.json { render json: @merchant_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def create\n @application = Application.new(params[:application])\n p @params\n user = User.find_by_user(params['requester'])\n puts user\n\n @application['user_id'] = user.id\n @application['status'] = 0\n @application['apply_date'] = Time.now\n\n\n @application['to'] = params[:application]['to'].join(\",\")\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to :action => \"index\", notice: 'Application was successfully created.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_with @applications = Application.all\n end", "def create\n @app = App.new(app_params)\n IO.popen([\"mail\", \"-s\", \"New Application request\", \"[email protected]\"], \"w\") {|f|\n f.puts @app.name;\n f.puts @app.email;\n f.puts @app.phone;\n f.puts @app.date;\n f.puts @app.employment;\n f.puts @app.currently;\n f.puts @app.looking_for;\n f.puts @app.experience;\n f.puts @app.ideas;\n f.puts @app.linkedin;\n f.puts @app.heard_from;\n f.close_write;\n }\n\n gb = Gibbon::API.new\n \n name_array = app_params[:name].split\n first_name = app_params[:name]\n last_name = \"\"\n if name_array.length > 1 && name_array[0].length > 0 && name_array[1].length > 0\n first_name = name_array[0]\n last_name = name_array[1]\n end\n puts \"subscribing new user to list\"\n \n gb.lists.subscribe({:id => \"75aba6bef3\", :email => {:email => app_params[:email]}, :merge_vars => {:FNAME => first_name, :LNAME => last_name}, :double_optin => true})\n\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to root_path, notice: \"A lovely application! We'll be in touch soon!\" }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75115496", "0.7120853", "0.7010377", "0.69720936", "0.6955418", "0.6880274", "0.68689686", "0.68499", "0.68345064", "0.68260735", "0.68003273", "0.67571235", "0.67512643", "0.6713185", "0.6713185", "0.666663", "0.6665081", "0.66627544", "0.66618484", "0.6633409", "0.6618574", "0.6590732", "0.6575141", "0.6574769", "0.6569582", "0.6551305", "0.65489143", "0.65489143", "0.6547161", "0.654068", "0.65322775", "0.64915127", "0.6468503", "0.64589113", "0.64579386", "0.64485854", "0.6443327", "0.6426223", "0.63893104", "0.6382237", "0.63622487", "0.6359208", "0.63585263", "0.63432956", "0.63013977", "0.6284374", "0.6264101", "0.6258199", "0.62495327", "0.6227021", "0.6225918", "0.6224622", "0.6210575", "0.62100494", "0.62100494", "0.62100494", "0.6192668", "0.618477", "0.6179233", "0.6139973", "0.61364996", "0.6133809", "0.61060846", "0.61029965", "0.6085162", "0.6084776", "0.60759044", "0.60593295", "0.60572034", "0.605112", "0.60462976", "0.6045442", "0.6041739", "0.60416067", "0.60416067", "0.6040651", "0.6026665", "0.6026665", "0.6016077", "0.60044503", "0.60030663", "0.60025734", "0.5998798", "0.599677", "0.5988473", "0.598093", "0.5979717", "0.5977451", "0.59755397", "0.5973307", "0.59608704", "0.59600216", "0.5956521", "0.59530824", "0.594531", "0.59227747", "0.5904076", "0.5904076", "0.59015316", "0.5899491", "0.5895385" ]
0.0
-1
PUT /applications/1 PUT /applications/1.json
def update return unless admin? @application = Application.find(params[:id]) respond_to do |format| if @application.update_attributes(params[:application]) format.html { redirect_to @application, notice: 'Application was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @application.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_app data={}\n put '/app', data\n end", "def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def update\n if @application.update(application_params)\n render :show, status: :ok, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to root_path, notice: 'Application was successfully submitted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, optional_params = {})\n response = Network.post(['Applications', id], optional_params)\n Application.new(response)\n end", "def update\n @application = Application.find(params[:id])\n\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n end\n \n respond_with @application\n end", "def update\n\n if @app.update_attributes(params[:app])\n respond_to do |format|\n format.html {\n redirect_to app_path(@app), notice: 'app was successfully updated.'\n }\n format.json { render :nothing => true}\n end\n else\n respond_to do |format|\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html {\n flash[:success] = 'Application was successfully updated.'\n redirect_to [:admin, @application]\n }\n format.json { head :no_content }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"edit\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n if @app \n @app.update(app_params)\n\n if @app.valid?\n head :no_content\n else \n head :bad_request\n end\n else \n head :not_found\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to dynamic_url(@application, action: :edit), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: \"Application was successfully updated.\" }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n if @newapp.update_attributes(params[:newapp])\n format.html { redirect_to @newapp, notice: 'Newapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n new_name = params[:application][:name].to_s.downcase\n @application.name = params[:application][:name]\n User.edit_app_name(@application.id, new_name) if @application.valid?\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to applications_path, notice: 'Приложение обновлено.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_oauth_application(token, name, redirect_uris, description = '', icon = nil)\n request(\n __method__,\n :put,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris, description: description, icon: icon }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update_oauth_application(token, name, redirect_uris, description = '', icon = nil)\n request(\n __method__,\n :put,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris, description: description, icon: icon }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update\n @application = Application.find(params[:id])\n \n respond_to do |format|\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n format.html { redirect_to(@application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html {redirect_to @application, notice: 'Application was successfully updated.'}\n format.json {render :show, status: :ok, location: @application}\n else\n format.html {render :edit}\n format.json {render json: @application.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @application.owner = current_user if @application.owner.blank?\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @app\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, alert: 'Your application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to student_url(current_user), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application_event=ApplicationsEvent.find(params[:applications_event_id])\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n if @applications_application.update_attributes(params[:applications_application])\n format.html { redirect_to @applications_application, notice: 'Applications application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @applications_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_application.update(client_application_params)\n format.html { redirect_to @client_application, notice: 'Client application was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_application }\n else\n format.html { render :edit }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n flash[:success] = 'App was successfully updated.'\n format.html { redirect_to @app }\n format.json { render :show, status: :ok, location: @app }\n else\n flash[:danger] = 'There was a problem updating the App Catalog Page.'\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n deprecate # 07/26/2012\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def update\n @app = App.find(params[:uid])\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single camp_application based on the id\n camp_application = CampApplication.find_by(id: the_id)\n\n # update it\n if camp_application.update!(\n camp_id: params[:camp_id],\n application_id: params[:application_id]\n )\n render json: camp_application.as_json\n else\n render json: {errors: camp_application.errors.full_messages}\n end\n end", "def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end", "def update\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n if @user_app.update_attributes(params[:user_app])\n format.html { redirect_to @user_app, notice: 'User app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to apps_path, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n\n Services::OpenIdConnectionService.new(@app).update \n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n flash[:notice] = 'App was successfully updated.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_application\n @application = Oread::Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def update\n respond_to do |format|\n if @visa_application.update(visa_application_params)\n format.html { redirect_to @visa_application, notice: 'Visa application was successfully updated.' }\n format.json { render :show, status: :ok, location: @visa_application }\n else\n format.html { render :edit }\n format.json { render json: @visa_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application_form = ApplicationForm.find(params[:id])\n authorize @application_form\n\n if @application_form.update(application_form_params)\n head :no_content\n else\n render json: @application_form.errors, status: :unprocessable_entity\n end\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @user_application.update(user_application_params)\n format.html { redirect_to @user_application, notice: 'User application was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_application }\n else\n format.html { render :edit }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_app = ClientApp.find(params[:id])\n\n respond_to do |format|\n if @client_app.update_attributes(params[:client_app])\n format.html { redirect_to(client_apps_path, :notice => 'Client app was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @seed.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: \"Test app was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: 'Test app was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_app\n @app = App.find_by( token: params[:app_id])\n if !@app \n render json: { error: \"app not found\"}, status: :not_found\n end\n end", "def set_api_application\n @api_application = ApiApplication.find(params[:id])\n end", "def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @customer_app.update(customer_app_params)\n render :show, status: :ok, location: @customer_app\n else\n render json: @customer_app.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @task_application.update(task_application_params)\n format.html { redirect_to @task_application, notice: 'Task application was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @task_application }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = policy_scope(Application).find(params[:id])\n\n @application.schedule_items.clear\n @application.experiences.clear\n @application.roles.clear\n\n policy_scope(Application).update(@application.id, application_params)\n authorize @application\n if params[:application][:decision] == 'update'\n if @application.save\n flash[:notice] = t('.successfully_updated')\n else\n flash[:alert] = t('.not_created')\n end\n elsif params[:decision] == 'accept'\n @application.accept!\n flash[:notice] = t('.accepted')\n elsif params[:decision] == 'reject'\n @application.reject!\n flash[:notice] = t('.rejected')\n else\n flash[:alert] = t('.cant_change_state')\n end\n redirect_to applications_path\n end", "def set_application\n @application = current_user.applications.find(params[:id])\n end", "def update\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n if @student_application.update_attributes(params[:student_application])\n format.html { redirect_to @student_application, notice: 'Student application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_application.logo = params['client_application']['logo']\n @client_application.theme = params['theme']\n @client_application.save\n respond_to do |format|\n if @client_application.update(client_application_params)\n logger.debug(\"IN THE APPLICATION UPDATE*************************\")\n format.html { redirect_to @client_application, notice: 'Client application was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_application }\n else\n format.html { render :edit }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end", "def set_application\n @application = current_user.oauth_applications.find(params[:id])\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end" ]
[ "0.7469422", "0.72270745", "0.7125723", "0.7125723", "0.7041248", "0.6964055", "0.6934149", "0.6930521", "0.6912836", "0.6912441", "0.69096094", "0.6858745", "0.68190056", "0.6797293", "0.67899096", "0.6755568", "0.67281526", "0.6690258", "0.6655856", "0.6655856", "0.6645903", "0.6627204", "0.6627204", "0.6627204", "0.66204", "0.66146314", "0.66146314", "0.66146314", "0.66146314", "0.66146314", "0.66146314", "0.6600618", "0.65550953", "0.65523887", "0.65523887", "0.65523887", "0.65523887", "0.65523887", "0.65508276", "0.65508276", "0.6521266", "0.65110654", "0.65055853", "0.6486852", "0.6464105", "0.6462064", "0.64292663", "0.6423925", "0.64194804", "0.636791", "0.63565695", "0.6354379", "0.63390166", "0.6334336", "0.63331825", "0.6293528", "0.6293528", "0.62851113", "0.62420267", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.623809", "0.6235937", "0.6235937", "0.6235937", "0.6235937", "0.620761", "0.62037367", "0.61833006", "0.6182899", "0.617145", "0.6124919", "0.61215454", "0.6087565", "0.60645527", "0.60525835", "0.60466814", "0.6045247", "0.6040446", "0.60401535", "0.6036286", "0.60264885", "0.6023161", "0.60067797", "0.60057503", "0.6003418", "0.59766304", "0.59766304" ]
0.6755353
16
DELETE /applications/1 DELETE /applications/1.json
def destroy @application = Application.find(params[:id]) return unless appAccess?(@application.job.id) id = @application.job.id @application.destroy respond_to do |format| format.html { redirect_to show_apps_path(:id=>id) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Application deleted.\"\n return\n else\n puts \"Missing arguments\"\n return\n end \nend", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to dynamic_url(:applications), notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_app = UserApp.find(params[:id])\n @user_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @newapp = Newapp.find(params[:id])\n @newapp.destroy\n\n respond_to do |format|\n format.html { redirect_to newapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to admin2017_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby_application = RubyApplication.find(params[:id])\n @ruby_application.destroy\n respond_to do |format|\n format.html { redirect_to home_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html {\n flash[:notice] = 'Application was successfully destroyed.'\n redirect_to admin_applications_url\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_application.destroy\n respond_to do |format|\n format.html { redirect_to client_applications_url, notice: 'Client application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_application.destroy\n respond_to do |format|\n format.html { redirect_to client_applications_url, notice: 'Client application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to(applications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = current_user.apps.find(params[:id])\n @app.destroy\n flash[:notice] = \"The #{@app.name} app was successfully deleted\"\n respond_to do |format|\n format.html { redirect_to apps_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n flash[:success] = 'App was successfully destroyed.'\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_with @application\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def destroy\n authorize! :destroy, @app\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_list.app_resouces.destroy\n @app_list.destroy\n respond_to do |format|\n format.html { redirect_to app_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobileapp = Mobileapp.find(params[:id])\n @mobileapp.destroy\n \n respond_to do |format|\n format.html { redirect_to mobileapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_app.destroy\n respond_to do |format|\n format.html { redirect_to admin_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_app.destroy\n respond_to do |format|\n format.html { redirect_to test_apps_url, notice: 'Test app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_app.destroy\n respond_to do |format|\n format.html { redirect_to test_apps_url, notice: \"Test app was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html {redirect_to applications_url, notice: 'Application was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @userapp = Userapp.find(params[:id])\n @userapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(userapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wine_app.destroy\n respond_to do |format|\n format.html { redirect_to wine_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n User.allow_to_all(@application.id) # перед удалением снимаем все запреты для данного приложения.\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Приложение удалено.' }\n format.json { head :ok }\n end\n end", "def destroy\n @applist.destroy\n respond_to do |format|\n format.html { redirect_to applists_url, notice: 'Applist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registered_app.destroy\n respond_to do |format|\n format.html { redirect_to registered_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy \n Services::OpenIdConnectionService.new(@app).destroy \n\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_app.destroy\n respond_to do |format|\n format.html { redirect_to mobile_apps_url, notice: 'Mobile app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dev = @app.developers.first.id\n @app.destroy\n respond_to do |format|\n format.html { redirect_to developer_path(@dev), notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n redirect_to apps_url, notice: 'app was successfully deleted.'\n end", "def admin_delete_app\n\n # Get Current App\n app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !app.is_admin or app.is_admin === 0\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n # Get App to be deleted\n del_app = App.find(params[:app_id])\n\n unless del_app\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n\n # Delete App\n del_app.destroy\n\n\n response = {\n success: true\n }\n\n render json: response and return\n\n\n end", "def destroy\n @parent_app.destroy\n respond_to do |format|\n format.html { redirect_to parent_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @papp = Rapns::Apns::App.find(params[:id])\n @papp.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mapp.destroy\n respond_to do |format|\n format.html { redirect_to mapps_url, notice: 'Mapp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n response = Network.delete(['Applications', id])\n Application.new(response)\n end", "def destroy\n @web_app = WebApp.find(params[:id])\n @web_app.destroy\n\n respond_to do |format|\n format.html { redirect_to web_apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @phone_app.destroy\n respond_to do |format|\n format.html { redirect_to phone_apps_url, notice: 'Phone app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end", "def destroy\n @visa_application.destroy\n respond_to do |format|\n format.html { redirect_to visa_applications_url, notice: 'Visa application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_application.destroy\n respond_to do |format|\n format.html { redirect_to user_applications_url, notice: 'User application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_request.destroy\n respond_to do |format|\n format.html { redirect_to app_requests_url, notice: 'App request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cotiz_app.destroy\n respond_to do |format|\n format.html { redirect_to cotiz_apps_url, notice: 'Cotiz app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @maapp.destroy\n respond_to do |format|\n format.html { redirect_to maapps_url, notice: 'Maapp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application_status = ApplicationStatus.find(params[:id])\n @application_status.destroy\n\n respond_to do |format|\n format.html { redirect_to application_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @herga_application.destroy\n respond_to do |format|\n format.html { redirect_to herga_applications_url, notice: 'Herga application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @credit_application.destroy\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 @applicationclient.destroy\n respond_to do |format|\n format.html { redirect_to applicationclients_url, notice: 'Applicationclient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_application = StudentApplication.find(params[:id])\n @student_application.destroy\n\n respond_to do |format|\n format.html { redirect_to student_applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @userapplication = Userapplication.find(params[:id])\n @userapplication.destroy\n respond_to do |format|\n format.html { redirect_to users_path(:id), info: 'Aplicación usuario a sido destruida correctamente.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @user_account_app = User.find(params[:id])\n @user_account_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_account_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alapp.destroy\n respond_to do |format|\n format.html { redirect_to alapps_url, notice: 'Alapp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n ELASTIC_SEARCH_CLIENT.delete index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id\n @mobile_app.destroy!\n respond_to do |format|\n format.html { redirect_to admin_mobile_apps_url, notice: 'Mobile Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n application.destroy\n respond_with application\n end", "def destroy\n @appdatum.destroy\n respond_to do |format|\n format.html { redirect_to appdata_url, notice: 'Appdatum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Personal info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_configs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n if admin_signed_in?\n format.html { redirect_to show_applications_path, notice: \"Application was successfully destroyed.\" }\n else\n format.html { redirect_to applicants_path, notice: \"Application was successfully destroyed.\" }\n end\n format.json { head :no_content }\n end\n end", "def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def destroy\n @appdatainfo.destroy\n respond_to do |format|\n format.html { redirect_to appdatainfos_url, notice: 'Appdatainfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @residential_application.destroy\n respond_to do |format|\n format.html { redirect_to residential_applications_url, notice: 'Residential application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_application.destroy\n respond_to do |format|\n format.html { redirect_to task_applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_config.destroy\n respond_to do |format|\n format.html { redirect_to app_configs_url, notice: 'App config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @second_rails_app = SecondRailsApp.find(params[:id])\n @second_rails_app.destroy\n\n respond_to do |format|\n format.html { redirect_to second_rails_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visaapp = Visaapp.find(params[:id])\n @visaapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(visaapps_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end" ]
[ "0.79110837", "0.756269", "0.7553193", "0.7553193", "0.7553193", "0.7548598", "0.7548598", "0.75248295", "0.75248295", "0.74210054", "0.74210054", "0.7404727", "0.7369377", "0.7369377", "0.7369377", "0.7363378", "0.7356216", "0.7339116", "0.7307494", "0.7307494", "0.7307494", "0.7307494", "0.72994107", "0.72830206", "0.7262265", "0.72310865", "0.72175896", "0.72175896", "0.72175896", "0.7205554", "0.71954906", "0.71954906", "0.7183093", "0.71757996", "0.7165998", "0.71415126", "0.7136846", "0.7111697", "0.70743275", "0.70700216", "0.70686895", "0.7065423", "0.7065423", "0.7065423", "0.7065423", "0.7065423", "0.7065423", "0.7065423", "0.7065423", "0.70601344", "0.7043547", "0.70286226", "0.70277023", "0.7011483", "0.7005715", "0.69860667", "0.69576985", "0.69566685", "0.6954296", "0.6952087", "0.6943517", "0.6941813", "0.69385314", "0.6933069", "0.6927665", "0.6916569", "0.69150764", "0.6896242", "0.68748504", "0.68683666", "0.6865336", "0.6861994", "0.68601686", "0.6829642", "0.6828516", "0.681833", "0.6802619", "0.67891437", "0.6785625", "0.67763954", "0.6776305", "0.6773131", "0.6770448", "0.67469853", "0.6745164", "0.6740914", "0.67381686", "0.6737868", "0.6736926", "0.6736683", "0.6735688", "0.67343026", "0.67303413", "0.6730315", "0.6727504", "0.6725079", "0.6719474", "0.67144275", "0.67065895", "0.6701625" ]
0.70905864
38
The Doctor class needs an instance method, new_appointment, that takes in a an instance of the Patient class and a date, and creates a new Appointment. That Appointment should know that it belongs to the doctor
def appointments Appointment.all.select {|appointment| appointment.doctor == self} # binding.pry # [1,2,3,4,5].select { |num| num.even? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_appointment(patient, date)\n #creating a new appointment whose doctor is the current instance of doctor\n Appointment.new(date, patient, self)\n end", "def new_appointment doctor, date\n Appointment.new self, doctor, date\n end", "def new_appointment(doctor, date)\n Appointment.new(date, self, doctor)\nend", "def new_appointment(doctor, date)\n Appointment.new(date, self, doctor)\nend", "def new_appointment(doctor, date)\n Appointment.new(date, self, doctor)\n end", "def new_appointment(doctor, date)\n Appointment.new(date, self, doctor)\n end", "def new_appointment(doctor, date)\n Appointment.new(date, self, doctor)\n end", "def new_appointment(doctor, date)\n Appointment.new(doctor, self, date)\n end", "def new_appointment(doctor, date)\n Appointment.new(self, date, doctor)\n end", "def new_appointment(patient, date)\n Appointment.new(date,patient, self)\n end", "def new_appointment(patient, date)\n Appointment.new(patient, self, date)\n end", "def new_appointment(patient, date)\n Appointment.new(patient, self, date)\nend", "def new_appointment(patient, date)\n Appointment.new(patient, self, date=\"\")\n end", "def new_appointment(a_Patient, date)\n \n Appointment.new(date, self, a_Patient)\n end", "def new_appointment(patient, date)\n Appointment.new(date, patient, self)\n end", "def new_appointment(patient, date)\n Appointment.new(date, patient, self)\n end", "def new_appointment(date, doctor)\n test = Appointment.new(date,self,doctor)\n test\nend", "def new_appointment(patient_class, date)\napps = Appointment.new(date, patient_class, self)\napps\nend", "def new_appointment(doctor,date)\n Appointment.new(self, doctor, date=\"\")\n\nend", "def initialize(date, doctor)\n @date = date\n @doctor = doctor\n doctor.add_appointment(self)\n end", "def initialize(date, doctor)\n @date = date\n @doctor = doctor\n doctor.add_appointment(self) #upon instatiation, make an appointment through the Doctor class #add_appointment method, which in turn sets this appointment (passed as an argument) as belonging to the doctor\n end", "def add_appointment(appointment)\n @appointments << appointment\n appointment.patient = self\n end", "def add_appointment(appointment)\n @appointments << appointment\n appointment.patient = self\n #when you create an appt for a patient, you assign the appointment.patient attribute to the current instance of the patient\n end", "def create\n @appointment = Appointment.new(params[:appointment])\n @appointment.patient_id = current_user.id if current_user.is_patient? \n @appointment.approve_status = 1\n if @appointment.save\n DoctorPatient.create({:patient_id => @appointment.patient_id, :doctor_id => @appointment.doctor_id })\n UserMailer.appointment_pending(@appointment).deliver\n redirect_to \"/appointments\"\n else\n render :new\n end\n end", "def create\n\n # physician = Physician.find(physician_id)\n # unless physician.patients.where(email: email).exists?\n # patient = Patient.find_or_create_by(email: email)\n # physician.appointments.create(patient: patient)\n\n unless Appointment.where(doctor_id: appointment_params[:doctor_id], appointment_date_id: appointment_params[:appointment_date_id], time_table_id: appointment_params[:time_table_id]).exists?\n # unless Appointment.where(doctor_id: requested_doctor, appointment_date_id: requested_date, time_table_id: requested_timing).exists?\n @appointment = Appointment.new(appointment_params)\n @patient_id = @current_patient.id\n end\n\n # if @appointment.try(:save)\n # if [email protected]? && @appointment.save\n if @appointment && @appointment.save\n puts \"Im saving!\"\n redirect_to @appointment, notice: 'Appointment was successfully created.'\n else\n puts \"Failed saving!\"\n redirect_to new_appointment_url, notice: 'Appointment was NOT successfully created.'\n end\n end", "def initialize(name)\n @name = name\n @appointment = appointment\n @doctor = doctor\n @@all_appointment << self\n save\n end", "def initialize(patient, doctor, date) #initialized with a date, patient, doctor.\n @date = date\n @patient = patient\n @doctor = doctor\n @@all << self #The appt should be saved in the @@all array\n end", "def create\n #@doctor = Doctor.find(params[:doctor_id])\n # @appointment = @doctor.appointments.build(params.require(:appointment).permit(:startTime, :comment, :patient_id, :doctor_id))\n # @appointment = Appointment.new(appointment_params)\n #@appointment.startTime = params[:appointment][:startTime]\n #@appointment.comment = params[:appointment][:comment]\n # @appointment.patient_id = params[:appointment][:patient_id]\n #@doctor_id1 = params[:appointment][:doctor_id]\n #@appointment.appointmentdate = params[:appointment][:appointmentdate]\n @doctor = Doctor.find(params[:doctor_id])\n @appointment = @doctor.appointments.build(params.require(:appointment).permit(:appointmentdate, :startTime, :comment, :patient_id, :doctor_id))\n #respond_to do |format|\n # @appointments_list = Appointment.all\n \n @appointment.patientname=current_user.email\n \n \n if @appointment.save\n # format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n #format.json { render :show, status: :created, location: @appointment }\n redirect_to doctor_appointment_path(@doctor, @appointment)\n else\n \n # format.html { render :isAvailable }\n render 'new'\n end\n \n \n end", "def initialize(date, patient, doctor)\n @date = date\n @patient = patient\n @doctor = doctor\n @@all << self\n end", "def initialize(patient, date, doctor)\n @patient = patient\n @date = date\n @doctor = doctor\n\n @@all << self\n end", "def initialize(patient, doctor, date)\n @date = date\n @patient = patient\n @doctor = doctor\n @@all << self\n end", "def initialize(date, patient, doctor) #initializes with a date, patient, and doctor\n @date = date\n @patient = patient #belongs to a patient\n @doctor = doctor #belongs to a doctor\n @@all << self\n end", "def create\n @appointment = Appointment.new(appointment_params)#params[:appointment])\n \n respond_to do |format|\n if @appointment.save\n @vital = Vital.new\n @vital.appointment_id = @appointment.id\n @vital.save\n format.html { redirect_to(@appointment, :notice => 'Appointment was successfully created.') }\n format.xml { render :xml => @appointment, :status => :created, :location => @appointment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @appointment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #@appointment = Appointment.new(params[:appointment])\n @appointment = Appointment.new\n @appointment.office_id = params[:appointment][:office_id]\n @appointment.appt_date = params[:appointment][:appt_date]\n @appointment.user_id = params[:appointment][:user_id]\n @appointment.doctor_id = Doctor.find_by_title(params[:appointment][:doctor]).id\n @appointment.save\n split_date = params[:appointment][:appt_date].split(\"/\")\n date = split_date[1] + \"/\" + split_date[0] + \"/\" + split_date[2]\n @appointment.appt_date = Date.parse(date)\n @user = current_user\n @appointment.user_id = @user.id\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to user_appointment_path(current_user.id, @appointment.id), notice: 'Appointment was successfully created.' }\n format.json { render json: @appointment, status: :created, location: @appointment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_doctor_appointment\n @doctor_appointment = DoctorAppointment.find(params[:id])\n end", "def create\n @patient = Patient.new(patient_params)\n\n unless @patient.save\n render :new, notice: 'Appointment was unable to be created. Check your fields.'\n end\n end", "def create\n p_id_appointment = params[:appointment_patient][:id_appointment].to_i\n p_area = params[:area]\n p_year = params[:appointment_patient][\"app_date(1i)\"].to_i\n p_month = params[:appointment_patient][\"app_date(2i)\"].to_i\n p_day = params[:appointment_patient][\"app_date(3i)\"].to_i\n p_hour = params[:appointment_patient][\"app_date(4i)\"].to_i\n p_minute = params[:appointment_patient][\"app_date(5i)\"].to_i\n p_observation = params[:appointment_patient][:observation]\n p_id_patient = params[:appointment_patient][:id_patient].to_i\n p_id_diagnoses = params[:appointment_patient][:id_diagnoses]\n p_status = params[:status]\n \n @appointment = Appointment.new(\n id_appointment: p_id_appointment,\n area: p_area,\n app_date: Time.new(\n p_year,\n p_month,\n p_day,\n p_hour,\n p_minute\n ),\n observation: p_observation,\n status: p_status,\n id_patient: p_id_patient,\n id_diagnoses: p_id_diagnoses\n )\n \n if @appointment.save\n flash[:notice] = \"OK\"\n redirect_to controller: 'appointment_patients', id: p_id_patient and return\n else\n flash[:notice] = \"FAIL\"\n redirect_to controller: 'appointment_patients', id: p_id_patient and return\n end\n end", "def create\n @appointment = Appointment.new(appointment_params)\n @pets = Pet.all\n @doctors = Doctor.all\n @customers = Customer.all\n \n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_browse\n input = appointment_params\n @date = Date.parse(input[:date])\n @doctor = Doctor.find(input[:doctor_id])\n @open_times = @doctor.open_appointment_times(@date)\n @appointment = Appointment.new\n end", "def set_appointment_patient\n @appointment_patient = Appointment.find(params[:id])\n end", "def initialize_appointment!(appointment)\n expert = Expert.find(appointment[:expert_id])\n service = Service.find(appointment[:service_id])\n\n description = 'Lorem Ipsum is simply dummy text of the printing and \\\n typesetting industry.'\n if service.respond_to? :introduction\n introduction = true\n subject = 'Introduction'\n else\n subject = 'Session'\n end\n\n pending_appointment = OpenAppointment.new(\n request_id: id,\n user_id: appointment[:client_id],\n expert_id: expert.id,\n service_id: appointment[:service_id],\n day_of_week: appointment[:day_of_week],\n start_date: appointment[:start_date],\n search_history_id: appointment[:search_history_id],\n subject: subject,\n description: description,\n introduction: introduction\n )\n\n if pending_appointment.save\n pending_appointment\n else\n puts \"---- 🔸 FAILURE | while saving pending_appointment \\\n error:#{pending_appointment.errors.messages} 🔸 \\\n in initialize_appointment\"\n false\n end\n end", "def create\n @appointment = current_user.appointments.new(just_appointment_params)\n set_appointments_patients\n\n respond_to do |format|\n if @appointment.save\n send_appointment_emails!\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appointment = Appointment.new\n if @appointment.verify_datetime(params) == false\n @error = \"Please enter a valid date and time.\"\n render('new') and return\n else\n @appointment.topic = params[:appointment][:topic]\n @appointment.start_time = @appointment.generate_start_time(params)\n @appointment.end_time = @appointment.generate_end_time(params)\n @appointment.interval = params[:appointment][:interval].to_i\n @appointment.available = true\n @appointment.mentor = current_user\n if @appointment.save\n redirect_to \"/appointments/index\"\n else\n render \"new\"\n end\n end\n end", "def create\n \n @appointment = current_user.appointments.build(appointment_params)\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: t('flash.actions.notice.appointment_created')}\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appointment = person.appointments.new(params[:appointment])\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to([person, @appointment], :notice => 'Appointment was successfully created.') }\n format.xml { render :xml => @appointment, :status => :created, :location => @appointment }\n else\n #flash[:notice] = @appointment.full_messages.to_sentence\n format.html { render :action => \"new\" }\n format.xml { render :xml => @appointment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @appointment = Appointment.new(appointment_params)\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appointment = Appointment.new(appointment_params)\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n @pets = Pet.all\n @doctors = Doctor.all\n @customers = Customer.all\n end", "def create\n @appointment = Appointment.new(appointment_params)\n @appointment.save\n \n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n user_id: appointment_params[:user_id], estate_id: appointment_params[:estate_id], doctor_id: appointment_params[:doctor_id])\n \n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @offices = Office.all\n @user = User.find_by_id(params[:user_id])\n @appointment = Appointment.new\n #@appointment.doctor = Doctor.new\n @appointment.user_id = @user.id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @appointment }\n end\n end", "def make_appointment(vet, cost)\n Appointment.create(cost: cost, veterinarian_id: vet.id, pet_id: self.id)\n end", "def create\n @appointment = Appointment.new(params[:appointment])\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render json: @appointment, status: :created, location: @appointment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appointment = Appointment.new(params[:appointment])\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render json: @appointment, status: :created, location: @appointment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @doctor = Doctor.find(params[:doctor_id])\n @appointment = @doctor.appointments.find(params[:id])\n end", "def create\n @appointment = Appointment.new(params[:appointment])\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to(@appointment, :notice => 'Appointment was successfully created.') }\n format.xml { render :xml => @appointment, :status => :created, :location => @appointment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @appointment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @doctor = Doctor.new #create a new doctor\n end", "def create\n\n @patient = Patient.new(patient_params)\n if @patient.save\n session[:patient_id] = @patient.id\n redirect_to new_doctor_booking_path(params[:doctor])\n else\n render :new\n end \n end", "def create\n if params.has_key?(:appointment)\n @appointment = Appointment.new(appointment_params)\n @selected_timeslot = Timeslot.where(start: @appointment.start.to_datetime).first\n @appointment.end = (@appointment.start.to_time + 1.hours).to_datetime\n @appointment.faculty_id = @selected_timeslot.faculty_id\n @application_form = ApplicationForm.find(@appointment.application_form_id)\n @candidate = Candidate.find(@application_form.candidate_id)\n @responsible_faculty = Faculty.find(@selected_timeslot.faculty_id)\n @appointment.title = \"Appt. for #{@candidate.full_name} with #{@responsible_faculty.full_name}\"\n @appointment.save\n Timeslot.where(start: @appointment.start.to_datetime).delete_all\n NotificationMailer.appointment_notification(@appointment).deliver_later\n render :json => {success: true, id: @candidate.id}\n else\n render :json => {success: false}\n end\n end", "def create\n @app_appointment = AppAppointment.new(app_appointment_params)\n\n respond_to do |format|\n if @app_appointment.save\n format.html { redirect_to @app_appointment, notice: 'App appointment was successfully created.' }\n format.json { render :show, status: :created, location: @app_appointment }\n else\n format.html { render :new }\n format.json { render json: @app_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @appointment = Appointment.new\n end", "def new\n @appointment = current_user.appointments.build \n end", "def create\n @appointment = Appointment.new(appointment_params)\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appoimtment.errors, status: :unprocessable_entity }\n end\n end\nend", "def create\n @next_appointment = NextAppointment.new(next_appointment_params)\n\n respond_to do |format|\n if @next_appointment.save\n format.html { redirect_to @next_appointment, notice: 'Next appointment was successfully created.' }\n format.json { render :show, status: :created, location: @next_appointment }\n else\n format.html { render :new }\n format.json { render json: @next_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @appointment = person.appointments.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end", "def new\n @patient = Patient.new\n end", "def new\n @patient = Patient.new\n end", "def new\n @patient = Patient.new\n end", "def create_appointment(appointment)\n @appointment = appointment\n \n mail to:\"[email protected]\", subject: \"you did it!!\"\n end", "def create\n attributes = set_attributes(params)\n @carpool = Carpool.find(params[:id])\n @appointment = current_user.created_appointments.new(attributes)\n @appointment.carpool_id = @carpool.id\n if @appointment.save\n @rider = current_user.riders.create(appointment_id: @appointment.id, rider_role: \"Driver\")\n render partial: 'appointment2.json.jbuilder', locals: { appointment: @appointment }, status: :created\n else\n render json: { errors: @appointment.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def set_appointment\n @appointment = Appointment.find_by(id: params[:id])\n end", "def create\n # Create new client object, with nested appointment object\n @client = Client.new(client_params)\n # Set the new appointment's user_id equal to the current_user's id. This completes the association\n # between the current user and client, with the appointment acting as a join table\n @client.appointments.update(user_id: current_user.id)\n if @client.save\n redirect_to client_path(@client)\n else\n redirect_to new_user_client_path(current_user), alert: \"Error(s): #{@client.errors.full_messages.join(', ')}.\"\n end\n end", "def new\n @appoiment = Appoiment.new(:patient_id => params[:id] )\n \n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointments_patient\n @patient = Patient.find_by(id: params[:patient])\n if @patient\n @patient_id = @patient.id # provide the default value for the patient filter select to the view\n else\n @patient_id = nil\n end\n end", "def appointment_params\n params.require(:appointment).permit(:starts_at, :ends_at, :patient_id, :doctor_id)\n end", "def create\n @pediatric_appointment = PediatricAppointment.new(pediatric_appointment_params)\n if params[:cedula_representante].blank?\n flash.keep[:notice] = \"Por favor introduzca una cedula valida\"\n render :new\n else\n if params[:cedula_representante] =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\Z/\n if PediatricPatient.existente(params[:cedula_representante])\n @pediatric_appointment.pediatric_patient_id = PediatricPatient.existente(params[:cedula_representante]).id\n respond_to do |format|\n if @pediatric_appointment.save\n format.html { redirect_to @pediatric_appointment, notice: 'Cita creada con exito.' }\n format.json { render :show, status: :created, location: @pediatric_appointment }\n else\n format.html { render :new }\n format.json { render json: @pediatric_appointment.errors, status: :unprocessable_entity }\n end\n end\n else\n paciente = PediatricPatient.create(telefono_padre: \"no indicado\", telefono_madre: \"no indicado\")\n PediatricHistory.create(ced_padre: params[:cedula_representante], ced_madre: params[:cedula_representante], genero: \"no indicado\", lugar_nacimiento: \"no indicado\", lugar_residencia: \"no indicado\", padre: \"no indicado\", ced_padre: \"no indicado\", madre: \"no indicado\", ced_madre: \"no indicado\", diagnostico_familiar: \"no indicado\", antecedentes_prenatales: \"no indicado\", antecedentes_natales: \"no indicado\", antecedentes_postnatales: \"no indicado\", sintomas_generales: \"no indicado\", pediatric_patient_id: paciente.id)\n @pediatric_appointment.pediatric_patient_id = paciente.id\n if @pediatric_appointment.save\n redirect_to edit_pediatric_patient_path(paciente), notice: 'Cita creada con exito.' \n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @pediatric_appointment.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n flash.keep[:notice] = \"La cedula debe ser numerica\"\n render :new\n end\n end\n end", "def create\n @appointment = Appointment.new(params[:appointment])\n str_datetime = params[:datetime].to_datetime\n # @appointment.date = DateTime.strptime(params[:appointment][:datetime], \"%m-%d-%Y\")\n @appointment.date = str_datetime\n @appointment.time = str_datetime\n @appointment.manager = current_manager.rolable\n #@appointment.assigned_pin = Pin.new\n\n notice = \"Well done! You have broadcasted a message to your Waitlist. You'll get a phone call from the first patient to respond!\"\n \n respond_to do |format|\n if @appointment.save\n format.html { redirect_to manager_appointments_path, notice: notice }\n format.json { render json: manager_appointment_path(@appointment), status: :created, location: @appointment }\n else\n errors = \"\"\n @appointment.errors.full_messages.each do |msg|\n errors.concat(\"<br>\")\n errors.concat(msg)\n end\n format.html { redirect_to manager_appointments_path, alert: errors }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_appointment = TestAppointment.new(params[:test_appointment])\n\n respond_to do |format|\n if @test_appointment.save\n format.html { redirect_to @test_appointment, notice: 'Test appointment was successfully created.' }\n format.json { render json: @test_appointment, status: :created, location: @test_appointment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appointment_date = AppointmentDate.new(params[:appointment_date])\n @appointment_date.affiliate_id = params[:affiliate_id]\n\n \n @isfacultyflag = Affiliate.find(params[:affiliate_id]).isfaculty\n\n if @isfacultyflag\n @pidm = Affiliate.find(params[:affiliate_id]).pidm\n end\n\n respond_to do |format|\n if @appointment_date.save\n if @isfacultyflag\n format.html { redirect_to affiliate_url(:id => params[:affiliate_id], :pidm => @pidm) + \"#appointments\", notice: 'Appointment was successfully updated!' }\n else\n format.html { redirect_to affiliate_url(:id => params[:affiliate_id])+ \"#appointments\", notice: 'Appointment was successfully updated!' }\n end\n # format.html { redirect_to affiliate_url(:id => params[:affiliate_id]) + \"#appointments\", notice: 'Appointment Date Added!'}\n # format.json { render json: @appointment_date, status: :created, location: @appointment_date }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appointment_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end", "def set_appointment\n @appointment = Appointment.find(params[:id])\n end" ]
[ "0.89874065", "0.8890551", "0.88336277", "0.8825928", "0.8823697", "0.8823697", "0.8823697", "0.8793198", "0.87709254", "0.8691347", "0.8691201", "0.8660245", "0.8617087", "0.8612515", "0.85878557", "0.85878557", "0.8396513", "0.8324181", "0.821093", "0.8061271", "0.7901105", "0.73734605", "0.7251899", "0.7139507", "0.7065448", "0.70509577", "0.7021133", "0.69960016", "0.6909005", "0.68963766", "0.6862282", "0.68560624", "0.6832592", "0.6826292", "0.68159294", "0.6777006", "0.67550516", "0.67445034", "0.66745603", "0.6575421", "0.65292835", "0.65186834", "0.65014154", "0.6425157", "0.6370559", "0.63551676", "0.63551676", "0.63456184", "0.6342817", "0.6342776", "0.6331676", "0.63235575", "0.6319442", "0.6319442", "0.6305535", "0.6259958", "0.62441206", "0.6242208", "0.62321573", "0.6229336", "0.6212937", "0.61855495", "0.6183237", "0.6180855", "0.6167005", "0.61648625", "0.61648625", "0.61648625", "0.61470115", "0.61399895", "0.6137062", "0.6133733", "0.61301345", "0.61197513", "0.61197513", "0.61197513", "0.61197513", "0.61197513", "0.61197513", "0.61197513", "0.61197513", "0.61091083", "0.61074895", "0.61046416", "0.6092118", "0.6085732", "0.6074202", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416", "0.60682416" ]
0.0
-1
The Doctor class needs an instance method, appointments, that iterates through all Appointments and finds those belonging to this doctor. def meals Meal.all.select do |meal| meal.customer == self end end
def patients self.appointments.map do |appointment| appointment.patient # binding.pry end # Appointments.all.select {|doc| } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n Meal.all.select do |meal|\n meal.customer == self\n end \n end", "def meals\r\n Meal.all.select do |meal|\r\n meal.customer == self\r\n end\r\n end", "def meals\n Meal.all.select {|meal| meal.customer == self}\n end", "def meals\n Meal.all.select {|meal| meal.customer == self}\n end", "def meals\n Meal.all.select {|m| m.customer == self}\n end", "def meals\n Meal.all.select do |meal|\n meal.customer == self\n end\n end", "def appointments\n Appointment.all.select {|appointment| appointment.doctor ==self}\nend", "def appointments\n Appointment.all.select do |appointment_instance|\n appointment_instance.doctor == self \n end\n end", "def appointments\n Appointment.all.select{|appointments| appointments.doctor == self}\n end", "def appointments\n # 1. access the Appt's @@all variable\n # 2. from there, select only the appoints whose doctor is self\n Appointment.all.select{|appointment| appointment.doctor == self}\n end", "def appointments\n Appointment.all.select do |a|\n a.doctor == self\n end\n end", "def appointments\nAppointment.all.select{|x| x.doctor == self}\nend", "def appointments\n Appointment.all.select{|appointment| appointment.doctor == self}\n end", "def my_appointments \n #look through all the appointments \n my_appointments == Appointment.all.select do |apt|\n apt.doctor == self \n end \n end", "def appointments\n Appointment.all.select {|appointment| appointment.patient == self}\n # Appointment.all.select {|appointment| appointment.doctor == self}\n end", "def appointments\n\n Appointment.all.select {|appointment| appointment.doctor == self}\n # binding.pry\n # [1,2,3,4,5].select { |num| num.even? }\n end", "def appointments\r\n Appointment.all.collect do\r\n\t\t\t|appt| appt if appt.doctor == self\r\n\t\tend\r\n\tend", "def appointments\n Appointment.all.collect do\n\t\t\t|appt| appt if appt.doctor == self\n\t\tend\n\tend", "def appointments\n Appointment.all.select {|appointments| appointments.patient == self}\n end", "def appointments\n Appointment.all.select{|x| x.patient == self}\nend", "def appointments\n Appointment.all.select do |appointment|\n appointment.patient == self\n end\n end", "def appointments\n Appointment.all.select do |appointment|\n appointment.patient == self\n end\n end", "def appointments\n Appointment.all.select do |appointment| appointment.patient == self end\n end", "def appointments\n Appointment.all.select { |appointment| appointment.patient == self }\nend", "def appointments\n Appointment.all.select{|appointment| appointment.patient == self}\nend", "def appointments \n Appointment.all.select do |a|\n a.patient == self\n end\nend", "def appointments\n Appointment.all.select {|appt| appt.patient == self}\n end", "def patients\napps = []\nAppointment.all.each do |x|\n if x.doctor == self\n apps << x.patient\n end\nend\napps\nend", "def meals \n Meal.all.select {|meal| meal.waiter == self}\n end", "def appointments\n Appointment.all.select do |appointment|\n appointment.patient == self\n #binding.pry\n end\n end", "def appointments\n Appointment.all.select { |x| x.patient == self }\n end", "def meals\n Meal.all.select do |meal|\n meal.waiter == self\n end\n end", "def meals\n Meal.all.select do |meal|\n meal.waiter == self\n end\n end", "def doctors\n doctor_list = []\n appointments.select do |doctor|\n doctor_list << doctor.doctor\n end\ndoctor_list\nend", "def meals\n Meal.all.select do | meal |\n meal.waiter == self\n end\n end", "def doctors\n self.appointments.map do |appointment|\n appointment.doctor\n end\n end", "def doctors\n @appointments.collect do |appointment|\n appointment.doctor\n end\n end", "def doctors\n appointments.map do |appointment| appointment.doctor end\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def doctors \n self.appointments.collect do |a|\n a.doctor\n end\nend", "def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\n end", "def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def patients\n self.appointments.collect do |appointment|\n appointment.patient\n end\n end", "def doctors\n appointments.map do |appointment|\n appointment.doctor\n end\nend", "def patients\r\n\t\tAppointment.all.collect do |appt|\r\n\t\t\t\tappt.patient if appt.doctor == self\r\n\t\tend\r\n\tend", "def doctors\n doctors = []\n appointments.each do |appt|\n doctors << appt.doctor if !doctors.include?(appt.doctor)\n end\n doctors\n end", "def appointments\n Appointment.all.filter { |appointment| appointment.provider_id == self.id || appointment.user_id == self.id}\n end", "def patients\n self.appointments.collect do |a|\n a.patient\n end\n end", "def doctors\n appointments.map do |appt|\n appt.doctor\n end\n end", "def patients\n self.appointments.map do |doctors_appts|\n doctors_appts.patient\n end\n end", "def patients\n\t\tAppointment.all.collect do |appt|\n\t\t\t\tappt.patient if appt.doctor == self\n\t\tend\n\tend", "def patients \n # patients = []\n # Appointment.all.each do | appointment |\n # if appointment.doctor == self \n # patients << appointment.patient\n # end\n # end\n # patients\n all_app = Appointment.all.select do | appointment |\n appointment.doctor == self\n end\n all_patients = all_app.collect do | appointment |\n appointment.patient.name\n end\n # all_patients.map do | patient |\n # patient.name\n # end\n end", "def my_appointments(user)\n Appointment.where(user_id: user.id)\n end", "def patients\n patients_array = []\n Appointment.all.each do |appointment|\n if appointment.doctor == self\n patients_array.push(appointment.patient)\n end\n end\n patients_array.uniq\n end", "def patients\n appointments.collect { |appt| appt.patient }\n end", "def doctors\n appointments.map{|appointment|appointment.doctor}.uniq\nend", "def like?(meal)\n self.customer_meals.find_by_meal_id(meal.id)\n end", "def doctors\nAppointment.all.map do |x| x.doctor\n\n end\nend", "def doctors\n # binding.pry\n self.appointments.collect {|appointment| appointment.date}\n end", "def patients\n appointments.map do |appointment|\n appointment.patient\n end\n end", "def patients\r\n appointments.map { |s|s.patient }\r\n end", "def customer\n @@all.select {|review| self.restaurant.customers}\n end", "def patients\n @appointments.collect do |appt|\n appt.patient\n end\n end", "def client_appointments\n self.clients.map(&:appointments)\n end", "def index\n @food_plans = FoodPlan.where(applicant_id: params[:applicant_id])\n @meals=Meal.all\n end", "def desserts\n # should return an array of desserts the bakery makes\n Dessert.all.select do |dessert|\n dessert.bakery == self \n end\n\n end", "def patients \n patients = Patient.all.select do |patient|\n patient.doctor == self\n end\n\n # patients.map do |patient|\n # patient.name\n # end\n end", "def showings\n Showing.all.select do |showing|\n showing.theater == self\n end\n end", "def show\n @doctor = Doctor.find(params[:doctor_id])\n @appointment = @doctor.appointments.find(params[:id])\n end", "def clients\n Appointments.all.collect do |appointment|\n appointment.client\n end\n end", "def desserts\n Dessert.all.select do |dessert|\n dessert.bakery == self\n end\n end", "def appointments\n Appointment.all(contact: to_s)\n end", "def patients\n appointments.map{|appointment| appointment.patient}.uniq\n end", "def show\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @appointments = Appointment.where(:company_id => current_user.company.id, :customer_id => @customer.id).order('starts_at DESC').paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def all_customers() # RETURN film1.all_customers (returns all customers attending that film)\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE tickets.film_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n result = customers.map { |customer| Customer.new(customer) }\n return result\n end", "def listings\n Trip.all.select do |listing|\n listing.guest == self\n end\n end", "def all_deals_dashboard\n #return Deal.where(\"assigned_to = ? or initiated_by= ?\",self.id,self.id)\n return Deal.where(\"deals.assigned_to = ? or deals.initiated_by= ? or (deals.is_public = true and deals.organization_id = ?)\",self.id,self.id,self.organization.id) \n end", "def my_rides\n Ride.all.select do |ride|\n ride.passenger == self\n end\n end", "def customer(customer)\n self.all.select {|rev| rev.customer == customer}\n end", "def patients\n my_patients = self.appointments.map do |appointment|\n appointment.patient\n end \n\n my_patients.uniq\n end", "def show\n @patient = Patient.find(params[:id])\n @appointments = Appointment.where(patient_id: @patient.id)\n end", "def cults_helper\n Bloodoath.all.select { |bloodoath| bloodoath.follower == self}\n end", "def requested\n @requested_meals = Meal.where(type: \"requested\")\n end", "def appointments\n @appointments\n end", "def appointments\n @appointments\n end", "def orders # return all the associated orders / reader method \n Order.all.select do |order| #select will returnn an array \n order.customer == self #condition true or false \n end \n end", "def home\r\n\r\n if params [:doctor_id]\r\n @appointments = Appointment.where(doctor_id: params[:doctor_id])\r\n else\r\n @appointments = Appointment.all\r\n end\r\n end", "def blood_oaths #<-- blood oath selects all cult members in bloodOath Class file\n BloodOath.all.select { |blood_oath| blood_oath.cult == self}\n end", "def offered\n @offered_meals = Meal.where(type: \"offered\")\n end", "def remaining_appointments_today\n Appointment.today.with_doctor(doctor_id).\n where(appointment_time: appointment_time+1.minute...DateTime.tomorrow)\n end", "def restaurants\n Restaurant.all.select do |restuarant|\n restaurant_number.restaurantowner == self\n end\n end", "def employees\n Employee.select{|employees| employees.manager == self.name}\nend", "def find_owner_appointments\n owner_appointments = Appointment.all.select { |appointment| appointment.owners.include?(self) || appointment.owner_id == id } \n if !owner_appointments.empty?\n owner_appointments\n else\n nil\n end\n end", "def blood_oaths\n # First, get all of the blood oaths and then from them, select only the ones that belong to this cult\n BloodOath.all.select { |blood_oath| blood_oath.cult == self }\n end", "def guests\n Trip.all.select do |guest|\n guest.listing == self\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 customers()\n sql = \"SELECT DISTINCT customers.* FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n INNER JOIN screenings ON tickets.screening_id = screenings.id\n WHERE screenings.film_id = $1;\"\n values = [@id]\n customers_array = SqlRunner.run(sql, values)\n return Customer.map_to_objects(customers_array)\n end", "def allergens\n allergy_instances = Allergy.all.select do |allergy|\n self.ingredients.include?(allergy.ingredient)\n end \n end", "def customers\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON tickets.customer_id = customers.id WHERE tickets.film_id = #{@id};\"\n return Customer.map_items(sql) \n end" ]
[ "0.84449434", "0.8438282", "0.8430137", "0.8430137", "0.8419096", "0.8372266", "0.78940815", "0.7890239", "0.7855226", "0.78399605", "0.7835399", "0.7760524", "0.7722476", "0.7689095", "0.7672292", "0.7579529", "0.7551969", "0.75274074", "0.73857087", "0.7345606", "0.73451954", "0.73451954", "0.73368025", "0.7325216", "0.72910464", "0.7289323", "0.72529244", "0.7252771", "0.7214252", "0.72069037", "0.7199534", "0.70067203", "0.6990565", "0.6670991", "0.66693014", "0.6612762", "0.65910244", "0.6539209", "0.65267855", "0.6522167", "0.6468986", "0.6468986", "0.6429931", "0.642943", "0.6395713", "0.63827837", "0.63790345", "0.63714486", "0.63416207", "0.63254124", "0.62829006", "0.6262116", "0.6255557", "0.6204772", "0.61996245", "0.6197512", "0.6184817", "0.6181713", "0.61814934", "0.6103376", "0.6095986", "0.6072662", "0.6067348", "0.6033231", "0.60290396", "0.6005704", "0.59748256", "0.5959949", "0.5956708", "0.5952182", "0.59048617", "0.58857137", "0.5851071", "0.58430165", "0.5822434", "0.58109105", "0.57981527", "0.57942945", "0.5793388", "0.57889843", "0.57652986", "0.575221", "0.57372123", "0.5729021", "0.56965566", "0.56965566", "0.5688875", "0.56844586", "0.5654857", "0.5653568", "0.5649656", "0.5609963", "0.5605342", "0.55812615", "0.5579198", "0.55719066", "0.55688614", "0.5559173", "0.5558742", "0.55544764" ]
0.62319326
53
GET /ratings GET /ratings.json
def index @ratings = Rating.all respond_to do |format| format.html # index.html.erb format.json { render json: @ratings } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end", "def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end", "def rating\n response[\"rating\"]\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end", "def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end", "def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end", "def index\n respond_with Rating.all\n\n \n end", "def statistics\n ratings = Restaurant.within(params[:latitude],\n params[:longitude],\n params[:radius]).pluck(:rating)\n render json: {\n count: ratings.length,\n avg: ratings.mean,\n std: ratings.standard_deviation\n }\n end", "def index_ratings\n @rating = Rating.all\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def average_rating\n render json: { rating: { avg_rating: @movie.avg_rating } }\n end", "def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end", "def index\n @game_ratings = GameRating.all\n end", "def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end", "def rating\n rating_calculator.rate(raters)\n end", "def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end", "def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end", "def scores\n ids = params[:ids].is_a?(Array) ? params[:ids] : params[:ids].split(/ |\\+/).collect{|i|i.to_i}\n posts = Post.where(id: ids).select('id,score').to_a\n if logged_in?\n rated = current_user.ratings_for(*posts)\n response.headers['Cache-Control'] = 'private'\n else\n response.headers['Cache-Control'] = 'public'\n end\n\n m = {}\n\n posts.each do |r|\n id = r.id\n json = {score: r.score}\n if rated\n json['rated'] = rated[id]\n end\n m[id] = json\n end\n\n respond_to do |format|\n format.json {\n render :json => m\n }\n end\n end", "def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end", "def rating #Getter\n @rating\n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def index\n @engine_ratings = EngineRating.all\n end", "def load_ratings (movie)\n\t\tmovie[\"ratings\"] = Rating.by_movie(movie[\"id\"])\n\tend", "def index\n @content_ratings = ContentRating.all\n end", "def rating\n @rating\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @user_rating = @restaurant.user_rating(current_user)\n @average_rating = @restaurant.average_rating\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @restaurant.application_hash(current_user).to_json }\n end\n end", "def rating_params\n params[:rating]\n end", "def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end", "def checked_ratings\n if params[:ratings]\n params[:ratings].keys\n else\n @all_ratings\n end\n end", "def index\n @dish_ratings = DishRating.all\n end", "def rating\r\n\t\t@rating\r\n\tend", "def index\n unless (logged_in? && authorized?)\n redirect_back_or_default('/')\n return\n end\n @ratings = Rating.find(:all, :conditions => {:pending => true})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ratings }\n end\n end", "def reports_user_ratings(user_id, rating, start_date, end_date, options)\n options = {\n user: user_id,\n rating: rating,\n start: start_date,\n end: end_date,\n }\n\n get(\"reports/user/ratings\", options)\n end", "def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end", "def _get_selected_ratings\n if !params[:ratings].nil?\n return params[:ratings]\n end\n if !session[:ratings].nil?\n @redirect_required = true\n ratings = session[:ratings]\n session.delete(:ratings)\n ratings\n end\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @album_ratings = AlbumRating.all\n end", "def ratings\n\t\tself.reviews.map{|review| review.rating}\n\tend", "def listing_ratings\n review_ids = Review.where(listing_id: listings.select(:id).collect(&:id)).select(&:id).collect(&:id)\n ReviewRating.where(review_id: review_ids)\n end", "def index\n @reviews_and_ratings = ReviewsAndRating.all\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def rating\n reviews.average(:rating)\n end", "def show\n food = FoodStore.find(params[:id])\n ratings = User.where(food_store:food)\n render json: {status: 'SUCCESS' , message:'Saved User' , data:ratings},status: :ok\n end", "def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end", "def index\n @rating = Rating.all\n # This is where the list of all the ratings of the stylists will be controlled\n end", "def index\n @effort_ratings = EffortRating.all.page(params[:page]).per(50)\n end", "def index\n @component_ratings = ComponentRating.all\n end", "def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end", "def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end", "def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end", "def index\n @meal_ratings = MealRating.all\n end", "def show\n\t\t@widget = Widget.find(params[:id])\n\t\t@rate = @widget.ratings.average :rate\n\tend", "def index\n if params[:show_only]\n @movies = current_user.ratings.where(value: params[:show_only]).map{|r| r.movie}\n else\n @movies = Movie.all\n end\n end", "def index\n @finale_ratings = FinaleRating.all\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def num_ratings \n 5\n end", "def rating(user_id, movie_id)\n\t\t@all_users[user_id].rating movie_id\n\tend", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def index\n @rating_scores = RatingScore.all\n end", "def show\n set_rating\n end", "def index\n @restaurant_table_ratings = RestaurantTableRating.all\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def show\n redirect_to root_path and return\n\n @advertisement = Advertisement.find(params[:id])\n\n if current_user\n @user_rating = @advertisement.user_rating(current_user.id).try(:value)\n @user_rated = @user_rating.present?\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisement }\n end\n end", "def show\n if params[:yelp_rating] && params[:google_rating] && params[:foursquare_rating]\n @ratings = {:yelp_rating => params[:yelp_rating], :foursquare_rating => params[:foursquare_rating], :google_rating => params[:google_rating], :weighted_rating => params[:weighted_rating]}\n end\n @social = {:yelp_id => params[:yelp_id], :foursquare_id => params[:foursquare_id], :google_id => params[:google_id]}\n if params[:google_id]\n @google_place = Restaurant.get_place_from_google params[:google_id]\n @google_reviews = @google_place.reviews\n @google_images = []\n @google_reviews.each do |review|\n str = review.author_url.to_s\n google_plus_id = str[24..-1]\n request = \"https://www.googleapis.com/plus/v1/people/\" + \"#{google_plus_id}\" + \"?fields=image&key=AIzaSyB8fUZUPNYIWKwz6Nss-Hu7J_2VUjFSOWA\"\n response = HTTParty.get(request)\n result = JSON.parse(response.body)\n\n if result[\"image\"]\n @google_images << result[\"image\"][\"url\"]\n else\n @google_images << nil\n end\n end\n\n end\n @yelp_reviews = Restaurant.get_restaurant_reviews_from_yelp params[:yelp_id]\n @foursquare_tips = Restaurant.get_venue_tips_from_foursquare params[:foursquare_id]\n \n @friend_recommendations = Recommendation.get_friend_recommedation_by_restaurant(params[:google_id], @registered_friends)\n end", "def raters\n self.ratings.includes(:rater).all.collect{|r| r.rater}\n end", "def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end", "def users_rating\n @rating = Rating.find(params[:id])\n redirect_to skate_spot_path(@skate_spot) unless @rating.user_id == current_user.id\n end", "def index\n @place_ratings = PlaceRating.all\n end", "def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end", "def rating\n return @rating\n end" ]
[ "0.81410384", "0.73434645", "0.73434645", "0.73434645", "0.7281987", "0.7273105", "0.7246692", "0.7246692", "0.7246692", "0.72193485", "0.716764", "0.7037074", "0.70103705", "0.70024836", "0.6965943", "0.6939483", "0.69357884", "0.6848616", "0.681786", "0.6757801", "0.6656508", "0.6650188", "0.6617363", "0.661019", "0.6591817", "0.6558887", "0.6541573", "0.6535652", "0.6510947", "0.6493429", "0.6492349", "0.6485524", "0.64731026", "0.6454344", "0.6448273", "0.6435952", "0.6425047", "0.64115417", "0.6407143", "0.63963944", "0.6394575", "0.63854355", "0.63809127", "0.63804036", "0.63792616", "0.6357137", "0.6353465", "0.63473403", "0.63444746", "0.63333213", "0.63278455", "0.63278455", "0.6322641", "0.6321082", "0.6319113", "0.63162273", "0.63129294", "0.63120794", "0.62969834", "0.62954307", "0.62919754", "0.6280683", "0.62766296", "0.62709725", "0.6267939", "0.6260634", "0.62583596", "0.62561244", "0.62474537", "0.6246689", "0.6229913", "0.61999094", "0.61999094", "0.61999094", "0.6179873", "0.6171254", "0.61559886", "0.6154391", "0.61543876", "0.6143372", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6120107", "0.6117354", "0.6109851", "0.6101111", "0.60933465", "0.60904354", "0.6085045", "0.60713506", "0.60702103" ]
0.7709336
3
GET /ratings/1 GET /ratings/1.json
def show @rating = Rating.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @rating } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end", "def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end", "def rating\n response[\"rating\"]\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\n end\n end", "def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end", "def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def index\n respond_with Rating.all\n\n \n end", "def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def index_ratings\n @rating = Rating.all\n end", "def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end", "def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def rating\n rating_calculator.rate(raters)\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end", "def show\n\t\t@widget = Widget.find(params[:id])\n\t\t@rate = @widget.ratings.average :rate\n\tend", "def rating #Getter\n @rating\n end", "def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end", "def rating\n @rating\n end", "def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end", "def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end", "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end", "def rating\r\n\t\t@rating\r\n\tend", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def average_rating\n render json: { rating: { avg_rating: @movie.avg_rating } }\n end", "def index\n @game_ratings = GameRating.all\n end", "def index\n @stars = Star.all\n render :json => @stars\n end", "def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @user_rating = @restaurant.user_rating(current_user)\n @average_rating = @restaurant.average_rating\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @restaurant.application_hash(current_user).to_json }\n end\n end", "def set_rating\n @rating = Rating.find_by_name(params[:id])\n end", "def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end", "def show\n set_rating\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def show\n @star = Star.find(params[:id])\n render :json => @star\n end", "def show\n food = FoodStore.find(params[:id])\n ratings = User.where(food_store:food)\n render json: {status: 'SUCCESS' , message:'Saved User' , data:ratings},status: :ok\n end", "def statistics\n ratings = Restaurant.within(params[:latitude],\n params[:longitude],\n params[:radius]).pluck(:rating)\n render json: {\n count: ratings.length,\n avg: ratings.mean,\n std: ratings.standard_deviation\n }\n end", "def index\n @album_ratings = AlbumRating.all\n end", "def rating\n rating_id.get_object.name\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def num_ratings \n 5\n end", "def rating_by(user)\n\t\tratings.select{ |rating| rating.rater_id == user.id }.first if user.try(:id)\n\tend", "def get_rate(id:)\n @client.http_get(\"/#{@resource}/#{id}/rate\")\n end", "def index\n @content_ratings = ContentRating.all\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def rating\n reviews.average(:rating)\n end", "def index\n @engine_ratings = EngineRating.all\n end", "def index\n @dish_ratings = DishRating.all\n end", "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def load_ratings (movie)\n\t\tmovie[\"ratings\"] = Rating.by_movie(movie[\"id\"])\n\tend", "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommendation }\n end\n end", "def _get_selected_ratings\n if !params[:ratings].nil?\n return params[:ratings]\n end\n if !session[:ratings].nil?\n @redirect_required = true\n ratings = session[:ratings]\n session.delete(:ratings)\n ratings\n end\n end", "def index\n unless (logged_in? && authorized?)\n redirect_back_or_default('/')\n return\n end\n @ratings = Rating.find(:all, :conditions => {:pending => true})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ratings }\n end\n end", "def show\n redirect_to root_path and return\n\n @advertisement = Advertisement.find(params[:id])\n\n if current_user\n @user_rating = @advertisement.user_rating(current_user.id).try(:value)\n @user_rated = @user_rating.present?\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisement }\n end\n end", "def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end", "def rating_params\n params[:rating]\n end", "def show\n @recipe = Recipe.find(params[:id])\n @page_title = \"#{@recipe.name}\"\n session[:recipe_id] = @recipe.id\n @rating = @recipe.ratings.find_by(user_id: session[:user_id])\n end", "def show\n @recipe = Recipe.find(params[:id])\n @page_title = \"#{@recipe.name}\"\n session[:recipe_id] = @recipe.id\n @rating = @recipe.ratings.find_by(user_id: session[:user_id])\n end", "def show\n @paragraph_rating = ParagraphRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paragraph_rating }\n end\n end", "def show\n @m_rating = MRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @m_rating }\n end\n end", "def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end", "def index\n @effort_ratings = EffortRating.all.page(params[:page]).per(50)\n end", "def rating(user_id, movie_id)\n\t\t@all_users[user_id].rating movie_id\n\tend", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def rating\n cached_rating\n end", "def index\n @meal_ratings = MealRating.all\n end", "def listing_ratings\n review_ids = Review.where(listing_id: listings.select(:id).collect(&:id)).select(&:id).collect(&:id)\n ReviewRating.where(review_id: review_ids)\n end" ]
[ "0.7949204", "0.7568998", "0.7568998", "0.7568998", "0.7461371", "0.74430245", "0.7253984", "0.71735245", "0.7153197", "0.7153197", "0.7153197", "0.6919049", "0.68775797", "0.68547004", "0.6786845", "0.6725233", "0.67199665", "0.6708475", "0.6704931", "0.6696515", "0.6687978", "0.6647803", "0.65885633", "0.6580068", "0.65792865", "0.6562418", "0.6544916", "0.6544916", "0.6544916", "0.652895", "0.6502153", "0.6493965", "0.6482212", "0.64776653", "0.6465306", "0.6449103", "0.64489716", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6443207", "0.6437059", "0.64360374", "0.64340836", "0.6431232", "0.64303863", "0.6426434", "0.6424991", "0.6414827", "0.6400307", "0.63698655", "0.63557273", "0.6343865", "0.63175213", "0.6304813", "0.6287989", "0.6287191", "0.6280797", "0.62583625", "0.6255272", "0.62517995", "0.62517995", "0.62517995", "0.62460405", "0.62428075", "0.6231731", "0.62114024", "0.6211224", "0.62061745", "0.6203313", "0.6191567", "0.6190287", "0.61845666", "0.61834633", "0.6182693", "0.6182497", "0.6177074", "0.6176467", "0.6164243", "0.6161842", "0.6161842", "0.616167", "0.6155676", "0.6154302", "0.6150679", "0.61500126", "0.61406094", "0.61384284", "0.61384284", "0.6137881", "0.61283404", "0.61173296" ]
0.75321156
6
GET /ratings/new GET /ratings/new.json
def new @rating = Rating.new respond_to do |format| format.html # new.html.erb format.json { render json: @rating } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rating_alt = Rating.new(params[:rating_alt])\n\n respond_to do |format|\n if @rating_alt.save\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully created.' }\n format.json { render json: @rating_alt, status: :created, location: @rating_alt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @school_rating = SchoolRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_rating }\n end\n end", "def new\n @team_rating = TeamRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_rating }\n end\n end", "def new\n @create_rating = CreateRating.new\n\n respond_to do |format|\n \n format.html # new.html.erb\n format.xml { render :xml => @create_rating }\n end\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n @m_rating = MRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @m_rating }\n end\n end", "def new\r\n\t\t@rating = Rating.new\r\n\t\[email protected]_id = Widget.find_by_id(params[:widget_id]).id\r\n\t\t# verificamos si el usuario ya puntuo el widget\r\n\t\t@rate = Rating.find(:all, :conditions => {:widget_id => @rating.widget_id, :user_id => current_user.id}).first\r\n\t\tif @rate.nil?\r\n\t\t\t@rate = 0\r\n\t\telse\r\n\t\t\t@rate = @rate.rate\r\n\t\tend\r\n\tend", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @paragraph_rating = ParagraphRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paragraph_rating }\n end\n end", "def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n else\r\n render json: { error: \"Rating creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end", "def new\n @like = Like.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @like }\n end\n end", "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end", "def create\n @rating = Rating.new(rating_params)\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back(fallback_location: presets_path, notice: 'rating was sucessefully added') }\n\n else\n format.html { render :new }\n\n end\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 create\n # work around the jquery rating plugin we're using\n if params[:id] and params[:rating].is_a?(String)\n params[:rating] = { :score => params[:rating], :dream_id => params[:id] }\n end\n \n # Slightly ugly, but for now we're letting users overwrite their previous\n # ratings.\n @rating = current_user.ratings.find_or_initialize_by_dream_id(params[:rating])\n @rating.attributes = params[:rating] unless @rating.new_record?\n\n respond_to do |format|\n if @rating.save\n format.html { flash[:notice] = 'Rating was successfully created.'; redirect_to(@rating.dream) }\n format.js { render :text => @rating.dream.ratings.average(:score), :status => :created }\n format.xml { render :xml => @rating, :status => :created, :location => @rating }\n else\n format.html { render :action => \"index\" }\n format.js { render :status => '400 Bad Request' } \n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@recommendation = Recommendation.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend", "def create\n @create_rating = CreateRating.new(params[:create_rating])\n\n respond_to do |format|\n if @create_rating.save\n format.html { redirect_to(@create_rating, :notice => 'Create rating was successfully created.') }\n format.xml { render :xml => @create_rating, :status => :created, :location => @create_rating }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @create_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @security_similar = SecuritySimilar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security_similar }\n end\n end", "def new\n @weight = current_user.weights.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end", "def new\n @star_product = Star::Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_product }\n end\n end", "def new\n @feed_dislike = FeedDislike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed_dislike }\n end\n end", "def create\n @team_rating = TeamRating.new(params[:team_rating])\n\n respond_to do |format|\n if @team_rating.save\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully created.' }\n format.json { render json: @team_rating, status: :created, location: @team_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\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 # any registered user can add a location\n unless current_user.is_general_user?\n redirect_to denied_path\n return\n end\n\n @review = Review.new\n logger.info \"review.new params: \" + params.inspect\n if params[:dish_id]\n @dish = Dish.find(params[:dish_id])\n else\n @dish = current_dish\n end\n @review.dish_id = @dish.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end", "def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_method }\n end\n end", "def create\n @idea_rating = IdeaRating.new(idea_rating_params)\n\n respond_to do |format|\n if @idea_rating.save\n format.html { redirect_to @idea_rating, notice: (I18n.t :act_create) }\n format.json { render :show, status: :created, location: @idea_rating }\n else\n format.html { render :new }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\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 create\n @m_rating = MRating.new(params[:m_rating])\n\n respond_to do |format|\n if @m_rating.save\n format.html { redirect_to(@m_rating, :notice => 'M rating was successfully created.') }\n format.xml { render :xml => @m_rating, :status => :created, :location => @m_rating }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @m_rating.errors, :status => :unprocessable_entity }\n end\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 @recommendation = Recommendation.new\n @rr = RecommendationRequest.find(params[:request])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommendation }\n end\n end", "def new\n @ranking = Ranking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ranking }\n end\n end", "def new\n\t\t@review = Review.new\n\t\[email protected] = Establishment.new\n\t\[email protected] = Category.new\n\t\[email protected] = Clientele.new\n\t\[email protected]_level = SoundLevel.new\n\t\[email protected] = Hygiene.new\n\t\[email protected] = Rating.new\n\t\t\n\t\tcollect_additional_params()\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @review }\n\t\tend\n\tend", "def create\n # @user = User.find_or_create_by(user_id: @user.id)\n \n @movie = Movie.find_or_create_by(imdbID: params[:imdbID], poster: params[:poster], title: params[:title])\n @rating = Rating.where(movie_id: @movie.id, user_id: logged_in_user.id).first_or_create do |rating|\n rating.score = rating_params[:score]\n rating.comment = rating_params[:comment]\n end\n render json: @rating\n end", "def new\n @star_fact = Star::Fact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_fact }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score }\n end\n end", "def new\n @ski = Ski.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ski }\n end\n end", "def new\n @ski = Ski.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ski }\n end\n end", "def new\n @average = Average.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @average }\n end\n end", "def new\n @retweet = Retweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retweet }\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 @rating_plan = RatingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating_plan }\n end\n end", "def create\n respond_to do |format|\n if logged_in?\n @user = current_user\n @movie = Movie.find_or_create_by(id: params[:movie_id], title: params[:title])\n @rating = Rating.new(user_id: @user.id, movie_id: @movie.id, rating: params[:rating])\n\n if @rating.save\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n else \n format.json { head :no_content }\n end\n end\n end", "def new\n @prefer = Prefer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prefer }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def create\n @fragrance = Fragrance.find(params[:fragrance_id])\n @rating = Rating.new(rating_params)\n @rating.user = @current_user\n @rating.fragrance = @fragrance\n\n if @rating.save\n render json: @rating, status: :created\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end", "def new\n @professor = Professor.find(params[:id])\n session[:professor] = @professor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating }\n end\n end", "def new\n @rank = Rank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rank }\n end\n end", "def create\n @rating = Plugins::CamaleonCmsRating::Rating.new(\n score: params[:score],\n post_id: params[:post_id],\n rater_id: cama_current_user.try(:id)\n )\n\n head @rating.save ? :ok : :bad_request\n end", "def new\n @rating_scale_step = RatingScaleStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_scale_step }\n end\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @recommend = Recommend.new\n\n respond_to do |format|\n format.html\n format.json { render json: @recommend }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @rater = Rater.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rater }\n end\n end", "def create\n @school_rating = SchoolRating.new(params[:school_rating])\n\n respond_to do |format|\n if @school_rating.save\n format.html { redirect_to @school_rating, notice: 'School rating was successfully created.' }\n format.json { render json: @school_rating, status: :created, location: @school_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @reviewer = Reviewer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reviewer }\n end\n end", "def new\n @liked_item = LikedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liked_item }\n end\n end", "def new\n @review_image = ReviewImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review_image }\n end\n end", "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "def create\n @game_rating = GameRating.new(game_rating_params)\n\n respond_to do |format|\n if @game_rating.save\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully created.' }\n format.json { render :show, status: :created, location: @game_rating }\n else\n format.html { render :new }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @review = reviewable.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trend }\n end\n end", "def new\n @atr = Atr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atr }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @postvote = Postvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @postvote }\n end\n end", "def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end", "def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end", "def new\n @user_like = UserLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_like }\n end\n end", "def new\n @post_like = PostLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_like }\n end\n end", "def new\n # Not generally used. Most people want to vote via AJAX calls.\n end", "def new\n @stat_misc = StatMisc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat_misc }\n end\n end", "def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def new\n @ocs_rating_factor = OcsRatingFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ocs_rating_factor }\n end\n end", "def new\n @impgen = Impgen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @impgen }\n end\n end", "def new\n @pool_session = PoolSession.new\n @users = User.all.select { |u| u.rating >= 0 }\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool_session }\n end\n end", "def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @trend }\n end\n end", "def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def create\n @reviews_and_rating = ReviewsAndRating.new(reviews_and_rating_params)\n\n respond_to do |format|\n if @reviews_and_rating.save\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully created.' }\n format.json { render :show, status: :created, location: @reviews_and_rating }\n else\n format.html { render :new }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_rating\n @place = Place.find(params[:id]) \n end", "def new\n @rock = Rock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rock }\n end\n end", "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end", "def new\n @gift = Gift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gift }\n end\n end", "def new\n @room_rate = RoomRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room_rate }\n end\n end", "def new\n\t\t@review = Review.new\n\tend", "def create\n # Check if already exists\n if Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n update\n else\n @rating = Rating.new(rating_params)\n @rating.event_id = params[:event_id]\n @rating.user_id = current_user.id\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :new }\n end\n end\n end\n end" ]
[ "0.7811452", "0.7174088", "0.7163591", "0.7093007", "0.70800436", "0.6947447", "0.6931201", "0.67748594", "0.6722131", "0.67181534", "0.67181534", "0.67181534", "0.67181534", "0.67181534", "0.67181534", "0.6691287", "0.6622075", "0.65468276", "0.6531713", "0.6506759", "0.65047204", "0.6499677", "0.64969176", "0.648292", "0.64772683", "0.64602864", "0.6455227", "0.64517933", "0.64462465", "0.6423815", "0.6422933", "0.64040136", "0.6395215", "0.63783765", "0.63771874", "0.63771874", "0.6365858", "0.6363016", "0.635755", "0.63475025", "0.63466966", "0.63328725", "0.63314974", "0.63298184", "0.6317702", "0.63095474", "0.63095474", "0.6298586", "0.6288449", "0.6286657", "0.6283247", "0.62784004", "0.6268333", "0.6265345", "0.62601167", "0.6254972", "0.6253366", "0.62499976", "0.62469417", "0.62460613", "0.62319326", "0.6230861", "0.6228214", "0.6214557", "0.6210686", "0.6198484", "0.6197292", "0.6195428", "0.6195428", "0.6195428", "0.6188246", "0.6187157", "0.61849576", "0.61621565", "0.61612624", "0.6160695", "0.6149051", "0.61480355", "0.61464846", "0.6139217", "0.61347085", "0.6130383", "0.61298984", "0.61216825", "0.6118472", "0.6118156", "0.6116593", "0.6116086", "0.61159116", "0.6114505", "0.6113103", "0.6108754", "0.6096745", "0.6096287", "0.6095963", "0.608087", "0.60752654", "0.6073405" ]
0.7917388
2
POST /ratings POST /ratings.json
def create @rating = Rating.new(params[:rating]) respond_to do |format| if @rating.save format.html { redirect_to @rating, notice: 'Rating was successfully created.' } format.json { render json: @rating, status: :created, location: @rating } else format.html { render action: "new" } format.json { render json: @rating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end", "def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n else\r\n render json: { error: \"Rating creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def rating_params\n params.require(:rating).permit(:rating, :user_id, :post_id)\n end", "def rating_params\n params.require(:rating).permit(:user_id, :rate, :answer_id)\n end", "def create\n @rating = Plugins::CamaleonCmsRating::Rating.new(\n score: params[:score],\n post_id: params[:post_id],\n rater_id: cama_current_user.try(:id)\n )\n\n head @rating.save ? :ok : :bad_request\n end", "def rating_params\n params.require(:rating).permit(\"food\", \"drinks\", \"talks\", \"vibe\")\n end", "def create\n @rating_alt = Rating.new(params[:rating_alt])\n\n respond_to do |format|\n if @rating_alt.save\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully created.' }\n format.json { render json: @rating_alt, status: :created, location: @rating_alt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # work around the jquery rating plugin we're using\n if params[:id] and params[:rating].is_a?(String)\n params[:rating] = { :score => params[:rating], :dream_id => params[:id] }\n end\n \n # Slightly ugly, but for now we're letting users overwrite their previous\n # ratings.\n @rating = current_user.ratings.find_or_initialize_by_dream_id(params[:rating])\n @rating.attributes = params[:rating] unless @rating.new_record?\n\n respond_to do |format|\n if @rating.save\n format.html { flash[:notice] = 'Rating was successfully created.'; redirect_to(@rating.dream) }\n format.js { render :text => @rating.dream.ratings.average(:score), :status => :created }\n format.xml { render :xml => @rating, :status => :created, :location => @rating }\n else\n format.html { render :action => \"index\" }\n format.js { render :status => '400 Bad Request' } \n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @fragrance = Fragrance.find(params[:fragrance_id])\n @rating = Rating.new(rating_params)\n @rating.user = @current_user\n @rating.fragrance = @fragrance\n\n if @rating.save\n render json: @rating, status: :created\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end", "def create\n @rating = Rating.new(params[:rating])\n facebook_id = params[:rating][:user_id]\n @user = User.find_by_facebook_id(facebook_id)\n @rating.user_id = @user.id\n dish = Dish.find(params[:rating][:dish_id]) \n @rating.dish_id = dish.id \n \n respond_to do |format|\n if @rating.save\n if @rating.value == 1\n dish.upvotes += 1\n else\n dish.downvotes += 1\n end\n dish.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @user = User.find_or_create_by(user_id: @user.id)\n \n @movie = Movie.find_or_create_by(imdbID: params[:imdbID], poster: params[:poster], title: params[:title])\n @rating = Rating.where(movie_id: @movie.id, user_id: logged_in_user.id).first_or_create do |rating|\n rating.score = rating_params[:score]\n rating.comment = rating_params[:comment]\n end\n render json: @rating\n end", "def rating_params\n params.require(:rating).permit(:comment, :star_rating, :dress_id, :username)\n end", "def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end", "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def evaluate\n puts params[:rating].inspect.yellow\n params[:ratings].each do |tenant, report|\n participant = @game.participants.find_by(tenant: tenant)\n if participant\n participant.ratings.create!(report: report, rated_at: Time.parse(report[:stopped_at]))\n else\n puts \"Cannot find participant #{tenant}\"\n end\n end\n render json: { status: 'ok' }\n end", "def create\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = UserRating.new(params[:rating])\n user_rating.rating_id = params[:rating_id]\n user_rating.user_id = current_user.id\n\n if user_rating.save\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n if current_user.provider == 'twitter' && current_user.facebook_share\n current_user.twitter.update(\"I've rated an idea on #Idearator ! available on: \" + root_url + \"ideas/\" + idea.id.to_s) rescue Twitter::Error\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea, :notice => 'Your rating has been saved successfully!' }\n format.js\n end\n else\n respond_to do |format|\n format.html { redirect_to idea, :alert => 'Your rating has not been saved, please retry!' }\n format.js\n end\n end\n end", "def rating_params\n params.require(:rating).permit(\n :movie_id, :user_id, :score\n )\n end", "def rate_post\n render nothing: true\n\n post = Post.find(params[:id])\n\n assert(@post.kind_of?(Post))\n\n if not post.user_ratings.include? current_user.id\n post.user_ratings.push(current_user.id)\n post.save\n else\n redirect_to_back(root_path)\n end\n end", "def rating_params\n params.require(:rating).permit(:rank, :fragrance_id, :user_id)\n end", "def rating_params\n params.require(:rating).permit(:value)\n end", "def create\n @reviews_and_rating = ReviewsAndRating.new(reviews_and_rating_params)\n\n respond_to do |format|\n if @reviews_and_rating.save\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully created.' }\n format.json { render :show, status: :created, location: @reviews_and_rating }\n else\n format.html { render :new }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:post_id, :profile_id, :rate, :rated_at, :type, :Description)\n end", "def rating_params\n\t\tparams.require(:rating).permit(:ratable, :score, :user)\n\tend", "def rating_params\n params[:rating]\n end", "def create\n respond_to do |format|\n if logged_in?\n @user = current_user\n @movie = Movie.find_or_create_by(id: params[:movie_id], title: params[:title])\n @rating = Rating.new(user_id: @user.id, movie_id: @movie.id, rating: params[:rating])\n\n if @rating.save\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n else \n format.json { head :no_content }\n end\n end\n end", "def create\n @team_rating = TeamRating.new(params[:team_rating])\n\n respond_to do |format|\n if @team_rating.save\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully created.' }\n format.json { render json: @team_rating, status: :created, location: @team_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @idea_rating = IdeaRating.new(idea_rating_params)\n\n respond_to do |format|\n if @idea_rating.save\n format.html { redirect_to @idea_rating, notice: (I18n.t :act_create) }\n format.json { render :show, status: :created, location: @idea_rating }\n else\n format.html { render :new }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end", "def rating_params\n params.require(:rating).permit(:rating, :text)\n end", "def create\n @restaurant_table_rating = RestaurantTableRating.new(restaurant_table_rating_params)\n\n respond_to do |format|\n if @restaurant_table_rating.save\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_table_rating }\n else\n format.html { render :new }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rating = Rating.new(rating_params)\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back(fallback_location: presets_path, notice: 'rating was sucessefully added') }\n\n else\n format.html { render :new }\n\n end\n end\n end", "def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend", "def create\n @rating = Rating.new\n @rating.user_id = params[:user_id]\n @rating.rate = params[:rate].to_i\n if @answer\n if @answer.user_id == current_user.id\n redirect_to @post, alert: \"You can't rate your own answer.\" and return\n end\n @rating.answer_id = @answer.id\n @answer.rating_score += @rating.rate\n @answer.save\n else\n if @post.user_id == current_user.id\n redirect_to @post, alert: \"You can't rate your own post.\" and return\n end\n @rating.post_id = @post.id\n @post.rating_score += @rating.rate\n @post.save\n end\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @post, notice: 'Rating was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to @post, alert: 'Rating was NOT successfully created.' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:rating, :preset_id)\n end", "def rating_params\n params.require(:rating).permit(:score, :game_id)\n end", "def create\n @engine_rating = EngineRating.new(engine_rating_params)\n\n respond_to do |format|\n if @engine_rating.save\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully created.' }\n format.json { render :show, status: :created, location: @engine_rating }\n else\n format.html { render :new }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game_rating = GameRating.new(game_rating_params)\n\n respond_to do |format|\n if @game_rating.save\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully created.' }\n format.json { render :show, status: :created, location: @game_rating }\n else\n format.html { render :new }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate_recipe(rating, recipe)\n recipe.ratings << Rating.create(user: self, recipe: recipe, star_rating: rating)\n end", "def rating_params\n params.require(:rating).permit(:value1, :value2, :value3, :value4, :value5, :user_id, :place_id)\n end", "def rating_params\n params.require(:rating).permit(:score, :beer_id)\n end", "def rating_params\n params.fetch(:rating, {})\n end", "def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rating_score = RatingScore.new(rating_score_params)\n\n respond_to do |format|\n if @rating_score.save\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully created.' }\n format.json { render :show, status: :created, location: @rating_score }\n else\n format.html { render :new }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.permit(:user, :serie, :value)\n end", "def create\n @participant_rating = ParticipantRating.new(params[:participant_rating])\n @participant_rating.participant_id = @participant.id\n\n\n respond_to do |format|\n if @participant_rating.save\n format.html { redirect_to(new_participant_question_set1_path(@participant.id))}\n format.json { render json: @participant_rating, status: :created, location: @participant_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate score, post\n ratings.create :score => (score.is_a?(Integer) ? score : Rating.score_for(score)), :post_id => Post.wrap(post).id\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def create\n @users_movie = UsersMovie.new(users_movie_params)\n @users_movie.user = current_user\n @users_movie.rating = params[:rating_rated]\n\n respond_to do |format|\n if @users_movie.save\n format.html { redirect_to movies_path(@users_movie.movie), notice: \"Movie was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def create_rating\n return unless valid?\n @rating_class.create(\n social_entry: @social_entry,\n rateable: @rateable,\n rater: @rater,\n ratee: @ratee,\n rating_type: @rating_type,\n rating_metrics: @rating_metrics\n )\n update_rating_aggregates\n end", "def create\n @effort_rating = @opportunity.effort_ratings.new(effort_rating_params)\n\n respond_to do |format|\n if @effort_rating.save\n @opportunity.effort_rating = @opportunity.effort_ratings.average(:rating)\n @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Effort rating was successfully created.' }\n format.json { render :show, status: :created, location: @effort_rating }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dish_rating = DishRating.new(dish_rating_params)\n\n respond_to do |format|\n if @dish_rating.save\n format.html { redirect_to @dish_rating, notice: 'Dish rating was successfully created.' }\n format.json { render :show, status: :created, location: @dish_rating }\n else\n format.html { render :new }\n format.json { render json: @dish_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rating_answer = RatingAnswer.new(rating_answer_params)\n\n respond_to do |format|\n if @rating_answer.save\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully created.' }\n format.json { render :show, status: :created, location: @rating_answer }\n else\n format.html { render :new }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:rating, :task_id)\n end", "def rate_student\n AcceptedTutorRequest.where('student_rating IS NULL')\n .where('id = ?', params[:id])\n .update(params[:id], student_rating: params[:student_rating])\n head :ok\n end", "def create\n # Check if already exists\n if Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n update\n else\n @rating = Rating.new(rating_params)\n @rating.event_id = params[:event_id]\n @rating.user_id = current_user.id\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :new }\n end\n end\n end\n end", "def create\n @album_rating = AlbumRating.new(album_rating_params)\n\n respond_to do |format|\n if @album_rating.save\n format.html { redirect_to @album_rating, notice: 'Album rating was successfully created.' }\n format.json { render :show, status: :created, location: @album_rating }\n else\n format.html { render :new }\n format.json { render json: @album_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def rating_params\n params.permit(:rating, :text, :token, :evento_id, :customer_id, :company_id)\n end", "def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end", "def dish_rating_params\n params.require(:dish_rating).permit(:rate_value, :user_id, :dish_id, :content, :post_id, :content)\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def rating_params\n params.require(:rating).permit(:subject_id, :tag_id, :f)\n end", "def create\n @school_rating = SchoolRating.new(params[:school_rating])\n\n respond_to do |format|\n if @school_rating.save\n format.html { redirect_to @school_rating, notice: 'School rating was successfully created.' }\n format.json { render json: @school_rating, status: :created, location: @school_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def rating\n rating_calculator.rate(raters)\n end", "def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end", "def create\n @content_rating = ContentRating.new(content_rating_params)\n\n respond_to do |format|\n if @content_rating.save\n format.html { redirect_to @content_rating, notice: \"Content rating was successfully created.\" }\n format.json { render :show, status: :created, location: @content_rating }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @content_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end", "def create\n @create_rating = CreateRating.new(params[:create_rating])\n\n respond_to do |format|\n if @create_rating.save\n format.html { redirect_to(@create_rating, :notice => 'Create rating was successfully created.') }\n format.xml { render :xml => @create_rating, :status => :created, :location => @create_rating }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @create_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @beer = Beer.new(beer_params)\n rank = params[:score] ? params[:score] : 0\n respond_to do |format|\n if @beer.save && @beer.ratings.create(user: current_user, rank: rank)\n format.html { redirect_to beers_path, notice: 'Beer was successfully created.' }\n format.json { render json: @beer, status: :created, location: @beer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_ratings\n uris = Restaurant.pluck(:uri)\n parse = Parse.new\n @new_ratings = {}\n uris.each do |uri|\n @new_ratings[uri] = parse.get_ratings(uri)\n end\n @new_ratings.each do |rating|\n Restaurant.where({uri: rating[0]}).update_all({rating: rating[1][:rating]})\n end\n end", "def create\n @swit_sour = SwitSour.where(:user_id => params[:user_id], :swit_id => params[:swit_id]).first_or_initialize\n @swit_sour.update(:rating => params[:rating])\n\n respond_to do |format|\n if @swit_sour.save\n format.html { redirect_to @swit_sour, notice: 'Swit sour was successfully created.' }\n format.js\n format.json { render :show, status: :created, location: @swit_sour }\n else\n format.html { render :new }\n format.json { render json: @swit_sour.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating\n response[\"rating\"]\n end", "def create\n @confidence_rating = ConfidenceRating.new(confidence_rating_params)\n\n respond_to do |format|\n if @confidence_rating.save\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully created.' }\n format.json { render :show, status: :created, location: @confidence_rating }\n else\n format.html { render :new }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end", "def rate\n @article = Article.find(params[:id])\n authorize! :rate, @article\n @article_rating = ArticleRating.new({\n :user_id => current_user.id,\n :article_id => params[:id],\n :rating => params[:rating]\n })\n\n if @article_rating.save\n flash[:notice] = 'Thanks for rating'\n else\n flash[:alert] = \"Could not save your rating. You may have rated this already!\"\n end\n\n redirect_to :back\n end", "def idea_rating_params\n params.require(:idea_rating).permit(:idea_id, :crit_id, :user_id, :rating, :rating_text)\n end", "def content_rating_params\n params.require(:content_rating).permit(:rating)\n end", "def create\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @product = Product.find(params[:product_id])\n @[email protected](rating_params)\n @rating.user_id = @current_user.id\n if @rating.save\n redirect_to @product , notice:'Review was successfully created'\n else\n redirect_to @product , notice:'Review was not created'\n end\n end", "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end" ]
[ "0.7309647", "0.7309517", "0.70375794", "0.68742937", "0.6778626", "0.67721534", "0.67654777", "0.6745564", "0.67338264", "0.6692064", "0.66909605", "0.6686345", "0.6668436", "0.66275793", "0.66187423", "0.66009176", "0.6595893", "0.6592229", "0.65695137", "0.6548216", "0.65344584", "0.6532116", "0.64823043", "0.6472243", "0.6467211", "0.6466153", "0.641899", "0.6409114", "0.6409114", "0.6409114", "0.64071894", "0.64041257", "0.63784575", "0.6355841", "0.6322094", "0.6318203", "0.630609", "0.63023347", "0.6297607", "0.6280559", "0.62754923", "0.62736803", "0.6256246", "0.6245665", "0.6242423", "0.6239212", "0.622891", "0.6226069", "0.6224074", "0.6224074", "0.6224074", "0.62219465", "0.62218696", "0.62218696", "0.62218696", "0.6211923", "0.6193195", "0.61903185", "0.6186115", "0.6183184", "0.6182536", "0.6180934", "0.6174581", "0.6165775", "0.61539495", "0.61404455", "0.6139927", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.6132247", "0.612692", "0.60999113", "0.60949385", "0.60949385", "0.60949385", "0.6091081", "0.6079773", "0.6078702", "0.6070157", "0.60531145", "0.6049601", "0.6045611", "0.60389006", "0.60258436", "0.6014285", "0.6005981", "0.6004374", "0.6004173", "0.6001479", "0.60013473", "0.6000344", "0.5992754", "0.5991723" ]
0.7129198
2
PUT /ratings/1 PUT /ratings/1.json
def update @rating = Rating.find(params[:id]) respond_to do |format| if @rating.update_attributes(params[:rating]) format.html { redirect_to @rating, notice: 'Rating was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @rating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n @rating.update_attribute :value, params[:value]\n end", "def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if logged_in?\n @user = current_user\n @rating = Rating.where(user_id: @user.id, movie_id: params[:movie_id]).first\n respond_to do |format|\n if @rating.update(user_id: @user.id, movie_id: params[:movie_id], rating: params[:rating])\n format.json { render json: @rating }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n else\n format.json { head :no_content }\n end\n end", "def update\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating_alt.update_attributes(params[:rating_alt])\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @recipe.average_rating = @recipe.ratings.average(:rate)\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def update\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.update(rating_params)\n flash[:success] = \"Rating has been successfully updated!\"\n redirect_to skate_spot_path(@skate_spot)\n #redirect_to([@rating.skate_spot, @rating], :notice => 'Rating has been successfully updated!') \n else\n flash[:danger] = \"Rating has been unsuccesfully updated. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end", "def set_rating\n @rating = Rating.find_by_name(params[:id])\n end", "def update\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = current_user.user_ratings.find_by_rating_id(params[:rating_id])\n\n if user_rating.update_attributes(params[:rating])\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :notice => 'Your rating has been updated successfully!' }\n format.js { render text: \"\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :alert => 'Your rating has not been updated, please retry!' }\n format.js { render text: \"\" }\n end\n end\n end", "def rate_student\n AcceptedTutorRequest.where('student_rating IS NULL')\n .where('id = ?', params[:id])\n .update(params[:id], student_rating: params[:student_rating])\n head :ok\n end", "def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end", "def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end", "def update\n @create_rating = CreateRating.find(params[:id])\n\n respond_to do |format|\n if @create_rating.update_attributes(params[:create_rating])\n format.html { redirect_to(@create_rating, :notice => 'Create rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @create_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tp \"UPDATE rating\"\n if current_user.nil?\n\t\t\tflash.now[:error] = 'You must be signed in to specify a rating.'\n else\n\t\t\[email protected] = @ratable\n\t\t\[email protected] = current_user\n\t if @rating.update_attributes(score: params[:score])\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.js { render :nothing => true }\n\t\t\t\tend\n\t else\n\t\t\t\tflash[:error] = \"Something went wrong. Please try again.\"\n\t end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end", "def update\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n if @team_rating.update_attributes(params[:team_rating])\n format.html { redirect_to @team_rating, notice: 'Team rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @idea_rating.update(idea_rating_params)\n format.html { redirect_to idea_ratings_path(:idea_id => @idea_rating.idea_id), notice: (I18n.t :act_update) }\n format.json { render :show, status: :ok, location: @idea_rating }\n calc_idea_rating\n else\n format.html { render :edit }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to :back, notice: 'Rating was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update!(**args)\n @rating = args[:rating] if args.key?(:rating)\n @rating_system = args[:rating_system] if args.key?(:rating_system)\n end", "def update_ratings\n uris = Restaurant.pluck(:uri)\n parse = Parse.new\n @new_ratings = {}\n uris.each do |uri|\n @new_ratings[uri] = parse.get_ratings(uri)\n end\n @new_ratings.each do |rating|\n Restaurant.where({uri: rating[0]}).update_all({rating: rating[1][:rating]})\n end\n end", "def update!(**args)\n @annotation_ratings = args[:annotation_ratings] if args.key?(:annotation_ratings)\n end", "def update\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n if @participant_rating.update_attributes(params[:participant_rating])\n format.html { redirect_to @participant_rating, notice: 'Participant rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rating(id)\n @rating = Rating.find(id)\n end", "def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rating_entry(db, rating, id)\n\tdb.execute(\"UPDATE books SET rating=? WHERE id=?\", [rating, id])\nend", "def update\n @app = App.find(params[:id])\n \n respond_to do |format|\n if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end", "def rating_id=(rating_id)\n self.rating = Rating.find rating_id\n end", "def update_rating\n @packages = Packages.find(params[:pid])\n @packages.update(:rating => params[:rate])\n end", "def create\n @rating = Rating.new(params[:rating])\n facebook_id = params[:rating][:user_id]\n @user = User.find_by_facebook_id(facebook_id)\n @rating.user_id = @user.id\n dish = Dish.find(params[:rating][:dish_id]) \n @rating.dish_id = dish.id \n \n respond_to do |format|\n if @rating.save\n if @rating.value == 1\n dish.upvotes += 1\n else\n dish.downvotes += 1\n end\n dish.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate\n @box = Box.find(params[:id])\n raise CanCan::AccessDenied unless @box.ordered_by?(current_user)\n @box.update_attributes(params[:box])\n\n flash[:alert] = \"You must provide a rating between 1 and 5\" if params[:box][:rating].blank?\n respond_to do |format|\n if @box.save\n format.html { redirect_to @box }\n format.json { render json: @box }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\n end\n end", "def update\n\t\tif @ratings.update(rating_params)\n\t\t\tredirect_to professor_url(@rating.professor), notice: 'Rating was successfully updated.'\n\t\telse\n\t\t\trender :edit\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @rating_score.update(rating_score_params)\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_score }\n else\n format.html { render :edit }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rating\n if !current_user\n raise \"MUST BE LOGGED IN\"\n end\n student_id = current_user.id\n company_id = params[:id]\n student_company_rating = StudentCompanyRating.find_or_create_by_student_id_and_company_id(student_id, company_id)\n student_company_rating.rating = params[:rating]\n student_company_rating.save!\n\n head :no_content\n end", "def update\n @m_rating = MRating.find(params[:id])\n\n respond_to do |format|\n if @m_rating.update_attributes(params[:m_rating])\n format.html { redirect_to(@m_rating, :notice => 'M rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rating = Rating.find(params[:id])\n if @rating.move_id != nil\n @move = @rating.move\n elsif @rating.tomato_id != nil\n @move = @rating.tomato.move\n end\n log_admin(\"AdminLog: Rating updated\")\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @move, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @move.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend", "def update\n respond_to do |format|\n if @engine_rating.update(engine_rating_params)\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @engine_rating }\n else\n format.html { render :edit }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:user_id, :rate, :answer_id)\n end", "def update\n respond_to do |format|\n if @album_rating.update(album_rating_params)\n format.html { redirect_to @album_rating, notice: 'Album rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_rating }\n else\n format.html { render :edit }\n format.json { render json: @album_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n rating = @coment.comentratings.find_by(user_id: current_user.id)\n respond_to do |format|\n if rating.update(star: params[:star])\n message = \"You updated to #{params[:star]} stars.\"\n format.html { redirect_back(fallback_location: coment_path(@coment), notice: message) }\n format.json { render :show, status: :ok, location: coment_path(coment) }\n else\n format.html { render :edit }\n format.json { render json: @coment.comentrating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant_table_rating.update(restaurant_table_rating_params)\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_table_rating }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\treview = Review.find(params['id'].to_i) if params['id']\n\t\treview.review_text = params['review_text'] if params['review_text']\n\t\treview.rating = params['rating'] if params['rating']\n\t\treview.reviewer_id = params['reviewer_id'] if params['reviewer_id']\n\t\treview.user_id = params['user_id'].to_i if params['user_id']\n\t\treview.trip_id = params['trip_id'].to_i if params['trip_id']\n\t\treview.save\n\tend", "def update\n respond_to do |format|\n if @dish_rating.update(dish_rating_params)\n format.html { redirect_to @dish_rating, notice: 'Dish rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @dish_rating }\n else\n format.html { render :edit }\n format.json { render json: @dish_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n if @school_rating.update_attributes(params[:school_rating])\n format.html { redirect_to @school_rating, notice: 'School rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @review = Review.find(params[:id])\n @review.update_attributes(review_params)\n render json: @review, include: [:movie]\n end", "def update\n @user_vote = UserVote.find(params[:id])\n\n @user_vote.rating_date = Time.now\n\n respond_to do |format|\n if @user_vote.update_attributes(params[:user_vote])\n format.html { redirect_to(@user_vote.movie, :notice => 'Movie rating was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_vote.errors, :status => :unprocessable_entity }\n format.js { head :ok }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:rating, :user_id, :post_id)\n end", "def update_recipe_rating(recipe_id)\n new_rating = prompt.ask(\"what new rating would you like to give?\")\n self.user.recipes.where(id: recipe_id).update(rating: new_rating.to_i)\n recipe_ingredients(recipe_id)\n end", "def update\n respond_to do |format|\n if @place_rating.update(place_rating_params)\n format.html { redirect_to @place_rating, notice: 'Place rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @place_rating }\n else\n format.html { render :edit }\n format.json { render json: @place_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(\n :movie_id, :user_id, :score\n )\n end", "def set_rating_score\n @rating_score = RatingScore.find(params[:id])\n end", "def set_rating\n all_ratings = []\n self.reviews.each { |review| all_ratings << review.overall_rating }\n self.rating = all_ratings.reduce(:+) / (all_ratings.length * 1.0)\n self.save\n end", "def rate(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).put do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/rating\"\n req.body = params\n end\n handle_response(resp)\n end", "def update\n respond_to do |format|\n if @game_rating.update(game_rating_params)\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_rating }\n else\n format.html { render :edit }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end", "def set_idea_rating\n @idea_rating = IdeaRating.find(params[:id])\n end", "def update\n respond_to do |format|\n if @confidence_rating.update(confidence_rating_params)\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @confidence_rating }\n else\n format.html { render :edit }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rate_recipe(rating, recipe)\n recipe.ratings << Rating.create(user: self, recipe: recipe, star_rating: rating)\n end", "def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end", "def update\n render json: Like.update(params[\"id\"], params[\"like\"])\n end", "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def update_rating!\n # not using count because lates some votes might be something other than +/- 1\n self.positive_vote_count = votes.positive.sum(:value).abs\n self.negative_vote_count = votes.negative.sum(:value).abs\n self.rating = votes.sum(:value)\n save!\n end", "def update\n respond_to do |format|\n if @rating_answer.update(rating_answer_params)\n format.html { redirect_to @rating_answer, notice: 'Rating answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_answer }\n else\n format.html { render :edit }\n format.json { render json: @rating_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad = Ad.find(params[:id])\n @item=Item.where(ad_id: @ad.id)\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: (t :ad_successfully_updated) }\n format.json { render json: @ad }\n @ad.rating=params[:rating]\n @ad.ratingsnumber+=1\n @[email protected]\n @ad.rating= @ad.ratingsum / @ad.ratingsnumber\n @ad.save \n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def object_params\n params.require(:vote).permit(:rating)\n end", "def object_params\n params.require(:vote).permit(:rating)\n end", "def update\n respond_to do |format|\n if @finale_rating.update(finale_rating_params)\n format.html { redirect_to @finale_rating, notice: 'Finale rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @finale_rating }\n else\n format.html { render :edit }\n format.json { render json: @finale_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def rating_params\n params.require(:rating).permit(:rank, :fragrance_id, :user_id)\n end", "def update\n @level = Level.find(params[:id])\n rating = params[:level][:rating].to_i\n @level.rating = rating\n if @level.save\n flash[:notice] = 'Level was successfully updated.'\n redirect_to :action => \"index\"\n else \n flash[:warning] = 'Invalid Options... Try again!'\n redirect_to :action => \"index\"\n end\n end", "def update!(**args)\n @best_rating = args[:best_rating] if args.key?(:best_rating)\n @image_url = args[:image_url] if args.key?(:image_url)\n @rating_explanation = args[:rating_explanation] if args.key?(:rating_explanation)\n @rating_value = args[:rating_value] if args.key?(:rating_value)\n @textual_rating = args[:textual_rating] if args.key?(:textual_rating)\n @worst_rating = args[:worst_rating] if args.key?(:worst_rating)\n end", "def rating_params\n params.require(:rating).permit(:value)\n end", "def rating=(new_rating)\n #review = Review.where(video: video, user: user).first \n #review.update_attributes(rating: new_rating) if review\n #review.update!(rating: new_rating) if review\n if review\n review.update_columns(rating: new_rating) \n else\n # using Review.new instead of Review.create to avoid the Valitaion. \n #--->\n #review = Review.new(user: user, video:video, rating: new_rating) \n new_review = Review.new(user: user, video:video, rating: new_rating) \n #review.save(validate: false)\n new_review.save(validate: false) #bypass validation \n #---> \n end\n end", "def set_Rating(value)\n set_input(\"Rating\", value)\n end", "def rate\n @album = Album.find(params[:id])\n authorize! :rate, @album\n @album_rating = AlbumRating.new({\n :user_id => current_user.id,\n :album_id => params[:id],\n :rating => params[:rating]\n })\n\n if @album_rating.save\n flash[:notice] = 'Thanks for rating'\n else\n flash[:alert] = \"Could not save your rating. You may have rated this already!\"\n end\n\n redirect_to :back\n end" ]
[ "0.72009504", "0.70992285", "0.70477927", "0.7011928", "0.69314367", "0.6922336", "0.6902734", "0.6896913", "0.6876283", "0.68599623", "0.68599623", "0.68599623", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.68200225", "0.6811756", "0.6790297", "0.6754005", "0.6744246", "0.67287046", "0.66937214", "0.6669023", "0.66537946", "0.6632219", "0.66150707", "0.66085106", "0.6568177", "0.6528598", "0.6523792", "0.65158564", "0.64881027", "0.646755", "0.6465832", "0.64612055", "0.6459818", "0.64572275", "0.64384794", "0.64265454", "0.6420327", "0.6382", "0.63807195", "0.6376342", "0.6373606", "0.636513", "0.6360034", "0.63484615", "0.6347358", "0.6338742", "0.63384664", "0.6285676", "0.62827945", "0.62776595", "0.6257881", "0.6254681", "0.6251727", "0.624032", "0.62299365", "0.62222624", "0.62201643", "0.62183845", "0.62167454", "0.6203216", "0.61979085", "0.61958", "0.61953586", "0.61901355", "0.61722094", "0.6167763", "0.616076", "0.61583185", "0.6154651", "0.61452955", "0.61394185", "0.6137701", "0.6129534", "0.6126145", "0.61179864", "0.6076027", "0.6038222", "0.60227275", "0.60131145", "0.6000183", "0.5999744", "0.5997161", "0.5997161", "0.5978904", "0.59747297", "0.59708077", "0.5953366", "0.5953171", "0.59515643", "0.5945894", "0.5942345" ]
0.72361165
0
DELETE /ratings/1 DELETE /ratings/1.json
def destroy @rating = Rating.find(params[:id]) @rating.destroy respond_to do |format| format.html { redirect_to ratings_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating_alt = Rating.find(params[:id])\n @rating_alt.destroy\n\n respond_to do |format|\n format.html { redirect_to rating_alts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(ratings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @idea_rating.destroy\n respond_to do |format|\n format.html { redirect_to idea_ratings_url, notice: (I18n.t :act_delete) }\n format.json { head :no_content }\n end\n end", "def destroy\n @create_rating = CreateRating.find(params[:id])\n @create_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(create_ratings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @participant_rating = ParticipantRating.find(params[:id])\n @participant_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @m_rating = MRating.find(params[:id])\n @m_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(m_ratings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @restaurant_table_rating.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_table_ratings_url, notice: 'Restaurant table rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.destroy\n flash[:success] = \"Rating has been successfully deleted!\"\n redirect_to skate_spot_path(@skate_spot)\n else\n flash[:danger] = \"Deletion unsuccessful. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_rating = TeamRating.find(params[:id])\n @team_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to team_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html {redirect_to ratings_url, notice: 'Payment was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n\n end\n end", "def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @user = current_user\n @review_like = ReviewLike.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @reviews_and_rating.destroy\n respond_to do |format|\n format.html { redirect_to reviews_and_ratings_url, notice: 'Reviews and rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_rating = SchoolRating.find(params[:id])\n @school_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to school_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n review = Review.find_by(id: params[:id]).destroy\n render json: review\n end", "def destroy\n @album_rating.destroy\n respond_to do |format|\n format.html { redirect_to album_ratings_url, notice: 'Album rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating = Rating.find(params[:id])\n if @rating.move_id != nil\n @move = @rating.move\n elsif @rating.tomato_id != nil\n @move = @rating.tomato\n end\n @rating.destroy\n log_admin(\"AdminLog: Rating destroyed\")\n respond_to do |format|\n format.html { redirect_to @move }\n format.json { head :no_content }\n end\n end", "def destroy\n @confidence_rating.destroy\n respond_to do |format|\n format.html { redirect_to confidence_ratings_url, notice: 'Confidence rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_rating.destroy\n respond_to do |format|\n format.html { redirect_to content_ratings_url, notice: \"Content rating was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @game_rating.destroy\n respond_to do |format|\n format.html { redirect_to game_ratings_url, notice: 'Game rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @finale_rating.destroy\n respond_to do |format|\n format.html { redirect_to finale_ratings_url, notice: 'Finale rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Rating was successfully destroyed.' }\n end\n end", "def destroy\n @dish_rating.destroy\n respond_to do |format|\n format.html { redirect_to dish_ratings_url, notice: 'Dish rating was successfully destroyed.' }\n format.json { head :no_content }\n format.js #can respond to javascript\n end\n end", "def destroy\n @rating_score.destroy\n respond_to do |format|\n format.html { redirect_to rating_scores_url, notice: 'Rating score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @effort_rating.destroy\n respond_to do |format|\n format.html { redirect_to effort_ratings_url, notice: 'Effort rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @engine_rating.destroy\n respond_to do |format|\n format.html { redirect_to engine_ratings_url, notice: 'Engine rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rat.destroy\n respond_to do |format|\n format.html { redirect_to rats_url, notice: 'Rat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_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 @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_rating.destroy\n respond_to do |format|\n format.html { redirect_to meal_ratings_url }#, notice: 'Meal rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviewer = Reviewer.find(params[:id])\n @reviewer.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @star.destroy\n respond_to do |format|\n format.html { redirect_to stars_url, notice: 'Starred post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @building_energy_rating.destroy\n respond_to do |format|\n format.html { redirect_to building_energy_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rater = Rater.find(params[:id])\n @rater.destroy\n\n respond_to do |format|\n format.html { redirect_to raters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paragraph_rating = ParagraphRating.find(params[:id])\n @paragraph_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to paragraph_ratings_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @ocs_rating_factor = OcsRatingFactor.find(params[:id])\n @ocs_rating_factor.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocs_rating_factors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rating_answer.destroy\n respond_to do |format|\n format.html { redirect_to rating_answers_url, notice: 'Rating answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end", "def destroy\n @destination_rating.destroy\n respond_to do |format|\n format.html { redirect_to destination_ratings_url, notice: 'Destination rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @credibility_rating.destroy\n respond_to do |format|\n format.html { redirect_to credibility_ratings_url, notice: 'Credibility rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n current_user.rating_for(parent_object).destroy\n respond_to do |format|\n format.js { render :template => \"movie_ratings/destroy.rjs\" }\n end\n \n end", "def destroy\n @place_rating.destroy\n respond_to do |format|\n format.html { redirect_to place_ratings_url, notice: 'Place rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @star.destroy\n respond_to do |format|\n format.html { redirect_to stars_url, notice: \"Star was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating_reason.destroy\n respond_to do |format|\n format.html { redirect_to rating_reasons_url, notice: 'Rating reason was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end", "def destroy\n @star.destroy\n respond_to do |format|\n format.html { redirect_to stars_url, notice: 'Star was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @star.destroy\n respond_to do |format|\n format.html { redirect_to stars_url, notice: 'Star was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @star.destroy\n respond_to do |format|\n format.html { redirect_to stars_url, notice: 'Star was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @reputation.destroy\n respond_to do |format|\n format.html { redirect_to reputations_url, notice: 'Reputation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comentrating.destroy\n respond_to do |format|\n format.html { redirect_to comentratings_url, notice: 'Comentrating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @component_rating.destroy\n respond_to do |format|\n format.html { redirect_to component_ratings_url, notice: 'Component rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @dislike.destroy\n respond_to do |format|\n format.html { redirect_to dislikes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: \"Rate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n @weight = Weight.find(params[:id])\n @weight.destroy\n\n respond_to do |format|\n format.html { redirect_to weights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n\n\n @vote = Vote.find(params[:id])\n\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @average = Average.find(params[:id])\n @average.destroy\n\n respond_to do |format|\n format.html { redirect_to averages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to restaurent_path(@restaurent.id),\n notice: \"Review was successfully destroyed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n @average_entry.destroy\n respond_to do |format|\n format.html { redirect_to average_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review_image = ReviewImage.find(params[:id])\n @review_image.destroy\n\n respond_to do |format|\n format.html { redirect_to review_images_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end" ]
[ "0.77660185", "0.7689148", "0.7496062", "0.74291325", "0.7310085", "0.7310085", "0.71718204", "0.71176755", "0.7095924", "0.70656586", "0.70259017", "0.7021365", "0.70124835", "0.69818383", "0.6980865", "0.696372", "0.6940898", "0.6907331", "0.6891433", "0.6887266", "0.6859448", "0.6855798", "0.6787514", "0.676675", "0.67666715", "0.6737191", "0.6731434", "0.6724578", "0.6723892", "0.66977996", "0.6691366", "0.6681618", "0.66617763", "0.66169053", "0.66107", "0.6608856", "0.66004896", "0.659614", "0.659614", "0.659614", "0.659614", "0.659614", "0.65894794", "0.6579407", "0.657933", "0.65685624", "0.65553737", "0.6546878", "0.65434813", "0.65389", "0.6536768", "0.65346426", "0.6524233", "0.65234935", "0.65118307", "0.6493903", "0.64909875", "0.648581", "0.6483801", "0.6479074", "0.64682716", "0.64539206", "0.6450887", "0.6450483", "0.6445823", "0.6443827", "0.6443827", "0.6443827", "0.6428736", "0.6417936", "0.6404634", "0.63980794", "0.639635", "0.6396", "0.6396", "0.6396", "0.63944596", "0.6390109", "0.635758", "0.63548213", "0.63427335", "0.6341958", "0.63376486", "0.63367945", "0.63367945", "0.63367945", "0.6336691", "0.63346225", "0.63284343", "0.6320896", "0.63178056", "0.6315024", "0.6314497", "0.6310956", "0.6302139", "0.6297796", "0.6294963", "0.62946355", "0.629152", "0.62902" ]
0.7704459
1
A list of the param names that can be used for filtering the Product list
def filtering_params(params) params.slice(:search, :title, :content) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtering_params(params)\n params.slice(:shortlist, :client, :category, :updated_at, :costmodel, :state, :prio)\n end", "def filtering_params(params)\n\t\t params.slice(:name, :category_id, :trademark)\n\t\tend", "def parameters_to_filter\n @parameters_to_filter ||= []\n end", "def filter_parameters; end", "def filter_parameters; end", "def filtering_params(params)\n \tparams.slice(:make, :color, :drive, :has_keys, :year, :state, :lot_number, :buy_now_price, :auction)\n\tend", "def filtered_parameters; end", "def filtering_params(params)\n params.slice(:model_name, :brand_name,:year,:mileage)\n end", "def parameter_names\n @parameters.map { |info| info.name }.join(', ')\n end", "def filtering_params(params)\n params.slice(:omnisearch)\n end", "def filtering_params(params)\n params.slice(:user, :minprice, :maxprice, :status, :sortby, :pricesort, :datesort)\n end", "def filtered_params\n %i[roles provider_type]\n end", "def pnames\n @params.keys\n end", "def filter_parameters\n if @filter_parameters\n @filter_parameters || []\n else\n defined?(Rails) && Rails.application.config.filter_parameters\n end\n end", "def filtering_params(params)\n params.slice(:term)\n end", "def filtering_params(params)\n params.slice(:desired_location, :max_price_dollars, :tour_name, :earliest_start, :latest_end, :min_seats)\n end", "def filtering_params(params)\n params.slice(:firstname, :lastname, :company)\n end", "def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if [email protected]? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end", "def applicable_filters\n fs = []\n products_searched = []\n\n if params[:search] \n if @products\n @products.each do |p|\n products_searched << p.id\n end\n end\n else\n products_searched = @taxon.products.all.pluck(:id)\n end\n\n fs << Spree::Core::ProductFilters.selective_filter('Quantity', :selective_quantity_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Manufacturer', :selective_manufacturer_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Use Type', :selective_use_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Type', :selective_bullet_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Weight', :selective_bullet_weight_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Casing', :selective_ammo_casing_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Caliber', :selective_ammo_caliber_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Primer Type', :selective_primer_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Condition', :selective_condition_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.price_filter(products_searched) if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs\n \n end", "def filtering_params(params)\n unless params[:search]\n return []\n end\n # {\"price_from\"=>\"50.000\",\n # \"price_till\"=>\"\",\n # \"property_type\"=>\"propertyTypes.bungalow\",\n # \"locality\"=>\"#<OpenStruct value=\\\"provincias.cadiz\\\", label=\\\"Cádiz\\\">\",\n # \"zone\"=>\"#<OpenStruct value=\\\"provincias.ciudadReal\\\", label=\\\"Ciudad Real\\\">\",\n # \"count_bedrooms\"=>\"6\",\n # \"count_bathrooms\"=>\"\",\n # \"property_state\"=>\"propertyStates.brandNew\"}\n params[:search].slice(:in_locality, :in_zone, :for_sale_price_from, :for_sale_price_till, :for_rent_price_from,\n :for_rent_price_till, :property_type, :property_state, :count_bathrooms, :count_bedrooms)\n end", "def list_filter_options(**opt)\n # TODO: ???\n end", "def params_with_values names, local_params = params\n local_params.select {|k,v| names.include?(k) && !v.blank?}\n end", "def products\n products_list\n .where(@filterable.filter_params)\n .order(@sortable.sort_params)\n .page(@paginator.current_page).per_page(@paginator.page_size)\n end", "def filtering_params(params)\n params.slice(:starts_with)\nend", "def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end", "def filtering_params(params)\n params.slice(:id, :tipo)\n end", "def filtering_params(params)\n params.slice(:business_id, :location, :starts_with)\n end", "def filtered_parameters\n @filtered_parameters ||= parameter_filter.filter(parameters)\n end", "def tags_for_filter(current:)\n if filtered_by_tag?(current)\n tags_from_params - Array(current.name)\n else\n tags_from_params.push(current.name)\n end.uniq.join(\",\")\n end", "def asset_params\n params.select{|key,value| key.in?(Asset.column_names())}\n end", "def listproduct_params\n params.fetch(:listproduct, {}).permit(:list_id, :skuid, :search)\n end", "def parse_filters(params)\n if params['filters'].blank?\n Utilities::Geo::REGEXP_COORD.keys\n else\n params.permit(filters: [])[:filters].map(&:to_sym)\n end\n end", "def param_names\n\t\treturn self.constraints.keys.map( &:to_s ).sort\n\tend", "def params\n [<%= attributes.map {|a| \":#{a.name}\" }.sort.join(', ') %>]\n end", "def filtering_params\n params.slice( :title, :location )\n end", "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def filter_method_params\n params.fetch(:filter_method, {})\n end", "def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end", "def list_filter(**opt)\n # May be overridden by the subclass.\n end", "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end", "def product_params\n params[:product]\n end", "def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_tax\n attribute_list = Lbtt::Tax.attribute_list\n params.require(required).permit(attribute_list) if params[required]\n end", "def filtered_search_product_ids(filter_params)\n\n # Select ids of attributes linked to search product.\n search_product_attribute = SitescanCommon::AttributeClass\n .where(depend_link: true)\n\n # Set condition to select product attributes related to search product.\n sql = where( attributable_type: SitescanCommon::SearchProduct )\n\n ids = nil\n\n # If the filter contains one or more options.\n if filter_params[:o]\n\n # Select classs attribute ids related to the filter options.\n sr_opt_attr_ids = search_product_attribute\n .joins(:attribute_class_options)\n .where(attribute_class_options: { id: filter_params[:o] }).ids\n\n # For each class attribute select product attribute ids.\n sr_opt_attr_ids.each do |attr_id|\n\n # Select options ids related to the class attribute.\n search_product_option_ids = SitescanCommon::AttributeClassOption\n .where(attribute_class_id: attr_id, id: filter_params[:o]).ids\n\n # Select Search products ids filtered by option or list of options.\n # Options which belong to same list type attribute conjuct with\n # OR logical condition.\n sr_opt_ids = sql.joins(%{ JOIN attribute_options ao\n ON ao.id=product_attributes.value_id\n AND value_type='#{ SitescanCommon::AttributeOption.to_s }' AND\n attribute_class_option_id IN (#{search_product_option_ids.join ','})})\n .pluck :attributable_id\n\n # Attributes conjuct with AND logical condition.\n ids = if ids then ids & sr_opt_ids else sr_opt_ids end\n end\n end\n\n # If filter has nubmer attributes.\n if filter_params[:n]\n filter_numbers = search_product_attribute.ids & filter_params[:n].keys\n filter_numbers.each do |key, value|\n unless key == 0\n num_condition = []\n num_condition << 'value>=:min' if value[:min]\n num_condition << 'value<=:max' if value[:max]\n num_condition << 'attribute_class_id=:attr_cls_id'\n sr_num_ids = sql.join( %{ JOIN attribute_numbers an\n ON an.id=product_attributes.value_id\n AND value_type='#{SitescanCommon::AttributeNumber.to_s}' } )\n .where(num_condition.join ' AND ', value.merge(attr_cls_id: key))\n .pluck :attributable_id\n ids = if ids\n ids & sr_num_ids\n else\n sr_num_ids\n end\n end\n end\n end\n ids\n end", "def filtering_params(params)\n params.slice(:id, :email, :password, :admin)\n end", "def index \n @products = Product.all\n @products = @products.filter_by_category(params[:category]) if params[:category].present?\n @products = @products.filter_by_name(params[:name]) if params[:name].present?\n @products = @products.paginate(:page => params[:page], :per_page => 10)\n end", "def filtering_params(params)\n params.slice(:role, :query)\n end", "def parameters\n context.parameters.map(&:name)\n end", "def filtering_params\n params.slice(:country, :data_source, :vaccine,\n :date_updated_start_date, :date_updated_end_date,\n :first_vaccine_date_start, :first_vaccine_date_end)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def needed_params\n param_str = String.new(term_class.params)\n res = []\n while param_str.sub! /%([^%\\s]+)%/, '' do\n res << $1\n end\n res.sort\n end", "def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end", "def object_params\n if params[\"product_group\"] and params[\"product_group\"][\"product_scopes_attributes\"].is_a?(Array)\n params[\"product_group\"][\"product_scopes_attributes\"] = params[\"product_group\"][\"product_scopes_attributes\"].group_by {|a| a[\"id\"]}.map do |scope_id, attrs|\n a = { \"id\" => scope_id, \"arguments\" => attrs.map{|a| a[\"arguments\"] }.flatten }\n if name = attrs.first[\"name\"]\n a[\"name\"] = name\n end\n a\n end\n end\n params[\"product_group\"]\n end", "def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_lbtt_return\n return {} unless params[required]\n\n not_required = %i[returns_lbtt_link_transactions returns_lbtt_yearly_rent]\n permit = { returns_lbtt_link_transactions: Lbtt::LinkTransactions.attribute_list,\n returns_lbtt_yearly_rent: Lbtt::YearlyRent.attribute_list }\n attribute_list = Lbtt::LbttReturn.attribute_list\n # to store multiple check box values in model attribute we will require to\n # pass them as array in filter param this method will convert attribute to array\n # ref url :https://www.sitepoint.com/save-multiple-checkbox-values-database-rails/\n attribute_list[attribute_list.index(:sale_include_option)] = { sale_include_option: [] }\n params.require(required).permit(attribute_list, permit).except(*not_required)\n end", "def filtering_params(params)\n params.slice(:added_by, :after, :before)\n end", "def filters\n [\n [\"Id\", \"id\"],\n [\"Added By\", \"created_by\"], \n [\"Updated By\", \"updated_by\"]\n ]\n end", "def parameters(params)\n allowed = [:start,:num,:type,:id,:filter,:tagged,:search,:state,:email,:password]\n params.merge! defaults if defaults\n params.reject {|key,value| !allowed.include? key }\n end", "def filter_params(_sub_object_attribute = nil)\n required = :returns_slft_slft_return\n output = {}\n output = params.require(required).permit(Slft::SlftReturn.attribute_list) if params[required]\n\n output\n end", "def product_list_params\n params.require(:product_list).permit(:product_name, :quantity, :measure, :list_name, \n product_names_attributes: [:id, :product_name, :quantity, :measure, :_destroy])\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_list(param)\n if params[param].blank?\n nil\n else\n params[param].split(',')\n end\n end", "def product_name_params\n params.require(:product_name).permit(:product_name, :quantity, :measure, :productlists_id)\n end", "def param_whitelist\n [:rating, :review]\n end", "def permitted_params\n columns.map { |name,multiple| multiple ? { name => [] } : name }\n end", "def filters\n mentos(:get_all_filters)\n end", "def product_params\n params.require(:product).permit(:page,:product_name,:brand_id,:category_id,:desc,:avatar,:inventory,:store_id,:price,:inventory_policy,:sku,:token,option_value: [], option_name: [])\n end", "def do_params_filter_and_sort scope\n do_params_sort do_params_filter scope\n end", "def collectible_attribute_list_params\n params.fetch(:collectible_attribute_list, {})\n end", "def whitelisted_filters_for(name, klass)\n requested_parameters = as_array(@params[name])\n if requested_parameters.empty?\n []\n else\n klass.where(slug: requested_parameters)\n end\n end", "def get_all()\n @params\n end", "def parameters\n # cache parameters so sorting is necessary only once - this saves a lot of time...\n @parameters ||= categories.values.flatten.sort\n end", "def product_params\n params.require(:product).permit(:name, :description, :project_id,\n feature_ids: [])\n end", "def index\n\t\t@products = Product.search(params[:search]).filter_category(params[:filter_category]).filter_types(params[:types]).filter_volume(params[:minvol], params[:maxvol]).filter_length(params[:minlen], params[:maxlen]).filter_width(params[:minwid], params[:maxwid]).filter_height(params[:minheig], params[:maxheig]).filter_diameter(params[:mindiam], params[:maxdiam]).filter_cover(params[:cover]).order(params.fetch(:sort, \"position ASC\"))\n end", "def products\n if Product.respond_to?(name)\n Product.send(name, *arguments)\n end\n end", "def product_params\n params.fetch(:product, {})\n end", "def product_params\n params.fetch(:product, {})\n end", "def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end", "def filter_params(params)\n attributes = self.class._attributes\n params.keep_if {|name, value|\n attributes.key?(name)\n }\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def list_params\n params.require(:list).permit(:name, :title, :image, :image_url, :product_image, :product_name, :product_url, :product_review, :rate, tag_ids: [])\n end", "def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end", "def resource_filter_permitted_params\n %i[page per_page]\n end", "def filters\n end", "def list_available_params\n cg_reader.list_available_params\n end", "def required_custom_params\n custom.select{|param| param[\"required\"]}.map{|param| param[\"name\"]}\n end", "def multiple_parameters\n @parameters = HostParameter.where(:reference_id => @hosts).select(\"distinct name\")\n end", "def list_item_fetched_params\n\t params.fetch(:list_item, {}).symbolize_keys\n\t end", "def filter_params\n params.require(:filter).permit(:name, :brand, :description, :notes)\n end", "def product_params\n params.require(:product).permit(:substancename, :nonproprietaryname, :propname, :producttype, :dosageform, :routename, :marketingcategory, :activenumerator, :activeingredunit, :seller_id, :price, :term, :order)\n end", "def list_filter_options(**opt)\n # May be overridden by the subclass.\n end", "def query_parameters\n params = {}\n params['filter'] = @optional['filter'] if @optional['filter']\n params\n end", "def product_params\n params.require(:product).permit(:category_id, :user_id, :name, :description, :r_action, :status, :search, :type, photos: [])\n end", "def list_params\n params[:list]\n end", "def products()\n return filter_products()\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def product_params\n params.require(:product).permit(:name, :soil, :utilization, :active, :photo, :description, :cycle_id, :purpose_ids =>[], :products_purposes_relation_ids =>[], :cultivation_ids =>[])\n end", "def list_filter(counts: nil, **opt)\n # TODO: ???\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 product_params\n params.require(:product).permit(:name, :supplier_id, :place_id, category_id: [])\n end", "def filtering_params(params)\n params.slice(:selecteduser, :weekstart, :weekend, :jobnumber)\nend" ]
[ "0.70026404", "0.686209", "0.68030256", "0.6721399", "0.6721399", "0.67001814", "0.66970915", "0.65932226", "0.65365136", "0.651642", "0.64946437", "0.64048344", "0.6366691", "0.6351925", "0.6294786", "0.6290239", "0.62871677", "0.6265679", "0.6261443", "0.6206927", "0.6201912", "0.61550283", "0.61433905", "0.6141443", "0.61385965", "0.61294454", "0.61279553", "0.6090575", "0.60840374", "0.60763323", "0.6064288", "0.60251397", "0.6019708", "0.60087776", "0.60080326", "0.5985917", "0.5985917", "0.59813225", "0.59741384", "0.59725994", "0.5961805", "0.5946499", "0.59420085", "0.59364736", "0.5926365", "0.59122974", "0.5903866", "0.58977664", "0.5885917", "0.58718115", "0.5870095", "0.58570576", "0.58465326", "0.58455604", "0.5828659", "0.5827812", "0.5817902", "0.5801907", "0.57992905", "0.5796131", "0.5785401", "0.57813", "0.5780852", "0.5773121", "0.57716686", "0.57713497", "0.5770698", "0.5770252", "0.57621217", "0.57614815", "0.5760116", "0.5743349", "0.57400346", "0.57398283", "0.5734232", "0.5733537", "0.5732904", "0.5732904", "0.5732589", "0.5727937", "0.5726715", "0.5707875", "0.57052386", "0.5702435", "0.5687874", "0.56861085", "0.5685528", "0.5683427", "0.5681073", "0.5679699", "0.56794584", "0.56765926", "0.5673371", "0.567143", "0.5670605", "0.5668717", "0.5655911", "0.56495655", "0.5645384", "0.56439316" ]
0.59879434
35
takes file from the string if protocols are http ftp then curl/wget if magnet then set to torrent both are async
def file_url= val return if val.blank? self.state = :pending self.server_data = val @file_last_action = __method__.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_torrent_data(the_torrent_url = self.torrent_url)\n if the_torrent_url && torrent_data.nil?\n begin\n torrent_item = open(the_torrent_url)\n self.torrent_data = Base64.encode64(torrent_item.read())\n torrent_item.close\n self.set_state(:to_download)\n return true\n rescue\n self.set_state(:broken) \n end\n end\n \n return false\n end", "def get_file(url); end", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def download_torrent(episode_id, torrent_url, limit = 10)\n # Check to make sure we haven't been trapped in an infinite loop\n if limit == 0 then\n puts \"Too much redirection, skipping #{episode_id}\";\n return true;\n else\n # Convert the URL of the torrent into a URI usable by Net:HTTP\n torrent_uri = URI.parse(torrent_url);\n # Open a connection to the torrent URL\n Net::HTTP.get_response(torrent_uri) { |http|\n # Check to see if we were able to connect to the torrent URL\n case http\n # We connected just fine\n when Net::HTTPSuccess, Net::HTTPFound then\n # Create a torrent file to store the data in\n File.open(\"#{episode_id}.torrent\", 'wb') { |torrent_file|\n # Write the torrent data to the torrent file\n torrent_file.write(http.body);\n # Close the torrent file\n torrent_file.close\n # Check to see if we've download a 'locked' torrent file (html) instead of a regular torrent (.torrent)\n if(File.exists?('download.torrent.html'))\n # Delete the html file\n File.delete('download_torrent.html');\n return false;\n else\n return true;\n end\n }\n when Net::HTTPRedirection then\n download_torrent(episode_id, http['location'], limit - 1);\n end\n }\n end\nend", "def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end", "def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end", "def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end", "def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end", "def open_resource(url_file_stream_or_string, options)\n options[:handlers] ||= []\n\n if url_file_stream_or_string.respond_to?(:read)\n return url_file_stream_or_string\n\n elsif url_file_stream_or_string == '-'\n return $stdin\n end\n \n # open-uri freaks out if there's leading spaces.\n url_file_stream_or_string.strip!\n \n \n uri = Addressable::URI.parse(url_file_stream_or_string)\n if uri && ['http','https','ftp'].include?(uri.scheme)\n auth = nil\n\n if uri.host && uri.password\n auth = Base64::encode64(\"#{uri.user}:#{uri.password}\").strip\n uri.password = nil\n url_file_stream_or_string = uri.to_s\n end\n\n req_headers = {} \n req_headers[\"User-Agent\"] = options[:agent] || USER_AGENT\n req_headers[\"If-None-Match\"] = options[:etag] if options[:etag]\n \n if options[:modified]\n if options[:modified].is_a?(String)\n req_headers[\"If-Modified-Since\"] = parse_date(options[:modified]).httpdate\n elsif options[:modified].is_a?(Time)\n req_headers[\"If-Modified-Since\"] = options[:modified].httpdate\n elsif options[:modified].is_a?(Array)\n req_headers[\"If-Modified-Since\"] = py2rtime(options[:modified]).httpdate\n end\n end\n \n req_headers[\"Referer\"] = options[:referrer] if options[:referrer]\n req_headers[\"Accept-encoding\"] = 'gzip, deflate' # FIXME make tests\n req_headers[\"Authorization\"] = \"Basic #{auth}\" if auth\n req_headers['Accept'] = ACCEPT_HEADER if ACCEPT_HEADER\n req_headers['A-IM'] = 'feed' # RFC 3229 support \n \n begin\n return open(url_file_stream_or_string, req_headers) \n rescue OpenURI::HTTPError => e\n return e.io\n rescue\n end\n end\n\n # try to open with native open function (if url_file_stream_or_string is a filename)\n begin \n return open(url_file_stream_or_string)\n rescue\n end\n # treat url_file_stream_or_string as string \n return StringIO.new(url_file_stream_or_string.to_s)\n end", "def http_downloader\n http.timeout(30).max_size(Danbooru.config.max_file_size).use(:spoof_referrer).use(:unpolish_cloudflare)\n end", "def raw_url(file_name)\n \"ftp://#{user}@#{host}#{folder}#{file_name}\"\n end", "def source_url=(url)\n return nil if not url\n http_getter = Net::HTTP\n uri = URI.parse(url)\n response = http_getter.start(uri.host, uri.port) {|http|\n http.get(uri.path)\n }\n case response\n when Net::HTTPSuccess\n file_data = response.body\n return nil if file_data.nil? || file_data.size == 0\n self.content_type = response.content_type\n self.temp_data = file_data\n self.filename = uri.path.split('/')[-1]\n else\n return nil\n end\n end", "def download_strategy\n case url\n when %r[^cvs://] then CVSDownloadStrategy\n when %r[^hg://] then MercurialDownloadStrategy\n when %r[^svn://] then SubversionDownloadStrategy\n when %r[^svn+http://] then SubversionDownloadStrategy\n when %r[^git://] then GitDownloadStrategy\n when %r[^https?://(.+?\\.)?googlecode\\.com/hg] then MercurialDownloadStrategy\n when %r[^https?://(.+?\\.)?googlecode\\.com/svn] then SubversionDownloadStrategy\n when %r[^https?://(.+?\\.)?sourceforge\\.net/svnroot/] then SubversionDownloadStrategy\n when %r[^http://svn.apache.org/repos/] then SubversionDownloadStrategy\n else CurlDownloadStrategy\n end\n end", "def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def start_download\n @state = :dat\n # Only check if there are any slashes in the filename.\n if @filename =~ %r{^/}\n senderror(main_sock,\n TftpErrorType.illegalTftpOp,\n rhost,\n rport)\n raise TftpError, \"Absolute paths in filenames not permitted\"\n elsif @filename =~ %r{../}\n senderror(main_sock,\n TftpErrorType.illegalTftpOp,\n rhost,\n rport)\n raise TftpError, \".. not permitted in filenames\"\n elsif @filename =~ %r{/}\n # Make sure it's in our root.\n @filename = File.expand_path(@filename)\n unless @filename =~ /^@root/\n # It's not in our root. Send an error.\n senderror(main_sock,\n TftpErrorType.illegalTftpOp,\n rhost,\n rport)\n raise TftpError, \"File request for #{@filename} outside of root\"\n end\n end\n\n # If it's ok, open the file and send the first DAT.\n path = @root + '/' + @filename\n if File.exists?(path)\n debug \"Opening file #{path} for reading\"\n @file = File.new(path, \"rb\")\n debug \"File open: #{@file.inspect}\"\n send_dat()\n else\n senderror(sock,\n TftpErrorType.fileNotFound,\n @host,\n @port)\n raise TftpError, \"File does not exist\"\n end\n end", "def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end", "def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end", "def get_download_command strUrl\n\tif (str_start_with(strUrl, \"http\") or str_start_with(strUrl, \"ftp\"))\n\t\treturn \"wget \" + strUrl\n\telse\n\t\treturn \"cp \" + strUrl + \" .\"\n\tend\nend", "def download_file(url, filename, start = 0) \n # Define some default values\n uri = URI.parse(url)\n len = start\n size = start\n perc = 0\n header = {\n 'User-Agent' => \"A tiny script in ruby to fetch your videos :) - But don't worry a user is also there.\",\n }\n header['Range'] = \"bytes=#{start}-\" if start > 0\n start = DateTime.now.strftime('%s').to_i\n begin\n # Open the target file\n File.open(filename, 'a') do |file|\n # Start the download\n h = Net::HTTP.new uri.host, uri.port\n getfile = uri.path\n getfile << '?' << uri.query if not uri.query.nil?\n h.request_get(getfile, header) do |r| \n # If there is a redirect header follow it and continue downloading there\n return download_file(r['location'], filename) if r.key? 'location'\n # Read the download size\n len = len + r.content_length if not r.content_length.nil?\n r.read_body do |s| \n # Write the downloded part to the file\n file.write s if not /2[0-9][0-9]/.match(r.code).nil?\n file.flush\n # Calculate downloaded size\n size = size + s.length\n len = size if r.content_length.nil?\n # Do some calculations for the nice status line\n perc = (size.to_f / len.to_f * 100).to_i if len > 0\n lines = (perc / 4).to_i\n timegone = DateTime.now.strftime('%s').to_i - start\n bps = size.to_f / timegone.to_f\n sleft = ((len - size).to_f / bps).to_i \n print_line \"DL: #{filename} - [#{'=' * lines}#{' ' * (25 - lines)}] #{perc}% (#{transform_byte(size)} / #{transform_byte(len)}) ETA: #{transform_secs(sleft)}\"\n end \n end\n end\n rescue Exception => ex\n if @debug\n print_line \"\\a\\a\\a\" << ex.message\n sleep 2\n end\n if ex.message.include? 'Interupt'\n print_line \"You interupted me. Skipping this file...\"\n return\n end\n # Something went wrong? Simply try again... (Hope the user want this to...)\n print_line \"Connection failture. Trying again...\"\n return download_file(url, filename, size) \n end\n # Finished but did not got everything? Should not happen. Try to get the rest\n if size < len\n return download_file(url, filename, size)\n end\n # Tell the user that we are done :)\n print_line \"Completed. See your file at #{filename}\"\n puts\nend", "def fetch_and_upload_file(file, **opt)\n meth = opt.delete(:meth) || __method__\n remote = file.match?(/^https?:/)\n result = remote ? upload_remote(file, **opt) : upload_local(file, **opt)\n Log.info do\n name = result&.original_filename.inspect\n size = result&.size || 0\n type = result&.mime_type || 'unknown MIME type'\n \"#{meth}: #{name} (#{size} bytes) #{type}\"\n end\n result\n end", "def download_and_store(url, filename=\"#{SecureRandom.uuid}\")\n\n # https://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html\n file = Tempfile.new(filename) # use an array to enforce a format\n\n # set to write in binary mode (kinda weird api, but hey)\n file.binmode\n\n @task_result.logger.log_good \"Attempting to download #{url} and store in #{file.path}\" if @task_result\n\n begin\n\n uri = URI.parse(url)\n\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n # TODO enable proxy\n http = Net::HTTP.start(uri.host, uri.port, nil, nil, opts) do |http|\n http.read_timeout = 15\n http.open_timeout = 15\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n end\n\n rescue URI::InvalidURIError => e\n @task_result.logger.log_error \"Invalid URI? #{e}\" if @task_result\n return nil\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n return nil\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n return nil\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ETIMEDOUT => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unexpected end of file, consider looking at this file manually: #{url}\" if @task_result\n return nil\n ensure\n file.flush\n file.close\n end\n\n file.path\n end", "def open(uri, text, version); end", "def set_url_type_and_command\n if @url =~ %r{http://\\d+.\\d+.\\d+.\\d+/cmd,/ck6fup6/(.*)/(.*)\\?}\n @type = $1.to_sym\n @command = $2.to_sym\n end\n notify \"Type is #{@type} , Command is #{@command}\"\n end", "def negotiate_mime(order); end", "def on_a_fort\n fort_response = Net::HTTP.get_response(URI('http://files.fort/'))\n fort_response.is_a?(Net::HTTPSuccess)\nrescue\n false\nend", "def download(f)\n result = \"\"\n prefix = \"dat/\"\n file_names = \"name.dat.txt\"\n file_surna = \"surnames.dat.txt\" \n file_words = \"words.dat.txt\"\n http_names_m = \"http://www.census.gov/genealogy/names/dist.male.first\"\n http_names_f = \"http://www.census.gov/genealogy/names/dist.female.first\"\n http_surnames = \"http://www.census.gov/genealogy/names/dist.all.last\"\n http_words = \"http://www.mieliestronk.com/corncob_lowercase.zip\"\n\n case f\n when 'names'\n print \"Downloading names ... [BUSY]\"\n nm_uri = URI.parse(http_names_m)\n nf_uri = URI.parse(http_names_f)\n (open(nm_uri).read + open(nf_uri).read).each_line {|m|\n result += m.split(/\\s+/)[0].capitalize + \"\\n\"\n }\n File.open(prefix + file_names, \"w\").write( result )\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n when 'surnames'\n print \"Downloading surnames ... [BUSY]\"\n sr_uri = URI.parse(http_surnames)\n (open(sr_uri).read).each_line {|m|\n result += m.split(/\\s+/)[0].capitalize + \"\\n\"\n }\n File.open(prefix + file_surna, \"w\").write ( result )\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n when 'words'\n print \"Downloading words ... [BUSY]\"\n wr_uri = URI.parse(http_words)\n # Store the zipfile\n File.open(prefix + file_words, \"w\").write(wr_uri.read)\n unzip(prefix + file_words)\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n end\n end", "def download(from, to = from.split(\"/\").last)\n #run \"curl -s -L #{from} > #{to}\"\n file to, open(from).read\nrescue\n puts \"Can't get #{from} - Internet down?\"\n exit!\nend", "def test_nonascii_suburls_download\n @wayback_machine_downloader = WaybackMachineDownloader.new(\n base_url: 'https://en.wikipedia.org/wiki/%C3%84')\n # Once just for the downloading...\n @wayback_machine_downloader.download_files\n end", "def file_uri_scheme; end", "def download_from_file(filename)\n\t\t\tif !File.exist? filename\n\t\t\t\tputs \"Error: #{filename} not found\" \n\t\t\t\texit 1\n\t\t\tend\n\t\t\tfilename = File.realpath(filename)\n\t\t\tt = Torrent.new(@config[:grabber])\n\t\t\tFile.readlines(filename).each { |show| download(get_link(t, show)) }\n\t\tend", "def by_http(url, destination_path)\n begin\n open(url, :allow_redirections => :safe) do |input|\n if @accepted_content_types.include?(input.content_type)\n\n if File.exists?(destination_path)\n return destination_path\n else\n file = File.open(destination_path, 'wb') do |output|\n output << input.read\n end\n return file.path\n end\n else\n # need to send this to the logger at some point\n #logger.error \"Content type for #{url} not accepted by this downloader instance.\"\n puts \"[FileDownloader] Content type for #{url} not accepted by this downloader instance.\"\n return nil\n end\n end\n rescue Errno::ENOENT\n puts \"[FileDownloader] Can't open file for writing\"\n return nil\n rescue Exception => e\n puts \"[FileDownloader] Couldn't retrieve file #{url} due to an error: #{e.to_s}\"\n return nil\n end\n end", "def url_for_file(filename, anchor = T.unsafe(nil)); end", "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end", "def fetchfilm parturl, _file=nil\n return nil unless parturl\n table = \"movie\"\n if parturl.index(\"&\")\n #$log.warn \"Cannot handle ampersand in URL. please correct #{parturl}\"\n $stderr.puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n $stderr.puts \"Cannot handle ampersand in URL. please correct #{parturl}\"\n $stderr.puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n return nil\n end\n # remove HOST and keep last part\n if parturl.index OLDHOST\n parturl = parturl[OLDHOST.length..-1]\n end\n if parturl.index HOST\n parturl = parturl[HOST.length..-1]\n end\n if parturl.index(\"http:\") or parturl.index(\"https:\")\n # added this block 2015-12-30 \n $stderr.puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n $stderr.puts \"Don't know how to handle this host : #{parturl}. Pls use #{HOST} if you must.\"\n $stderr.puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n #$log.error \"Don't know how to handle #{parturl}\"\n #exit(1)\n return nil\n end\n #inserting = false\n return nil if parturl.nil? || parturl.strip == \"\"\n parturl = parturl.chomp\n #nid = counter + starting\n nid = nil\n upperurl = parturl.upcase\n key = converturl parturl\n id = $db.get_first_value %Q[select rowid from #{table} where upper(url) = \"#{upperurl}\";]\n # in some cases the data on wiki has changed a lot, so we are forcing a download\n unless $opt_force\n if id.nil?\n id = $db.get_first_value %Q[select url from #{table} where upper(canonical) = \"#{upperurl}\";]\n if id\n $stderr.puts color(\"ERROR: FOUND another url with similar canonical : #{id} skipping ..\",\"red\");\n return nil\n end\n # NOTE 2016-02-28 - this can prevent me from downloading a movie with same name but different\n # year. I should check title + year at point of updating in db. or key + year.\n id = $db.get_first_value \"select rowid from #{table} where key = '#{key}';\"\n if id\n tmp = $db.get_first_value \"select url from #{table} where key = '#{key}';\"\n $stderr.puts color(\"ERROR: FOUND another row with similar KEY #{key}: #{id} #{tmp} , skipping ..\",\"red\");\n #$log.warn \"XXX: FOUND another row with similar KEY #{key}: #{id} #{tmp} , SKIPPING ..\"\n return nil\n end\n else\n $stderr.puts color(\"ERROR: FOUND another row with #{parturl} ... skipping\",\"red\");\n return nil\n end\n end\n id = nid\n url = HOST + parturl.strip\n #\n # BUG: still fails if ampersand in URL regardless of single or double quote\n # TODO maybe we need to try Shellwords.escape since i am able to do it with wget on commandline\n text = %x[wget -q -O - \"#{url}\"] \n # 2015-12-29 - sometimes the URL is wrong, so we get a blank. The file has zero bytes\n # so we should check here\n if text.nil? or text.chomp == \"\"\n $stderr.puts color(\"ERROR: =========== url is wrong or internet down, no data received #{url}. pls check ...\", \"red\")\n #$my_errors << \"no data fetched for #{parturl} pls check/correct.\"\n sleep(60)\n return nil\n end\n # 2016-03-08 - write to a temp folder and only copy to real name if file passes disambiguation check\n tmpfile = _file.sub(\"wiki\", \"tmp\")\n File.open(tmpfile,\"w\") {|f2| f2.write(text) }\n\n _ff = Shellwords.escape(tmpfile)\n type = `file #{_ff}`\n\n # check if its a zip\n # SOMETime it comes in zip format. how do contreol that ?\n # if file says zipped then add gz extension and do a gunzip\n if type.index \"gzip\"\n $stderr.puts color(\" gzip found, expanding\", \"blue\")\n FileUtils.mv tmpfile, \"#{tmpfile}.gz\"\n system \"gunzip #{_ff}.gz\"\n #text = File.readlines(_file).join(\"\\n\")\n end\n\n # 2016-03-08 - check if disambiguation page\n ret = %x[ ./oldprogs/grepdisambiguation.sh \"#{tmpfile}\" ]\n if ret and ret.size > 3\n $stderr.puts color(\" ERROR: This (#{tmpfile} is a disambiguation page, aborting ...\", \"red\" ) \n return nil\n end\n # all okay, move file to real folder\n FileUtils.mv tmpfile, _file\n #\n # TODO 2016-03-06 - 13:09 extract canonical and compare with parturl\n # If different then change html path removing HOST and calling uri_to_filename \n # Then change parturl and write to file so next program can pick up and adjust url, htmlpath and ymlpath.\n # We check after writing since the string could be in zip format.\n # This could fail, we may need to use _ff instead here and in parsedoc\n canonical = %x[ ./oldprogs/grepcanonical.sh -h \"#{_file}\" ]\n\n # 2016-03-08 - read file and check for canonical. if so return error do not update table.\n if canonical && canonical.size > 2\n canonical = canonical.chomp\n if ( (canonical != parturl) && (URI.decode(canonical) != parturl) )\n suggestedurl = URI.decode(canonical);\n # 2016-03-08 - if canon link contains disambiguation or '#' then return error\n if suggestedurl.index(\"disambiguation\") or suggestedurl.index(\"#\")\n $stderr.puts color(\" ERROR: This (#{suggestedurl} is a disambiguation page, aborting ...\", \"red\", \"reverse\") \n return nil\n end\n $stderr.puts color(\" WARNING: canonical does not match url, should change name #{parturl} != #{canonical}...\",\"red\");\n $stderr.puts color(\" WARNING: we should rename file and url to: #{suggestedurl} and change the parturl in file and caller \",\"red\");\n # if this works out, we can change the name of the file. and write new url and html path to a yml file.\n end\n end\n return _file\nend", "def file_uri_scheme=(_arg0); end", "def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def save_file_locally(remote_url_str, extension = nil)\n extension ||= remote_url_str.match(/\\.\\w+$/)[0].sub(/^\\./, '')\n new_file_name = self.tmp_file_name(extension)\n local_path_to_file = File.join(Video.tmp_file_dir, new_file_name)\n\n # Make sure dir exists\n FileUtils.mkdir_p(Video.tmp_file_dir) unless File.exists?(Video.tmp_file_dir)\n\n # simple one-liner because using net/http just doesn't seem to work\n system(\"wget -O #{local_path_to_file} #{remote_url_str}\")\n\n self.local_file_path = local_path_to_file if File.exists?(local_path_to_file)\n if self.local_file_path.blank?\n raise \"Local file could not be saved\" \n else\n return true\n end\n end", "def initialize(base, url, temp_dir, options)\n @base = base\n @temp_dir = temp_dir\n self.options = options\n @file = File.basename(url)\n @zip_file = @file[/[.]zip$/]\n @file_path = File.join(temp_dir, @file)\n \n # TODO: GET THE FIRST DIRECTORY INSTEAD\n dir_name = @file.gsub(/[.]tar[.]gz$/, '').gsub(/[.]zip$/, '')\n @extracted_path = File.join(temp_dir, dir_name)\n \n @base.say_status 'download and compile', url\n \n download(url)\n extract\n configure unless options[:skip_configure]\n make\n make_install\n end", "def get_download\n\tend", "def file_download(*paths); net_scp_transfer!(:download, false, *paths); end", "def mkurl(oldurl, selector)\n mlog(\"checking %p ...\", oldurl)\n url = oldurl\n # yes, technically one can include a resource from FTP.\n # some people actually do that.\n # but you really shouldn't.\n if oldurl.match(/^(https?|ftp)/) or (autoscm = oldurl.match(/^\\/\\//)) then\n if autoscm then\n # in case of \"//somehost.com/...\" urls, just create an absolute url by\n # reusing the scheme from the mothership\n url = @parsed.scheme + \":\" + oldurl\n end\n else\n # macgyver the url together from the mothership scheme and host\n url = String.new\n url << @parsed.scheme << \"://\" << @parsed.host\n # if the url starts with a slash, it's an absolute path (i.e., \"/blah/something.js\")\n if oldurl.match(/^\\//) then\n url << oldurl\n else\n # otherwise, it's a relative one (i.e., \"subdir/whatever/thing.js\")\n url << File.dirname(@parsed.path)\n if ((url[-1] != \"/\") && (oldurl[0] != \"/\")) then\n url << \"/\"\n end\n url << oldurl\n end\n end\n localdest = File.join(@opts.resdir, Utils.mkname(url, selector))\n fulldest = File.join(@opts.destination, localdest)\n # coincidentally, the local url is the same as the file dest. whudathunkit\n @flog[:urls] << {url: url, local: fulldest}\n if File.file?(fulldest) then\n return localdest\n end\n response = geturl(url)\n if response then\n mlog(\"storing as %p\", fulldest)\n FileUtils.mkdir_p(File.join(@opts.destination, @opts.resdir))\n response.to_file(fulldest)\n return localdest\n end\n raise Exception, \"bad response from geturl?\"\n end", "def act_on_file(filename)\n basename = string_basename(filename)\n case File.extname(filename)\n when \".gz\"\n # .tar.gz\n if File.extname(string_basename(filename)) == \".tar\" then tar_gz(filename, basename) end\n # This is the shortform for .tar.gz\n when \".tgz\" : tar_gz(filename, basename)\n # TODO: This can't deal with passwords.\n when \".rar\" : unc_common(\"unrar x \", filename, basename)\n end\nend", "def add(str)\n # If the thing passes for an URI with host and path we use it as url\n # otherwise as fingerprint. file:// uris would not qualify, we do not\n # presently have a use case for them though.\n if url?(str)\n add_url(str)\n else\n fingerprint_added?(str) ? true : add_fingerprint(str)\n end\n end", "def download_from_sftp(sfd_connection, remote_dir, dir_local, backup_rem_dir, file_regex, options)\n s_file = []\n sfd_connection.dir.entries(remote_dir).map do |entry|\n s_file << entry.name\n end\n s_file -= [\".\",\"..\"]\n s_file = s_file.select{|f| f =~ /#{file_regex}/}\n if s_file.empty? == true\n log_error(\"There are no files to be downloaded from sFTP server\")\n if options[:verbose]\n puts \"---No files found in #{remote_dir} using RegExp #{file_regex} \" \n end\n else\n log_error(\"These files are going to be downloaded: #{s_file} from sFTP server\")\n\n full_rem_dir = sfd_connection.realpath!(remote_dir).name\n full_rem_back_dir = sfd_connection.realpath!(backup_rem_dir).name\n\n #Check for paths and permissions in verbose mode\n if options[:verbose]\n puts \"---Files list s_file = #{s_file}\"\n puts \"---Parsed remote dir full_rem_dir = #{full_rem_dir}\"\n puts \"---Parsed remote backup dir full_rem_back_dir = #{full_rem_back_dir}\"\n puts \"---Checking #{full_rem_dir} permissions: %04o\" % sfd_connection.lstat!(full_rem_dir).permissions\n puts \"---Checking #{full_rem_back_dir} permissions: %04o\" % sfd_connection.lstat!(full_rem_back_dir).permissions\n end\n\n #Check if single key has been passed as argument and then download files in single mode\n if options[:single]\n if options[:verbose]\n puts \"---Downloading files in SINGLE SYNC MODE\"\n end\n dls = s_file.map{|item| sfd_connection.download!(full_rem_dir + \"/\" + item, dir_local + \"/\" + item)}\n dls.each{|d| d.wait}\n else \n if options[:verbose]\n puts \"---Downloading files in MULTI ASYNC MODE\"\n end\n dls = s_file.map{|item| sfd_connection.download(full_rem_dir + \"/\" + item, dir_local + \"/\" + item)}\n dls.each{|d| d.wait}\n end\n \n log_error(\"All files have been downloaded from sFTP server.\")\n if full_rem_back_dir.empty?\n log_error(\"Please pay attention: There is no remote backup folder.\")\n else\n log_error(\"Moving files to the remote backup directory #{full_rem_back_dir}.\")\n uls = s_file.map{|item| sfd_connection.upload!(dir_local + \"/\" + item, full_rem_back_dir + \"/\" + item, :progress => CustomHandler.new)}\n uls.each{|u| u.wait}\n end\n \n # Send list of files and directory to console if we will remove this files\n if options[:verbose] and not options[:noremove]\n puts \"---Removing files #{s_file} from #{full_rem_dir} \"\n end\n\n # Don't remove any file from SFTP is noremove option has been passed\n if not options[:noremove]\n log_error(\"Removing files #{s_file} from SFTP\")\n s_file.map{|item| sfd_connection.remove!(full_rem_dir + \"/\" + item )}\n else\n puts \"---Found no-remove option, skipping file removal\"\n log_error(\"Found no-remove options, skipping file removal\")\n end\n end\n rescue Net::SFTP::StatusException => access_error\n log_error(\"Permission denied. A badly formatted packet or other SFTP protocol incompatibility was detected: #{access_error.message}\")\nend", "def forced_file_from_url(url)\n data = open URI.parse(url)\n return data if data.is_a? Tempfile\n\n extname = File.extname url\n basename = File.basename url, extname\n\n file = Tempfile.new [basename, extname]\n file.binmode\n file.write data.read\n file.rewind\n file\n end", "def download_file(file)\n BasicSocket.do_not_reverse_lookup = true\n ftp = Net::FTP.new('server', 'user', 'password')\n ftp.passive = true\n\n begin\n logger.info \"info: Downloading #{file}.\"\n ftp.getbinaryfile(File.basename(file), file, 1024)\n rescue Net::FTPPermError => e\n logger.info \"warning: can't download #{File.basenme(file)} from the remote server (#{e.message.tr(\"\\n\",\"\")}).\"\n end\n\n ftp.close\n\n end", "def download_strategy\n CurlDownloadStrategy\n end", "def add_torrent_magnet uri, options={}\n @con.call 'core.add_torrent_magnet', uri, options, {}\n end", "def resolve_filename (filename, port)\n s = TCPSocket.open('localhost', port)\n s.puts(\"RESOLVE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n r = s.gets\n values = r.split(\":\")\n server = values[0]\n file = values[1].strip\n s.close\n return server, file\nend", "def uri_to_file(uri); end", "def uri_to_file(uri); end", "def loadfile _file_url, _append\n send_cmd(\"loadfile #{_file_url} #{_append}\")\n end", "def create_file_from_url(url, file_name)\n ::FileSet.new(import_url: url, label: file_name) do |fs|\n actor = CurationConcerns::Actors::FileSetActor.new(fs, user)\n actor.create_metadata(curation_concern, visibility_attributes)\n fs.save!\n uri = URI.parse(URI.encode(url))\n if uri.scheme == 'file'\n IngestLocalFileJob.perform_later(fs, URI.decode(uri.path), user)\n else\n ImportUrlJob.perform_later(fs, file_name, log(actor.user))\n end\n end\n end", "def fetch(filename, default = T.unsafe(nil), read_shebang = T.unsafe(nil)); end", "def initialize(options = {})\n @file = options[:file]\n @text = options[:text]\n @url = options[:url]\n end", "def file_transfer_mode; end", "def http_test_4\n Net::HTTP.start('download.openbricks.org') do |http|\n f = File.open('http_test_4.mp4', 'wb')\n begin\n http.request_get('/sample/H2645/big_buck_bunny_480p_H264_AAC_25fps_1800K.MP4') do |resp|\n resp.read_body do |segment|\n f.write segment\n end\n end\n ensure\n f.close\n end\n end\nend", "def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend", "def download!(source_url, destination_file); end", "def open(path_or_url, ext = T.unsafe(nil), options = T.unsafe(nil)); end", "def load_from(source)\n if ( source[0..4] == 'http:' || source[0..5] == 'https:' )\n load_url(source)\n else\n load_file(source)\n end\n end", "def enqueue_url(url)\n if http_url = HttpUrl.parse(url)\n return false if has_file?(http_url.to_filename) \n url = http_url.to_s\n raise \"FATAL: invalid URL\" if url =~ /[\\n\\r]/\n queue_no = select_queue(url)\n fh = (@next_queue_files[queue_no] ||= File.open(File.join(@next_queue_dir, queue_no.to_s), 'a+'))\n fh.puts url\n true\n else\n false\n end\n end", "def url=(url)\n extension = File.extname(url)\n file = Tempfile.new([\"\", extension])\n file.binmode\n file << open(url).read\n self.assign(file)\n end", "def string_download(*paths)\n net_scp_transfer!(:download, *paths).string\n end", "def has_download\n\tend", "def ftpDownload\n ftp = nil\n begin\n timeout( CON_TIMEOUT ) do\n ftp = Net::FTP.new( @ftpUrl )\n ftp.login( @username, @passwd )\n ftp.chdir(@directory)\n $LOG.info(\"#{@name} : Connected to #{ @ftpUrl}\") \n @filenames = ftp.nlst(\"*.#{@extension}\")\n\n end\n @filenames.each{|filename|\n timeout( TRANSFER_TIMEOUT ) do\n $LOG.info(\"#{@name} : Download #{filename}\") \n ftp.getbinaryfile(filename,@folder+\"/#{filename}\") #Get the file\n ftp.delete(filename)\n $LOG.info{\"#{@name} : Deleted on server #{filename}\"}\n end\n } unless @filenames.empty?\n rescue Exception => e\n $LOG.error(\"Error ftp-transfer server: #{@ftpUrl}\")\n $LOG.error(\"Error: #{e}\")\n #raise\n ensure\n ftp.close if ftp\n GC.start\n sleep 5\n end\n \n end", "def create_file_from_url_through_active_fedora(env, uri, file_name, auth_header)\n import_url = URI.decode_www_form_component(uri.to_s)\n ::FileSet.new(import_url: import_url, label: file_name) do |fs|\n actor = Hyrax::Actors::FileSetActor.new(fs, env.user)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n fs.save!\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end", "def raw_url(file_name)\n fail('Requires implementation')\n end", "def parse(url)\n # parse URL\n # URL ends with number then filetype.\n # filetype can be removed by the final [.]. name of file is preceded by final [/].\n # number detection... every example we've seen has something before the number that isn't a number.\n # # of 0's to use as buffer can be read from the filename itself.\n # parts:\n # URL base (everything up to number)\n # filename base (after /, before number)\n # number base\n end", "def getfile(host, path)\n puts \"getting https://#{host}#{path}\"\n https = Net::HTTP.new(host, 443)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n https.start { |w| w.get2(path).body }\nend", "def file_exists? url\n if url.match(/^http/)\n localfile = remote_url_to_local url\n else\n localfile = url\n end\n remotefile = local_to_remote localfile\n begin\n localfile_size = File.size localfile\n remotefile_size = ftp.size remotefile\n # puts \"#{localfile}: #{localfile_size}\"\n # puts \"#{remotefile}: #{remotefile_size}\"\n if remotefile_size == localfile_size\n url\n else\n nil\n end\n rescue Exception=>ex\n # puts ex.message\n nil\n end\n end", "def download_from_sftp(sfd_connection, remote_dir, dir_local, backup_rem_dir, file_regex)\n s_file = []\n sfd_connection.dir.entries(remote_dir).map do |entry|\n s_file << entry.name\n end\n s_file -= [\".\",\"..\"]\n s_file = s_file.select{|f| f =~ /#{file_regex}/}\n\n if s_file.empty? == true\n log_error(\"There are no files to be downloaded from sFTP server\")\n else\n log_error(\"These files are going to be downloaded: #{s_file} from sFTP server\")\n\n full_rem_dir = sfd_connection.realpath!(remote_dir).name\n full_rem_back_dir = sfd_connection.realpath!(backup_rem_dir).name\n\n dls = s_file.map{|item| sfd_connection.download(full_rem_dir + \"/\" + item, dir_local + \"/\" + item)}\n dls.each{|d| d.wait}\n log_error(\"All files have been downloaded from sFTP server.\")\n if full_rem_back_dir.empty?\n log_error(\"Please pay attention: There is no remote backup folder.\")\n else\n log_error(\"Moving files to the remote backup dirrectory #{full_rem_back_dir}.\")\n uls = s_file.map{|item| sfd_connection.upload!(dir_local + \"/\" + item, full_rem_back_dir + \"/\" + item, :progress => CustomHandler.new)}\n uls.each{|u| u.wait}\n end\n\n s_file.map{|item| sfd_connection.remove!(full_rem_dir + \"/\" + item)}\n end\n rescue Net::SFTP::StatusException => access_error\n log_error(\"Permission denied. A badly formatted packet or other SFTP protocol incompatibility was detected: #{access_error.message}\")\nend", "def meta_dl(fn)\n if File.exist? \"#{MIRROR_FOLDER}/mirror/#{fn}\"\n FileUtils.cp(\"#{MIRROR_FOLDER}/mirror/#{fn}\", \"#{MIRROR_FOLDER}/meta_backup/#{fn}\") # backup ori files\n end\n $metadata_dl_list[fn] = true # mark it as downloading\n download(fn) { |res, rcon|\n rcon.unbind rescue nil\n $meta_fail = true unless res\n $metadata_dl_list[fn] = false\n }\nend", "def resolve_url url_array\n url_array.each do |url_str|\n url = URI.parse(url_str)\n req = Net::HTTP.new(url.host, url.port)\n\n begin\n Timeout.timeout(5) do\n res = req.request_head(url.path)\n\n if res.code == \"200\"\n return url_str\n end\n end\n rescue Timeout::Error\n puts \"URL #{url_str} did not respond in 5 seconds.\"\n next\n end\n end\n return \"\"\nend", "def open?(uri); end", "def supported_protocols\n [\"afp\", \"smb\", \"ftp\"]\n end", "def download(url, file)\n # First, open the remote file. (FD == 'File Descriptor', a C term)\n #\n # If we first open the remote file, if there are any exceptions in\n # attempting to open it, we won't lose the contents of the local file.\n open(url) do |remoteFD|\n # Open the local file, purging the contents.\n File.open(file, \"w\") do |genericFD|\n remoteFD.each_line do |line|\n # Take each line, stick it in the file.\n genericFD.puts line\n end\n end\n end\n @repo.add(file) # add the file to the list to be committed\nend", "def from_string(content, options = {})\n ios = StringIO.new(content)\n file = Paperclip.io_adapters.for(ios)\n\n file.original_filename = options[:filename] || 'download.txt'\n file.content_type = options[:content_type] || 'text/plain'\n\n self.result = file\n save!\n end", "def valid_download?\n @download_url != \"\"\n end", "def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend", "def setup_remote\n if(@cache_file)\n begin\n @cf = File.open(@cache_file, 'w+')\n rescue\n @cf = nil\n end\n end\n @uri = URI.parse(@path)\n @con = Net::HTTP.new(@uri.host, @uri.port)\n @call_path = @uri.path + (@uri.query ? \"?#{@uri.query}\" : '')\n res = @con.request_get(@call_path)\n @heads = res.to_hash\n res.value\n @store = nil\n @redefine_prefix = 'remote'\n end", "def file_uri?(uri)\n uri =~ %r{\\Afile://}\n end", "def download_command(src, name, folder_name, data)\n url = data[:url]\n if src.to_s == \"bandcamp_urls\"\n download_bandcamp_url(folder_name, url)\n elsif src.to_s == \"youtube_urls\"\n download_youtube_url(folder_name, url)\n end\n end", "def initialize(params={})\n @url = params[:url]\n @content = params[:content]\n @content_type = params[:content_type] || (@content ? guess_content_type : nil)\n @url_file_path = nil\n @directory_path = nil\n @filename = nil\n end", "def parseHTTPRequest(request)\n httpRequestRE = /(GET|HEAD) (?:http:\\/\\/[^\\/]+)?(\\/?\\S+) HTTP\\/1.[10]\\r\\n.*Host: ?([^:\\r]+)(?::(\\d*))?\\r\\n.*/m # note optional (in my opinion) space after Host: , and optional port. HTTP/1.0 for wget, which is odd\n answers = httpRequestRE.match(request)\n file = host = port = start = endy = nil\n if answers \n requestType = answers[1]\n file = answers[2]\n host = answers[3]\n port = (answers[4] || '80').to_i\n start = nil\n endy = nil\n end\n \n httpRequestRE = /.*\\r\\nRange: bytes=(\\d+)-(\\d+)?/\n answers = httpRequestRE.match(request)\n if answers # ltodo test case straight download from a peer of size 100, block size 33\n start = answers[1].to_i\n if answers[2] # if it's nil, then don't do \".to_i\" on it. heh.\n endy = answers[2].to_i\n assert endy >= start # note: can be equal, which means 'serve one byte'\n else\n endy = nil\n end\n end\n fullUrl = \"http://#{host}:#{port}#{file}\" \n return file, host, port, start, endy, requestType, fullUrl\n end", "def file_url\n end", "def download(_io, _path)\n false\n end", "def fileUri(f)\n \"file://\" + f.gsub(\" \", \"%20\")\nend", "def download_from_original_url\n return if self.original_url.blank?\n\n self.contents = begin\n Timeout::timeout(300) do\n io = open(URI.parse(self.original_url))\n def io.original_filename\n base_uri.path.split('/').last\n end\n io.original_filename.blank? ? nil : io\n end\n rescue\n errors.add :original_url, \"unable to download url\"\n nil\n end\n end", "def download(uri, io_or_filename, parameters = T.unsafe(nil), referer = T.unsafe(nil), headers = T.unsafe(nil)); end", "def set_torrent\n @torrent = Torrent.find(params[:torrent_id])\n end", "def ftp_download(target,\n url_to_download,\n count,\n total,\n ftp_server,\n ftp_dir,\n destination_dir)\n Log.log_debug(' Into download (target=' + target +\n ') url_to_download=' + url_to_download +\n ' count=' + count.to_s +\n ' total=' + total.to_s +\n ' ftp_server=' + ftp_server +\n ' ftp_dir=' + ftp_dir +\n ' destination_dir=' + destination_dir)\n returned_downloaded_filenames = {}\n #\n Net::FTP.open(ftp_server) do |ftp|\n ftp.login\n ftp.read_timeout = 300\n ftp.chdir(ftp_dir)\n files_on_ftp_server = ftp.nlst('*.epkg.Z')\n subcount = 0\n #\n files_on_ftp_server.each do |file_on_ftp_server|\n fix_to_download = ::File.join(url_to_download,\n ::File.basename(file_on_ftp_server))\n #\n begin\n # download file\n local_path_of_file_to_download =\n ::File.join(destination_dir,\n ::File.basename(file_on_ftp_server))\n Log.log_debug(' Consider downloading ' +\n fix_to_download +\n ' into ' +\n local_path_of_file_to_download +\n \" : #{count}.#{subcount}/#{total} fixes.\")\n #\n if !::File.exist?(local_path_of_file_to_download)\n Log.log_debug(' downloading ' + fix_to_download +\n 'into ' +\n local_path_of_file_to_download +\n \" : #{count}.#{subcount}/#{total} fixes.\")\n #\n ftp.getbinaryfile(::File.basename(file_on_ftp_server),\n local_path_of_file_to_download)\n b_download = 1\n else\n Log.log_debug(' not downloading ' +\n fix_to_download +\n 'into ' +\n local_path_of_file_to_download +\n \" : #{count}.#{subcount}/#{total} fixes.\")\n b_download = 0\n end\n #\n subcount += 1\n #\n returned_downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n rescue Errno::ENOSPC => e\n Log.log_err('Automatically increasing file system when ftp_downloading as\\\n Exception e=' + e.to_s)\n Flrtvc.increase_filesystem(destination_dir)\n return ftp_download(target,\n url_to_download,\n count,\n total,\n ftp_server,\n ftp_dir,\n destination_dir)\n rescue StandardError => e\n Log.log_err('Exception e=' + e.to_s)\n # Log.log_warning(\"Propagating exception of type '#{e.class}' when ftp_downloading!\")\n returned_downloaded_filenames[::File.basename(local_path_of_file_to_download)] = -1\n end\n end\n end\n Log.log_debug('returned_downloaded_filenames=' + returned_downloaded_filenames.to_s)\n returned_downloaded_filenames\n end", "def fetch_file(url)\n url =~ %r{/([^/]*)\\.(tar\\.gz|tar\\.bz2|tgz|zip|tbz)$}\n name = $1\n ext = $2\n filename = \"#{name}.#{ext}\"\n archive = File.join(env.path, \"archives\", filename)\n\n rbvm_md5 = config_md5[filename]\n\n if File.exists?(archive)\n archive_md5 = Digest::MD5.file(archive)\n if rbvm_md5\n if archive_md5.to_s == rbvm_md5\n log(\"Using existing archive for #{filename}.\", \"info\")\n fetch = false\n else\n log(\"Existing archive has bad MD5, backup and download again.\", \"error\")\n FileUtils.mv(archive, File.join(env.path, \"archives\", \"#{filename}-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}.orig\"))\n archive_md5 = nil\n fetch = true\n end\n else\n log(\"Unknown archive: #{archive}\", \"warn\")\n fetch = false\n end\n else\n fetch = true\n end\n\n if fetch\n catch_error(\"Failed to fetch: #{url}\") do\n log(\"#{name} - #fetching\", 'info')\n exec_cmd(\"curl\", \"-s\", \"-S\", \"-L\", \"--create-dirs\", \"-C\", \"-\", \"-o\", archive, url)\n end\n end\n\n return archive\n end", "def fetch_csv_from_ftp(type='*')\n puts 'Connecting to FTP...'\n local_files = [] #Successfully downloaded files\n ftp = Net::FTP.open(FTP_HOST, FTP_USR, FTP_PASS)\n begin\n puts 'Connected'\n ftp.chdir(INCOMING_PATH)\n #We only fetch files with suffix that match today\n puts 'Checking for update...'\n filenames = ftp.nlst(\"#{FILE_PREFIX}_#{type}_#{Time.now.strftime(\"%d%m%Y\")}*\")\n\n unless filenames.count.zero?\n filenames.each{ |filename| \n puts \"Fetching #{filename} ...\"\n ftp.getbinaryfile(filename,\"#{RAILS_ROOT}/tmp/#{filename}\")\n local_files += [\"#{RAILS_ROOT}/tmp/#{filename}\"]\n }\n else\n puts 'Sorry, there is no new updates'\n end\n ensure\n ftp.close unless ftp.nil?\n puts 'Disconnected'\n end\n local_files\nend", "def check_file(url, refs)\n if get_internal_file(url)\n add_valid_url(url, refs)\n elsif check_head(url) == false\n add_invalid_url(url, refs)\n else\n add_valid_url(url, refs)\n end\n end", "def check_file(url, refs)\n if get_internal_file(url)\n add_valid_url(url, refs)\n elsif check_head(url) == false\n add_invalid_url(url, refs)\n else\n add_valid_url(url, refs)\n end\n end", "def fetch!\n\n open(fetch_txt_file) do |io|\n \n io.readlines.each do |line|\n \n (url, length, path) = line.chomp.split(/\\s+/, 3)\n \n add_file(path) do |io|\n io.write open(url)\n end\n \n end\n \n end\n\n # rename the old fetch.txt\n Dir[\"#{fetch_txt_file}.?*\"].sort.reverse.each do |f|\n \n if f =~ /fetch.txt.(\\d+)$/\n new_f = File.join File.dirname(f), \"fetch.txt.#{$1.to_i + 1}\"\n FileUtils::mv f, new_f\n end\n \n end\n\n # move the current fetch_txt\n FileUtils::mv fetch_txt_file, \"#{fetch_txt_file}.0\"\n end", "def download(url, filename, outputFolder)\r\n loadStatus = true\r\n begin\r\n Net::HTTP.start(url) { |http|\r\n t= Time.now\r\n filedate = t.strftime(\"%m%d%Y\")\r\n\t\tif url == \"downloads.cms.gov\"\r\n\t\t\tresp = http.get(\"/medicare/#{filename}\")\r\n\t\telse\r\n\t\t\tresp = http.get(\"/download/#{filename}\")\r\n\t\tend\r\n\r\n open(\"#{outputFolder}#{filedate}#{filename}\", \"wb\") { |file|\r\n file.write(resp.body)\r\n }\r\n }\r\n\r\n puts \"download of #{filename} complete\"\r\n rescue Exception=>e\r\n loadStatus = false\r\n end\r\n return loadStatus\r\nend" ]
[ "0.6025188", "0.57515717", "0.5744811", "0.56442326", "0.5541267", "0.5541267", "0.5541267", "0.5541267", "0.5480322", "0.53987443", "0.53890586", "0.5354135", "0.5318147", "0.5296142", "0.5296142", "0.5236898", "0.5235556", "0.5235556", "0.5230711", "0.5227862", "0.5213218", "0.5190388", "0.51825434", "0.51359856", "0.51191324", "0.51172614", "0.5105013", "0.50989115", "0.50637877", "0.5053126", "0.5033715", "0.49935332", "0.4987872", "0.49791646", "0.49563044", "0.49429026", "0.49321684", "0.49321684", "0.4924001", "0.49194464", "0.49105406", "0.4890772", "0.48899257", "0.48885143", "0.48804814", "0.4869879", "0.4856476", "0.48527884", "0.4851159", "0.48420534", "0.48262715", "0.4822185", "0.4822185", "0.48207748", "0.48165256", "0.4816205", "0.48128542", "0.4807554", "0.480422", "0.48026407", "0.480175", "0.47949657", "0.47949556", "0.4785982", "0.47853252", "0.47747895", "0.47659713", "0.47634688", "0.47574258", "0.4746559", "0.4743948", "0.47430792", "0.47427946", "0.47404164", "0.47381562", "0.47373587", "0.47357708", "0.4730009", "0.4729696", "0.47247642", "0.47247437", "0.47164667", "0.47136447", "0.47064668", "0.47039828", "0.46999416", "0.46987042", "0.46971452", "0.46901703", "0.4690041", "0.46894383", "0.46878847", "0.46862376", "0.46760294", "0.4672766", "0.46716726", "0.4669393", "0.4669393", "0.46661738", "0.4659824" ]
0.54284954
9
some other job should decide what to do in order to better support if errors occured
def run_processor if @file_last_action == :file_url processor = WORKER_LIST.detect{|worker| worker.can_work_with_file_name?(val) } processor.perform_later(self) elsif @file_last_action == :file end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_failed; end", "def handle_perform_error(_e); end", "def do_failure; end", "def errorhandling\n end", "def storage_failure=(_arg0); end", "def task_check_error\n # nochannel job failure should not result in any state changes\n return if is_nochannel?\n\n policies = Push::Policy.policies_for_errata(errata, {:mandatory => true}).select(&:push_applicable?)\n push_jobs = policies.map(&:push_job_since_last_push_ready).compact\n\n # nochannel jobs never count toward whether advisory push is considered\n # to have failed\n push_jobs.reject!(&:is_nochannel?)\n\n failed_jobs = push_jobs.select(&:failed?)\n active_jobs = push_jobs.select(&:in_progress?)\n\n # Move the status of errata to PUSH_READY if:\n # - no more active push jobs are running\n # - and there is at least one failed push job.\n if active_jobs.empty? && failed_jobs.any?\n comment = \"Mandatory push job(s) have failed: #{failed_jobs.map(&:id).join(', ')}\"\n error comment\n move_advisory_to_push_ready(comment)\n end\n end", "def failed?; failed_to_start? || (@success == false) end", "def process_new\n # each time a job is run then then a note is made that the owning user\n # has run a job. This is so we can get a count of jobs even if the user\n # deletes them\n user = User.find_by_email(self.email)\n if user.runs[\"#{self.type}\"].blank?\n user.runs[\"#{self.type}\"] = 1\n else\n user.runs[\"#{self.type}\"] += 1\n end\n user.save\n\n # get the input file, if it has not already been loaded\n begin\n if self.infile.nil? and !self.inputurl.nil?\n self.get_infile unless (self.type == 'durden' or self.type == 'identkey')\n end\n rescue\n self.jobfail(\"Could not get input file\",\"could not get input file\")\n return\n end\n\n # before processing the job, write a brief summary to the log of this job. It\n # should be csv: type,user,id,date\n logfile = \"#{Vibrant::Application.config.dropbox}/oboe_log_#{Rails.env}.txt\"\n begin\n open(logfile, 'a') do |f|\n f.puts \"#{self.type},#{self.email},#{self.id},#{self.created_at}\"\n end\n rescue\n Rails.logger.error(\"Could not write to logfile!\")\n end\n \n # having got the file, we can now commence the processing\n begin\n self.send(\"process_new_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end", "def failures; end", "def failures; end", "def failures; end", "def error?; end", "def error?; end", "def error?; end", "def process_upload!\n init_error_report\n\n if fail_on_error?\n handle_save_nothing_on_error\n else\n handle_save_clean_orders\n end\n\n store_error_report if result.failed?\n self.processed_at = Time.zone.now\n save!\n end", "def run_and_raise_on_failure\n # TODO ?\n end", "def handle_job_failure(error, job)\n count = job[:error_count].to_i + 1\n\n Que.execute(\n :set_error, [\n count,\n (count**4) + 3, # exponentially back off when retrying failures\n \"#{error.message}\\n#{error.backtrace.join(\"\\n\")}\",\n *job.values_at(*Job::JOB_INSTANCE_FIELDS),\n ]\n )\n end", "def process_with_graceful_fail(cmd, options, *klass); end", "def unsuccessful\n end", "def error job, exception\n if tracetop = exception.backtrace&.first\n # Extract the file and line # from the stack top\n tracetop = \" at<br>\" + tracetop.match(/(.*:[\\d]*)/).to_s.if_present || tracetop\n tracetop.sub! Rails.root.to_s+'/', ''\n end\n errors.add :base, exception.to_s+tracetop\n self.status = :bad if processing? # ...thus allowing others to set the status\n end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def storage_failure; end", "def fail_job job, error\n job.fail error\n end", "def success job=nil\n # ...could have gone error-free because errors were reported only in the record\n # NB: This is a pretty crude report. For more specific info, the model should throw the error\n # with a proper report, which will then get recorded in errors[:base]\n if relaunch?\n raise Exception, self.errors.full_messages # Make sure DJ gets the memo\n end\n self.status = (errors.present? ? :bad : :good) if processing? # ...thus allowing others to set the status\n self.dj = nil if good?\n if persisted?\n if changed? # && !bad? # By this point, any error state should be part of the record\n msgs = errors.messages.clone\n save\n msgs.each { |type, errs| errs.each { |err| errors.add type, err } }\n else\n update_attribute :dj_id, dj&.id\n end\n end\n end", "def perform\n begin\n # prepare the job\n prepare\n # check that everything is kosher\n check\n # run the job\n run\n # perform any post processing`\n clean_up\n rescue Exception => e\n PutMetricDataService.new.put_metric('DelayedJobErrorResponse', 'Count', 1)\n\n Rails.logger.warn e.message\n Rails.logger.warn e.backtrace\n Delayed::Worker.logger.warn e.message rescue nil # log to worker logger if available\n Delayed::Worker.logger.warn e.backtrace rescue nil # log to worker logger if available\n end\n end", "def run_succeeded; end", "def handle_failure(job,e)\n puts \"!\"\n puts \"! \\t FAIL\"\n puts \"! \\t \\t #{job.inspect}\"\n puts \"! \\t \\t #{e.inspect}\"\n puts \"!\"\n end", "def handle_failure(job,e)\n puts \"!\"\n puts \"! \\t FAIL\"\n puts \"! \\t \\t #{job.inspect}\"\n puts \"! \\t \\t #{e.inspect}\"\n puts \"!\"\n end", "def validate\n\n if @csv_report_job.status != GlobalConstant::CsvReportJob.pending_status\n send_error_mail(\"csv report job status should be pending. status-#{@csv_report_job.status}\")\n return error_with_data(\n 'pkrj_1',\n 'Job is not in pending state',\n 'Job is not in pending state',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n if @admin.blank? || (@admin.default_client_id != @csv_report_job.client_id) || @admin.role != GlobalConstant::Admin.super_admin_role\n send_error_mail(\"Admin does not have permission to download csv\")\n update_job_status(GlobalConstant::CsvReportJob.failed_status)\n return error_with_data(\n 'pkrj_2',\n 'Admin does not have permission to download csv',\n 'Admin does not have permission to download csv',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n success\n end", "def check_errors;\n end", "def proceed!; end", "def proceed!; end", "def process_result\n end", "def process\n by_time_batch\n by_waiting_batch\n rescue\n @logger.fatal \"Failed to process: #{$!}\"\n @logger.fatal $!.backtrace.join(\"\\n\")\n end", "def run_pyjob(cmd_in, cmd_out, dbcmd)\n puts cmd_in\n cmd_complete1 = system(cmd_in)\n if cmd_complete1\n cmd_complete2 = system(cmd_out)\n if cmd_complete2\n puts \"************\"\n puts dbcmd\n dbcmd_complete = system(dbcmd)\n if dbcmd_complete\n puts \"sucessfully loaded mallet into the db\"\n else\n @error = \"Error: Job failed importing results into the database\"\n end\n else\n @error = \"Error: Mallet Job failed on the 2nd step\"\n end\n else\n @error = \"Error: Mallet Job failed on the first step\"\n end\n return false\n end", "def process_result(result, exit_status); end", "def process_command\n puts \"# #{$0} #{@options.to_s}\" if @options.verbose\n # Get current time in epochs\n time = Time.now\n epochs = time.gmtime.to_i\n # Subtract seconds(obtained from minutes user ip) to go back in accounting file\n epochs = epochs - @seconds.to_i\n # Output file - set to STDOUT if @options.opfile not specified\n if @ofilename \n ofile = File.open(@ofilename, \"w\") \n else\n ofile = STDOUT\n end\n ofile << \"# Failed jobs for user #{@user} since last #{@options.since}\\n\" if @options.verbose\n ofile << \"# SGE Job ID,Job script name,Requested Memory,Used Memory,Requested run-time,Actual walltime\\n\" if @options.verbose\n count_failed_jobs = 0\n File.foreach(@afilename) do |aline| \n # Select lines that match following criteria: \n ## specified-username\n ## && (completed/end-time in last n minutes #{epochs})\n ## && (failed status is non-zero || exit status is non-zero)\n if aline !~ /#/\n aarray = aline.split(\":\")\n wallclock = aarray[10].to_i - aarray[9].to_i\n s_rt = aarray[39].slice(/(s_rt=)([\\d]+)/,2).to_i # get requested s_rt\n h_rt = aarray[39].slice(/(h_rt=)([\\d]+)/,2).to_i # get requested h_rt\n h_vmem = aarray[39].slice(/(h_vmem=)([[:alnum:]]+\\.?[[:alnum:]]+)/,2) # get requested h_vmem\n failure = wallclock.between?(s_rt,h_rt+2) ? \"Reached max. run-time limit #{seconds_to_units(h_rt)}\" : \"Reached max. memory limit #{h_vmem}\"\n if aarray[3]== @user && (aarray[10].to_i>=epochs) && (aarray[11]!='0' || aarray[12]!='0')\n #ofile << \"#{aarray[5]} #{epochs} #{aarray[10]} #{time}\\n\"\n ofile << \"#{aarray[5]},#{aarray[4]},#{h_vmem},#{aarray[42]},#{h_rt},#{wallclock},#{failure}\\n\"\n count_failed_jobs = count_failed_jobs + 1 \n end\n end\n end\n ofile << \"# #{count_failed_jobs} jobs failed for #{@user} in last #{@options.since}\\n\" if @options.verbose\n ofile.close\n # Close output file \n end", "def handle_failed_jobs(jobs)\n failed_jobs = jobs.select { |j| !j.exception.nil? }\n return if failed_jobs.empty?\n if jobs.length == 1\n # Don't provide a bad UX by showing a 'one or more jobs has failed'\n # message when there was only one job.\n raise jobs.first.exception\n end\n\n raise ChefApply::MultiJobFailure.new(failed_jobs)\n end", "def continue_on_error\n @continue_on_error = true\n end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success; end", "def success; end", "def handle_failed_rows?\n false\n end", "def success?() end", "def too_many_hops?; end", "def continued_exception; end", "def job_error_handler(err)\n\tUserMailer.job_notification_email(job_spec, @job_log_s3_full_path).deliver\n self.update(status: ERROR, status_message: error_message(err))\n @job_log.error error_message(err)\n raise err\n end", "def handle_job_failures(jobs)\n failed_jobs = jobs.select { |j| !j.exception.nil? }\n return if failed_jobs.empty?\n raise ChefRun::MultiJobFailure.new(failed_jobs)\n end", "def parse_failure_cause; end", "def grab_job_uniq\n throw :notimpl\n end", "def run\n # Run all the steps below. Stop as soon as one of them returns\n # false or throws an error.\n true &&\n fetch_internal_date_and_size &&\n check_for_really_old_internal_date &&\n check_for_pre_creation_internal_date &&\n check_for_relapsed_internal_date &&\n check_for_big_messages &&\n fetch_uid_envelope_rfc822 &&\n update_user_mark_email_processed &&\n handle_tracer_email &&\n check_for_duplicate_message_id &&\n check_for_duplicate_sha1 &&\n create_mail_log &&\n deploy_webhook &&\n update_daemon_stats\n ensure\n clean_up\n end", "def failure(job)\n self.successful = true\n self.complete = true\n self.state = 'Failed'\n update_sync_job\n end", "def execute; end", "def execute; end", "def do_success; end", "def fail_job\n self.last_run_at = Time.now\n self.next_run_at = nil\n self.last_run_result = \"Timeout\"\n self.save\n\n # ...and persist the next run of this job if one exists\n set_next_job\n end", "def fail\n # no-op\n end", "def process; raise CommandError, \"command '#{command_name}' not implemented\" end", "def job_error\n command = params[:command].to_sym\n message = params[:message]\n @project.send(\"#{command}_fail!\", nil, message)\n head :ok\n end", "def failure\n end", "def on_failure(object, *args); end", "def fail_job\n self.last_run_at = Time.zone.now\n self.next_run_at = nil\n self.last_run_result = \"Timeout\"\n self.save\n\n # ...and persist the next run of this job if one exists\n set_next_job\n end", "def job?(cmd)\n @job = api.query_job(cmd)\n job.wait_until_done!\n fld = job.failed?\n puts(job.error['message']) if fld\n fld\n end", "def post_fail_message; end", "def process_job_msg(job_msg)\n msg = job_msg[\"msg\"]\n data = job_msg[\"data\"]\n\n if status == 'pending' && msg == 'begin'\n @status = 'running'\n @start_time = Time.now\n elsif (status == 'running' || status == 'unknown') && (msg == 'success' || msg == 'failure')\n @status = msg\n @result = data\n @duration = Time.now - @start_time\n elsif (status == 'running' || status == 'unknown') && msg == 'exception'\n @status = 'exception'\n @exception = data\n @duration = Time.now - @start_time\n elsif msg == \"info\"\n # Ignore client defined messages\n true\n elsif msg == \"arrhythmia\"\n @status = 'unknown'\n @duration = Time.now - @start_time\n else\n raise \"State machine Error #{job_msg}\"\n end\n end", "def result_of_checking; end", "def apply_errors\n apply_errors_get(data)\n end", "def error_in_submission(pid, reason)\n throw reason\n end", "def process_monitor_results(result_array_of_hashes)\n result_array_of_hashes = result_array_of_hashes[\n 0..Settings.result_limit.to_i\n ]\n Delayed::Worker.logger.debug \"Processing #{@asq.name}\"\n Delayed::Worker.logger.debug \"Evaluating if #{@asq.alert_result_type}\n #{@asq.alert_operator} #{@asq.alert_value}\"\n\n if @asq.alert_result_type == 'rows_count'\n Delayed::Worker.logger.debug \"Row length: #{result_array_of_hashes.length}\n // Error value: #{@asq.alert_value.to_i}\"\n process_row_count(result_array_of_hashes)\n elsif @asq.alert_result_type == 'result_value'\n # Should break if we get multiple rows back\n return unless single_row?(result_array_of_hashes)\n Delayed::Worker.logger.debug 'Result to evaluate: ' \\\n \"#{result_array_of_hashes[0].values[0]} \" \\\n \"(#{result_array_of_hashes[0].values[0].class}) // \\n\" \\\n \"Error value: #{@asq.alert_value} (#{@asq.alert_value.class})\"\n\n if invalid_non_numeric_comparison?(result_array_of_hashes[0].values[0])\n @asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => 'Error processing results: This Asq is ' \\\n 'using a less-than or greater-than operator against a ' \\\n 'non-numeric expected result. For non-numeric results, ' \\\n 'only the == and != operators are valid.'\n }].to_json)\n else\n compare_result_value(result_array_of_hashes)\n end\n else\n @asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => 'Error processing results: ' \\\n 'I tried to evaluate if this Asq was in error but I ' \\\n 'couldn\\'t understand if I was supposed to look at the ' \\\n 'row count or result set.'\n }].to_json)\n end\n @asq.finish_refresh\n rescue StadardError => e\n @asq.operational_error([{\n 'error_source' => 'Asq',\n 'error_text' => \"Error when processing results: #{e}\"\n }].to_json)\n end", "def process_ingest_errors(result, *records, **opt)\n\n # If there were no errors then indicate that all items succeeded.\n errors = ExecReport[result].error_table(**opt)\n return records, {} if errors.blank?\n\n # Otherwise, all items will be assumed to have failed.\n errors = errors.dup\n failed = {}\n\n # Errors associated with the position of the item in the request.\n by_index = errors.select { |idx| idx.is_a?(Integer) && records[idx-1] }\n if by_index.present?\n errors.except!(*by_index.keys)\n by_index.transform_keys! { |idx| manifest_item_id(records[idx-1]) }\n by_index.transform_values! { |msg| Array.wrap(msg) }\n failed.rmerge!(by_index)\n end\n\n # Errors associated with item submission ID.\n by_sid = errors.extract!(*records.map(&:submission_id))\n if by_sid.present?\n sid_id = records.map { |rec| [rec.submission_id, rec] }.to_h\n by_sid.transform_keys! { |sid| manifest_item_id(sid_id[sid]) }\n by_sid.transform_values! { |msg| Array.wrap(msg) }\n failed.rmerge!(by_sid)\n end\n\n # Remaining (general) errors indicate that there was a problem with the\n # request and that all items have failed.\n if errors.present?\n general = errors.values.presence || ['unknown error'] # TODO: I18n\n general = records.map { |rec| [manifest_item_id(rec), general] }.to_h\n failed.rmerge!(general)\n end\n\n return [], failed\n\n end", "def load_job_submit\n location = Location.find_by_location_barcode(self.pdt_screen_def.get_input_control_value(\"location\"))\n self.set_temp_record(:location, location)\n if !location\n result_screen = PDTTransaction.build_msg_screen_definition(\"location does not exist\",nil,nil,nil)\n return result_screen\n end\n\n if !location.current_job_reference_id\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n job = Job.find_by_id(location.current_job_reference_id)\n \n if !job\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n\n if job.job_type_code.upcase != \"RECOOLING\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"this is not a recooling job\",nil,nil,nil)\n return result_screen\n end\n\n if job.current_job_status.upcase != \"JOB_CREATED\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"job[\" + job.job_number + \"] status must be 'created'\",nil,nil,nil)\n return result_screen\n end\n\n pallet_probes = PalletProbe.find_all_by_job_id(job.id)\n if (pallet_probes.length() == 0)\n error = [\"NO PROBES ALLOCATED\"]\n result_screen = PDTTransaction.build_msg_screen_definition(nil, nil, nil, error)\n return result_screen\n end\n\n ActiveRecord::Base.transaction do\n job.update_attribute(:current_job_status, \"JOB_LOADED\")\n\n self.set_transaction_complete_flag\n end\n\n self.set_transaction_complete_flag\n result_screen = PDTTransaction.build_msg_screen_definition(\"job loaded succesfully\",nil,nil,nil)\n return result_screen\n end", "def process_steps(should_harvest)\n bump_version\n\n simple_validations\n\n # All of the simple validations are basic requirements for processing a file.\n # Does it exist? Does it have more than 0 bytes? Is it a file included in our target extensions?\n # No point advancing if these conditions are not met.\n return move_to_failed unless valid?\n\n # I didn't want to mutate files in the information gathering stage.\n # However, unless fixes are applied it is really hard to gather\n # correct metadata for the file - which is needed for validating.\n # Lastly, EMU is meant to be safe and fault tolerant so we're just\n # Hoping it is up to the task.\n apply_fixes\n\n # EMU can detect some unfixable problems\n return move_to_failed unless valid?\n\n extract_metadata\n\n validate\n\n mark_status(HarvestItem::STATUS_METADATA_GATHERED)\n\n # stop here if we're only gathering metadata\n return unless should_harvest\n\n # we're trying to do an actual harvest but there are still validation errors; fail time\n return move_to_failed unless valid?\n\n # fix any errors or manipulate the files before harvest\n pre_process\n\n # create the audio recording in the database\n return move_to_failed unless create_audio_recording\n\n # harvest the file ( move the file on disk)\n return move_to_failed unless harvest_file\n\n post_process\n\n mark_status(HarvestItem::STATUS_COMPLETED)\n rescue StandardError => e\n move_to_error(e)\n\n # Two cases here:\n # 1. Truly exceptional behaviour, such as a bug in the code. Raise and send an error notification.\n # 2. Some kind of domain/logical/transient error. Timeouts are a good example.\n # - Do not send a notification.\n # - Maybe it can be retried?\n\n # here we detect exceptions that should trigger a retry\n raise if should_retry?(e)\n\n # raise will mark the job tracker as :errored\n raise unless one_of_our_exceptions(e)\n\n # otherwise, set the job-tracker to :failed indicating retry is possible\n failed!(e.message)\n ensure\n save_state\n end", "def recover_from_post_processing_failure #:nodoc:\n true\n end", "def execute_process(dir_base)\n raise \"parameter error: base directory is null\" if dir_base.blank?\n logger.info \"start LibraryCheck.execute : #{dir_base}\"\n\n #1-3) item barcord data is uploaded ?\n data_files = self.libcheck_data_files\n data_files = [] if data_files.nil? # this check is already done\n\n barcord_files = []\n data_files.each do |f|\n in_file = \"#{dir_base}/data_uploads/#{f.id}/original/#{f.file_name}\"\n if File.exist?(in_file) then\n barcord_files << in_file\n logger.debug \"#{f.file_name} is found\"\n else\n logger.warn \"#{f.file_name} is NOT found\"\n end\n end\n\n logger.info \"start load check barcode data\"\n #2) load barcode data to libcheck_tmp_items table\n begin\n load_check_barcode_data(barcord_files)\n rescue => exc\n p \"Error at loading barcord files\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_loading_barcode') + \":\" + exc.to_s\n logger.error \"Error at loading barcode files:\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end load check barcode data\"\n\n do_notfound_flg = Setting.libcheck_test_do_notfound\n logger.info \"don't check not found\" unless do_notfound_flg\n\n logger.info \"start check not found items\"\n #3) search not found item information\n begin\n check_notfound_items() if do_notfound_flg\n rescue => exc\n #p \"Error at finding not found items\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_checking_notfound') + \":\" + exc.to_s\n logger.error \"Error at search not found items:\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end check not found items\"\n \n #4-pre) auto checkin\n logger.info \"start auto_checkin #{SystemConfiguration.get(\"library_checks.auto_checkin\")}\"\n if SystemConfiguration.get(\"library_checks.auto_checkin\") \n begin\n logger.info \"start auto_checkin\"\n check_checkouted_items_with_checkin \n logger.info \"end auto_checkin\"\n rescue => exc\n logger.error \"Error occured. at check_checkouted_items_with_checkin:\" + exc.to_s\n logger.error $@\n end\n end\n logger.info \"end auto_checkin \"\n\n logger.info \"start check confusion\"\n #4) check confusion\n begin\n check_confusion()\n rescue => exc\n #p \"Error at checking confusion:\" + exc.to_s\n logger.error \"Error at checking confusion:\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_checking_confusion') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end check confusion\"\n \n # output directory\n out_dir = \"#{dir_base}/library_check/#{self.id}/\"\n # clear output directory\n Dir.foreach(out_dir){|file| File.delete(out_dir + file) rescue nil} rescue nil\n\n logger.info \"start export resource list\"\n #5) output resource list\n begin\n LibcheckTmpItem.export(out_dir)\n rescue => exc\n p \"Error at exporting resource list:\" + exc.to_s\n logger.error \"Error at exporting resource list:\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_resource_list') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export resource list\"\n\n\n logger.info \"start export resource list (pdf)\"\n #5-2) output resource list (pdf)\n begin\n LibcheckTmpItem.export_pdf(out_dir)\n rescue => exc\n p \"Error at exporting resource list (pdf):\" + exc.to_s\n logger.error \"Error at exporting resource list (pdf):\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_resource_list') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export resource list\"\n\n logger.info \"start export error list (csv,pdf)\"\n #5-3) output error list (csv,pdf)\n begin\n LibcheckTmpItem.export_error_list(out_dir)\n rescue => exc\n p \"Error at exporting error list (csv,pdf):\" + exc.to_s\n p \"Error at export_removing_list (csv,pdf):\" + $@\n logger.error \"Error at exporting error list (csv,pdf):\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_error_list') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export resource list\"\n\n logger.info \"start export not found item list\"\n #6) output not found item list\n begin\n LibcheckNotfoundItem.export(out_dir)\n rescue => exc\n p \"Error at exporting not found item list:\" + exc.to_s\n p \"Error at export_removing_list (csv,pdf):\" + $@\n logger.error \"Error at exporting not found item list:\" + exc.to_s\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_notfound_list') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export not found item list\"\n\n #7) \n logger.info \"start export_removing_list\"\n begin \n Item.export_removing_list(out_dir)\n rescue => exc\n p \"Error at export_removing_list (csv,pdf):\" + exc.to_s\n p \"Error at export_removing_list (csv,pdf):\" + $@\n logger.error \"Error at exporting error list (csv,pdf):\" + exc.to_s\n logger.error \"Error at exporting error list (csv,pdf):\" + $@\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_error_list') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export_removing_list\"\n \n #8) export item register\n logger.info \"start export_item_register\"\n begin\n Item.export_item_register(out_dir)\n rescue => exc\n p \"Error at export_item_register (csv,pdf):\" + exc.to_s\n p \"Error at export_item_register (csv,pdf):\" + $@\n logger.error \"Error at exporting item register (csv,pdf):\" + exc.to_s\n logger.error \"Error at exporting item register (csv,pdf):\" + $@\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_item_register') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export_item_register\" \n\n #9) export detection item list\n logger.info \"start export_detection_list\"\n begin\n LibcheckDetectionItem.export_detection_list(out_dir)\n rescue => exc\n p \"Error at export_detection_list (csv,pdf):\" + exc.to_s\n p \"Error at export_detection_list (csv,pdf):\" + $@\n logger.error \"Error at exporting detection list (csv,pdf):\" + exc.to_s\n logger.error \"Error at exporting detection list (csv,pdf):\" + $@\n self.error_msg = I18n.t('activerecord.errors.messages.library_check.error_at_exporting_detection_list') + \":\" + exc.to_s\n sm_fail!\n return\n end\n logger.info \"end export_detection_list\" \n\n self.operated_at = Time.now\n sm_complete!\n rescue => exc\n logger.error exc\n self.error_msg = exc.to_s\n sm_fail!\n end", "def check_for_stuck_jobs\n Job.incomplete.each do |job|\n if job.stuck_chunks?\n job.priority = 50\n job.save!\n job.resend_stuck_chunks \n elsif job.stuck_packing?\n job.send_pack_request\n end\n end\n end", "def after_process_record (row: , result: , batch_id: )\n get_batch_params batch_id\n REDIS_BATCHES.rpush(@batch_success, row.to_json) if result == 'success'\n REDIS_BATCHES.rpush(@batch_error, row.to_json) if result == 'error'\n REDIS_BATCHES.decr(@batch_counter)\n after_complete_batch unless REDIS_BATCHES.get(@batch_counter).to_i > 0\n rescue => e\n Rails.logger.error \"#{self.name}.#{__method__} - #{e}\"\n end", "def update_status_to_processed\n fail 'child class to implement'\n end", "def post_processing\n @opts.each do |opt|\n if opt.required? && [email protected]?(opt.to_sym)\n fail \"The option #{opt.to_sym} is required\"\n end\n end\n end", "def reserve_and_run_one_job; end", "def failed?; state == 'failed'; end", "def failed?; state == 'failed'; end", "def exercise_method\n\n # => All jobs\n @old = Job.all\n @jobs=Set.new\n @jobs=@old\n @result=Set.new\n # => let remove the singles, independent one\n @jobs.each do |f| \n if f.predecessor_id.nil? && f.successor_id.nil?\n if @result.add?(f).nil?\n return 'Error 1'\n end\n @jobs.delete(f)\n end\n if f.predecessor_id==f.id || f.successor_id==f.id\n raise \"#{f.inspect}\"\n \n return 'Error 0'\n end\n end\n\n # => following successors\n @jobs.each do |f|\n if f.predecessor_id.nil? \n loop do\n if @result.empty?\n @result.add(f)\n elsif @result.add?(f).nil?\n return 'Error 2'\n end\n @jobs.delete(f)\n if !f.successor_id.nil?\n f = Job.find(f.successor_id)\n else\n f=nil\n end\n break if !f \n end\n end\n end\n \n if @jobs.any?\n return 'Error 3'\n end\n return @result\n end", "def recover_from(_error); end", "def error() \n results.close\n end", "def processing\n result = RegisterCheckerApi.job_status(job_name, job_correlation_id)\n return if result == 'RUNNING'\n\n if result == 'SUCCESS'\n session[:job] = nil\n flash[:success] = I18n.t('database_updated')\n redirect_to authenticated_root_path\n else\n redirect_to authenticated_root_path, alert: 'Uploaded file is not valid'\n end\n end", "def process\n raise Error::new(\"This method should be implemented by a subclass\")\n end", "def process_errors\n Sparkql::ErrorsProcessor.new(errors)\n end", "def post_process; end", "def normal_failed?\n return status == PRE_FAILED ||\n status == WORKFLOW_FAILED ||\n status == UPLOADING_RESULTS_VCF_FAILED ||\n status == UPLOADING_RESULTS_SCORE_FAILED\n end", "def prepare_result; end" ]
[ "0.7024513", "0.6798284", "0.67348063", "0.63316077", "0.6287837", "0.62539697", "0.6213479", "0.6212638", "0.6166773", "0.6166773", "0.6166773", "0.61639655", "0.61639655", "0.61639655", "0.6096867", "0.60809845", "0.6070552", "0.6065741", "0.6025575", "0.6021471", "0.60136884", "0.60136884", "0.60136884", "0.60136884", "0.60136884", "0.60136884", "0.60136884", "0.60123044", "0.59517854", "0.5921447", "0.59139794", "0.59057635", "0.586846", "0.586846", "0.5827615", "0.5824826", "0.5794452", "0.5794452", "0.5794141", "0.5780786", "0.5772555", "0.5767306", "0.5760361", "0.575657", "0.57556206", "0.5751117", "0.5751117", "0.5751117", "0.5751117", "0.5751117", "0.5751117", "0.5740466", "0.5740466", "0.5738591", "0.57295966", "0.5727235", "0.5716114", "0.57105654", "0.5703806", "0.5702247", "0.56965655", "0.5694068", "0.56922513", "0.5673675", "0.5673675", "0.5673265", "0.5671306", "0.5666859", "0.5664817", "0.5660278", "0.56473076", "0.564594", "0.5644013", "0.5630051", "0.5626101", "0.56240475", "0.5621654", "0.56144625", "0.56134015", "0.56108946", "0.5608474", "0.5595601", "0.5593526", "0.55925554", "0.55889004", "0.5587199", "0.5585398", "0.5571482", "0.55681115", "0.5558232", "0.5554076", "0.5554076", "0.5535831", "0.5533924", "0.5530922", "0.5529542", "0.5517831", "0.5517006", "0.5498234", "0.54941964", "0.5492748" ]
0.0
-1
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new if !@external_id.nil? && @external_id.to_s.length > 64 invalid_properties.push('invalid value for "external_id", the character length must be smaller than or equal to 64.') end if !@first_name.nil? && @first_name.to_s.length > 128 invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 128.') end if @last_name.nil? invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') end if @last_name.to_s.length > 64 invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 64.') end if @last_name.to_s.length < 1 invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.') end if !@middle_name.nil? && @middle_name.to_s.length > 64 invalid_properties.push('invalid value for "middle_name", the character length must be smaller than or equal to 64.') end if [email protected]? && @language.to_s.length > 32 invalid_properties.push('invalid value for "language", the character length must be smaller than or equal to 32.') end if [email protected]? && @phone.to_s.length > 64 invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 64.') end if [email protected]? && @email.to_s.length > 128 invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 128.') end if !@doc_type.nil? && @doc_type.to_s.length > 32 invalid_properties.push('invalid value for "doc_type", the character length must be smaller than or equal to 32.') end if !@doc_issuer_info.nil? && @doc_issuer_info.to_s.length > 256 invalid_properties.push('invalid value for "doc_issuer_info", the character length must be smaller than or equal to 256.') end if !@doc_series.nil? && @doc_series.to_s.length > 64 invalid_properties.push('invalid value for "doc_series", the character length must be smaller than or equal to 64.') end if !@doc_number.nil? && @doc_number.to_s.length > 64 invalid_properties.push('invalid value for "doc_number", the character length must be smaller than or equal to 64.') end if !@department_code.nil? && @department_code.to_s.length > 64 invalid_properties.push('invalid value for "department_code", the character length must be smaller than or equal to 64.') end if !@department_name.nil? && @department_name.to_s.length > 256 invalid_properties.push('invalid value for "department_name", the character length must be smaller than or equal to 256.') end if !@building_no.nil? && @building_no.to_s.length > 8 invalid_properties.push('invalid value for "building_no", the character length must be smaller than or equal to 8.') end if [email protected]? && @city.to_s.length > 32 invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 32.') end if !@country_code.nil? && @country_code.to_s.length > 8 invalid_properties.push('invalid value for "country_code", the character length must be smaller than or equal to 8.') end if !@country_name.nil? && @country_name.to_s.length > 64 invalid_properties.push('invalid value for "country_name", the character length must be smaller than or equal to 64.') end if [email protected]? && @district.to_s.length > 64 invalid_properties.push('invalid value for "district", the character length must be smaller than or equal to 64.') end if !@flat_no.nil? && @flat_no.to_s.length > 8 invalid_properties.push('invalid value for "flat_no", the character length must be smaller than or equal to 8.') end if !@house_no.nil? && @house_no.to_s.length > 16 invalid_properties.push('invalid value for "house_no", the character length must be smaller than or equal to 16.') end if [email protected]? && @region.to_s.length > 64 invalid_properties.push('invalid value for "region", the character length must be smaller than or equal to 64.') end if !@room_no.nil? && @room_no.to_s.length > 8 invalid_properties.push('invalid value for "room_no", the character length must be smaller than or equal to 8.') end if !@settlement_type.nil? && @settlement_type.to_s.length > 32 invalid_properties.push('invalid value for "settlement_type", the character length must be smaller than or equal to 32.') end if [email protected]? && @street.to_s.length > 64 invalid_properties.push('invalid value for "street", the character length must be smaller than or equal to 64.') end if !@raw_address.nil? && @raw_address.to_s.length > 512 invalid_properties.push('invalid value for "raw_address", the character length must be smaller than or equal to 512.') 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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @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.765058", "0.765058", "0.765058", "0.765058", "0.7638772", "0.7638772", "0.7638772", "0.7638772", "0.7638772", "0.7638772", "0.7638772", "0.7638772", "0.73569804", "0.7336038", "0.72692806", "0.72394663", "0.72318745", "0.7226795", "0.7209003", "0.7177062", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715", "0.7171715" ]
0.0
-1
Check to see if the all the properties in the model are valid
def valid? return false if !@external_id.nil? && @external_id.to_s.length > 64 return false if !@first_name.nil? && @first_name.to_s.length > 128 return false if @last_name.nil? return false if @last_name.to_s.length > 64 return false if @last_name.to_s.length < 1 return false if !@middle_name.nil? && @middle_name.to_s.length > 64 gender_validator = EnumAttributeValidator.new('String', ["M", "F"]) return false unless gender_validator.valid?(@gender) return false if [email protected]? && @language.to_s.length > 32 return false if [email protected]? && @phone.to_s.length > 64 return false if [email protected]? && @email.to_s.length > 128 return false if !@doc_type.nil? && @doc_type.to_s.length > 32 return false if !@doc_issuer_info.nil? && @doc_issuer_info.to_s.length > 256 return false if !@doc_series.nil? && @doc_series.to_s.length > 64 return false if !@doc_number.nil? && @doc_number.to_s.length > 64 return false if !@department_code.nil? && @department_code.to_s.length > 64 return false if !@department_name.nil? && @department_name.to_s.length > 256 return false if !@building_no.nil? && @building_no.to_s.length > 8 return false if [email protected]? && @city.to_s.length > 32 return false if !@country_code.nil? && @country_code.to_s.length > 8 return false if !@country_name.nil? && @country_name.to_s.length > 64 return false if [email protected]? && @district.to_s.length > 64 return false if !@flat_no.nil? && @flat_no.to_s.length > 8 return false if !@house_no.nil? && @house_no.to_s.length > 16 return false if [email protected]? && @region.to_s.length > 64 return false if !@room_no.nil? && @room_no.to_s.length > 8 return false if !@settlement_type.nil? && @settlement_type.to_s.length > 32 return false if [email protected]? && @street.to_s.length > 64 return false if !@raw_address.nil? && @raw_address.to_s.length > 512 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? && [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if [email protected]? && @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 [email protected]? && @name.to_s.length > 31\n return false if [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @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 [email protected]? && @city.to_s.length > 50\n return false if [email protected]? && @state.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if [email protected]? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if [email protected]? && @title.to_s.length > 100\n return false if [email protected]? && @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.7899264", "0.7899264", "0.70971936", "0.7078258", "0.7032224", "0.70312935", "0.6951032", "0.6869895", "0.68580866", "0.68580866", "0.6828718", "0.6823897", "0.6820318", "0.6814491", "0.6794687", "0.675217", "0.66843694", "0.6676567", "0.6667767", "0.6629611", "0.66184616", "0.6608233", "0.6599219", "0.65943044", "0.6584327", "0.6580474", "0.6578107", "0.6558591", "0.6555898", "0.65424126", "0.65369904", "0.65339017", "0.65315765", "0.65312046", "0.6526775", "0.65259147", "0.6520819", "0.6520584", "0.6511063", "0.6498407", "0.6496653", "0.6493521", "0.64911336", "0.6488619", "0.647903", "0.64737064", "0.6467953", "0.64672595", "0.64612556", "0.64601463", "0.6455316", "0.64540696", "0.64479923", "0.6439429", "0.64341897", "0.64312416", "0.6428224", "0.6426183", "0.6412447", "0.64070296", "0.6404443", "0.64035165", "0.6399374", "0.6397994", "0.6385898", "0.63855284", "0.63855284", "0.63855284", "0.63855284", "0.63740456", "0.63673556", "0.6364544", "0.63621795", "0.6360008", "0.6357404", "0.63549054", "0.63549054", "0.63549054", "0.63549054", "0.63548607", "0.63542235", "0.63503146", "0.6344312", "0.6344312", "0.6344312", "0.6344312", "0.6344312", "0.6344312", "0.6344312", "0.6344312", "0.6343598", "0.63406754", "0.63345003", "0.63331914", "0.633136", "0.6329451", "0.6327114", "0.6324789", "0.6324789", "0.6324789", "0.6324789" ]
0.0
-1
Custom attribute writer method with validation
def external_id=(external_id) if !external_id.nil? && external_id.to_s.length > 64 fail ArgumentError, 'invalid value for "external_id", the character length must be smaller than or equal to 64.' end @external_id = external_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\[email protected] 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 first_name=(first_name) if !first_name.nil? && first_name.to_s.length > 128 fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 128.' end @first_name = first_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\[email protected] 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 last_name=(last_name) if last_name.nil? fail ArgumentError, 'last_name cannot be nil' end if last_name.to_s.length > 64 fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 64.' end if last_name.to_s.length < 1 fail ArgumentError, 'invalid value for "last_name", the character length must be great than or equal to 1.' end @last_name = last_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\[email protected] 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 middle_name=(middle_name) if !middle_name.nil? && middle_name.to_s.length > 64 fail ArgumentError, 'invalid value for "middle_name", the character length must be smaller than or equal to 64.' end @middle_name = middle_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\[email protected] 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 gender=(gender) validator = EnumAttributeValidator.new('String', ["M", "F"]) unless validator.valid?(gender) fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}." end @gender = gender 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\[email protected] 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 language=(language) if !language.nil? && language.to_s.length > 32 fail ArgumentError, 'invalid value for "language", the character length must be smaller than or equal to 32.' end @language = language 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\[email protected] 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 phone=(phone) if !phone.nil? && phone.to_s.length > 64 fail ArgumentError, 'invalid value for "phone", the character length must be smaller than or equal to 64.' end @phone = phone 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\[email protected] 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 email=(email) if !email.nil? && email.to_s.length > 128 fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 128.' end @email = email 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\[email protected] 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 doc_type=(doc_type) if !doc_type.nil? && doc_type.to_s.length > 32 fail ArgumentError, 'invalid value for "doc_type", the character length must be smaller than or equal to 32.' end @doc_type = doc_type 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\[email protected] 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 doc_issuer_info=(doc_issuer_info) if !doc_issuer_info.nil? && doc_issuer_info.to_s.length > 256 fail ArgumentError, 'invalid value for "doc_issuer_info", the character length must be smaller than or equal to 256.' end @doc_issuer_info = doc_issuer_info 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\[email protected] 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 doc_series=(doc_series) if !doc_series.nil? && doc_series.to_s.length > 64 fail ArgumentError, 'invalid value for "doc_series", the character length must be smaller than or equal to 64.' end @doc_series = doc_series 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\[email protected] 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 doc_number=(doc_number) if !doc_number.nil? && doc_number.to_s.length > 64 fail ArgumentError, 'invalid value for "doc_number", the character length must be smaller than or equal to 64.' end @doc_number = doc_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\[email protected] 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 department_code=(department_code) if !department_code.nil? && department_code.to_s.length > 64 fail ArgumentError, 'invalid value for "department_code", the character length must be smaller than or equal to 64.' end @department_code = department_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\[email protected] 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 department_name=(department_name) if !department_name.nil? && department_name.to_s.length > 256 fail ArgumentError, 'invalid value for "department_name", the character length must be smaller than or equal to 256.' end @department_name = department_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\[email protected] 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 building_no=(building_no) if !building_no.nil? && building_no.to_s.length > 8 fail ArgumentError, 'invalid value for "building_no", the character length must be smaller than or equal to 8.' end @building_no = building_no 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\[email protected] 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 city=(city) if !city.nil? && city.to_s.length > 32 fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 32.' end @city = city 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\[email protected] 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 country_code=(country_code) if !country_code.nil? && country_code.to_s.length > 8 fail ArgumentError, 'invalid value for "country_code", the character length must be smaller than or equal to 8.' end @country_code = country_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\[email protected] 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 country_name=(country_name) if !country_name.nil? && country_name.to_s.length > 64 fail ArgumentError, 'invalid value for "country_name", the character length must be smaller than or equal to 64.' end @country_name = country_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\[email protected] 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 district=(district) if !district.nil? && district.to_s.length > 64 fail ArgumentError, 'invalid value for "district", the character length must be smaller than or equal to 64.' end @district = district 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\[email protected] 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 flat_no=(flat_no) if !flat_no.nil? && flat_no.to_s.length > 8 fail ArgumentError, 'invalid value for "flat_no", the character length must be smaller than or equal to 8.' end @flat_no = flat_no 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\[email protected] 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 house_no=(house_no) if !house_no.nil? && house_no.to_s.length > 16 fail ArgumentError, 'invalid value for "house_no", the character length must be smaller than or equal to 16.' end @house_no = house_no 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\[email protected] 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 region=(region) if !region.nil? && region.to_s.length > 64 fail ArgumentError, 'invalid value for "region", the character length must be smaller than or equal to 64.' end @region = region 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\[email protected] 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 room_no=(room_no) if !room_no.nil? && room_no.to_s.length > 8 fail ArgumentError, 'invalid value for "room_no", the character length must be smaller than or equal to 8.' end @room_no = room_no 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\[email protected] 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 settlement_type=(settlement_type) if !settlement_type.nil? && settlement_type.to_s.length > 32 fail ArgumentError, 'invalid value for "settlement_type", the character length must be smaller than or equal to 32.' end @settlement_type = settlement_type 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\[email protected] 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 street=(street) if !street.nil? && street.to_s.length > 64 fail ArgumentError, 'invalid value for "street", the character length must be smaller than or equal to 64.' end @street = street 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\[email protected] 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 raw_address=(raw_address) if !raw_address.nil? && raw_address.to_s.length > 512 fail ArgumentError, 'invalid value for "raw_address", the character length must be smaller than or equal to 512.' end @raw_address = raw_address 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\[email protected] 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
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && url == o.url && external_id == o.external_id && first_name == o.first_name && last_name == o.last_name && middle_name == o.middle_name && birth_date == o.birth_date && gender == o.gender && language == o.language && phone == o.phone && allow_phone_contact == o.allow_phone_contact && email == o.email && allow_email_contact == o.allow_email_contact && notes == o.notes && date_created == o.date_created && date_modified == o.date_modified && ext_date_created == o.ext_date_created && ext_date_modified == o.ext_date_modified && doc_type == o.doc_type && doc_issuer_info == o.doc_issuer_info && doc_series == o.doc_series && doc_number == o.doc_number && department_code == o.department_code && department_name == o.department_name && doc_issue_date == o.doc_issue_date && doc_expiration_date == o.doc_expiration_date && is_closed == o.is_closed && merged_to == o.merged_to && building_no == o.building_no && city == o.city && country_code == o.country_code && country_name == o.country_name && district == o.district && flat_no == o.flat_no && house_no == o.house_no && region == o.region && room_no == o.room_no && settlement_type == o.settlement_type && street == o.street && raw_address == o.raw_address && cards == o.cards && view_url == o.view_url && preferences == o.preferences 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 eql?(object)\n self.class.equal?(object.class) && attributes == object.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 equals(rule)\n element == rule.element && attributes == rule.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 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 xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend", "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 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.72932124", "0.7189842", "0.70406866", "0.7007727", "0.68881786", "0.68621296", "0.67085785", "0.66622394", "0.661674", "0.6586541", "0.65844727", "0.65818226", "0.65561724", "0.6545535", "0.6508076", "0.64813215", "0.64577025", "0.64179385", "0.6414028", "0.6414028", "0.6414028", "0.6413171", "0.6381426", "0.63794506", "0.6261132", "0.6248216", "0.62396336", "0.62170404", "0.62027985", "0.6185393", "0.6183358", "0.61645603", "0.6130997", "0.6116409", "0.60984176", "0.6085103", "0.60793746", "0.60665256", "0.6007008", "0.59990627", "0.59962237", "0.5992054", "0.59861875", "0.59839666", "0.59775484", "0.59522015", "0.5942759", "0.59304726", "0.5926056", "0.5919373", "0.5919373", "0.59087664", "0.58807796", "0.58804125", "0.5872191", "0.5858762", "0.58584523", "0.5856515", "0.58547515", "0.5848128", "0.584702", "0.5838001", "0.580043", "0.57966435", "0.5789952", "0.5782547", "0.57804406", "0.5776911", "0.5768212", "0.5760853", "0.57585114", "0.5754842", "0.57537735", "0.5751662", "0.5739966", "0.57313424", "0.57282376", "0.57258046", "0.57248116", "0.57227004", "0.57146037", "0.57104737", "0.5706446", "0.57053125", "0.5702263", "0.56904846", "0.56762695", "0.5645565", "0.5641733", "0.56226075", "0.56152636", "0.55932444", "0.5588176", "0.5585386", "0.55700636", "0.55527586", "0.55477995", "0.5546062", "0.5543475", "0.55395126", "0.55284184" ]
0.0
-1
Calculates hash code according to all attributes.
def hash [id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].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 # :nodoc:\n identifier.hash ^ requirement.hash\n end", "def hash\n 0\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 ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end", "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].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 hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\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 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() source.hash ^ target.hash; end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n 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 attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end" ]
[ "0.71187764", "0.7038497", "0.7038497", "0.7038497", "0.7038497", "0.7038497", "0.7038497", "0.7038497", "0.68957126", "0.67830646", "0.6707231", "0.6699251", "0.6687822", "0.6669884", "0.64887464", "0.64610004", "0.64610004", "0.64441663", "0.64113593", "0.6394231", "0.63886976", "0.6371609", "0.63554424", "0.6336284", "0.6266637", "0.6252377", "0.6245255", "0.6229722", "0.62172586", "0.62136954", "0.62128717", "0.61960685", "0.6190796", "0.61851734", "0.6184136", "0.6184136", "0.6152752", "0.6144127", "0.6142732", "0.6137587", "0.612751", "0.61212015", "0.61207736", "0.6120732", "0.61028445", "0.60987854", "0.60924363", "0.6091898", "0.60803974", "0.607942", "0.6049799", "0.60315377", "0.6021446", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.6018785", "0.60166895", "0.60137993", "0.59962875", "0.59875983", "0.5985851", "0.59782195", "0.59712523", "0.59682417", "0.5968196", "0.5959121", "0.5956449", "0.59414905", "0.5940927", "0.59234726", "0.59230155", "0.5904077", "0.5901585", "0.585265", "0.5845751", "0.58444715", "0.5843664", "0.58431464", "0.58429325", "0.5841238", "0.58391136", "0.5836764", "0.58249235", "0.5823425", "0.58224803", "0.5816545", "0.5814419", "0.581328", "0.5809152", "0.58069646", "0.58069646", "0.58069646", "0.5806275", "0.5806275" ]
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_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 CheckpointCrmClient.const_get(type).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 temp_model = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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 = UltracartClient.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.7330926", "0.7274019", "0.72504056", "0.7245751", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.7218884", "0.7213926", "0.71909", "0.7183136", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71712995", "0.71712995", "0.71712995", "0.71712995", "0.71712995", "0.71632504", "0.71549904", "0.71473306", "0.71413666", "0.71413666", "0.7141116", "0.7141116", "0.7141116", "0.7133874", "0.7133874", "0.7133874", "0.7133874", "0.71333444", "0.71333444", "0.7127688", "0.7125744", "0.71210617", "0.71210617", "0.71190786", "0.71184087", "0.711393", "0.7113519", "0.7113519", "0.7113516", "0.71119875", "0.71119875", "0.71119875", "0.7105169", "0.7105169", "0.7105169", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7102596", "0.7102596", "0.7102596", "0.7101596", "0.7101596", "0.7101596", "0.70996517", "0.70996517", "0.7097952", "0.7097185", "0.70965225" ]
0.0
-1
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.901102", "0.8951408", "0.847116", "0.83399886", "0.8337297", "0.8337297", "0.8332112", "0.82551175", "0.8145114", "0.8143849", "0.8134524", "0.8126343", "0.8092803", "0.80863005", "0.8072428", "0.80386686", "0.80304825", "0.80054814", "0.80054814", "0.80054814", "0.80054814", "0.79618967", "0.79618967", "0.79618967", "0.79618967", "0.79538035", "0.7944262", "0.7918815", "0.79082245", "0.7883917", "0.7883917", "0.7883481", "0.7882636", "0.7882636", "0.78753656", "0.78753656", "0.78753656", "0.78753656", "0.78753656", "0.78753656", "0.78753656", "0.78664535", "0.78664535", "0.78655005", "0.78655005", "0.78498703", "0.78498703", "0.78498703", "0.78498703", "0.7807684", "0.7784341", "0.7784341", "0.77672994", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334", "0.7760334" ]
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.842897", "0.83478487", "0.83478487" ]
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_s\n to_hash.to_s\n end", "def to_s\n to_hash.to_s\n end", "def read\n value = super\n value = value.to_hash if value.respond_to?(:to_hash)\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 _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.6721064", "0.6721064", "0.66705114", "0.66585946", "0.65890485", "0.6454646", "0.6417013", "0.6417013", "0.6384306", "0.6348656", "0.630476", "0.6225539", "0.6153802", "0.6104665", "0.6081452", "0.6081452", "0.6072844", "0.6038052", "0.60226446", "0.5938669", "0.5903004", "0.5903004", "0.5903004", "0.5903004", "0.5903004", "0.58898455", "0.58898455", "0.5883896", "0.5883896", "0.586848", "0.5855506", "0.58348554", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58231765", "0.58046985", "0.58046985", "0.57998747", "0.5781839", "0.5775767", "0.5775767", "0.5775767", "0.5775767", "0.5775767", "0.5775767", "0.5770725", "0.5770725", "0.57697994", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734", "0.57690734" ]
0.0
-1
GET /categories GET /categories.json
def index resource_params = {} resource_params[:f] = params[:f].to_json if params[:f].present? resource_params[:page] = params[:page].present? ? params[:page] : 1 resource_params[:per] = params[:per].present? ? params[:per] : 12 @categories = Category.all(params: resource_params) @categories = Kaminari::PaginatableArray.new(@categories,{ limit: @categories.http_response['X-limit'].to_i, offset: @categories.http_response['X-offset'].to_i, total_count: @categories.http_response['X-total'].to_i }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def categories\n get('venues/categories').categories\n end", "def index\n categories = Category.all\n render json:categories\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def get_categories\n @categories = Category.all\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end", "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def categories\n parsed_json['data']\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n render json: category\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def index\n respond_with Category.all\n end", "def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end", "def index\n @categories = CategoryService.index\n end", "def show\n render json: @category\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'\n end\n # resource path\n local_var_path = '/categories'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Category>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def categories(make, year)\n make_id = get_object_id make\n response = get_url \"Categories/#{make_id}/#{year}\"\n response_obj = JSON.parse response\n response_obj[\"GetCategoriesResult\"].map{|r| Models::Category.from_response_hash(r)}\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def categories\n add_to_query restrict_kind: 'category'\n end", "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def index\n @categories = Category.roots\n end", "def get_categories(opts = {})\n data, _status_code, _headers = get_categories_with_http_info(opts)\n data\n end", "def index\n @categories = Category.all\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @categories=Category.root\n respond_with @categories\n end", "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "def category\n client.categories.find(data[\"categoryId\"])\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def categories\n category\n end", "def get_categories(opts = {})\n data, _status_code, _headers = get_categories_with_http_info(opts)\n return data\n end", "def categories\n []\n end", "def index\n\t@categories = Category.all\n\tend", "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def index\n render json: Category.order('name ASC').all\n end", "def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end", "def show\n render json: @categoria\n end", "def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def index\n @categories = Category.all\n end", "def get_categories(project_id_or_key)\n get(\"projects/#{project_id_or_key}/categories\")\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def categories\n raw_categories.to_hashugar\n end", "def event_categories(options = {})\n response = connection.get do |req|\n req.url \"events/categories\", options\n end\n return_error_or_body(response, response.body.response.categories)\n end", "def index\n @service_categories = ServiceCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_categories }\n end\n end", "def categories_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.categories_list ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Category>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#categories_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end", "def all\n render json: Cat.all\n end", "def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end" ]
[ "0.8390047", "0.83304346", "0.8320247", "0.78100723", "0.77435976", "0.7568599", "0.7512776", "0.7415717", "0.7387233", "0.73714656", "0.73706967", "0.73706967", "0.7368256", "0.7347074", "0.73320836", "0.7318429", "0.72868323", "0.72664523", "0.7229807", "0.7223272", "0.72172403", "0.72150654", "0.7192817", "0.71727514", "0.7121547", "0.7100738", "0.70767266", "0.7049057", "0.70437014", "0.7034108", "0.70339864", "0.70326936", "0.7029167", "0.70166403", "0.6997692", "0.69958776", "0.6994664", "0.69833064", "0.6971254", "0.69646984", "0.69564646", "0.6899742", "0.6897191", "0.6889821", "0.6886114", "0.6885961", "0.6873665", "0.6871688", "0.68493974", "0.6815992", "0.68099004", "0.6803213", "0.6800467", "0.67736703", "0.6771646", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.6766389", "0.67616576", "0.67616177", "0.6759702", "0.67535156", "0.6735489", "0.6728561", "0.6726154", "0.67245436", "0.67054135", "0.67050505", "0.6699279", "0.66987884", "0.66874367", "0.6681066", "0.6680382", "0.66782266", "0.6672367", "0.6638391", "0.6635226", "0.6626268", "0.6621368", "0.6617301" ]
0.0
-1
GET /categories/1 GET /categories/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def index\n categories = Category.all\n render json:categories\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def show\n render json: category\n end", "def show\n render json: @category\n end", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def category\n client.categories.find(data[\"categoryId\"])\n end", "def categories\n get('venues/categories').categories\n end", "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def get_categories\n @categories = Category.all\n end", "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end", "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def index\n @categories = CategoryService.index\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def category(id = nil)\n res = Connection.get('categories', id)\n id.nil? ? Category.all(res) : Category.new(res)\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end", "def index\n respond_with Category.all\n end", "def show\n render json: @categoria\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def index\n @categories = Category.roots\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n\t@categories = Category.all\n\tend", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n render json: Category.order('name ASC').all\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def category\n Category.find(params[:id])\n end", "def index\n @categories=Category.root\n respond_with @categories\n end", "def show\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end", "def show\n\t @category = Category.find(params[:id])\n\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @category }\n\t end\n\tend", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def index\n #expires_in 24.hours\n #fresh_when last_modified: @max, public: true\n @roots = @categories.roots\n @keyword = String.new\n\n @roots.each do |r|\n @keyword << r.name << \" \"\n end\n\n if params[:id]\n if c = Category.find(params[:id])\n redirect_to c\n return\n else\n flash.now[:error] = \"Category not found.\"\n end\n end\n\n respond_to do |format|\n format.html\n format.json {render json:@categories}\n end\n\n end", "def categories\n parsed_json['data']\n end", "def index\n @categories = Category.order(\"name ASC\")\n @latest_reviews = Review.limit(3).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def show\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post_category }\n end\n end", "def index\n @categories = Category.paginate(:page => params[:page], per_page:30)\n @number = Category.count\n\n respond_to do |format|\n format.html\n format.json { render json: Category.all }\n end\n end", "def index\n @categorias = Categoria.where(ativo: true)\n \t\n render json: @categorias\n end", "def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end", "def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end", "def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end", "def show\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cat }\n end\n end", "def show\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_category }\n end\n end", "def index\n @categories = collections_config.values\n end", "def index\n @taxonomy_categories = TaxonomyCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomy_categories }\n end\n end", "def fetch_categories(count = ENV['DEFAULT_CATEGORY_COUNT'].to_i)\n max_category = 18418\n uri = \"http://jservice.io/api/categories?count=#{count}&offset=#{1+rand(max_category/count.to_f)}\"\n request = HTTParty.get(uri)\n data = JSON.parse(request.body)\nend" ]
[ "0.7878061", "0.7865138", "0.7847367", "0.78421843", "0.7415738", "0.7407003", "0.73067135", "0.7306128", "0.7306128", "0.72814614", "0.7234994", "0.7184808", "0.7156553", "0.71328664", "0.7124016", "0.70659167", "0.7043319", "0.703876", "0.7034461", "0.7033088", "0.7012336", "0.7011274", "0.69989944", "0.6994295", "0.69898754", "0.6980876", "0.695718", "0.6948995", "0.6933987", "0.6871907", "0.68566537", "0.68558574", "0.68516314", "0.68437624", "0.6834854", "0.6834854", "0.6834854", "0.6834854", "0.6834854", "0.6834854", "0.6834854", "0.6820768", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68195134", "0.68112385", "0.6795976", "0.6770524", "0.675246", "0.67313266", "0.6728228", "0.6726232", "0.67203325", "0.6719478", "0.67184544", "0.67128724", "0.6707611", "0.6707555", "0.67072976", "0.66982484", "0.66973794", "0.6695135", "0.6654644", "0.66536057", "0.66403806", "0.6638536", "0.66369665", "0.66135746", "0.6612607", "0.6606915", "0.6590192", "0.65861875", "0.6574454", "0.6572768", "0.6572013", "0.65690047", "0.65683043", "0.6567285", "0.6561307", "0.6557465" ]
0.0
-1
POST /categories POST /categories.json
def create @category = Category.new(category_params) respond_to do |format| if @category.save format.html { redirect_to @category, notice: 'Category was successfully created.' } format.json { render :show, status: :created, location: @category } else format.html { render :new } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n json_create(category_params, Category)\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def create\n category = @current_user.categories.create!(category_params)\n render json: { category: category }\n end", "def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def create\n @category = Category.new(category_params)\n authorize! :create, @category\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def post_category(category_name, options={ })\n self.post('/categories.json',\n options.merge(\n :body => { :category => {\n :name => category_name\n } }.to_json\n )\n )['category']\n end", "def create\n category = Category.create(category_params)\n\n \n if category\n render json:{\n status: :created,\n category: category}\n else\n render json: { status: 500 }\n end\n end", "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end", "def addCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.new(name: params[:name])\n status = c.save\n error = \"\"\n if(c.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 @category = Category.create(params[:category])\n respond_with(@category, location: categories_url)\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def create\n category = Category.create!(category_params)\n render json: {\n :html => render_to_string(\n :partial => \"setups/category\",\n :layout => false,\n :locals => {:category => category})\n }\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html {\n redirect_to @category, notice: 'Category was successfully created.'\n }\n format.json {\n render json: @category, status: :created, location: @category\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @category = Category.new(params[:category]) \n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:created_category_success)}\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :created }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categories_post = CategoriesPost.new(categories_post_params)\n\n respond_to do |format|\n if @categories_post.save\n format.html { redirect_to @categories_post, notice: 'Categories post was successfully created.' }\n format.json { render :show, status: :created, location: @categories_post }\n else\n format.html { render :new }\n format.json { render json: @categories_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @category = @collection.categories.new(category_params)\n\n if @category.save\n ActionCable.server.broadcast 'categories',\n title: @category.title,\n collection_id: @category.collection_id\n head :ok\n else\n\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created!!' }\n format.json { render json: @category, status: :created, location: @category }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_category = Post::Category.new(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to @post_category, notice: 'Category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully created.' }\n format.json { render json: @categoria, status: :created, location: @categoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to Category.find(@category.category_id), notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = CategoryService.create\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Категория добавлена.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # @category = Category.new(params[:category])\n @category = current_user.categories.build(params[:category])\n\n respond_to do |format|\n if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie utworzono kategorię.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n # format.html { render action: \"new\" }\n format.html { redirect_to categories_path, :flash => { :error => 'Nie udało się utworzyć kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end", "def index\n categories = Category.all\n render json:categories\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def create\n @categories = Category.all\n\n @category = Category.create(category_params)\n flash[:notice]=\"Catégorie créer avec succès!!!\"\n end", "def create\n @categories = Category.where(validity: true)\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:category_created) }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end", "def create\r\n @category = Category.new(categories_params)\r\n\r\n respond_to do |format|\r\n if @category.save\r\n format.html { redirect_to articles_path, notice: 'Profile was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @category.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n\t\t@cat = Cat.new(cat_params)\n\n\t\tif @cat.save\n\t\t\t# cat_url(@cat) == /cat/{@cat.id}\n\t\t\tredirect_to cat_url(@cat)\n\t\telse\n\t\t\trender :new\n\t\t\t# render json: @cat.errors.full_messages, status: :unprocessable_entity\n\t\tend \n\tend", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Категория была успешно создана'}\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to root_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n flash.alert = @category.errors.full_messages\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.create(params[:category])\n \n if @category.save\n redirect_to categories_path\n else\n render 'new'\n end\n \n end", "def create\n @category = PostCategory.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def create\n admins_only do\n @category = Category.new(category_params)\n @category.name = params[:category][:name].to_s.camelcase\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to category_index_path, notice: 'Category was successfully created.' }\n format.json { render action: 'index', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}}, status: :unprocessable_entity\n end\n\n else\n @categoria = Categoria.new(parametros_categoria)\n\n if @categoria.save\n render json: @categoria, status: :created\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end\n end", "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend", "def create\n @cat = Cat.new(params[:cat])\n\n respond_to do |format|\n if @cat.save\n format.html { redirect_to @cat, notice: 'Cat was successfully created.' }\n format.json { render json: @cat, status: :created, location: @cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно создана\" }\n format.json { render :show, status: :created, location: adminpanel_categories_path }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n\n user = User.find(@user_id)\n post = user.posts.build(params_post)\n \n category = Category.find_by_id(params[:category])\n return render json: { error: \"Category not found\"}, status: 404 if category.nil?\n \n post.category = category\n \n \n if post.save\n render json: post, status: :created\n else \n render json: post.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(category_params)\n @category.user_id = current_user.id\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t('create.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @category = Category.new(params[:category])\n @user.categories << @category\n #TODO: error handling\n #TODO: AJAX this\n if @user.save\n redirect_to user_path(@user)\n else\n render \"new\"\n end\n end", "def create\n @post_category = current_user.post_categories.build(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to [:client,:post_categories], notice: 'Post category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"index\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_category = RecipeCategory.new(params[:recipe_category])\n\n respond_to do |format|\n if @recipe_category.save\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully created.' }\n format.json { render json: @recipe_category, status: :created, location: @recipe_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_url, notice: 'Category was successfully created.' }\n end\n end\n end", "def create\n @category_form_url = forum_categories_path\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend", "def create\n @category = Category.new(params[:category])\n @category.category_group_id ||= params[:category_group_id]\n\n respond_to do |format|\n if @category.save\n save_curated_items(@category)\n format.html { redirect_to(categories_path, notice: 'Category was successfully created.') }\n format.json { render json: @category, status: :created, location: @category }\n else\n set_flash_messages_from_errors(@category)\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxonomy_category = TaxonomyCategory.new(params[:taxonomy_category])\n\n respond_to do |format|\n if @taxonomy_category.save\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully created.' }\n format.json { render json: @taxonomy_category, status: :created, location: @taxonomy_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n if @category.save\n flash[:notice] = 'Categoria criada com sucesso.'\n else\n flash[:notice] = 'Erro ao salvar a categoria.'\n end\n\n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to categories_path}\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @category = Category.new(category_params)\n\n\n begin\n Category.transaction do # un ActiveRecord\n #@full_category.each do |f|\n #Category.create(f)\n #f.save!\n #end\n @category.save!\n end\n #Código de éxito\n rescue => e\n raise ActiveRecord::Rollback #Lanzamos el rollback de nuevo a saco\n #Seguimos con las acciones que queramos, como notificar, etc.\n end\n\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n category = Documents::Category.create(category_params)\n if category.save\n redirect_to categories_path\n else\n redirect_to categories_path, alert: I18n.t('admin.categories.validation_error')\n end\n end", "def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end", "def create_category_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.create_category ...\"\n end\n # resource path\n local_var_path = \"/categories\"\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[:'category'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'CategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#create_category\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @category = Category.new(params[:category])\n @title = \"Neue Kategorie erstellen\"\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = CategoryService.create(category_params)\n\n respond_to do |format|\n unless @category.errors.any?\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Created!', \"Category [#{@category.description}] was successfully created.\") \n }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mk_categoria = MkCategoria.new(mk_categoria_params)\n\n respond_to do |format|\n if @mk_categoria.save\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully created.' }\n format.json { render :show, status: :created, location: @mk_categoria }\n else\n format.html { render :new }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to [:admin, @category], notice: t('messages.created', model:Category.model_name.human) }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_category = Admin::Category.new(admin_category_params)\n\n respond_to do |format|\n if @admin_category.save\n format.html { redirect_to admin_categories_url }\n format.json { render :show, status: :created, location: @admin_category }\n else\n format.html { render :new }\n format.json { render json: @admin_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories=(value)\n @categories = value\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end" ]
[ "0.7738549", "0.74339235", "0.72349083", "0.71634054", "0.7124031", "0.70645165", "0.705568", "0.695861", "0.6956783", "0.6903891", "0.6838659", "0.6821712", "0.68190134", "0.6807838", "0.678525", "0.66138625", "0.6566919", "0.65661913", "0.65567696", "0.6523676", "0.65186286", "0.65124106", "0.6507293", "0.64973867", "0.64973867", "0.64973867", "0.64973867", "0.64973867", "0.6491015", "0.64895564", "0.6476546", "0.64730144", "0.6470093", "0.6455681", "0.6438828", "0.6436862", "0.64220095", "0.63991785", "0.63877624", "0.6384297", "0.6379078", "0.63786995", "0.6376995", "0.63656723", "0.63593614", "0.6358317", "0.6356693", "0.6355196", "0.6354375", "0.6352758", "0.6345056", "0.63400453", "0.63052505", "0.63035464", "0.62976784", "0.6287918", "0.6284682", "0.6269106", "0.62629235", "0.626244", "0.6258697", "0.6254516", "0.62478405", "0.62459856", "0.62374765", "0.62301993", "0.62244", "0.6220316", "0.6219008", "0.6210804", "0.6199586", "0.61989397", "0.6196965", "0.6195727", "0.61901325", "0.6185757", "0.61840874", "0.6181882", "0.61759615", "0.61596483", "0.6154083", "0.6150745", "0.6144707", "0.6140831", "0.6128935", "0.6128884", "0.61209923", "0.6117174", "0.6109629", "0.610358" ]
0.6418686
46
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json
def update respond_to do |format| if @category.update_attributes(category_params) format.html { redirect_to @category, notice: 'Category was successfully updated.' } format.json { render :show, status: :ok, location: @category } else format.html { render :edit } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n json_update(category,category_params, Category)\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update! {admin_categories_path}\n end", "def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end", "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end", "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n @categories=RecipeCategory.all\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end", "def editCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.update(name: params[:name])\n error = \"\"\n if(c.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!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: t('update.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to :back, notice: 'category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html {\n redirect_to @category, notice: 'Category was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n # recipe_params[:ingredient_lists_attributes].each do |list|\n # list.each do |item|\n # item[:ingredient_attributes] = Ingredient.where(name: item[:ingredient_attributes].name).first_or_create\n # end\n # end\n \n # category_ids = params[:recipe][:categories_attributes].map { |k,v| v[:id] }\n # #pry.debugger\n \n # recipe_params.merge({ category_ids: category_ids })\n \n\n respond_to do |format|\n \n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_category_edit\n @user = User.where(contact: params[:contact]).first\n @user.categories.destroy_all\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-categories\", data: \"categories updated\"}, status: :ok\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to @cat, notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n _update_topics \n format.html { redirect_to action: \"edit\", notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to @post_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n category= Category.find(params[:id])\n category.update(category_params)\n \n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update category_params\n format.html { redirect_to admin_categories_url, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end", "def update\n authorize! :update, @category\n \n @category.modifier = current_user\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_url + '#' + @category.slug, notice: t('.success') }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: \"Category was successfully updated.\" }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category.update(category_params)\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Категория изменена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def putCategory( category_id, language, name)\n params = Hash.new\n params['category_id'] = category_id\n params['language'] = language\n params['name'] = name\n return doCurl(\"put\",\"/category\",params)\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to [:admin, @category], notice: t('messages.updated', model:Category.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to category_index_path, notice: 'Categorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n # format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie zaktualizowano kategorię.' }\n format.json { head :no_content }\n else\n # format.html { render action: \"edit\" }\n format.html { redirect_to units_path, :flash => { :error => 'Nie udało się zaktualizować kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalog_category.update(catalog_category_params)\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :ok, location: @catalog_category }\n else\n format.html { render :edit }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n return unless admin?\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post_category = current_user.post_categories.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to [:client,@post_category], notice: 'Post category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # update attribute\n if @category.update_attributes(category_params)\n # flash message\n flash.now[:success] = \"更新完了しました。\"\n # get category data\n all_categories\n else\n render 'edit'\n end\n end", "def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n @title = 'Kategorie ' + @category.title + ' bearbeiten'\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n intent_request = @api_ai_client.create_intents_request\n response = intent_request.update(@category.intent_id, param_options)\n\n if response.is_a?(Hash) && response[:status][:code].eql?(200)\n\n contexts_templates = { contexts: category_params[:contexts].split(\",\"), templates: category_params[:templates].split(\",\") }\n\n if @category.update(category_params.merge(contexts_templates))\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n else\n @notice = response.message\n\n format.html { render :new }\n format.json { render json: { error: response.message }, status: response.code}\n end\n end\n end", "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to :back, notice: 'Kategori diperbarui.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n #My product belongs_to category relationship won't work so I made this so when I update it reflects changes\n category_name = set_category.name\n Product.all.each do |product|\n product.category = category_params[:name] if product.category == category_name\n product.save\n end\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n category = Documents::Category.find(params[:id])\n category.update!(category_params)\n redirect_to categories_path\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Updated!', \"Category [#{@category.description}] was successfully updated.\") \n }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_group_category.update(api_v1_group_category_params)\n format.html { redirect_to @api_v1_group_category, notice: 'Group category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно обновлена\" }\n format.json { render :show, status: :ok, location: adminpanel_categories_path }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Категория была успешно изменена' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_url, notice: 'Category was successfully updated.' }\n end\n end\n end", "def update\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n if @kategory.update_attributes(params[:kategory])\n format.html { redirect_to @kategory, notice: 'Kategory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schema_category.update(schema_category_params)\n format.html { redirect_to schema_categories_path, notice: 'Schema category was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_category }\n else\n format.html { render :edit }\n format.json { render json: @schema_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category , notice: 'Información actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @category.errors , status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_category.category==\"noone\"\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n else\n render :file => \"/public/404.html\",:status => \"404\"\n end\n \n end", "def update_categories(cats=[])\n rescue_extra_data\n cats = cats.to_i\n old_categories = categories.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")\n delete_categories = old_categories - cats\n news_categories = cats - old_categories\n term_relationships.where(\"term_taxonomy_id in (?)\", delete_categories ).destroy_all if delete_categories.present?\n news_categories.each do |key|\n term_relationships.create(:term_taxonomy_id => key)\n end\n update_counters(\"categories\")\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n flash[:success] = 'Category was successfully updated.'\n format.html { redirect_to admin_category_url(@category) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend" ]
[ "0.7692541", "0.76002717", "0.72122926", "0.69430083", "0.69147646", "0.68174535", "0.6781423", "0.6712822", "0.66981524", "0.66931385", "0.66563374", "0.66518235", "0.6651313", "0.66455007", "0.6606881", "0.65994096", "0.6570957", "0.6570957", "0.6554447", "0.65348464", "0.6499948", "0.64760303", "0.6465012", "0.6463636", "0.6447567", "0.6447567", "0.6447567", "0.6447567", "0.6447567", "0.6447567", "0.6447567", "0.6446885", "0.6445108", "0.64354676", "0.6425877", "0.6404802", "0.6398117", "0.6397342", "0.63867646", "0.63712156", "0.63689286", "0.63614106", "0.63614106", "0.63602877", "0.635827", "0.63504726", "0.63498646", "0.63454443", "0.6333137", "0.6325338", "0.6323661", "0.63140064", "0.6313047", "0.6304492", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.6298676", "0.625837", "0.6256286", "0.6252758", "0.6248299", "0.62477565", "0.6242413", "0.62419957", "0.6231747", "0.6229775", "0.6213711", "0.6213574", "0.6213316", "0.6211167", "0.62064534", "0.6203476", "0.62033504", "0.62024665", "0.6198553", "0.6189735", "0.6188076", "0.61843246", "0.61827266", "0.6171157", "0.6169644", "0.61685896", "0.6166008", "0.6152873", "0.61479074", "0.6136016", "0.61348724", "0.6131454" ]
0.635001
46
DELETE /categories/1 DELETE /categories/1.json
def destroy @category.destroy respond_to do |format| format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path }\n format.json { head :no_content }\n end\n end", "def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.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 @category.destroy\n render json: { notice: 'Categoria eliminada exitosamente' }\n end", "def destroy\n category = set_category\n if category.destroy\n head :no_content\n else\n render json: { status: 500 }\n end\n \n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = @collection.category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alien_category.destroy\n respond_to do |format|\n format.html { redirect_to alien_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: t('destroy.notice', name: t('activerecord.models.category')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to cm_post_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categoria_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = current_mall.categories.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_wmall_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n head :no_content\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_good_categories_url }\n format.json { head :no_content }\n end\n end", "def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete CATEGORIES, id ).code\n\t\t\t\t\tend\n\t\t\t\tend", "def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post_category = Post::Category.find(params[:id])\n @post_category.destroy\n\n respond_to do |format|\n format.html { redirect_to post_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categ.destroy\n respond_to do |format|\n format.html { redirect_to categs_url, notice: 'Categ was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_db.destroy\n respond_to do |format|\n format.html { redirect_to category_dbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria.destroy\n respond_to do |format|\n format.html { redirect_to categorias_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorie = Categorie.find(params[:id])\n @categorie.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n end\n end", "def destroy\n @admin_category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.delete\n end", "def destroy\n @recipe_category = RecipeCategory.find(params[:id])\n @recipe_category.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: \"Journal was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_scenic_spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @desserts_category.destroy\n respond_to do |format|\n format.html { redirect_to desserts_categories_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @level_category = LevelCategory.find(params[:id])\n @level_category.destroy\n\n respond_to do |format|\n format.html { redirect_to level_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cat.destroy\n respond_to do |format|\n format.html { redirect_to cats_url, notice: 'Cat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n begin\n @category.destroy\n rescue ActiveRecord::DeleteRestrictionError\n error = 'Эта категория не может быть удалена, пока с ней связан хоть один файл.'\n ensure\n respond_to do |format|\n format.html { redirect_to categories_url, notice: error }\n format.json { head :ok }\n end\n end\n end", "def destroy\n @kategory = Kategory.find(params[:id])\n @kategory.destroy\n\n respond_to do |format|\n format.html { redirect_to kategories_url }\n format.json { head :ok }\n end\n end", "def destroy\n return unless admin?\n\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_path, notice: \"Category was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @categor.destroy\n respond_to do |format|\n format.html { redirect_to categors_url, notice: 'Categor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to \"index\", notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = current_user.user_categories.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorias_tipo = CatTipo.find(params[:id])\n @categorias_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to cat_tipos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cathegory.destroy\n respond_to do |format|\n format.html { redirect_to cathegories_url, notice: 'Cathegory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #locates the category to be destroyed\n @category = Category.find(params[:id])\n #Creates an array of all categories\n @all_categories = Category.all\n #creates an empty hash\n @all_categories_hash = {}\n #calls function to populate & sort @all_categories_hash\n sort_categories()\n #calls function to destroy the category\n destroy_category(@category)\n\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n authorize! :destroy, @category\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to backend_shop_branch_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to(cats_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mk_categoria.destroy\n respond_to do |format|\n format.html { redirect_to mk_categories_url, notice: 'Mk categoria was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_type = CategoryType.find(params[:id])\n @category_type.destroy\n\n respond_to do |format|\n format.html { redirect_to category_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorie_droit.destroy\n respond_to do |format|\n format.html { redirect_to categorie_droits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.delete_context #there you go, this little fatty kills em all!\n #fred and post have equal methods, makes it slim and easy\n\n respond_to do |format|\n format.html { redirect_to categories_url, :method => :get, :notice => t(:deleted_category_success) }\n format.json { head :ok }\n end\n end", "def destroy\n @dish_category.destroy\n respond_to do |format|\n format.html { redirect_to dish_categories_url, notice: 'Категория блюда удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n CategoryService.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n #######\n format.html { redirect_to category_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \tauthorize! :destroy, @category\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_category.destroy\n respond_to do |format|\n format.html { redirect_to status_categories_url, notice: 'Status category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_category = current_user.post_categories.find(params[:id])\n @post_category.destroy\n\n respond_to do |format|\n format.html { redirect_to [:client, :post_categories] }\n format.json { head :no_content }\n end\n end", "def destroy\n @course_category = CourseCategory.find(params[:id])\n @course_category.destroy\n\n respond_to do |format|\n format.html { redirect_to course_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: '分类删除成功~' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gt_category.destroy\n respond_to do |format|\n format.html { redirect_to gt_categories_url, notice: 'Gt category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cover_cat = CoverCat.find(params[:id])\n @cover_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cover_cats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n end", "def destroy\n @category = DishCategory.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Категория удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to management_categories_url, notice: 'Category was successfully removed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.78262806", "0.7735309", "0.763867", "0.7488627", "0.74725026", "0.7423611", "0.7399044", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7384889", "0.7378353", "0.7378353", "0.7378353", "0.7371836", "0.73661655", "0.7362431", "0.7334779", "0.7334779", "0.733343", "0.73252547", "0.7318166", "0.7294225", "0.72858506", "0.72825265", "0.7282173", "0.7245426", "0.7241004", "0.72371924", "0.7193636", "0.7186497", "0.71837664", "0.7167329", "0.716671", "0.7146598", "0.71456736", "0.71454", "0.7141549", "0.7128463", "0.7127294", "0.7125977", "0.71218824", "0.71151793", "0.7113733", "0.71123374", "0.7106755", "0.7101639", "0.7101167", "0.70985866", "0.7097672", "0.70842886", "0.70772535", "0.70764834", "0.7075973", "0.70757073", "0.7073489", "0.707158", "0.7064111", "0.705559", "0.7051514", "0.7051231", "0.70475066", "0.70474344", "0.7045757", "0.70425045", "0.70404637", "0.703079", "0.70129836", "0.7004961", "0.6999108", "0.6998305", "0.6995902", "0.6993201", "0.69926", "0.6987264", "0.6987264", "0.6987264", "0.6978412", "0.6976748" ]
0.70824283
72
Use callbacks to share common setup or constraints between actions.
def set_category @category = Category.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 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 default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def category_params params.require(:category).permit(:title, :ancestry) 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
ruledata = <<~DATA 0: 1 2 1: "a" 2: 1 3 | 3 1 3: "b" DATA ruledata = <<~DATA 0: 4 1 5 1: 2 3 | 3 2 2: 4 4 | 5 5 3: 4 5 | 5 4 4: "a" 5: "b" DATA
def flatten(id, rules) rule = rules[id] if rule.kind_of?(String) [rule] else rule.reduce([]) do |sum, subrule| sum + subrule.map { |s| flatten(s, rules) } .reduce { |prod, s| prod.product(s) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rule(tag, data, id)\n @rules ||= {}\n @rules[tag] ||= {}\n @rules[tag][id] ||= data.each_with_object({}) do |(key, value), style|\n if value.is_a? Hash\n handle_rule_raw_hash tag, key, value\n else\n style[key] = value\n end\n end\n end", "def parse_rules(rules)\n rules.split(\"\\n\").each_with_object({}) do |rule, rule_hsh|\n mdata = /\\s{3}(\\w+)\\s/.match(rule)\n case mdata.nil? ? nil : mdata[1]\n when 'match'\n rule_hsh[:match] = [] unless rule_hsh.include?(:match)\n rule_hsh[:match] << rule.sub('match', '').strip\n when 'set'\n rule_hsh[:set] = [] unless rule_hsh.include?(:set)\n rule_hsh[:set] << rule.sub('set', '').strip\n when 'continue'\n rule_hsh[:continue] = nil unless rule_hsh.include?(:continue)\n rule_hsh[:continue] = rule.sub('continue', '').strip.to_i\n when 'description'\n rule_hsh[:description] = nil unless rule_hsh.include?(:description)\n rule_hsh[:description] = rule.sub('description', '').strip\n end\n end\n end", "def parse_rules(rules)\n rules.split(\"\\n\").map do |rule|\n rule_name,r1,r2,r3,r4 = rule.match(/^([\\w\\s]+): (\\d+)-(\\d+) or (\\d+)-(\\d+)$/i).captures\n [rule_name,[(r1.to_i..r2.to_i),(r3.to_i..r4.to_i)]]\n end.to_h\n end", "def data_to_ruleset \n\n\t\ttemp_array = []\n\t\trule_name = self.fctr_code.blank? ? (\"rule_\" + self.id.to_s) : self.fctr_code + \": \"\n\n\t\tif not self.where_country.blank?\n\t\t\ttemp_array << (\"c_where_country = \" + self.where_country.subfctr_name)\n\t\tend\n\n\t\tif not self.where_zone.blank?\n\t\t\ttemp_array << (\"c_where_zone = \" + self.where_zone.subfctr_name)\n\t\tend\n\n\t\tif not self.where_network.blank?\n\t\t\ttemp_array << (\"c_where_network = \" + self.where_network.subfctr_name)\n\t\tend\n\n\t\tif not self.where_custom.blank?\n\t\t\ttemp_array << (\"c_where_custom = \" + self.where_custom.subfctr_name)\n\t\tend\n\n\t\tif temp_array.size > 0\n\t\t\treturn rule_name + temp_array.join(\", \")\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend", "def add(rule); end", "def parse_rule(input = T.unsafe(nil)); end", "def rule; end", "def rule; end", "def rule; end", "def render_rule(data)\n render_block data.values.reduce(&:merge).to_h\n end", "def visitRule(elem, data)\r\n @@log.debug(\"XmlRuleVisitor::visitRule\")\r\n @@log.debug(elem.inspect)\r\n\r\n\r\n ruleAlias = elem.attributes['Name']\r\n ruleData = @context.rules[ruleAlias]\r\n raise \"Rule data not found: #{ruleAlias}\" unless (ruleData.kind_of? Rule)\r\n\r\n ruleName = ruleData.name\r\n\r\n ruleCond = \"\"\r\n elem.each_element do |child|\r\n if (\"Condition\" == child.name)\r\n ruleCond = visit(child, ruleCond)\r\n break\r\n end\r\n end\r\n\r\n ifActions = \"\"\r\n elem.each_element do |child|\r\n if (\"IfActions\" == child.name)\r\n ifActions = visit(child, ifActions)\r\n break\r\n end\r\n end\r\n\r\n elseActions = \"\"\r\n elem.each_element do |child|\r\n if (\"ElseActions\" == child.name)\r\n elseActions = visit(child, elseActions)\r\n break\r\n end\r\n end\r\n\r\n\r\n ifMsgs = \"\" # Generate 'If' messages\r\n ruleData.ifMsgs.each do |msgTxt|\r\n ifMsgs += generateMsg(msgTxt)\r\n end # ifMsgs.each\r\n\r\n elseMsgs = \"\" # Generate 'Else' messages\r\n ruleData.elseMsgs.each do |msgTxt|\r\n elseMsgs += generateMsg(msgTxt)\r\n end # ifMsgs.each\r\n\r\n\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n if (ruleName != ruleAlias)\r\n aliasStmt = <<EOF\r\nalias(rule, #{ruleName}, \"#{ruleAlias}\");\r\nEOF\r\n end # if rulename...\r\n\r\n # Create rule template\r\n output = <<EOF\r\n#{aliasStmt}\r\n// ############################################\r\n// #{ruleName}\r\n\r\nrule #{ruleName}()\r\n if(\r\n #{ruleCond}\r\n )\r\n then\r\n #{ifActions}\r\n#{ifMsgs}\r\nEOF\r\n\r\n if (elseActions.length > 0)\r\n output += <<EOF\r\n else\r\n #{elseActions}\r\n#{elseMsgs}\r\nEOF\r\n end\r\n\r\n output += <<EOF\r\n end\r\nend // rule\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n data += output\r\n return data\r\n end", "def initialize(content_data)\n if content_data.nil?\n raise PacketFormatError, 'Wrong formatted S2A_RULES response packet.'\n end\n\n super SteamPacket::S2A_RULES_HEADER, content_data\n\n rules_count = @content_data.short\n\n @rules_hash = {}\n\n rules_count.times do\n rule = @content_data.cstring\n value = @content_data.cstring\n\n break if rule.empty?\n\n @rules_hash[rule] = value\n end\n end", "def visit_rule(node)\n rules = node.rule[0].split(',')\n\n rules.each do |rule|\n append_child_rules(node, rule.strip)\n end\n end", "def init_rule(rule)\n # categories get square brackets and ? becomes <, also split rule\n r = rule.gsub(/\\p{Lu}/,'[\\\\0]').gsub('?', '<').split('/')\n unless r[0].gsub!('#', '*').nil?\n # change # to * (in TRG) or % (in CHG) when not with _\n r[1].gsub!(/(?<!_)#(?!_)/, '%')\n end\n r[1].gsub!(/(?<!@)\\-/, '#') # - becomes # for word-insertions\n r # return ruleset as initialised array\n end", "def get_rule_detail(h_filters, filtertype, filter, term)\n\n # Check filtertype and assign correct global hash ($h_filters or $h_filters6) to filters\n case filtertype\n when :ipv4_input_filter\n filters = $h_filters\n when :ipv4_output_filter\n filters = $h_filters\n when :ipv6_input_filter\n filters = $h_filters6\n when :ipv6_output_filter\n filters = $h_filters6\n else\n p \"get_rule_detail: filtertype not supported - #{filtertype}\" if $opts[:debug]\n end\n\n # Initialize vars, sets, etc\n result = '' ### To pass status back to calling method\n srcaddr = Set.new\n dstaddr = Set.new\n sport = Set.new\n dport = Set.new\n protocol = Set.new\n dscp = Set.new\n svcnegate = 'false' ### if type icmp-except need to negate the rule\n\n # Update corresponding hash based on object type from term's sources hash branch\n filters[filter][term][:source].each do |object, objtype|\n\n case objtype\n when :'source-address'\n srcaddr.add(object)\n\n when :'destination-address'\n dstaddr.add(object)\n\n when :address\n srcaddr.add(object)\n dstaddr.add(object)\n\n when :'source-port'\n sport.add(object)\n\n when :'destination-port'\n dport.add(object)\n\n when :port\n dport.add(object)\n\n when :'source-prefix-list'\n srcaddr.add(object)\n\n # The following code snipet is no longer used, but can be activated to add each address in the prefix list\n # to the dstaddr set. Instead, we are using the name to reference an address group that should\n # have been created for each prefix list\n # $h_prefix_lists[object].each do |addr|\n # srcaddr.add(addr)\n # end\n\n when :'destination-prefix-list'\n dstaddr.add(object)\n\n # The following code snipet is no longer used, but can be activated to add each address in the prefix list\n # to the dstaddr set. Instead, we are using the name to reference an address group that should\n # have been created for each prefix list\n # $h_prefix_lists[object].each do |addr|\n # dstaddr.add(addr)\n # end\n\n when :'prefix-list'\n srcaddr.add(object)\n dstaddr.add(object)\n\n when :protocol\n protocol.add(object)\n\n when :'next-header'\n protocol.add(object)\n\n when :'icmp-type'\n protocol.add(:icmp)\n dport.add(object)\n\n when :'icmp-type-except'\n protocol.add(:icmp)\n dport.add(object)\n svcnegate = 'true'\n\n when :dscp\n dscp.add(object)\n\n else\n result += \"get_rule_detail: object type: #{objtype}, not supported for filter: #{filter}, term: #{term}\"\n p \"get_rule_detail: object type: #{objtype}, not supported for filter: #{filter}, term: #{term}\"\\\n if $opts[:verbose] || $opts[:debug]\n end\n end\n\n action = h_filters[filter][term][:action]\n\n return srcaddr, dstaddr, sport, dport, protocol, action, svcnegate, result, dscp\nend", "def rule_by_id; end", "def initialize(content_data)\n if content_data.nil?\n raise SteamCondenser::Error::PacketFormat, 'Wrong formatted S2A_RULES response packet.'\n end\n\n super BasePacket::S2A_RULES_HEADER, content_data\n\n rules_count = @content_data.short\n\n @rules_hash = {}\n\n rules_count.times do\n rule = @content_data.cstring\n value = @content_data.cstring\n\n break if rule.empty?\n\n @rules_hash[rule] = value\n end\n end", "def run(rule)\n end", "def pcdata!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = PCDATA\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 406:9: {...}? => (~ '<' )+\n raise FailedPredicate( \"PCDATA\", \" !@tagMode \" ) unless ( ( !@tagMode ) )\n # at file 406:25: (~ '<' )+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0.between?( 0x0, 0x3b ) || look_8_0.between?( 0x3d, 0xffff ) )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 406:26: ~ '<'\n if @input.peek( 1 ).between?( 0x0, 0x3b ) || @input.peek( 1 ).between?( 0x3d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\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__, 50 )\n\n end", "def iterate rule, seed\n \"00#{seed}00\".chars.each_cons(3).map { |c| rule[c.join.to_i 2] }.join\nend", "def add_rule(rhs)\n nonterm = '~[' + @nonterm.succ! + ']'\n @rules[nonterm] = rhs\n nonterm\n end", "def rules_from_step_content\n @rules_from_step_content ||= content_items.each_with_object({}) do |content_item, items|\n items[content_item[\"content_id\"]] = build_rule(content_item)\n end\n end", "def apply_one_rule!(rule, input)\n output = []\n while first = input.shift\n if first.kind_of?(String)\n rule.doc = @doc\n rule.apply(first, input, output)\n else\n output << first\n end\n end\n output\n end", "def _consume_rule seq\n # rule = rulename defined-as elements c-nl\n\n rulename = seq.shift\n raise \"BUG: bad rulename #{rulename.inspect}\" if rulename.nil? || rulename.type != :name\n\n raise \"truncated rule for #{rulename.value}\" if seq.empty?\n\n defined_as = nil\n case (op = seq.shift).type\n when :EQ, :EQ_ALT\n defined_as = op\n else\n raise \"unexpected #{op.type.inspect}, expected :EQ or :EQ_ALT\"\n end\n\n definition = _alternation(seq)\n raise \"unexpected #{seq.first.type.inspect} after rule\" unless seq.empty? || seq.first.type == :endline\n [rulename, defined_as, definition]\n end", "def rule_ref!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 57)\n\n type = RULE_REF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 585:4: 'a' .. 'z' ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*\n match_range(?a, ?z)\n # at line 585:13: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*\n loop do #loop 17\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0.between?(?0, ?9) || look_17_0.between?(?A, ?Z) || look_17_0 == ?_ || look_17_0.between?(?a, ?z)) \n alt_17 = 1\n\n end\n case alt_17\n when 1\n # at line \n if @input.peek(1).between?(?0, ?9) || @input.peek(1).between?(?A, ?Z) || @input.peek(1) == ?_ || @input.peek(1).between?(?a, ?z)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break #loop 17\n end\n end\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__, 57)\n\n end", "def parse_rule\n @s.skip(/[\\t\\ ]+/)\n name = @s.scan(RULE_RE)\n return if !name\n op = @s.scan(/\\ *:\\ */)\n raise \"expect op : #{@s.inspect}\" if !op\n rule_body = parse_rule_body\n raise \"expect rule body : #{@s.inspect}\" if !rule_body\n eol = parse_eols\n raise \"expect eol : #{@s.inspect}\" if !eol\n PegRule.new Token.new(\"name.rule\", name), rule_body\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 102 )\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 923:5: ( '$' | '_' | 'a' .. 'z' | 'A' .. 'Z' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '$' )*\n if @input.peek(1) == 0x24 || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 924:5: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '$' )*\n while true # decision 31\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == 0x24 || look_31_0.between?( 0x30, 0x39 ) || look_31_0.between?( 0x41, 0x5a ) || look_31_0 == 0x5f || look_31_0.between?( 0x61, 0x7a ) )\n alt_31 = 1\n\n end\n case alt_31\n when 1\n # at line \n if @input.peek(1) == 0x24 || @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 31\n end\n end # loop for decision 31\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__, 102 )\n\n end", "def matching_rules(number, rules)\n result = []\n rules.each do |rule, ranges|\n ranges.each do |range|\n next if number < range[0] || number > range[1]\n\n result.append(rule)\n break\n end\n end\n result\nend", "def parse_rule( rule )\n\t\tpredecessor, successor = rule.strip.split( /\\s*(?:->|→)\\s*/, 2 )\n\t\tself.log.debug \"Parsed rule: %p -> %p\" % [ predecessor, successor ]\n\t\tsuccessor_set = Set.new( successor.chars )\n\n\t\traise \"Invalid rule: predecessor %p is not in the variable set %p\" %\n\t\t\t[ predecessor, self.variables ] unless self.variables.include?( predecessor )\n\t\traise \"Invalid rule: successor %p contains characters not in the alphabet %p\" %\n\t\t\t[ successor, self.alphabet ] unless self.alphabet.superset?( successor_set )\n\n\t\treturn predecessor, successor\n\tend", "def parse_horizontal_rule; end", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def rd!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 51 )\n\n type = RD\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 350:5: d= ( ( DIGIT )* ) '3' ( 'R' | 'r' ) ( 'D' | 'd' )\n # at line 350:7: ( ( DIGIT )* )\n # at line 350:8: ( DIGIT )*\n # at line 350:8: ( DIGIT )*\n while true # decision 3\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == 0x33 )\n look_3_1 = @input.peek( 2 )\n\n if ( look_3_1.between?( 0x30, 0x39 ) )\n alt_3 = 1\n\n end\n elsif ( look_3_0.between?( 0x30, 0x32 ) || look_3_0.between?( 0x34, 0x39 ) )\n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line 350:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 3\n end\n end # loop for decision 3\n\n match( 0x33 )\n if @input.peek(1) == 0x52 || @input.peek(1) == 0x72\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x44 || @input.peek(1) == 0x64\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\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__, 51 )\n\n end", "def qos_add_rule(rule_name,rule_id,data,qkey)\n # RJS\n # add code to check to see if we are tying to add a rule that already exists\n # if so exit with a warning message\n # \n base = qkey + '-rule-' + rule_id +'-'\n if data.has_key?('source')\n self.msg(rule_name,:debug, \"qos_add\", \"found source:\"+ data['source'].to_s)\n if data['source'] == \"any\"\n self.msg(rule_name, :debug, 'qos_add_rule', \"found any\")\n @ff.select_list(:name, 'sym_net_obj_src').select_value('ANY')\n #@ff.link(:text, 'Apply').click\n self.msg(rule_name, :info, base + 'source-any', 'done')\n else\n sources = data['source']\n sources.each do |source,src_info|\n self.msg(rule_name, :info, base + 'source-' +source, 'done')\n if source == 'ip_address' \n self.msg(rule_name, :debug, 'qos_add_rule', src_info)\n @ff.select_list(:name, 'sym_net_obj_src').select_value('USER_DEFINED')\n qos_add_ip(rule_name,src_info)\n @ff.link(:text, 'Apply').click\n elsif source == 'ip_subnet' \n self.msg(rule_name, :debug, 'qos_add_rule', \"subnet = \" +src_info)\n @ff.select_list(:name, 'sym_net_obj_src').select_value('USER_DEFINED')\n qos_add_2_ip(rule_name,src_info,1)\n @ff.link(:text, 'Apply').click\n elsif source =='ip_range'\n self.msg(rule_name, :debug, 'qos_add_rule', \"range = \" +src_info)\n @ff.select_list(:name, 'sym_net_obj_src').select_value('USER_DEFINED')\n qos_add_2_ip(rule_name,src_info,2)\n @ff.link(:text, 'Apply').click\n elsif source =='mac'\n self.msg(rule_name, :debug, 'qos_add_rule', \"mac = \" +src_info)\n @ff.select_list(:name, 'sym_net_obj_src').select_value('USER_DEFINED')\n qos_add_mac(rule_name,src_info)\n self.msg(rule_name, :debug, 'qos_add_rule', \"mac is done \")\n @ff.link(:text, 'Apply').click\n elsif source =='host'\n self.msg(rule_name, :debug, 'qos_add_rule', \"host = \" +src_info)\n @ff.select_list(:name, 'sym_net_obj_src').select_value('USER_DEFINED')\n qos_add_host(rule_name,src_info)\n @ff.link(:text, 'Apply').click\n elsif source =='dhcp_option'\n self.msg(rule_name, :debug, 'qos_add_rule', \"dhcp = \" +src_info)\n @ff.select_list(:name, 'sym_net_obj_src').select_value('USER_DEFINED')\n qos_add_dhcp_option(rule_name,src_info)\n @ff.link(:text, 'Apply').click\n elsif source =='discovered_hosts'\n self.msg(rule_name, :debug, 'qos_add_rule', \"discovered_hosts \" + src_info)\n host_list = src_info.split(',')\n self.msg(rule_name, :debug, 'qos_add_host', \"host_list\" +host_list.to_s)\n disc_host= @ff.select_list(:name, 'sym_net_obj_src').getAllContents\n # for each host int the config data scan the select list to see if that\n # host is in the pull down. If so select it, if not print an error\n #\n host_list.each do |host|\n found = false\n self.msg(rule_name, :debug, 'qos_add_host', \"processing host\" +host.to_s)\n disc_host.each do |el|\n if host.strip == el\n @ff.select_list(:name, 'sym_net_obj_src').select(el)\n found = true\n end\n end \n if found == false\n self.msg(rule_name, :error, 'qos_add_rule', \"cannot find discovered_hosts \" + host.strip)\n end\n end\n\n #@ff.link(:text, 'Apply').click\n end\n end\n end\n end\n if data.has_key?('destination')\n self.msg(rule_name,:debug,\"qos_add\", \" found destination:\")\n self.msg(rule_name, :debug, 'qos_add_rule', data['destination'])\n if data['destination'] == \"any\"\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('ANY')\n #@ff.link(:text, 'Apply').click\n self.msg(rule_name, :info, base + 'dest-any', 'done')\n else\n dests = data['destination']\n dests.each do |dest,dest_info|\n self.msg(rule_name, :info, base + 'dest-'+dest, 'done')\n if dest =='ip_address'\n self.msg(rule_name, :debug, 'qos_add_rule', dest_info)\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('USER_DEFINED')\n qos_add_ip(rule_name,dest_info)\n @ff.link(:text, 'Apply').click\n elsif dest =='ip_subnet'\n self.msg(rule_name, :debug, 'qos_add_rule', \"subnet = \" +dest_info)\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('USER_DEFINED')\n qos_add_2_ip(rule_name,dest_info,1)\n @ff.link(:text, 'Apply').click\n elsif dest =='ip_range'\n self.msg(rule_name, :debug, 'qos_add_rule', \"range = \" +dest_info)\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('USER_DEFINED')\n qos_add_2_ip(rule_name,dest_info,2)\n @ff.link(:text, 'Apply').click\n elsif dest =='mac'\n self.msg(rule_name, :debug, 'qos_add_rule', \"mac = \" +dest_info)\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('USER_DEFINED')\n qos_add_mac(rule_name,dest_info)\n self.msg(rule_name, :debug, 'qos_add_rule', \"mac is done \")\n @ff.link(:text, 'Apply').click\n elsif dest =='host'\n self.msg(rule_name, :debug, 'qos_add_rule', \"host = \" +dest_info)\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('USER_DEFINED')\n qos_add_host(rule_name,dest_info)\n @ff.link(:text, 'Apply').click\n elsif dest =='dhcp_option'\n self.msg(rule_name, :debug, 'qos_add_rule', \"dhcp = \" +dest_info)\n @ff.select_list(:name, 'sym_net_obj_dst').select_value('USER_DEFINED')\n qos_add_dhcp_option(rule_name,dest_info)\n @ff.link(:text, 'Apply').click\n elsif dest =='discovered_hosts'\n self.msg(rule_name, :debug, 'qos_add_rule', \"discovered_hosts \" + dest_info)\n host_list = dest_info.split(',')\n self.msg(rule_name, :debug, 'qos_add_host', \"host_list\" +host_list.to_s)\n disc_host= @ff.select_list(:name, 'sym_net_obj_dst').getAllContents\n # for each host int the config data scan the select list to see if that\n # host is in the pull down. If so select it, if not print an error\n #\n host_list.each do |host|\n found = false\n self.msg(rule_name, :debug, 'qos_add_host', \"processing host\" +host.to_s)\n disc_host.each do |el|\n if host.strip == el\n @ff.select_list(:name, 'sym_net_obj_dst').select(el)\n found = true\n end\n end\n if found == false\n self.msg(rule_name, :error, 'qos_add_rule', \"cannot find discovered_hosts \" + host.strip)\n end\n end\n\n #@ff.link(:text, 'Apply').click\n end\n\n end\n end\n end\n if data.has_key?('protocol')\n self.msg(rule_name,:debug,\"qos_add\", \" found protocol:\")\n protos [email protected]_list(:name, 'svc_service_combo').getAllContents\n if protos.include?(\"Show All Services\")\n self.msg(rule_name,:debug,\"qos_add\", \" displaying all services:\")\n @ff.select_list(:name, 'svc_service_combo').select(\"Show All Services\")\n end\n protos [email protected]_list(:name, 'svc_service_combo').getAllContents\n protocols = data['protocol']\n protocols.each do |proto,proto_info|\n self.msg(rule_name, :info, base + 'protocol-'+ proto, 'done')\n if proto == 'named' \n self.msg(rule_name, :debug, 'qos_add_rule', \"named info = \" +proto_info.to_s)\n proto_info.each do |proto_instance| \n if protos.include?(proto_instance)\n @ff.select_list(:name, 'svc_service_combo').select(proto_instance)\n else\n self.msg(rule_name,:debug,\"qos_add\", \"protocol \" + proto_instance.to_s + \" not found\")\n end\n end\n end\n if proto == 'user_defined' \n qos_user_defined_proto(rule_name,proto_info)\n end\n end\n end\n if data.has_key?('dscp')\n self.msg(rule_name,:debug,\"qos_add\", \" found dscp:\")\n @ff.checkbox(:id, 'dscp_check_box_').set\n dscp_vals = data['dscp'].split(',')\n if dscp_vals.length == 2\n @ff.text_field(:name, 'dscp_check_val').set(dscp_vals[0].strip) \n @ff.text_field(:name, 'dscp_check_mask').set(dscp_vals[1].strip) \n self.msg(rule_name, :info, base + 'dscp' , 'done')\n else\n self.msg(rule_name,:error,\"qos_add\", \" must specify dscp and mask\")\n end \n end\n if data.has_key?('priority')\n self.msg(rule_name,:debug,\"qos_add\", \" found priority:\")\n @ff.checkbox(:id, 'prio_check_box_').set\n regx=Regexp.new data['priority']\n @ff.select_list(:name, 'prio_check_combo').select_value(regx)\n self.msg(rule_name, :info, base + 'priority' , 'done')\n end\n if data.has_key?('packet_length')\n self.msg(rule_name,:debug,\"qos_add\", \" found packet_length:\")\n @ff.checkbox(:id, 'length_check_box_').set\n @ff.select_list(:name, 'length_check_type').select_value(\"0\")\n len_vals = data['packet_length'].split(',')\n if len_vals.length == 2\n @ff.text_field(:name, 'length_check_from').set(len_vals[0].strip) \n @ff.text_field(:name, 'length_check_to').set(len_vals[1].strip) \n self.msg(rule_name, :info, base + 'packet_length' , 'done')\n else\n self.msg(rule_name,:error,\"qos_add\", \" must specify from and to lengths for packet_length\")\n end \n end\n if data.has_key?('data_length')\n self.msg(rule_name,:debug,\"qos_add\", \" found data_length:\")\n @ff.checkbox(:id, 'length_check_box_').set\n @ff.select_list(:name, 'length_check_type').select_value(\"1\")\n len_vals = data['data_length'].split(',')\n if len_vals.length == 2\n @ff.text_field(:name, 'length_check_from').set(len_vals[0].strip) \n @ff.text_field(:name, 'length_check_to').set(len_vals[1].strip) \n self.msg(rule_name, :info, base + 'data_length' , 'done')\n else\n self.msg(rule_name,:error,\"qos_add\", \" must specify from and to lengths data_length\")\n end \n end\n if data.has_key?('dscp_auto')\n self.msg(rule_name,:debug,\"qos_add\", \" found specify_dscp:\")\n @ff.checkbox(:id, 'length_check_box_').set\n self.msg(rule_name, :info, base + 'dscp_auto' , 'done')\n end\n if data.has_key?('set_dscp')\n self.msg(rule_name,:debug,\"qos_add\", \" found specify_dscp:\")\n @ff.checkbox(:id, 'set_dscp_check_').set\n if data['set_dscp'] == 'auto'\n @ff.select_list(:name, 'set_dscp').select_value(\"1\")\n else\n @ff.select_list(:name, 'set_dscp').select_value(\"2\")\n dscp_vals = data['set_dscp'].split(',')\n if dscp_vals.length == 2\n @ff.text_field(:name, 'qos_dscp_edit').set(dscp_vals[0].strip) \n @ff.text_field(:name, 'qos_dscp_mask').set(dscp_vals[1].strip) \n else\n self.msg(rule_name,:error,\"qos_add\", \" must specify dscp and mask when setting dscp vals\")\n end \n end \n self.msg(rule_name, :info, base + 'set_dscp' , 'done')\n end\n if data.has_key?('set_priority')\n self.msg(rule_name,:debug,\"qos_add\", \" found set_priority:\")\n @ff.checkbox(:id, 'set_priority_').set\n regx=Regexp.new data['set_priority']\n @ff.select_list(:name, 'qos_8021p_combo').select_value(regx)\n self.msg(rule_name, :info, base + 'set_priority' , 'done')\n end\n if data.has_key?('apply')\n self.msg(rule_name,:debug,\"qos_add\", \" found apply:\")\n if data['apply'] == \"packet\"\n @ff.select_list(:name, 'qos_on_conn').select_value(\"0\")\n end\n if data['apply'] == \"connection\"\n @ff.select_list(:name, 'qos_on_conn').select_value(\"1\")\n end\n self.msg(rule_name, :info, base + 'apply' , 'done')\n \n end\n if data.has_key?('logging')\n self.msg(rule_name,:debug,\"qos_add\", \" found logging:\")\n if data['logging'] == 1\n @ff.checkbox(:id, 'rule_log_').set\n end\n if data['logging'] == 0\n @ff.checkbox(:id, 'rule_log_').clear\n end\n self.msg(rule_name, :info, base + 'logging' , 'done')\n end\n # rjs\n # do when here\n if data.has_key?('when')\n self.msg(rule_name,:debug,\"qos_rule\", \" found when\")\n if data['when'] == 'always'\n @ff.select_list(:name, 'schdlr_rule_id').select(\"Always\")\n else\n @ff.select_list(:name, 'schdlr_rule_id').select(\"User Defined\")\n qos_scheduler(rule_name,data['when'])\n end\n self.msg(rule_name, :info, base + 'scheduler' , 'done')\n end\n #\n @ff.link(:text, 'Apply').click\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def visitRule(elem, data)\r\n @@log.debug(\"XmlVisitor::visitRule\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def rule(rule)\r\n\r\n # Rule output is generated in GdlDoc.visitRule()\r\n return rule.src\r\n\r\n end", "def command(rule, vars)\n raise \"Invalid rule name '#{rule}'.\" unless valid_id(rule)\n @file.write(\"rule #{rule}\\n description = #{rule}\\n\")\n var_set(vars)\n end", "def get_rule(rule)\n @rules[rule]\n end", "def chain_rule\n output = []\n variables.each_with_index do |variable, i|\n j = i - 1\n given = j < 0 ? [] : variables[0..i - 1]\n output << {variable => given}\n end\n output\n end", "def add\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n add_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 334:6: ( 'A' | 'a' ) ( 'D' | 'd' ) ( 'D' | 'd' )\n if @input.peek( 1 ).between?( T__48, T__49 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__42, T__43 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__42, T__43 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n memoize( __method__, add_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end", "def rules\n @rules ||= {}\n end", "def push(rule, dest=@rules)\n rule = rule.parse_rule if rule.kind_of? String\n if @rules.has_key? rule.head\n @rules[rule.head].push(rule.daughters)\n else\n @rules[rule.head] = [rule.daughters]\n end\n end", "def node_rule rule:\n label = make_label rule.values\n attrs = rule # assign all rule attributes\n\n add_node :Rule, label, attrs\n end", "def nd!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = ND\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 349:5: d= ( ( DIGIT )* ) '2' ( 'N' | 'n' ) ( 'D' | 'd' )\n # at line 349:7: ( ( DIGIT )* )\n # at line 349:8: ( DIGIT )*\n # at line 349:8: ( DIGIT )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == 0x32 )\n look_2_1 = @input.peek( 2 )\n\n if ( look_2_1.between?( 0x30, 0x39 ) )\n alt_2 = 1\n\n end\n elsif ( look_2_0.between?( 0x30, 0x31 ) || look_2_0.between?( 0x33, 0x39 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 349:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n match( 0x32 )\n if @input.peek(1) == 0x4e || @input.peek(1) == 0x6e\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x44 || @input.peek(1) == 0x64\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\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__, 50 )\n\n end", "def process(process_id, plan, data)\n message = data[:message] || data[\"message\"] \n data[:matches] = []\n data[:misses] = []\n \n match_words.each do |match_word|\n filter = case match_type\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_ALL\n /^#{match_word}$/i\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_WORD\n /\\b#{match_word}\\b/i\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_BEGIN_WITH\n /^#{match_word}/i\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_END_WITH\n /#{match_word}$/i\n end\n \n if filter =~ message\n RulesEngine::Process.auditor.audit(process_id, \"found #{match_word}\", RulesEngine::Process::AUDIT_INFO)\n data[:matches] << match_word\n else\n RulesEngine::Process.auditor.audit(process_id, \"missed #{match_word}\", RulesEngine::Process::AUDIT_INFO)\n data[:misses] << match_word\n end\n end\n \n unless data[:matches].empty?\n case workflow_action\n when 'stop_success'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS)\n when 'stop_failure'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE)\n when 'start_workflow'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, workflow_code)\n else #'next'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT)\n end\n end\n \n RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT)\n end", "def qos_add_ip(rule_name,data)\n \n addr_list = data.split(',')\n self.msg(rule_name, :debug, 'qos_add_rule', \"addr_list\" +addr_list.to_s)\n \n addr_list.each do |ip_data|\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"processing address\" +ip_data.to_s)\n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('1')\n \n if ip_data.size > 0\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"set ip address\" +ip_data)\n str_ip_data = ip_data.strip\n octets=str_ip_data.split('.')\n @ff.text_field(:name, 'ip0').set(octets[0])\n @ff.text_field(:name, 'ip1').set(octets[1])\n @ff.text_field(:name, 'ip2').set(octets[2])\n @ff.text_field(:name, 'ip3').set(octets[3])\n @ff.link(:text, 'Apply').click\n \n end # end of if\n \n end # end of each\n \n end", "def parse_rule(rule)\n # Same tricks as before\n rule = BAG_REGEX\n .match(rule)\n .named_captures\n .transform_keys(&:to_sym)\n # Except we transform the children into children nodes\n .tap { |cs| cs[:children] = parse_child_rule(cs[:children]) }\n\n { rule[:color] => rule[:children] }\nend", "def rule(val); @rule = val; self; end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 336:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 336:31: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x30, 0x39 ) || look_4_0.between?( 0x41, 0x5a ) || look_4_0 == 0x5f || look_4_0.between?( 0x61, 0x7a ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\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__, 32 )\n\n end", "def check_rule(rule)\n\n\t if rule.include? 'twitter_lang'\n\t\t rule = handle_lang_operators rule\n\t end\n\n\t if rule.include? 'has:lang'\n\t\t rule = handle_has_lang rule\n\t end\n\n\t if rule.include? '_contains:'\n\t\t rule = handle_contains_operators rule\n\t end\n\n\n\t if rule.include? 'country_code:'\n\t\t rule = handle_country_code_operators rule\n\t end\n\n\t rule\n\n end", "def game_rules\n \trules = <<-EOF\nGreed is a dice game played among 2 or more players, using 5\nsix-sided dice.\n\n== Playing Greed\n\nEach player takes a turn consisting of one or more rolls of the dice.\nOn the first roll of the game, a player rolls all five dice which are\nscored according to the following:\n\n Three 1's => 1000 points\n Three 6's => 600 points\n Three 5's => 500 points\n Three 4's => 400 points\n Three 3's => 300 points\n Three 2's => 200 points\n One 1 => 100 points\n One 5 => 50 points\n\nA single die can only be counted once in each roll. For example,\na \"5\" can only count as part of a triplet (contributing to the 500\npoints) or as a single 50 points, but not both in the same roll.\n\nThe dice not contributing to the score are called the non-scoring\ndice. \"3\" and \"4\" are non-scoring dice in the first example. \"3\" is\na non-scoring die in the second, and \"2\" is a non-score die in the\nfinal example.\n\nAfter a player rolls and the score is calculated, the scoring dice are\nremoved and the player has the option of rolling again using only the\nnon-scoring dice. If all of the thrown dice are scoring, then the\nplayer may roll all 5 dice in the next roll.\n\nThe player may continue to roll as long as each roll scores points. If\na roll has zero points, then the player loses not only their turn, but\nalso accumulated score for that turn. If a player decides to stop\nrolling before rolling a zero-point roll, then the accumulated points\nfor the turn is added to his total score.\n\nBefore a player is allowed to accumulate points, they must get at\nleast 300 points in a single turn. Once they have achieved 300 points\nin a single turn, the points earned in that turn and each following\nturn will be counted toward their total score.\n\n== End Game\n\nOnce a player reaches 3000 (or more) points, the game enters the final\nround where each of the other players gets one more turn. The winner\nis the player with the highest score after the final round.\\n\nEOF\n\n\t system(\"clear\")\n\t puts rules\n\t continue\n\tend", "def rule_triples_creator(rule_json, time, graph)\n rule = rule_json['rule']\n key = rule_json['key']\n parameters = rule['parameters']\n\n rule_uuid = generate_uuid\n rule_uri = '<' + validation_result_collection + rule_uuid + '>'\n\n # add type, uuid and timestamp, status\n rule_triples = rule_uri + \" a mu:validationResultCollection ;\\n\"\n rule_triples += \" mu:uuid '\" + rule_uuid + \"' ;\\n\"\n rule_triples += \" mu:timestamp '\" + time + \"'^^xsd:dateTime ;\\n\"\n rule_triples += \" mu:Graph '\" + graph + \"' ;\\n\" unless graph.nil?\n\n # end withadding a ruleId\n # and returning triples, uri and parameters\n rule_triples += \" mu:ruleId '\" + key + \"' .\\n\\n\"\n {\n 'rule_triples' => rule_triples,\n 'rule_uri' => rule_uri,\n 'parameters' => parameters,\n 'ruleId' => key\n }\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = $1\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = {\n Flapjack::Data::Acceptor => [],\n Flapjack::Data::Rejector => []\n }\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n time_restrictions = Flapjack.load_json(rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n acceptor_conditions_by_media = {}\n rejector_conditions_by_media = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n cond_by_media = blackhole ? rejector_conditions_by_media : acceptor_conditions_by_media\n cond_by_media[media_types_str] ||= []\n cond_by_media[media_types_str] << fail_state\n end\n\n checks_and_tags_for_rule = proc do |rule_klass, cond_by_media|\n\n rule_klass.lock(Flapjack::Data::Check, Flapjack::Data::Tag,\n Flapjack::Data::Contact, Flapjack::Data::Medium) do\n\n cond_by_media.each_pair do |media_types_str, fail_states|\n rule = rule_klass.new\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.all = regex_entities.empty? && regex_tags.empty?\n rule.time_restrictions = time_restrictions\n rule.save\n raise rule.errors.full_messages.join(\", \") unless rule.persisted?\n\n media_transports = media_types_str.split('|')\n media = contact.media.intersect(:transport => media_transports)\n rule.media.add_ids(*media.ids) unless media.empty?\n\n unless rule.all\n # apply the entities/tag regexes as a filter\n checks = Flapjack::Data::Check.intersect(:id => check_ids).select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check.tags.each do |tag|\n matching_re += regex_tags.select {|re| re === tag.name }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n\n tags = checks.collect do |check|\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n end\n rules[rule_klass] << rule\n end\n end\n end\n\n checks_and_tags_for_rule.call(Flapjack::Data::Rejector, rejector_conditions_by_media)\n checks_and_tags_for_rule.call(Flapjack::Data::Acceptor, acceptor_conditions_by_media)\n end\n\n rejectors = rules[Flapjack::Data::Rejector]\n contact.rejectors.add(*rejectors) unless rejectors.empty?\n\n acceptors = rules[Flapjack::Data::Acceptor]\n contact.acceptors.add(*acceptors) unless acceptors.empty?\n end\n end", "def rule=(rule)\n write_attribute :rule_id, case rule\n when ReputationRule\n rule.id\n else \n ReputationRule.find_by_name( rule ).try(:id)\n end\n end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 49:5: ( 'a' .. 'z' | 'A' .. 'Z' ) ( ( 'a' .. 'z' | 'A' .. 'Z' ) | '_' | ( '0' .. '9' ) )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n # at line 49:33: ( ( 'a' .. 'z' | 'A' .. 'Z' ) | '_' | ( '0' .. '9' ) )*\n while true # decision 8\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0.between?( 0x30, 0x39 ) || look_8_0.between?( 0x41, 0x5a ) || look_8_0 == 0x5f || look_8_0.between?( 0x61, 0x7a ) )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n break # out of loop for decision 8\n end\n end # loop for decision 8\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end", "def shacl_validator(rdf_graph, shacl_document)\n shacl_shapes = Hash.new\n responsive_endpoints = Array.new\n graph = RDF::Graph.load(rdf_graph)\n File.foreach(shacl_document) {|line|\n case line\n when /^EU/\n @endpoint_url = line.match(\"^EU\\t(.+)\\n\")[1]\n when /^SH/\n content = line.match(\"^SH\\t(.+\\n)\")[1]\n if shacl_shapes.include? @endpoint_url\n shacl_shapes[@endpoint_url] << content\n else\n shacl_shapes[@endpoint_url] = content\n end\n when /^XX/\n next\n end\n } \n #This splits the value of the hash, which corresponds to all the shapes from an\n # endpoint one after another in a string. The split is made on the ] . that\n # delimits the end of a shape, and with ?<= it is kept in the shapes.\n shacl_shapes.update(shacl_shapes) {|key, value| value.split(/(?<=\\] \\.)\\n/)}\n shacl_shapes.each do |key, value|\n value.each do |shape|\n File.open(\"tmp.ttl\", \"w\") {|file|\n file.write \"@prefix sh: <http://www.w3.org/ns/shacl#> .\\n\\n\"\n file.write shape\n }\n shacl = SHACL.open(\"tmp.ttl\")\n report = shacl.execute(graph)\n \n puts \"SHAPE:\\n\\n#{shape}\\n\\nConforms?: #{report.conform?}\\n\\nLength: #{report.all_results.length}\"\n puts puts\n puts report\n puts puts\n if report.conform? && report.all_results.length > 0\n responsive_endpoints << key\n break\n else \n next\n end\n end\n end\n return responsive_endpoints\nend", "def << rule\n rules << rule\n nil\n end", "def parse_rules(rules)\n key = nil\n rules.each do |s|\n s.split.each do |ru|\n if key.nil? and /^:([a-z_]+)=(\\S+)*/ =~ ru\n key = $1\n var = $2\n @attr[key] = var\n key = nil\n elsif /^:([a-z_]+)+/ =~ ru\n key = $1\n if @attr[key].nil?\n @attr[key] = []\n end\n elsif not key.nil?\n @attr[key].push ru unless key.nil?\n else\n if /([a-z0-9_.:-]+)([=!><\\~][=>]*)(.*)/ =~ ru\n names = $1\n op = $2\n ver = $3\n r = Gem::Version.new ver\n name, new_name = names.split(/:/, 2)\n @requirements[name] = {\n :method => :update,\n :op => op,\n :version => r,\n :name => new_name\n }\n elsif /([a-z0-9_-]+):$/ =~ ru\n name = $1\n @requirements[name] = {\n :method => :delete,\n }\n end\n end\n end\n end\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def rrule(*args)\n if args[0].is_a?(Hash)\n freq = __value({ :freq => args[0].delete(:freq) })\n others = args[0].empty? ? nil : __value(args[0])\n args[0] = [freq, others].compact.join(';')\n end\n method_missing(:rrule, *args)\n end", "def dumpRule(als)\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULE: #{als}\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n rule = @rules[als]\r\n if (nil != rule)\r\n puts \"#{rule.name}\\t(#{rule.alias})\"\r\n puts \"#{rule.xml}\"\r\n\r\n else\r\n puts \"Cannot find matching rule.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def <<(rule); end", "def th!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n\n type = TH\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 351:5: d= ( ( DIGIT )* ) DIGIT ( 'T' | 't' ) ( 'H' | 'h' )\n # at line 351:7: ( ( DIGIT )* )\n # at line 351:8: ( DIGIT )*\n # at line 351:8: ( DIGIT )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x30, 0x39 ) )\n look_4_1 = @input.peek( 2 )\n\n if ( look_4_1.between?( 0x30, 0x39 ) )\n alt_4 = 1\n\n end\n\n end\n case alt_4\n when 1\n # at line 351:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n\n digit!\n if @input.peek(1) == 0x54 || @input.peek(1) == 0x74\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x48 || @input.peek(1) == 0x68\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\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__, 52 )\n\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def format_rule(rule)\n return unless rule.attributes['name']\n\n puts ''\n puts '----'\n puts ''\n puts \"== #{rule.attributes['name']} ==\"\n puts ''\n\n is_deprecated = rule.attributes['deprecated'] == 'true'\n if is_deprecated\n puts \"'''Deprecated'''\"\n puts ''\n \n ref = rule.attributes['ref'].sub(/rulesets\\/java\\//, '') \n name = ref[/[^\\/]+$/]\n ruleset = ref[/^[^\\.]+/]\n puts \"This rule has been renamed or moved. Use instead: [[PmdRules#{ruleset.capitalize}##{name.downcase}|#{name}]]\"\n \n return\n end\n \n puts \"<blockquote>#{norm_text(rule.get_text('description'))}</blockquote>\"\n puts ''\n\n isxpath = rule.attributes['class'] == 'net.sourceforge.pmd.lang.rule.XPathRule'\n if isxpath\n puts 'This rule is defined by the following XPath expression:'\n puts '<pre>'\n puts rule.elements['properties/property/value'].texts.join.strip\n puts '</pre>'\n else\n classname = rule.attributes['class']\n href = \"https://github.com/codecop/pmd-rules/tree/master/src/main/java/#{classname.gsub(/\\./,'/')}.java\"\n puts \"This rule is defined by the following Java class: [#{href} #{classname}]\"\n end\n\n rule.elements.each('example') do |example|\n puts ''\n puts '=== Example: ==='\n puts '<pre>'\n puts example.texts.join.strip\n puts '</pre>'\n end\n\n properties = rule.elements['count(properties/property)']\n properties -= 1 if isxpath\n if properties > 0\n puts ''\n puts 'This rule has the following properties:'\n puts ''\n \n puts '{| class=\"wikitable\"'\n puts '! Name'\n puts '! Default value' \n puts '! Description' \n \n rule.elements.each('properties/property') do |prop|\n next if prop.attributes['name']=='xpath'\n puts '|-' \n puts \"| #{prop.attributes['name']}\"\n puts \"| '#{prop.attributes['value']}'\"\n puts \"| #{prop.attributes['description']}\"\n end\n puts '|}' \n end\nend", "def descriptions\n# [\"Column name or name of the rule.\",\"Column/Name\",\n# nil,nil,nil,conditions[i][0],nil],\n#\t[\"Operator for the rule.\",\"Operator\",\n# nil,nil,nil,conditions[i][1],nil],\n#\t[\"Value to compare for the rule.\",\"Value\",\n# nil,nil,nil,value,nil],\n#\t[\"Percentage of items matched this rule.\",\"%\",\n# get_condition(i), nil, \"ALL\", nil, \"del_condition\",\"d\"],\n#\t[\"All values matched by that rule, and are in this sample.\",\"In %\",\n# get_condition_string(true), nil, get_condition(i), nil,nil,nil],\n#\t[\"All values matched by that rule, that are not in this sample.\",\"Not In %\",\n# get_condition(i), get_condition_string(true) , get_condition(i), nil,'negate_all_but','>'],\n#\t[\"How many records more would be in the sample if this rule where deleted.\",\"Banish\",\n# get_condition_string(true,i),get_condition_string(true), nil, nil,'banished', '>'],\n#\t[\"Disable/Enable the rule.\",\"\",\n# nil, nil, nil, if conditions[i][3] then \"on\" else \"off\" end, 'toggle', '>']\n \n end", "def add_rule(rule)\n new_rules = rules.dup\n new_rules << rule\n @rules = new_rules.uniq.freeze\n validate_rules!\n self\n end", "def parse_http_rule rule_yaml\n rule = Google::Api::HttpRule.new\n rule.selector = rule_yaml[HTTP_RULES_SELECTOR_KEY] if rule_yaml.key? HTTP_RULES_SELECTOR_KEY\n verb_path = HTTP_RULES_VERBS_ALLOWED.find { |verb| rule_yaml[verb] }\n rule.send \"#{verb_path}=\", rule_yaml[verb_path] if verb_path\n rule.body = rule_yaml[HTTP_RULES_BODY_KEY] if rule_yaml.key? HTTP_RULES_BODY_KEY\n\n if rule_yaml.key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY\n rule.additional_bindings = rule_yaml[HTTP_RULES_ADDITIONAL_BINDINGS_KEY].map do |binding_yaml|\n parse_http_rule binding_yaml\n end\n end\n\n rule\n end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 12)\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 131:5: ( 'a' .. 'z' | '_' ) ( 'a' .. 'z' | '_' | 'A' .. 'Z' | '0' .. '9' )*\n if @input.peek(1) == ?_ || @input.peek(1).between?(?a, ?z)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n # at line 132:5: ( 'a' .. 'z' | '_' | 'A' .. 'Z' | '0' .. '9' )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek(1)\n\n if (look_2_0.between?(?0, ?9) || look_2_0.between?(?A, ?Z) || look_2_0 == ?_ || look_2_0.between?(?a, ?z)) \n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line \n if @input.peek(1).between?(?0, ?9) || @input.peek(1).between?(?A, ?Z) || @input.peek(1) == ?_ || @input.peek(1).between?(?a, ?z)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\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__, 12)\n\n end", "def rule\n @rule || @distribution.inject([]){|result, elm| result << [(result.empty? ? 0.0 : result.last[0]) + elm[0], elm[1]]}\\\n .tap{|array| array.last[0] = 1.0 } # make sure the last element's cdf is 1.0\n end", "def match?(rule, scanner)\n if rule.no == 0\n eight = list.fetch(8)\n eleven = list.fetch(11)\n\n match?(eight, scanner) && match?(eleven, scanner)\n elsif rule.no == 8\n match?(list.fetch(42), scanner)\n elsif rule.no == 11\n match_any_number_of?(42, scanner) &&\n match_any_number_of?(31, scanner)\n else\n values = values_for(rule)\n values.each do |value|\n if scanner.peek(value.length) == value\n scanner.pos += value.length\n return true\n end\n end\n false\n end\n end", "def rule_stanza(desc, manipulators)\n return {\n 'description' => desc,\n 'manipulators' => manipulators\n }\nend", "def visit_rule(node)\n node.children\n .select { |child| child.is_a?(Sass::Tree::PropNode) }\n .reject { |prop| prop.name.any? { |item| item.is_a?(Sass::Script::Node) } }\n .each do |prop|\n add_lint(prop, 'everything offends me 2') if prop.value.first.to_sass.strip == 'fail2'\n end\n\n yield\n end", "def add_rule(rule_object)\n\n # store the rule\n @rules[rule_object.name] = rule_object\n\n case\n\n # rule which asserts facts without conditions or questions\n when rule_object.matcher.nil? && rule_object.questions.empty?\n\n # add the rule to the fact rules array, contains rules with only facts\n @fact_rules << rule_object\n\n when rule_object.matcher.nil? && rule_object.questions.count > 0\n\n # rules can be triggered directly\n @start_rules << rule_object\n\n else\n\n # get the matcher\n matcher = rule_object.matcher\n\n # get the matcher type (any / all)\n matcher_type = matcher.type\n\n # generate the ruleby conditions based on the matcher conditions\n conditions = create_conditions matcher.conditions\n\n # switch statement for the matcher type\n case matcher_type\n\n # all the conditions must match\n when :all\n\n # star to convert array to arguments\n rule AND *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n # one of the conditions must match\n when :any\n\n # star to convert array to arguments\n rule OR *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n else\n raise \"Unknown matcher type #{matcher.type}\"\n\n end\n\n end\n\n end", "def rule(expression, &block); end", "def rule(expression, &block); end", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def parse(source, rule=nil)\n rule = root unless rule\n raise ArgumentError, \"Rule is nil and not root has been installed\" unless rule\n source.extend(Anagram::Utils::StringUtils)\n @memoization = {}\n r0 = factor_result(source, 0, 0)\n r1 = self.send(\"_nt_#{rule}\", r0)\n raise ParseError, failure_reason(source) unless r1\n raise ParseError, failure_reason(source, r1) unless r1.stop_index==source.length\n r1\n end", "def rules_by_name; end", "def qos_add_mac(rule_name,data)\n \n addr_list = data.split(',')\n self.msg(rule_name, :debug, 'qos_add_rule', \"addr_list\" +addr_list.to_s)\n \n addr_list.each do |dual_mac_data|\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"processing mac address\" +dual_mac_data.to_s)\n \n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value(\"4\")\n mac_data=dual_mac_data.split('/')\n \n if mac_data.length > 0 and mac_data.length < 3\n \n if mac_data[0].size > 0 \n self.msg(rule_name, :debug, 'qos_add_rule', \"set mac \" + mac_data[0])\n str_mac_data = mac_data[0].strip\n octets=str_mac_data.split(':')\n @ff.text_field(:name, 'mac0').set(octets[0])\n @ff.text_field(:name, 'mac1').set(octets[1])\n @ff.text_field(:name, 'mac2').set(octets[2])\n @ff.text_field(:name, 'mac3').set(octets[3])\n @ff.text_field(:name, 'mac4').set(octets[4])\n @ff.text_field(:name, 'mac5').set(octets[5])\n end # end of if...\n \n end # end of if mac_data.len...\n \n if mac_data.length == 2\n \n if mac_data[1].size > 0\n \n self.msg(rule_name, :debug, 'qos_add_rule', \"set mac mask\" + mac_data[1])\n # set the mask\n str_mac_data = mac_data[1].strip\n octets=str_mac_data.split(':')\n @ff.text_field(:name, 'mac_mask0').set(octets[0])\n @ff.text_field(:name, 'mac_mask1').set(octets[1])\n @ff.text_field(:name, 'mac_mask2').set(octets[2])\n @ff.text_field(:name, 'mac_mask3').set(octets[3])\n @ff.text_field(:name, 'mac_mask4').set(octets[4])\n @ff.text_field(:name, 'mac_mask5').set(octets[5])\n \n end\n\n end\n \n @ff.link(:text, 'Apply').click\n \n end # end of addr_list.each...\n \n end", "def set_rule_int(rule_int)\n @rule = []\n (0...@NUM_RULE_STATES).each do |i|\n @rule[@NUM_RULE_STATES-1 - i] = (rule_int & (1 << i) != 0 ? 1 : 0)\n end\n print @rule.length\n end", "def addRule(s, d, t)\r\n invalidMsg = CFG.ruleInvalid(s, d, t)\r\n unless invalidMsg.nil?\r\n return \"Rule invalid:\\n\" + invalidMsg\r\n else\r\n @rules[s.to_sym] = [] unless @rules[s.to_sym]\r\n @rules[s.to_sym].push([d,t])\r\n end\r\n end", "def play_rule_expressions(tick)\n #@synth.play_note(@channel_id, 0, rand(50)+20) if @generation % 8 == 0\n\n velocity = 50\n duration = 100\n #@history[tick].each { |n| @synth2.note_off(0, n, 127) } if @history[tick]\n \n @cells.each_index do |i| \n next if i < @play_range[:start] || i > @play_range[:end]\n\n note = i - @play_range[:start] \n\n if play_rule? i\n #@history[tick + duration] ||= []\n #@history[tick + duration] << note\n @synth2.note_on(0, note, velocity) \n\n #@synth.play_note(@channel_id, i - @play_range[:start], rand(30)+30)\n end\n end\n end", "def expand_rule_definition definition\r\n\t\[email protected]_each do |r|\r\n definition = definition.gsub \"[:#{r.type.to_s}]\", \"(#{r.definition})\"\r\n\t\tend\r\n\t\tdefinition\r\n\tend", "def rule_hash\n # \"rule\": {\n # \"id\": \"1\",\n # \"question_id\": \"822\",\n # \"match_type\": \"all\",\n # \"conditions\": [\n # {\n # \"id\": \"1\",\n # \"question_id\": \"818\",\n # \"operator\": \"is equal to\",\n # \"answer\": \"Yes\"\n # }\n # ]\n # }\n unless self.rule.blank?\n Hanuman::RuleHashSerializer.new(self.rule).to_json\n end\n end", "def chunk!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n type = CHUNK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 47:3: ( ( '-' )+ ( CHUNK_CHAR )* | ( CHUNK_CHAR )+ )\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == 0x2d )\n alt_16 = 1\n elsif ( look_16_0.between?( 0x0, 0x8 ) || look_16_0.between?( 0xb, 0xc ) || look_16_0.between?( 0xe, 0x1f ) || look_16_0 == 0x21 || look_16_0.between?( 0x25, 0x26 ) || look_16_0.between?( 0x2b, 0x2c ) || look_16_0.between?( 0x2e, 0x3a ) || look_16_0 == 0x3d || look_16_0.between?( 0x40, 0x5f ) || look_16_0.between?( 0x61, 0x7a ) || look_16_0.between?( 0x7f, 0xffff ) )\n alt_16 = 2\n else\n raise NoViableAlternative( \"\", 16, 0 )\n end\n case alt_16\n when 1\n # at line 47:5: ( '-' )+ ( CHUNK_CHAR )*\n # at file 47:5: ( '-' )+\n match_count_13 = 0\n while true\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0 == 0x2d )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 47:5: '-'\n match( 0x2d )\n\n else\n match_count_13 > 0 and break\n eee = EarlyExit(13)\n\n\n raise eee\n end\n match_count_13 += 1\n end\n\n # at line 47:10: ( CHUNK_CHAR )*\n while true # decision 14\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0.between?( 0x0, 0x8 ) || look_14_0.between?( 0xb, 0xc ) || look_14_0.between?( 0xe, 0x1f ) || look_14_0 == 0x21 || look_14_0.between?( 0x25, 0x26 ) || look_14_0.between?( 0x2b, 0x3a ) || look_14_0 == 0x3d || look_14_0.between?( 0x40, 0x5f ) || look_14_0.between?( 0x61, 0x7a ) || look_14_0.between?( 0x7f, 0xffff ) )\n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 47:10: CHUNK_CHAR\n chunk_char!\n\n else\n break # out of loop for decision 14\n end\n end # loop for decision 14\n # --> action\n type = SWITCH \n # <-- action\n\n when 2\n # at line 48:5: ( CHUNK_CHAR )+\n # at file 48:5: ( CHUNK_CHAR )+\n match_count_15 = 0\n while true\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0.between?( 0x0, 0x8 ) || look_15_0.between?( 0xb, 0xc ) || look_15_0.between?( 0xe, 0x1f ) || look_15_0 == 0x21 || look_15_0.between?( 0x25, 0x26 ) || look_15_0.between?( 0x2b, 0x3a ) || look_15_0 == 0x3d || look_15_0.between?( 0x40, 0x5f ) || look_15_0.between?( 0x61, 0x7a ) || look_15_0.between?( 0x7f, 0xffff ) )\n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line 48:5: CHUNK_CHAR\n chunk_char!\n\n else\n match_count_15 > 0 and break\n eee = EarlyExit(15)\n\n\n raise eee\n end\n match_count_15 += 1\n end\n\n # --> action\n @cmd_start and type = COMMAND_NAME \n # <-- action\n\n end\n \n @state.type = type\n @state.channel = channel\n # --> action\n @cmd_start = false \n # <-- action\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end", "def rule_action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n return_value = RuleActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal55 = nil\n __ACTION57__ = nil\n id56 = nil\n\n tree_for_char_literal55 = nil\n tree_for_ACTION57 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token AT\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 169:4: '@' id ACTION\n char_literal55 = match( AT, TOKENS_FOLLOWING_AT_IN_rule_action_974 )\n if @state.backtracking == 0\n stream_AT.add( char_literal55 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_action_976 )\n id56 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id56.tree )\n end\n __ACTION57__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_action_978 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION57__ )\n end\n # AST Rewrite\n # elements: ACTION, id, AT\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 169:18: -> ^( '@' id ACTION )\n # at line 169:21: ^( '@' id ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_AT.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end\n \n return return_value\n end" ]
[ "0.6051894", "0.59856635", "0.59272337", "0.59269965", "0.59088653", "0.577136", "0.5759406", "0.5759406", "0.5759406", "0.57396615", "0.57260936", "0.5710072", "0.56360507", "0.55693185", "0.55602074", "0.55467236", "0.553209", "0.5512858", "0.5491807", "0.5484152", "0.5454531", "0.5453511", "0.5421907", "0.5416663", "0.5411225", "0.5400422", "0.5382825", "0.5382825", "0.5382825", "0.5382825", "0.5382825", "0.5382825", "0.5382825", "0.53661853", "0.53537977", "0.5351468", "0.53471434", "0.53402084", "0.532239", "0.5321103", "0.53165245", "0.5306393", "0.53004074", "0.52895606", "0.5282292", "0.52793336", "0.52725816", "0.5271483", "0.527088", "0.52575386", "0.52480644", "0.5237431", "0.5231478", "0.52249724", "0.5215343", "0.52148646", "0.52092785", "0.52081317", "0.520233", "0.5201436", "0.5196565", "0.5187385", "0.5185157", "0.51847756", "0.518328", "0.5179768", "0.51781785", "0.51722604", "0.51722604", "0.516566", "0.51464653", "0.51464134", "0.5136337", "0.51297885", "0.51095927", "0.51095927", "0.51095927", "0.51032686", "0.50924796", "0.5092196", "0.50858617", "0.5085054", "0.5084103", "0.50828516", "0.5058239", "0.50514454", "0.50460917", "0.50427794", "0.50415015", "0.50415015", "0.5031383", "0.50286037", "0.50231403", "0.50169957", "0.5013595", "0.50004125", "0.4999112", "0.49989143", "0.49961203", "0.4984193", "0.49819288" ]
0.0
-1
GET /lab_users GET /lab_users.xml index and new view are merged
def index #@lab_users = LabUser.find(:all, :order=>params[:sort_by]) set_order_by @lab_users = LabUser.order(@order).paginate(:page => params[:page], :per_page => @per_page) @lab_user = LabUser.new @users= User.order('username') if request.format == 'json' if params[:conditions] conditions = params[:conditions].as_json #fix start and end if conditions[:end] && conditions[:end]=='' conditions[:end]=nil end if conditions && conditions[:start]=='' conditions[:start]=nil end logger.info "FIND LABUSER: #{conditions}" labusers = LabUser.where(conditions) else labusers = LabUser.all end if params[:with_ping] labusers = labusers.map{|l| l.with_ping} end end respond_to do |format| format.html # index.html.erb format.json { render :json => labusers } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_index\n\t\[email protected]_list($users)\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend", "def index\n @user_labs = UserLab.all\n end", "def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end", "def index\n @lab_user_infos = LabUserInfo.all\n end", "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def index3\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n if @user\n @lessons = Lesson.view(@user.login, \"lessons_by_author\", {:author => @user.login})\n else\n @lessons = []\n end\n \n #This could be done within the users's branch....\n @public_lessons = Lesson.view(\"master\", \"lessons_by_public\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons}\n end\n end", "def index\n users = get_collection(visible_users) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def index\r\n @users = User.find(:all)\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @users.to_xml }\r\n end\r\n end", "def index\n if(params[:user_id])\n @lab_groups = LabGroup.find(\n :all,\n :include => :lab_memberships,\n :conditions => [ \"lab_memberships.user_id = ?\", params[:user_id] ]\n )\n elsif(params[:name])\n @lab_groups = LabGroup.find(\n :all,\n :conditions => {:name => params[:name]}\n )\n else\n @lab_groups = LabGroup.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_groups }\n end\n end", "def html_index\n\t\t@users = User.all\n\tend", "def index\n authorize! :read, User\n @users = User.find(:all)\n @users ||= []\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def index\n\t @users = User.all\t\n\t render :index_user\n\tend", "def index\n @users = User.all(include: :stats)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { head :ok }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def index\n users = get_collection(User) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: 'users', skip_types: 'true') }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def index\n #Todos os usuários e suas autorizações\n @users = User.find(:all)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @allow_tests }\n end\n end", "def index\n @users = @user.users\n render layout: false\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @title = \"All users\"\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(:except => [:password_digest, :remember_token])}\n end\n end", "def index\n @user = current_user\n @title = \"Account\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n\t\t@users = User.all\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @users }\n\t\tend\n\tend", "def index\n\t\t# will automatically go into views/users and look for 'index' file to render\n\t\t@all_users = User.all\n\t\t# p @all_users, \"all users\"\n\tend", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n return false unless authorize(permissions = [\"view_user\"])\n render :layout => 'login' unless current_user\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n\t\tif !admin?\n\t\t\thead 404\n\t\tend\n @users = User.all\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => BioCatalogue::Api::Json.index(\"users\", json_api_params, @users).to_json }\n format.bljson { render :json => BioCatalogue::Api::Bljson.index(\"users\", @users).to_json }\n end\n end", "def index\n @users = User.all\n render :xml => @users\n end", "def index\n @users = User.all\n @title = 'Users Management'\n @breadcrumb = 'Users'\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n\t\t@user = User.all\n\t\tCUSTOM_LOGGER.info(\"Start to return users #{@user.to_yaml}\")\n\tend", "def index\n # for partial generic views\n @title_user = \"All Catstagram Users\"\n @users = User.all\n end", "def index\n @users = User.all\n @page_title = '用户列表'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n render json: current_org.users\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html\n format.xml { render :xml => @users }\n format.json { render :json => @users }\n end\n end", "def index\n\t\t@users = User.all\n\n\t\trender :layout => \"application\"\n\tend", "def index\n @allUsers = User.find(:all, :order => 'points DESC, last_request_at DESC')\n @users = @allUsers.paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n if current_user\n @users = User.all\n render \"index_users.json.jb\"\n else\n render json: []\n end\n end", "def index\n @users = User.all(:order => \"nick, id ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @userls = Userl.all\n end", "def index\r\n respond_with User.all\r\n end", "def index\n @all_users = User.all\n\trender \"list_users\"\n end", "def user_labs\n get_user # @user - either lab owner or current user\n if !@user && params[:username]\n logger.debug \"There is no user named '#{params[:username]}'\"\n flash[:notice] = \"There is no user named '#{params[:username]}'\"\n redirect_back fallback_location: my_labs_path+(params[:id] ? \"/#{params[:id]}\" : '')\n elsif !@admin && params[:username] then # simple user should not have the username in url\n logger.debug \"\\nmy_labs: Relocate user\\n\"\n # simple user should not have the username in url\n redirect_to(my_labs_path+(params[:id] ? \"/#{params[:id]}\" : ''))\n else\n get_user_labs(@user) # @labs (all labs), @started, @complete, @not_started\n # if no course is selected show the first one\n if params[:id]!=nil\n @lab = Lab.find(params[:id])\n else\n @[email protected] \n end\n\n if @labs!=[] && @labs.include?(@lab)\n @lab_user = LabUser.where('lab_id=? and user_id=?', @lab.id, @user.id).last if @lab\n elsif @labs!=[] # users with labs, that try to see others labs are redirected to error\n logger.debug \"\\n'#{current_user.username}' redirected: dont have lab '#{@lab.name}' (#{@lab.id}) \\n\"\n redirect_to(error_401_path) and return\n end\n end\n end", "def index\n @users = User.order(\"id\")\n render :index and return\n end", "def user_index\n \t\t@users = User.all\n \tend", "def index\r\n # @users = User.all\r\n end", "def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end", "def index\n @title = t('admin.users.index.title')\n @users = User.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all(:order=>:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(\n :dasherize => false, :only => [:id, :name,\n :created_at, :updated_at]) }\n end\n end", "def index\n @title = \"Nos utilisateurs\"\n @description = \"Liste de nos plus fervents utilisateurs\"\n @users = User.all\n end", "def index\n @lessons = current_user.organization.lessons.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def index\n if can?(:read, User)\n @users = User.accessible_by(current_ability, :index)\n else\n @users = []\n end\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n format.html\n end\n end", "def index\n @users = User.valid_users.find(:all, :order => \"name DESC\")\n render :index\n end", "def get_users(request); end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n\n end\n end", "def index\n\t@users = User.all\nend", "def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def index\n \t@users = User.all\n \tend", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @new_users = NewUser.all\n end", "def list_users\n self.class.get('/users')\n end", "def index\n\t\t@users = User.all\n\t\thide_view_action\n\t\tsetup_remove_confirm_message 'users.confirm_delete'\n\t\tsetup_index_title 'users.index.title'\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all\n @users = @users.paginate(:page => 1, :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.atom # index.atom.builder\n format.xml { render :xml => @users }\n end\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\n # index not implemented - only admins may list users\n raise \"This action is not implemented\"\n end", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend" ]
[ "0.72773415", "0.7232288", "0.7165176", "0.70872307", "0.70236284", "0.69331115", "0.6904785", "0.68364716", "0.68174815", "0.68134177", "0.67674434", "0.6763421", "0.67588854", "0.6709928", "0.6680158", "0.66797256", "0.6665183", "0.6663183", "0.6659405", "0.6652202", "0.66500443", "0.66490644", "0.6644156", "0.66346157", "0.6625927", "0.6625927", "0.6625927", "0.6618766", "0.660782", "0.6603913", "0.66027397", "0.66017", "0.6591043", "0.6581801", "0.65777093", "0.65777093", "0.65777093", "0.6568317", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6562576", "0.6535641", "0.6523487", "0.65184355", "0.6517439", "0.65149325", "0.65112704", "0.6501512", "0.64992815", "0.64978665", "0.64863694", "0.64748", "0.64723843", "0.64611167", "0.64590794", "0.6453705", "0.64536816", "0.64480376", "0.6439302", "0.6430844", "0.6422389", "0.64134854", "0.6412574", "0.6402484", "0.6399002", "0.6398747", "0.6398206", "0.6393118", "0.6390302", "0.6387348", "0.6379658", "0.6374938", "0.63680613", "0.6363414", "0.6363395", "0.6357967", "0.63529766", "0.63518155", "0.6344147", "0.6344147", "0.6344147", "0.63422453", "0.6333364", "0.6333364", "0.6333364", "0.6333364", "0.6333364", "0.6333364" ]
0.6466197
65
for search view to display user machines in an attempt
def show @info={:running=>[], :paused=>[], :stopped=>[]} @lab_user.vms.each do |v| v['username']=@lab_user.user.username v['port'] = v.rdp_port logger.debug "state is #{v.state}" @info[:"#{v.state}"]<< v end respond_to do |format| format.json { render :json => @info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @machine_user_name = MachineUserName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @machine_user_name }\n end\n end", "def index\n @machine_infos = MachineInfo.all\n end", "def list\n \t\tuser = User.find(current_user.id)\n \t @computers = user.computer.all\n end", "def show\n @user = User.find(params[:id])\n @machine = @user.current_machine\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def index\n @machines = Machine.all.order(mac: :asc)\n end", "def show\n @match = params[:dd]\n @setdefault = Setdefault.all\n @users = User.all\n @setdefault.each do |f|\n if f.user_id == @user.id\n @find = f.user_id\n @setid = f.id\n @setrun = f.runner\n @setchef = f.chef\n end\n end\n end", "def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end", "def index\n\t\t@machine = Machine.find_by_permalink(params[:id])\n\tend", "def show\n @q = User.ransack(params[:q])\n\n @user_search = Array.new\n @user_search = @q.result if params[:q] and params[:q][:name_or_phone_or_email_cont].length > 0\n\n\n @players = User.find(@team.player_team_rs.pluck(:user_id))\n end", "def list_machines\n machines = Machine.all\n machines.each do |machine|\n puts \"#{machine.serial_number}, #{machine.description} (#{machine.building.name})\"\n end\nend", "def index\n @clusters = current_user.clusters.all if current_user.clusters.any?\n @infrastructures = current_user.infrastructures.all if current_user.infrastructures.any?\n end", "def show \n available_users\n end", "def index\n\n @virtualmachines = Virtualmachine.all\n\n end", "def index\n if params[:search].present?\n @atm_machines = AtmMachine.near(params[:search], 50)\n else\n @atm_machines = AtmMachine.all\n end\n end", "def index\n @component_in_machines = ComponentInMachine.all\n end", "def index\n @users = GuestUsers::User.where(host: current_user) || []\n end", "def index\n @vending_machines = VendingMachine.all\n end", "def index\n @vending_machines = VendingMachine.all\n end", "def index\n if session[:isadmin]\n @sshkeys = Sshkey.all\n else\n #user_id = User.where(\"ldapowner LIKE ?\", \"%#{session[:nickname]}%\")\n #@sshkeys = Sshkey.where(\"user_id LIKE ?\", \"%#{session[:nickname]}%\")\n @something = Array.new\n @userids = ldap_owner_sshkeys(session[:nickname])\n\n @userids.each do |userid|\n @something = Sshkey.where(:user_id => userid).to_a\n if @something\n @sshkeys = @something\n else\n @sshkeys = []\n end\n\n end\n\n end\n\n\n end", "def index\n @hackathons = Hackathon.search(params[:search]) \n if defined?(current_user.id) && (current_user.id != '') then \n @hackathons = Hackathon.where(:user_id => current_user.id)\n else\n redirect_to root_url \n #render 'hackathons/index.html.erb'\n end \n \n end", "def suggest_user\n skope = User.scoped\n skope = skope.where(\"username LIKE ?\", \"%#{params[:term]}%\")\n @team.members.all.each do |member|\n skope = skope.where(User.arel_table[:id].not_eq(member.user.id))\n end\n\n skope = skope.limit(10)\n\n respond_with(skope.all.map{|x| {:label => x.username, :value => x.id}})\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def find_game\n prompt = TTY::Prompt.new\n prompt.select(\"Would you like to search by..\") do |menu|\n menu.choice \"System\", -> {view_by_system}\n menu.choice \"Category\", -> {view_by_category}\n menu.choice \"Back to Main Menu\", -> {welcome}\n end\n end", "def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end", "def web_servers; machines_by_role('web'); end", "def find_people\n @users=[]\n session[:search_opt] = params[:user]\n if request.post?\n @users = @login_user.search_query(params[:user],1)\n flash[:notice] = \"No results found.\" if @users.empty?\n end\n end", "def list_hosts(folder = '')\n rows = JSON.parse(http_request(@uri + '/view.py', {\n wato_folder: folder,\n\tsearch: 'Search',\n\tfilled_in: 'filter',\n\thost_address_prefix: 'yes',\n\tview_name: 'searchhost',\n\toutput_format: 'json',\n\t}))\n rows.shift # skip the header\n rows.map { |r| r[1] }\n end", "def show\n @user_list= []\n \n @customtable = CustomeTable.where(:identifier_id => @hackathon.id)\n @reguser = Registration.where(:hackathon_id => @hackathon.id)\n \n @reguser.each do |user| \n u = User.find(user.userId)\n @user_list.push(u.user_name)\n end\n end", "def show\n @steps = @discovery.steps.all\n @user = @discovery.user\n end", "def list\n search_value = params[\"search\"] || \"\"\n if !current_user.blank?\n @reservation = Reservation.where(\"user_id = ? and itinerary_number like ?\", current_user.id, \"%#{search_value}\")\n end\n end", "def user\n t = []\n ville = nom_ville\n\t\tville.each do |i|\n\t\t\tCLIENT.search(i).take(1).collect do |tweet|\n\t\t\t\tt.push(\"#{tweet.user.screen_name}\") \n\n\t\t\tend\n\t\t end\n\treturn t\nend", "def show\n @user = User.find(current_user)\n @atm_machine=AtmMachine.find(params[:id])\n session[:my_atm_machine]= @atm_machine.id\n end", "def index\n @name = params[:receptionist_name]\n if current_user.is_admin\n @guests = Guest.all\n elsif current_user.email_id\n @guests = Receptionist.find_by_email_id(current_user.email_id).guests\n end\n end", "def show\r\n @salle = Salle.find(params[:id])\r\n\r\n@machines = Machine.find(:all, :conditions =>{:salle_id => Salle.find(params[:id])})\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end", "def show\n @algorithm = Algorithm.find(params[:id])\n @available_computers = Computer.all.reject {|computer| @algorithm.computers.include?(computer)}\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @algorithm }\n end\n end", "def user_search_results\n @limit = 25\n load_facility\n @price_group = PriceGroup.find(params[:price_group_id]) if params[:price_group_id].present?\n @account = Account.find(params[:account_id]) if params[:account_id].present?\n @product = Product.find(params[:product_id]) if params[:product_id].present?\n @search_type = valid_search_types.find { |t| t == params[:search_type] }\n @users, @count = UserFinder.search_with_count(params[:search_term], @limit)\n\n render layout: false\n end", "def user_search(params = {})\n last_name.set params[:last_name] unless nil_or_empty? params[:last_name]\n login_id.set params[:login] unless nil_or_empty? params[:login]\n site_name.set params[:site] unless nil_or_empty? params[:site]\n site_group_select.select unless nil_or_empty? params[:site_group]\n role_select.set params[:role] unless nil_or_empty? params[:role]\n study_select.select params[:study] unless nil_or_empty? params[:study]\n unless nil_or_empty? params[:environment]\n if params[:environment].downcase == 'prod'\n env = 'Live: Prod'\n else\n env = 'Aux: ' + params[:environment].gsub(/[\\W]/, '') # sanitize study string\n end\n environment_select.select env\n end\n auth_select.select params[:authenticator] unless nil_or_empty? params[:authenticator]\n search_button.click\n sleep 5 #TODO: Figure out a way to remove this ~MD\n end", "def search_collaborator\n # Search for email or name of collaborator\n projects = current_user.projects\n @users = Array.new\n projects.each do |project|\n project.users.each do |user|\n unless @users.include? user\n @users.push user\n end\n end\n end\n\n # Get all users if current user is a manager or admin\n if manager? || admin?\n @users = current_user.university.users\n end\n\n # Return a JSON with \"label\" and \"value\" as key required by JQueryUI autocomplete\n result = Array.new\n @users.each do |user| \n label = user.first_name + \" \" + user.last_name + \" - \" + user.email\n item = Hash[ \"label\" => label, \"value\" => user.email ]\n result.push item\n end\n\n render :json => result\n end", "def search_diagnose\n\t\t# Searching for diagnose as per user entered term\n\t\tif Diagnose.where(user_type: \"admin\").any_of({ :name => /^#{params[:term]}/i }).present?\n\t\t\t# if search show from the admin then the search term from diagnose of admin\n\t\t\tdiagnose = Diagnose.where(user_type: \"admin\").any_of({ :name => /^#{params[:term]}/i }).all.collect{|diagnosis| {label: diagnosis.name}}.uniq.to_json\n\t\telse\n\t\t\t# else the term is not equal to the admin diagnose then that search from the user term\n\t\t\tdiagnose = current_user.diagnose.any_of({ :name => /^#{params[:term]}/i }).all.collect{|diagnosis| {label: diagnosis.name}}.uniq.to_json \n\t\tend\n\t\t# render to the diagnose name page\n\t\trespond_to do |format|\n\t\t format.json { render :json => diagnose }\n\t\tend\n\tend", "def show\n @clean_ui = params['clean_ui']\n @search = PeopleSearch.find(params[:id])\n authorize @search\n @people = @search.query_search_engine_get_people params[:page]\n @all_people_count = @people.total_count\n @people = Person.where(id: @people.collect(&:id)).includes(:submissions)\n @ppl = []\n email_address = OutgoingMailService.retrieve_email_credentials(current_user.email).payload.parsed_response[\"email_address\"]\n email_address.present? ? @is_email_credential = true : @is_email_credential = false\n people_ids = @people.pluck(:id)\n searched_candidates_ids = current_user.searched_candidates.pluck(:person_id) \n unsearched_candidates_ids = people_ids - searched_candidates_ids \n unsearched_candidates_ids.each do |unsearched_candidate_id|\n current_user.searched_candidates.create!(person_id: unsearched_candidate_id)\n end\n @searches = current_user.people_searches.last(3)\n @jobs = Job.all.as_json(only: [:id, :name])\n end", "def index\n @resource_group_machines = ResourceGroupMachine.all\n end", "def users_walk\n\t\tprint_status('Enumerating Usernames.....')\n\t\tusers=[['Usernames']]\n\t\[email protected]('enterprises.77.1.2.25') { |x| users << [\"#{x.value}\"] }\n\t\tif users.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\tprint_good(\"#{users.size} Usernames Found!\")\n\t\t\ttable = users.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend", "def search_results\n @individual = Individual.by_uid( params[:'names-search-uid'] )\n if @individual\n redirect_to display_path( @individual.uid )\n else\n redirect_to :search\n end\n end", "def search(user_query)\n\n characters = @client.characters(name: user_query)\n # comics = @client.comics(name: user_query)\n # creators = @client.creators(name: user_query)\n # events = @client.events(name: user_query)\n # series = @client.series(name: user_query)\n # stories = @client.stories(name: user_query)\n\n puts characters\n # I'm finally getting return goobledigook! But Derek also used this API and is getting different return than me. His was formulated like a nice little hash. \n\n end", "def employer_dashboard\n #send query parameter for filteration\n @tests = Test.employer_test_which_are(current_user,params[:q])\n end", "def show\n @requests = Request.where(pet_id: params[:id]).all\n users_id = Array.new(@requests.size) \n @requests.each do |req|\n users_id.push([req.interented_id])\n end\n @interested = User.find(users_id)\n end", "def show\n @event = Event.find_by_id(params[:id])\n #event.participants returns a collection and we CANT perform query on it\n host = @event.participants.select { |p| p.role == \"host\" }\n @users = @event.users.select { |u| u.id != host.first.user_id } #excludes the host\n end", "def index\n $lmc_left_menu = \"lmw_all_jobs\"\n $lmc_subleft_menu = \"lmw_job_applications\"\n @user = current_user\n @job_applications_ids = current_user.job_applications.pluck(:job_id)\n @job_applications = Job.where(id: @job_applications_ids).text_search(params[:query], params[:town], params[:status])\n end", "def users\n result_hash['usr']\n end", "def show\n redirect_to dashboard_url if current_user.team_id != @team.id\n teammates = @team.hackers.reject{ |h| h == current_user }\n @current_name = current_user.full_name.present? ? current_user.full_name : 'Me'\n @others = []\n 3.times do |i|\n teammate = teammates[i]\n if teammate.present?\n name = teammate.full_name.present? ? teammate.full_name : 'Friend'\n @others << {name: name, present: true, email: teammate.email}\n else\n @others << {name: 'Invite Friend', present: false}\n end\n end\n end", "def auto_complete_for_user_name\n @users = session[:user].get_available_users(params[:user][:name])\n render inline: \"<%= auto_complete_result @users, 'name' %>\", layout: false\n end", "def search\n find_clients\n render_clients\n end", "def divisions_users_search\n render 'activities/divisions/division_users_search'\n end", "def find_available_node\n node_name=nil\n nodes = JSON.parse http_get(@node_list_end_point)\n nodes[\"computer\"].each do |i|\n if i[\"offline\"]\n node_name=i[\"displayName\"]\n break\n end\n end\n\n return node_name\nend", "def index\n @machines = Machine.order(nr: :asc).all\n end", "def user_search\n @users = User.admin_search(params[:query])\n end", "def scanemss\n assert_privileges(params[:pressed])\n emss = []\n if @lastaction == \"show_list\" # showing a list, scan all selected emss\n emss = find_checked_items\n if emss.empty?\n add_flash(_(\"No %{model} were selected for scanning\") % {:model => ui_lookup(:table => @table_name)}, :error)\n end\n process_emss(emss, \"scan\") unless emss.empty?\n add_flash(n_(\"Analysis initiated for %{count} %{model} from the %{product} Database\",\n \"Analysis initiated for %{count} %{models} from the %{product} Database\", emss.length) %\n {:count => emss.length,\n :product => I18n.t('product.name'),\n :model => ui_lookup(:table => @table_name),\n :models => ui_lookup(:tables => @table_name)}) if @flash_array.nil?\n show_list\n @refresh_partial = \"layouts/gtl\"\n else # showing 1 ems, scan it\n if params[:id].nil? || model.find_by_id(params[:id]).nil?\n add_flash(_(\"%{record} no longer exists\") % {:record => ui_lookup(:tables => @table_name)}, :error)\n else\n emss.push(params[:id])\n end\n process_emss(emss, \"scan\") unless emss.empty?\n add_flash(n_(\"Analysis initiated for %{count} %{model} from the %{product} Database\",\n \"Analysis initiated for %{count} %{models} from the %{product} Database\", emss.length) %\n {:count => emss.length,\n :product => I18n.t('product.name'),\n :model => ui_lookup(:table => @table_name),\n :models => ui_lookup(:tables => @table_name)}) if @flash_array.nil?\n params[:display] = @display\n show\n if [\"vms\", \"hosts\", \"storages\"].include?(@display)\n @refresh_partial = \"layouts/gtl\"\n else\n @refresh_partial = \"main\"\n end\n end\n end", "def by_machine\n @subprocesses = Machine.find(params[:machine_id]).subprocesses.scheduled.order(:start_date)\n render 'index'\n end", "def index\n @possible_names = current_user.possible_names.all\n end", "def index\n @machine_configs = MachineConfig.all\n end", "def show\n @systemadmin = Systemadmin.find(params[:id])\n @pSAdmins = Host.find_all_by_primary_sadmin_id(params[:id])\n @secSAdmins = Host.find_all_by_secondary_sadmin_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @systemadmin }\n end\n end", "def show\n # if params[:value]\n # @occasion = Occasion.find(params[:value])\n\n # @results1 = Tradename.find_by_contents(query, :models => [Tradename, Client], :limit => :all)\n # if @results1.empty? \n # @results2 = Word.find_by_contents(query, :models => [Word, Tradename, Client], :limit => :all)\n # if @results2.empty?\n # @results = Client.find_by_contents(query, :models => [Client], :limit => :all)\n # else\n # @results = @results2\n # end\n # else\n # @results = @results1\n # end\n\n # end\n end", "def show\n @specialization = Specialization.find(params[:id])\n @vmilists = Vmilist.select(:id, :name, :avatar, :status)\n .where('lower(vmilists.name) LIKE ? and vmilists.specialization_id = ?', \n \"%#{params[:search].mb_chars.downcase.to_s if params[:search]}%\", \"#{params[:id]}\")\n .paginate per_page: 9, page: params[:page]\n end", "def index\n @redes = Rede.all\n @hosts= Host.all\n @filtro ||= Hash.new\n @filtro[:mac] ||= \"PRIMEIRAVEZ\"\n\n unless @filtro[:mac].nil? and @filtro[:mac].blank? and @filtro[:mac]!= \"PRIMEIRAVEZ\"\n @hosts = Host.search(params[:search])\n else\n @filtro[:mac] = \"\"\n end\n\n end", "def index\n @hostnames = current_user.hostnames.all\n end", "def index\n @shift = Shift.new #new shift model\n\n #store in session so on refresh search input is empty (it will not reset the route)\n session[:search_by_name] = params[:search]\n \n\n #get all shifts that are from same organization that current logged in user is\n #possible to do it this way but querying will be N + 1\n # @shifts = Shift.all.order(created_at: :desc).select {|shift| shift.user.organization == current_user.organization}\n @shifts = Shift.order(created_at: :desc).includes(user: [:organization]).select {|shift| shift.user.organization == current_user.organization}\n\n #order shifts by user names\n @shifts = Shift.sort_by_name(@shifts) if params[:order_by_name]\n\n\n #search all shifts by users name\n @shifts = Shift.search_by_shifts_user_name(@shifts, session[:search_by_name]) if session[:search_by_name]\n end", "def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def show\n @virtualmachines = Virtualmachine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @virtualmachines }\n end\n end", "def machines\n response = request(:get, @machines_uri)\n response.body.split(MACHINES_SEPARATOR_RE)\n end", "def research_index\n @houdd_user = HouddUser.find(params[:user_id])\n @researches = HouddUser.find(params[:user_id]).researches\n\n respond_to do |format|\n format.html # research_index.html.erb\n end\n end", "def find_available_node\n node_name=nil\n nodes = JSON.parse http_get(@node_list_endpoint)\n nodes[\"computer\"].each do |i|\n if i[\"offline\"]\n node_name=i[\"displayName\"]\n break\n end\n end\n\n return node_name\nend", "def index\n @computers_keyboards = ComputersKeyboard.all\n end", "def show\n @user = @okr.user\n @okrs = @user.okrs.active.includes([:objectives => [:key_results]])\n end", "def index\n if params[:term].present?\n @users = User.clients.search params[:term]\n else\n @users = User.clients\n end\n\n end", "def index\n @searches = current_user.searches.all\n end", "def search\n @user = current_user\n @query = params[:query]\n @resulted_users = Admin.search_user(@query.downcase)\n @resulted_users.delete @user\n @resulted_users.sort! {|a,b| a.email <=> b.email}\n render layout: 'mobile_template'\n end", "def show\n @search = Host.search params[:search]\n @host = Host.find(params[:id])\n \n filter_notes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @host }\n end\n end", "def kon_user_account_checking\n user_array = User.kon_search(params[:name])\n if user_array.length \n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def view_all_users\n # !! get all user so can interact after viewing them? all_users\n # User.select(:username).each_with_index {|user, index| puts \"#{index+1}. #{user.username}\"}\n #??????\n User.select(:username).each {|user| puts user.username}\n end", "def search_results\n @results = User.search(params[:search])\n end", "def scrims_host\n Scrim.where(team_host: self)\n end", "def show\n if current_user.team_id.nil?\n redirect_to dashboard_url\n else\n @team = Team.find(current_user.team_id)\n teammates = @team.hackers.reject{ |h| h == current_user }\n @current_name = current_user.full_name.present? ? current_user.full_name : 'Me'\n @others = []\n 3.times do |i|\n teammate = teammates[i]\n if teammate.present?\n name = teammate.full_name.present? ? teammate.full_name : 'Friend'\n @others << {name: name, present: true, email: teammate.email}\n else\n @others << {name: 'Teammate', present: false}\n end\n end\n end\n end", "def suggest\n main_page_cred\n @user = current_user\n end", "def load_more_search_result\n @users=[]\n @users = @login_user.search_query(session[:search_opt],params[:page].to_i)\n render :partial => \"search_user_result\"\n #render :text => \"yes\"\n end", "def search_users\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '1'\n flash[:authority_error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n empty_user_id\n return\n end\n end\n empty_user_id\n @check=0\n @searched_user=User.new\n end", "def show\n @user = User.find(params[:id])\n @channels = Array.new\n @user.antennas.each do |antenna|\n @channels << Channel.find(antenna.channel_id)\n end\n @channels.sort_by{|e| e[:name]}\n @devices = Array.new\n @user.own_devices.each do |own_device|\n @devices << Device.find(own_device.device_id)\n end\n @devices.sort_by{|e| e[:name]}\n @set_top_boxes = Array.new\n @user.own_boxes.each do |own_box|\n @set_top_boxes << SetTopBox.find(own_box.set_top_box_id)\n end\n @set_top_boxes.sort_by{|e| e[:name]}\n end", "def index\n session[:current_tab] = \"Manage\"\n session[:current_sub_tab] = \"Resources\"\n @machines = Machine.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @machines }\n format.atom\n end\n end", "def index\n @searches = @user.searches\n respond_to do |format|\n format.html { }\n format.json { @presenter = json_presenter(@searches) }\n end\n end", "def index\n @user ||= current_user\n @apps = @user.apps.all\n # @app = @user.apps.find(params[:id]) \n\n end", "def search_user\n \t@users = UsersService.searchUser(params)\n render :index\n end", "def index\n jobs = current_user.hr.jobs\n @applications = Array.new\n jobs.each do |job|\n job_faculties_map = Hash.new\n job_faculties_map[job] = Array.new\n if job.faculties.length > 0\n job.faculties.each do |faculty|\n job_faculties_map[job] << faculty\n end\n @applications << job_faculties_map\n end\n end\n @applications\n end", "def index\n order = order_vms\n if params[:admin]!=nil && @admin # admin user\n sql = Vm.joins(:lab_user).order(order)\n @tab='admin'\n else \n labuser_ids = current_user.lab_users.map{|lu| lu.id }.flatten.uniq\n sql = Vm.joins(:lab_user).where( lab_user_id: labuser_ids ).order(order)\n end\n @vms = sql.paginate( :page => params[:page], :per_page => @per_page) \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vms }\n end\n end", "def search_rooms\n end", "def index\n @resources = @user.resources\n @matches = find_matches @user # defined below\n @like_requests = find_like_requests @user # defined below\n\n existing_categories = [] # populates the carousel dropdown with resource to be searched for\n\n if @user.wants_bike == true\n existing_categories << \"bike\"\n end\n\n if @user.wants_vehicle == true\n existing_categories << \"vehicle\"\n end\n\n if @user.wants_social == true\n existing_categories << \"social\"\n end\n\n if @user.wants_pet == true\n existing_categories << \"pet\"\n end\n\n if @user.wants_housing == true\n existing_categories << \"housing\"\n end\n\n @avail_resources = existing_categories # instance variable to be used in view\n end", "def view_by_system\n system \"clear\"\n prompt = TTY::Prompt.new\n prompt.select(\"Choose a console to view games\") do |menu|\n menu.choice \"PC\", -> {show_games_by_system(\"PC\")}\n menu.choice \"PlayStation 4\", -> {show_games_by_system(\"PlayStation 4\")}\n menu.choice \"XBOX1\", -> {show_games_by_system(\"Xbox One\")}\n menu.choice \"Nintendo Switch\", -> {show_games_by_system(\"Nintendo Switch\")}\n end\n end" ]
[ "0.59255767", "0.5848387", "0.5792922", "0.5683477", "0.5663232", "0.5630264", "0.56130457", "0.5556362", "0.5544253", "0.55217975", "0.54379725", "0.5431421", "0.54277843", "0.5392782", "0.53881454", "0.53772306", "0.53627795", "0.53627795", "0.5351879", "0.533307", "0.53175664", "0.53162986", "0.53069454", "0.5302674", "0.5300115", "0.52992475", "0.5288492", "0.52734977", "0.527043", "0.5266328", "0.5246994", "0.5241857", "0.52294683", "0.5211912", "0.52117944", "0.52007884", "0.5189546", "0.5174633", "0.5162272", "0.51616395", "0.5158597", "0.5146659", "0.51445687", "0.51440626", "0.51398546", "0.51371765", "0.51349294", "0.51242566", "0.5121186", "0.5120328", "0.51196474", "0.5100092", "0.5099372", "0.5094224", "0.5092549", "0.50924915", "0.5092097", "0.5088486", "0.50878966", "0.5077682", "0.5075845", "0.50753695", "0.50752413", "0.507165", "0.507085", "0.5062138", "0.50604934", "0.50519574", "0.5051102", "0.5049443", "0.5048982", "0.50482816", "0.5045206", "0.5042533", "0.5029416", "0.502795", "0.50233483", "0.5015053", "0.50116354", "0.50094694", "0.50094694", "0.50094694", "0.50094694", "0.50077057", "0.5005212", "0.5002998", "0.4999943", "0.49996564", "0.4997063", "0.4985522", "0.49847108", "0.49841484", "0.49828607", "0.49826583", "0.49796072", "0.49778578", "0.4976298", "0.49651864", "0.49596488", "0.49590057" ]
0.5209501
35
POST /lab_users POST /lab_users.xml
def create set_order_by @lab_users = LabUser.order(@order).paginate(:page => params[:page], :per_page => @per_page) # logic for when adding/removing multiple users at once to a specific lab if params[:lab_user] && params[:lab_user][:page]=='bulk_add' LabUser.add_users(params) flash[:notice] = 'successful update.' redirect_back fallback_location: add_users_path else #adding a single user to a lab respond_to do |format| #create lab_user params based on lab_id and user_id if params[:lab_id] params[:lab_user] = { lab_id: params[:lab_id] } if @user params[:lab_user][:user_id] = @user.id end end # continue to create @lab_user = LabUser.new(labuser_params) if @lab_user.save format.html { flash[:notice] = 'successful update.' redirect_back fallback_location: lab_users_path } format.json { logger.info "LABUSER CREATE SUCCESS: labuser=#{@lab_user.id} lab=#{@lab_user.lab.id} user=#{@lab_user.user.id} [#{@lab_user.user.username}]" render :json=> {:success => true, :lab_user => @lab_user}, :status=> :created } else format.html { render :action => 'index' } format.json { logger.error "LABUSER CREATE FAILED: lab=#{params[:lab_id]} user=#{params[:user_id]} " + ( @user ? "[#{@user.username}]" : '') logger.error @lab_user.errors.as_json render :json=> {:success => false, :errors => @lab_user.errors}, :status=> :unprocessable_entity } end #end if end #end respond_to end #end else end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def append_user_info(username, xml); end", "def create_user(body)\n post 'create_user', body\n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def parseUserData(doc, params)\n \n real_name = (doc.find_first('//xmpp2rest/user/real_name')) ? doc.find_first('//xmpp2rest/user/real_name').content : nil\n password = (doc.find_first('//xmpp2rest/user/password')) ? doc.find_first('//xmpp2rest/user/password').content : nil\n \n if not real_name or not password\n raise Exception.new(\"Missing elements data for creating new user!\")\n end \n \n params.merge!({:real_name => real_name})\n params.merge!({:password => password})\n \n return params\n end", "def create\n if params[:lab_id] && @lab = Lab.find_by_id(params[:lab_id])\n @user = @lab.build_user(user_params)\n else\n @user = User.new(user_params)\n end\n if @user.save\n session[:user_id] = @user.id\n UserMailer.with(new_user: @user).welcome_email.deliver_now\n AdminMailer.with(new_user: @user, lab: @user.lab).new_user_notification_email.deliver_now\n redirect_to lab_path(@user.lab_id)\n else\n render :new\n end\nend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def append_user_info(username, xml)\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n @lab = Lab.new(lab_params)\n @all_users=false\n @user_count=0\n respond_to do |format|\n if @lab.save\n \n @lab.add_all_users if params[:add] && params[:add].to_s==1.to_s\n @lab.remove_all_users if params[:remove] && params[:remove].to_s==1.to_s \n \n format.html { redirect_to(@lab, :notice => \"Lab was successfully created. #{params[:add]}\") }\n format.json { render :json => { :success => true, :lab=> @lab.as_json} }\n else\n format.html { render :action => 'new' }\n format.json { render :json => {:success=>false, :errors=>@lab.errors}, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @lab_user_info = LabUserInfo.new(lab_user_info_params)\n\n respond_to do |format|\n if @lab_user_info.save\n format.html { redirect_to @lab_user_info, notice: 'Lab user info was successfully created.' }\n format.json { render :show, status: :created, location: @lab_user_info }\n else\n format.html { render :new }\n format.json { render json: @lab_user_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def postUser( email, user_id, first_name, last_name, active, trust, creation_date, user_type, social_network, social_network_id, reseller_admin_masheryid, group_id, admin_upgrader)\n params = Hash.new\n params['email'] = email\n params['user_id'] = user_id\n params['first_name'] = first_name\n params['last_name'] = last_name\n params['active'] = active\n params['trust'] = trust\n params['creation_date'] = creation_date\n params['user_type'] = user_type\n params['social_network'] = social_network\n params['social_network_id'] = social_network_id\n params['reseller_admin_masheryid'] = reseller_admin_masheryid\n params['group_id'] = group_id\n params['admin_upgrader'] = admin_upgrader\n return doCurl(\"post\",\"/user\",params)\n end", "def create\n @lab_membership = LabMembership.new(params[:lab_membership])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.save\n flash[:notice] = 'LabMembership was successfully created.'\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { render :xml => @lab_membership, :status => :created, :location => @lab_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lab_membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create_users(accountId, model) path = \"/api/v2/accounts/#{accountId}/users\"\n post(path, model, {}, AvaTax::VERSION) end", "def createuserxml(useremail, username, roleid, restrictionid, groupids)\n userxml = Document.new\n userxml.add_element(\"user\")\n email = Element.new(\"email\")\n email.text= useremail\n userxml.root.add_element(email)\n name = Element.new(\"name\")\n name.text = username\n userxml.root.add_element(name)\n role = Element.new(\"roles\")\n role.text = roleid\n userxml.root.add_element(role)\n restriction_id = Element.new(\"restriction_id\")\n restriction_id.text = restrictionid\n userxml.root.add_element(restriction_id)\n groups = Element.new(\"groups\")\n userxml.root.add_element(groups, {\"type\" => \"array\"})\n # we can have or more of the groupIds\n groupids.each { |groupid|\n group = Element.new(\"group\")\n group.text = groupid\n groups.add_element(group)\n }\n\n return userxml # need to explicitly return in in this case because we want to return the entire xml we just built\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(\n email: params[:user][:email],\n password: params[:user][:password],\n password_confirmation: params[:user][:password_confirmation],\n admin: params[:user][:admin],\n master: params[:user][:master],\n )\n\n e = lambda { |ex|\n flash[:alert] = ex.message\n session[:form] = {\n email: params[:user][:email],\n admin: params[:user][:admin],\n master: params[:user][:master],\n }\n redirect_to(action: :new)\n }\n\n begin\n @user.save!\n rescue StandardError => ex\n e.call(ex) and return\n end\n\n begin\n # TODO カレントユーザーでZabbixとコネクションを張れるようにする\n z_params = params[:user][:zabbix_servers]\n z_params.shift\n @user.zabbix_server_ids = z_params\n zab = ZabbixServer.find(z_params)\n zab.each do |s|\n z = Zabbix.new(s.fqdn, s.username, s.password)\n z.create_user(@user)\n end\n rescue StandardError => ex\n @user.destroy\n e.call(ex) and return\n end\n\n flash[:notice] = I18n.t('users.msg.created')\n redirect_to(action: :index) and return\n end", "def create\n lab = Lab.find_by(id: params[:lab_id])\n user_lab = current_user.user_labs.create(lab: lab)\n\n respond_to do |format|\n if user_lab.save\n format.html { redirect_to labs_url , notice: 'Successfully subscribed.' }\n format.json { render :show, status: :created, location: labs_url }\n else\n format.html { render :new }\n format.json { render json: user_lab.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_data_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def create_user(resource)\n session = Puppet::NetDev::CE::Device.session\n\n set_user_xml = '<rpc><edit-config><target><running/></target><default-operation>merge</default-operation><error-option>rollback-on-error</error-option><config><aaa xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\"><lam><users><user operation=\"merge\"><userName>' + (resource[:name]).to_s + '</userName>'\n\n if resource[:password]\n set_user_xml += '<password>' + (resource[:password]).to_s + '</password>'\n end\n\n set_user_xml += '</user></users></lam></aaa></config></edit-config></rpc>'\n\n session.rpc.do_config(set_user_xml)\n end", "def create_user(user,pass,firstname,lastname,sso_provider)\n\n # test_user = '[email protected]'\n # pass = 'akbvgdrz77'\n # firstname = 'J'\n # lastname = 'T'\n\n values = \"{\\\"writerId\\\": \\\"#{@writer_id}\\\", \\\"email\\\": \\\"#{user}\\\", \\\"password\\\": \\\"#{pass}\\\", \\\"firstName\\\": \\\"#{firstname}\\\", \\\"lastName\\\": \\\"#{lastname}\\\", \\\"ssoProvider\\\": \\\"#{sso_provider}\\\"}\"\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n begin\n response = RestClient.post \"#{@api_endpoint}/users\", values, headers\n\n rescue Exception => msg\n\n puts msg\n #manager.clean_csv(variable_file,message)\n #manager.set_existing_variable_bulk(variable_file,$gd_pid)\n #puts message\n end\n\n return response\n\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n format.xml { render xml: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def users_post(user_mod_req, opts = {})\n data, _status_code, _headers = users_post_with_http_info(user_mod_req, opts)\n data\n end", "def save_user\n client = create_db_client\n client.query(\"INSERT INTO users(name, email, password, bio) VALUES('#{@name}', '#{@email}', '#{@password}', '#{@bio}')\")\n \n id = client.last_id\n rawData = client.query(\"SELECT * FROM users WHERE id='#{id}'\")\n users = Array.new\n rawData.each do |data|\n user = {:id => data[\"id\"], :name => data[\"name\"] ,:email => data[\"email\"], :password => data[\"password\"], :bio => data[\"bio\"]}\n users << user\n end\n response = Response.new('success', 'success input user', users)\n return response.response_api\n end", "def create\n @user = V1::User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'V1::User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_user(attributes = {})\n elektron_identity.post(\"users\") { { user: attributes } }.body[\"user\"]\n end", "def create_user(description= {})\n request(Net::HTTP::Post, \"/api/#{API_VERSION}/user\", nil, description, true)\n end", "def create_user(options = {})\n post :create, {:user => { :name => 'quire', :point_value => \"2\", :login => 'quire', :email => '[email protected]',\n :password => 'quire', :password_confirmation => 'quire' }.merge(options)}, {:user_id => \"1\"}\n end", "def user_new_user(email, password, username, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_new_user ...\"\n end\n\n # verify the required parameter 'email' is set\n fail \"Missing the required parameter 'email' when calling user_new_user\" if email.nil?\n\n # verify the required parameter 'password' is set\n fail \"Missing the required parameter 'password' when calling user_new_user\" if password.nil?\n\n # verify the required parameter 'username' is set\n fail \"Missing the required parameter 'username' when calling user_new_user\" if username.nil?\n\n # resource path\n path = \"/user\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"email\"] = email\n form_params[\"password\"] = password\n form_params[\"username\"] = username\n form_params[\"firstname\"] = opts[:'firstname'] if opts[:'firstname']\n form_params[\"lastname\"] = opts[:'lastname'] if opts[:'lastname']\n form_params[\"acceptsTOS\"] = opts[:'accepts_tos'] if opts[:'accepts_tos']\n form_params[\"referrerID\"] = opts[:'referrer_id'] if opts[:'referrer_id']\n form_params[\"country\"] = opts[:'country'] if opts[:'country']\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'User')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_new_user. Result: #{result.inspect}\"\n end\n return result\n end", "def users_post_with_http_info(user_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.users_post ...'\n end\n # verify the required parameter 'user_mod_req' is set\n if @api_client.config.client_side_validation && user_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'user_mod_req' when calling UsersApi.users_post\"\n end\n # resource path\n local_var_path = '/users'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(user_mod_req)\n auth_names = ['BrainPortalSession']\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 => 'User')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#users_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @users_hacktag = UsersHacktag.new(params[:users_hacktag])\n\n respond_to do |format|\n if @users_hacktag.save\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully created.') }\n format.xml { render :xml => @users_hacktag, :status => :created, :location => @users_hacktag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_new_users(users)\n user = users.first\n wait_until_bus_section_load\n user_group_select.select(user.user_group) unless user.user_group.nil?\n storage_type_select.select(user.storage_type) unless user.storage_type.nil?\n storage_max_tb.type_text(user.storage_limit) unless user.storage_limit.nil?\n device_tb.type_text(user.devices) unless user.devices.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n enable_stash_cb.check\n else\n enable_stash_cb.uncheck\n end\n end\n\n users.each_index do |index|\n Log.debug \"##########adding the #{index} user\"\n find(:id, \"user#{index+1}_name\").type_text(users[index].name)\n find(:id, \"user#{index+1}_username\").type_text(users[index].email)\n add_user_btn.click if index != users.length-1\n end\n\n unless user.send_email.nil?\n if user.send_email.downcase.eql?('yes')\n send_emails_cb.check\n else\n send_emails_cb.uncheck\n end\n end\n\n submit_btn.click\n wait_until_bus_section_load\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_url, :notice => \"User #{@user.name} was successfully created.\") }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def register\n usr=params[:user]\n pass=encryptor(usr[:password])\n confPass=encryptor(usr[:password_confirmation])\n #puts(pass)\n #puts(usr[:password])\n @key_name_prefix=\"grupo_\"\n options = {\n :body =>{\n \"firstName\": usr[:firstName],\n \"lastName\": usr[:lastName],\n \"email\": usr[:email],\n \"password\": pass,\n \"password_confirmation\": confPass\n }.to_json,\n :headers => {'Content-Type'=> 'application/json'\n }\n }\n #puts(options)\n resultsLDAP = HTTParty.post(\"http://192.168.99.104:4001/user/resources/ldapcruds\", options)\n if resultsLDAP.code == 201\n # options = {\n # :body => params.to_json,\n # :headers => {\n # 'Content-Type' => 'application/json'\n # }\n # }\n options = {\n :body =>{ \"user\":{\n \"firstName\": usr[:firstName],\n \"lastName\": usr[:lastName],\n \"email\": usr[:email],\n \"password\": pass,\n \"password_confirmation\": confPass\n }\n }.to_json,\n :headers => {'Content-Type'=> 'application/json'\n }\n }\n #puts(options)\n results = HTTParty.post(\"http://192.168.99.101:4051/users\", options)\n if results.code == 201\n user = results.parsed_response\n aux = params[:user]\n options = {\n :body =>{ \"notification_key\": \"\",\n \"user_id\": user\n }.to_json,\n :headers => {'Content-Type'=> 'application/json'\n }\n }\n results3 = HTTParty.post(\"http://192.168.99.101:4051/group_keys\".to_s,options)\n if results3.code == 201\n head 201\n else\n render json: results3.parsed_response, status: results3.code\n end\n else\n render json: results.parsed_response, status: results.code\n end\n elsif resultsLDAP.code == 400\n render json: {\"email\": [\"has already been taken\"]}.to_json, status: 422\n else\n renderError(\"Not Avalible\", 503, \"OpenLDAP server conection failed\")\n end\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def user_create(username, email, password, tenant_id)\n\t\n\t\tuser = {\"user\" => {\"name\" => username, \"email\" => email, \"enabled\" => true, \"password\" => password, \"tenantid\" => tenant_id}}\n\t\n\t\tjson_string = JSON.generate(user)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/v2.0/users\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\t\t\t\t\t\t\t\t \n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def create_user_and_login \n\t\tinsert_into :users, {\n\t\t\tid: 1 ,\n\t\t\tfirst_name: 'First',\n\t\t\tlast_name: 'Last',\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password',\n\t\t\trole_id: 1,\n\t\t\tuid: \"a\"\n\t\t}\n\n\t\tproxy.post( 'http://my.ownet/api/session',{\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password'\n\t\t}.to_json)\n\tend", "def create\n group_ids = params[\"group_id\"]\n org_id = params[:organization_id]\n @user = User.new(full_name: params[:full_name], password: params[:password], password_confirmation: params[:password], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path], team_leader_id: nil)\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def create_usr\n user_reg = MobileUser.api(params[:usr_crt])\n render json: {errorMessage: user_reg[0], status: user_reg[1]}, status: 201\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(:root) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\", :layout=>false }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sys_user = Sys::User.new(sys_user_params)\n\n respond_to do |format|\n if @sys_user.save\n format.html { redirect_to @sys_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @sys_user }\n else\n format.html { render :new }\n format.json { render json: @sys_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create\r\n @user = User.new(params[:user])\r\n \r\n respond_to do |format|\r\n if @user.save\r\n flash[:notice] = 'User was successfully created.'\r\n format.html { redirect_to user_url(@user) }\r\n format.xml { head :created, :location => user_url(@user) }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @user.errors.to_xml }\r\n end\r\n end\r\n end", "def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n end", "def publish_to_users\n data = { users: users }.merge!(payload)\n client.post('publishes/users', data)\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def get_users(request)\n # --- Get Users Pool ---\n user_pool = UserPoolOCCI.new(@client)\n\n # --- Prepare XML Response ---\n rc = user_pool.info\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return to_occi_xml(user_pool, :code=>200, :verbose=>request.params['verbose'])\n end", "def create\n @user = User.new(params[:user])\n get_list\n\n respond_to do |format|\n if @user.save\n flash[:notice] = \"User #{@user.fname} #{@user.lname} was successfully created.\"\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n verify_post_request\n access_denied unless has_role?(:admin)\n require_parameters :login, :password, :password_confirmation\n\n user = User.find_by_login(params[:login])\n\n if user && user.active\n render_bad_request('An active user with this login already exists')\n else\n if user\n user.reactivate!(java_facade.getSettings().getString('sonar.defaultGroup'))\n user.notify_creation_handlers\n else\n user = prepare_user\n user.save!\n user.notify_creation_handlers\n end\n hash = user.to_hash\n respond_to do |format|\n format.json { render :json => jsonp(hash) }\n format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'users') }\n end\n end\n end", "def create\n\t\tparams.permit!\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_url,\n :notice => \"User #{@user.name} was successfully created.\") }\n format.xml { render :xml => @user,\n :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n result = access_token.post('/api/v1/users/create', {:email=>params[:email],:psw=>params[:password],:psw_conf=>params[:password_conf],:inbox=>params[:inbox]})\n display_api_response result\n respond_with(\"\",:location => :back)\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :json => ( (@user.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @user.errors.empty?\n format.html { render :json => {:success => false} }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_add(username, password, permissions, type)\n payload = {\n :username => username, \n :password => password, \n :permissions => permissions, \n :type => type, \n :json => 1\n }\n http_post(:uri=>\"/users\", :fields=>x_cookie, :data=>payload)\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(:users, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new(params[:user])\n @user.group = Group.new\n @user.group.name = \"Scriptwords\"\n @user.bright_text_application_id = BrightTextApplication.where(:name=>\"ScriptureWords\").first.id\n @user.user_type = 0\n\n respond_to do |format|\n if @user.save\n GroupMember.where(:email => @user.email).update_all(:user_id=>@user.id)\n log_in! @user\n format.html { redirect_to(scriptwords_root_url, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" , :layout => \"scriptwords\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :created, :location => user_url(@user) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def create_user(field_hash)\n field_hash[:id] = \"user/new\"\n payload = compose(field_hash)\n resp = @site['user/new/edit'].post payload\n new_id = resp.match(/User\\s*(\\d+)/)\n if new_id.class == MatchData\n new_user = new_id[1]\n else\n new_user = resp\n end\n new_user # return the new user id or the full REST response\n end", "def addUser\n id = params[:id] # retrieve project ID from URI route\n proj = Project.find(id)\n if proj.add_user(params[:username],params[:rolename])\n head :no_content\n else\n render_error(:unprocessable_entity, \"Could not add user\")\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def new\n @user = User.find(params[:user_id])\n @lab_membership = LabMembership.new(\n :user_id => @user.id,\n :lab_group_id => nil\n )\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lab_membership }\n end\n end", "def create\n if !current_user || is_admin?\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(:root, :notice => 'Registration successfull.') }\n #format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to :root\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :created, :location => user_url(@user) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors }\n end\n end\n end", "def create\n logger.debug(\"AAA \" + params[:user][:password])\n\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { redirect_to(users_path, :notice => 'User was successfully created.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(context, name, should)\n res = context.transport.post_request(context, 'security/users', keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def create(params = {})\n response = Tiptaplab.api.make_call('users', {:user => params}, 'POST')\n dup_params = params.dup\n dup_params[:ttl_id] = response['id']\n u = self.new(dup_params)\n end", "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "def new_user\n begin\n $results.log_action(\"button(#{@params[0]})\")\n @driver.find_element(:id, \"user-new-btn\").click\n sleep 2\n $results.success\n rescue => ex\n $results.fail(\"button(#{@params[0]})\", ex)\n end\n end", "def create\n @xp_user = XpUser.new(xp_user_params)\n\n respond_to do |format|\n if @xp_user.save\n format.html { redirect_to new_xp_user_path, notice: '恭喜您已經成功取得抽獎資格,請繼續注意本網站公告喔!' }\n format.json { render action: 'show', status: :created, location: @xp_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @xp_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(\n email: params[:user][:email],\n password: params[:user][:password],\n password_confirmation: params[:user][:password_confirmation],\n admin: params[:user][:admin],\n master: params[:user][:master]\n )\n\n e = -> (ex) {\n flash[:alert] = ex.message\n session[:form] = {\n email: params[:user][:email],\n admin: params[:user][:admin],\n master: params[:user][:master],\n }\n redirect_to(action: :new)\n }\n\n begin\n @user.save!\n rescue => ex\n e.(ex) and return\n end\n\n begin\n #TODO カレントユーザーでZabbixとコネクションを張れるようにする\n s = AppSetting.get\n z = Zabbix.new(s.zabbix_user, s.zabbix_pass)\n z.create_user(@user)\n rescue => ex\n @user.destroy\n e.(ex) and return\n end\n\n flash[:notice] = I18n.t('users.msg.created')\n redirect_to(action: :index) and return\n end", "def create\n @user = User.new(params[:user])\n\t\n respond_to do |format|\n if @user.save\n\t url = \"http://tagnart.com/rdc/\"+params[:url]\n\t @tag = @user.tags.new(:url => url, :data => params[:data])\n\t\tif @tag.save \n\t\t\tflash[:notice] = \"User #{@user.email} was successfully created.\"\n\t\t\tformat.html { redirect_to :action=>'index' }\n\t\t\tformat.json { render json: @user, status: :created, location: @user } \n\t\telse\n\t\t\tputs \"User #{@user.email} was not successfully created.\"\n\t\tend\n\t else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_contexts_path(@user), notice: 'Nutzer erfolgreich registriert.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n @user.admin = false\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(root_url, notice: 'User was successfully created.') }\n format.xml { render xml: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_user(uid, params={})\n params.merge!(default_params)\n params['pio_uid'] = uid\n extract_latlng(params)\n @connection.post(:users, params).body\n end", "def create\n @user = User.new(user_params)\n @user.remote_ip = request.remote_ip\n\n response = Apis.get_imsi_ecgi(request.remote_ip)\nlogger.error '### ' + response.code.to_s\n \tif response.code != 200\n\t\tredirect_to new_user_path, notice: '해당 사용자가 등록되어 있지 않습니다.'\n\telse \n\t\txml_parser = Nori.new\n\n\t\tresult = xml_parser.parse(response.body)\n\t\[email protected] = result['BODY']['IMSI']\n\t\[email protected] = result['BODY']['ECGI']\n\t\t\n\t\trespond_to do |format|\n\t\t\t\tif @user.save\n\t\t\t\t\tsign_in(@user)\n\t\t\t\t\tformat.html { redirect_to setting_path, notice: '가입을 축하합니다' }\n\t\t\t\t\tformat.json { render action: 'show', status: :created, location: @user }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\tend\n\tend\n end", "def labinfo\n respond_to do |format|\n format.html { redirect_to(root_path, notice: 'Invalid request') }\n format.json { render :json=> ImportLabs.export_labuser(params[:uuid], params[:pretty]) }\n end\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end", "def post_users(users, opts = {})\n data, _status_code, _headers = post_users_with_http_info(users, opts)\n data\n end", "def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.children.create(params[:user].merge :email => \"design+parent_id#{current_user.id}_child_count#{current_user.children.count + 1}@newint.com.au\")\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(current_user), notice: 'User was successfully created.' }\n format.json { render json: [:institution, @user], status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(options = {})\n post \"/users\", options\n end" ]
[ "0.6368727", "0.6049231", "0.59577274", "0.58966994", "0.58820397", "0.5861588", "0.5841159", "0.5837824", "0.5827645", "0.5822449", "0.5818072", "0.5780486", "0.57476145", "0.57180935", "0.5712718", "0.5638049", "0.5620628", "0.55968904", "0.55528", "0.5540951", "0.5531949", "0.5531552", "0.55228007", "0.550379", "0.5489016", "0.54804754", "0.546711", "0.5464602", "0.54616326", "0.5454873", "0.5452794", "0.54410696", "0.5439626", "0.5439441", "0.54310507", "0.54265314", "0.54244506", "0.5412758", "0.5410568", "0.54095876", "0.5404764", "0.5400999", "0.5395156", "0.53854775", "0.53795797", "0.5379349", "0.53792745", "0.53791904", "0.5378574", "0.5369006", "0.53660464", "0.5357376", "0.53537756", "0.5351847", "0.5350549", "0.535001", "0.5341812", "0.5333098", "0.5332583", "0.5330892", "0.5327084", "0.53236496", "0.5321026", "0.53178734", "0.53125936", "0.5294213", "0.52927274", "0.52887416", "0.5288361", "0.5286722", "0.5276746", "0.5276432", "0.5275912", "0.5275333", "0.526697", "0.52626735", "0.5260519", "0.5258773", "0.52508795", "0.52374786", "0.52260923", "0.52251595", "0.5224941", "0.52233326", "0.52219546", "0.5216419", "0.5216207", "0.5211955", "0.52094567", "0.52079123", "0.5207103", "0.5207103", "0.5207103", "0.5207103", "0.5207103", "0.5207103", "0.5207103", "0.5207103", "0.52055913", "0.5205161" ]
0.53722155
49
PUT /lab_users/1 PUT /lab_users/1.xml
def update respond_to do |format| if @lab_user.update_attributes(labuser_params) format.html { flash[:notice] = 'successful update.' redirect_back fallback_location: lab_users_path } format.json { render :json=>{:success=>true, :lab_user=>@lab_user.as_json} } else format.html { render :action => 'edit' } format.json { render :json => {:success=>false, :errors=> @lab_user.errors}, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update\n respond_to do |format|\n if @lab_user_info.update(lab_user_info_params)\n format.html { redirect_to @lab_user_info, notice: 'Lab user info was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_user_info }\n else\n format.html { render :edit }\n format.json { render json: @lab_user_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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 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 => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n respond_to do |format|\n @all_users=false\n @user_count =0\n @user_count = @lab.lab_users.count \n @all_users=true if User.all.count==@user_count\n if @lab.update_attributes(lab_params)\n \n @lab.add_all_users if params[:add].to_s==1.to_s \n @lab.remove_all_users if params[:remove].to_s==1.to_s \n \n format.html { redirect_to(@lab, :notice => 'Lab was successfully updated.') }\n format.json { render :json => {:success=>true, :lab=> @lab.as_json} }\n else\n format.html { render :action => 'edit' }\n format.json { render :json => {:success=>false, :errors=>@lab.errors}, :status => :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def append_user_info(username, xml); end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update_user\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def set_lab_user_info\n @lab_user_info = LabUserInfo.find(params[:id])\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\n @user = User.find_by_urlname(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated successfully\"\n format.html { redirect_to user_path(@user) }\n format.xml { head :ok }\n else\n flash[:error] = \"There were problems updating the profile\"\n format.html { render :action => 'edit' }\n format.xml { @user.errors.to_xml }\n end\n end\n end", "def append_user_info(username, xml)\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url,:notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to([:admin, @user], notice: 'User was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated user #{@user.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:users]\n user_ids = params[:users].keys\n user_ids.each do |id|\n @jam_circle.users << User.find(id)\n end\n end\n respond_to do |format|\n if @jam_circle.update(jam_circle_params)\n format.html { redirect_to @jam_circle }\n format.json { render :show, status: :ok, location: @jam_circle }\n else\n format.html { render :edit }\n format.json { render json: @jam_circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @users_hacktag = UsersHacktag.find(params[:id])\n\n respond_to do |format|\n if @users_hacktag.update_attributes(params[:users_hacktag])\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(root_path, :notice => 'Usuario alterado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find_by_slug(params[:id])\n # @wiki = Wiki.find(params[:id])\n # merge default value with params so if no collaborators checked, will erase\n if @user.update_attributes(params[:user])\n redirect_to @user\n else\n flash[:error] = \"Error saving user. Please try again.\"\n render :edit\n end\n end", "def update\n @user = User.find(params[:id])\n logger.info 'ffffff'\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash.now[:notice] = 'Successfully updated.'\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n flash.now[:error] = 'Could not update. Please see errors below...'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user(id, attributes)\n elektron_identity.put(\"users/#{id}\") { { user: attributes } }.body[\n \"user\"\n ]\n end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "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(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 @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to root_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(users_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @xcuser.update(xcuser_params)\n format.html { redirect_to @xcuser, notice: 'Xcuser was successfully updated.' }\n format.json { render :show, status: :ok, location: @xcuser }\n else\n format.html { render :edit }\n format.json { render json: @xcuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_addon = UserAddon.find(params[:id])\n\n respond_to do |format|\n if @user_addon.update_attributes(params[:user_addon])\n format.html { redirect_to([:scaffold, @user_addon], :notice => 'User addon was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_addon.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @userspec.update(userspec_params)\n format.html { redirect_to root_path, notice: 'Userspec was successfully updated.' }\n format.json { render :show, status: :ok, location: @userspec }\n else\n format.html { render :edit }\n format.json { render json: @userspec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => 'User has been updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n return unless force_group(\"root\")\n @user = User.find(params[:id])\n\n # init always, so non-checked checkboxes will be updated\n params[:user][:fachschaft_ids] ||= []\n params[:user][:referat_ids] ||= []\n # normalize groups field\n params[:user][:groups] = params[:user][:groups].downcase.split(/[^a-z]+/).uniq.sort.join(\" \") if params[:user][:groups]\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to edit_user_path(@user), notice: 'Nutzer erfolgreich aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_user.errors, status: :unprocessable_entity\n end\n end", "def update_user(user_name:, user:)\n validate_user_name(:user_name, user_name)\n response = wrap_response(@connection.put(user_path(user_name), user))\n\n response.fmap { |r| SftpgoClient::ApiResponse.new(r.body) }\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(\"/parametres_cabinets/#{@user.parametres_cabinet_id}/edit\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.get!(params[:id])\n set_groups(@user, ids_to_groups(params[:groups]))\n \n respond_to do |format|\n if @user.update_attributes(params[:user]) or not @user.dirty?\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(user_url(@user.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(self.current_user)\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:success] = 'You Have Successfully Updated Your Details'\n format.html { redirect_to user_url(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def reg_personal_profile_update\n respond_to do |format|\n if @user.update_attributes(params[:users]) \n format.html { redirect_to(dashboards_path, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :editing_user_profile }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n head :ok\n else\n render :xml => @user.errors, :status => :unprocessable_entity\n end\n rescue\n render :nothing => true, :status => :not_found\n end", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(home_url()) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_user_update\n new_data = {\n 'OrgDefinedId' => 'ruby-test',\n 'FirstName' => 'Test-User',\n 'MiddleName' => 'changed',\n 'LastName' => 'Test',\n 'ExternalEmail' => nil, # Predefines user data, in the case that\n 'UserName' => 'test-ruby-user1234', # there is are variables left out in the JSON\n 'Activation' => {\n 'IsActive' => true\n }\n }\n user_id = get_user_by_username(new_data['UserName'])['UserId']\n update_user_data(user_id, new_data)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user(uid, params={})\n begin\n RestClient.post construct_url(\"user/#{uid}\"), params\n true\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end", "def update\n @user_name = UserName.find(params[:id])\n\n respond_to do |format|\n if @user_name.update_attributes(params[:user_name])\n format.html { redirect_to(@user_name, :notice => 'User name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = @current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, notice: 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n #render action: :edit\n end\n end\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(admin_users_path, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@user = User.find_by_id(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def test_should_update_group_user_via_API_JSON\r\n # lookup user's membership\r\n get \"memberships/find.json?api_key=testapikey&user_id=4&group_id=1\"\r\n membership = JSON.parse(response.body)\r\n membership_id = membership['id']\r\n assert membership_id == 3, 'Incorrect membership id'\r\n assert membership['role_id'] == Role.find_by_rolename('user').id, 'Incorrect role id'\r\n \r\n # promote user to group admin\r\n put \"/memberships/#{membership_id}.xml\", :api_key => 'testapikey',\r\n :membership => {:user_id => 4,\r\n :group_id => 1,\r\n :role_id => Role.find_by_rolename('group_admin') }\r\n assert_response :success\r\n end", "def update\n @title = 'Users Management'\n @breadcrumb = 'Users > Edit'\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @catalogs_user_resource.update(catalogs_user_resource_params)\n flash[:success] = t('notices.updated_successfully')\n index\n end\n end" ]
[ "0.6696875", "0.6186183", "0.6172667", "0.61507875", "0.61284614", "0.6025905", "0.59806406", "0.5942275", "0.59141713", "0.59137934", "0.5913523", "0.59059465", "0.58524704", "0.5849189", "0.5819567", "0.5815567", "0.5808175", "0.5785233", "0.57784307", "0.57784307", "0.5749344", "0.57423794", "0.5732638", "0.57283956", "0.57149935", "0.5712335", "0.57038134", "0.56834817", "0.56790096", "0.5653205", "0.5631176", "0.56266713", "0.5603497", "0.55872583", "0.5584545", "0.5577592", "0.5559334", "0.55551875", "0.5554501", "0.55452347", "0.55341774", "0.55330926", "0.5529419", "0.55258036", "0.5520088", "0.5511701", "0.5498315", "0.54880923", "0.54833955", "0.5476463", "0.54694307", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.54582644", "0.5457349", "0.54565364", "0.5456046", "0.5451252", "0.5445828", "0.54425955", "0.54413027", "0.5439071", "0.54374117", "0.5437278", "0.5436867", "0.5436691", "0.54312307", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.5431207", "0.54298097", "0.54288167", "0.5427028", "0.5423768", "0.5423621", "0.5421866", "0.5420604", "0.5420344", "0.54151523", "0.54143107", "0.54143107", "0.54110944", "0.5410437", "0.5403905" ]
0.5892333
12
DELETE /lab_users/1 DELETE /lab_users/1.xml
def destroy respond_to do |format| #when removing someone from a lab, you need to end their lab @lab_user.end_lab @lab_user.destroy format.html { redirect_to(lab_users_path) } format.json { render :json=> { :success=>true, :message=>'lab user removed'} } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def delete_users\n delete(users_path)\n end", "def destroy\n @user = User.find_by_urlname(params[:id])\n @user.destroy\n \n respond_to do |format|\n flash[:notice] = \"User deleted from the system\"\n format.html { redirect_to users_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(scriptwords_users_url) }\n format.xml { head :ok }\n end\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) unless res.success?\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted user #{@user.name}\")\n end", "def destroy\n #@user = User.find_by_login(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @users = Users.find(params[:id])\n @users.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @lab_membership = LabMembership.find(params[:id])\n @user = @lab_membership.user\n @lab_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { head :ok }\n end\n end", "def delete\n @linked_user.delete(@uri)\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n flash[:notice] = \"User #{@user.login} deleted\"\n \n respond_to do |format|\n format.html { redirect_to(space_users_path(@space)) }\n format.xml { head :ok }\n format.atom { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n user = User.get(params[:id])\n user.destroy if user\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #@user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_path) }\n format.xml { head :ok }\n end\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :no_content }\n end\n end", "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @user.destroy\r\n \r\n respond_to do |format|\r\n format.html { redirect_to users_url }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @lab_user_info.destroy\n respond_to do |format|\n format.html { redirect_to lab_user_infos_url, notice: 'Lab user info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user(uid)\n begin\n RestClient.delete construct_url(\"user/#{uid}\")\n true\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_addon = UserAddon.find(params[:id])\n @user_addon.destroy\n\n respond_to do |format|\n format.html { redirect_to([:scaffold, user_addons_url]) }\n format.xml { head :ok }\n end\n end", "def test_user_delete\n # Get the user info\n user = get_user_by_username('test-ruby-user12356')\n # Check to see if the returned user was the correct one.\n # Doubles to check whether the returned data exists in a proper form\n assert_equal('test-ruby-user12356', user['UserName'])\n # Delete the user based upon the returned user's id\n ap delete_user_data(user['UserId'])\n # assert if referencing this user, again, causes an error.\n user = get_user_by_username('test-ruby-user12356')\n assert_raise { delete_user_data(user['UserId']) }\n end", "def destroy\n @ecnuser = Ecnuser.find(params[:id])\n @ecnuser.destroy\n\n respond_to do |format|\n format.html { redirect_to(ecnusers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(:first, :conditions => [\"id = ?\", params[:id]])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(users_path) }\n format.xml { head :ok }\n end\n end", "def delete\n appctrl_delete( 'User' )\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end", "def delete_user\n end", "def destroy\n @users_hacktag = UsersHacktag.find(params[:id])\n @users_hacktag.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_hacktags_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_name = UserName.find(params[:id])\n @user_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_names_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\nend", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @usuario = User.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n flash[:notice] = 'User was successfully deleted.'\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = current_org.users.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @user_ext = UserExt.find(params[:id])\n @user_ext.destroy\n\n respond_to do |format|\n format.html { redirect_to user_exts_url }\n format.json { head :no_content }\n end\n end", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/parametres_cabinets/#{@user.parametres_cabinet_id}/edit\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @big_auth_user = BigAuth::User.find(params[:id])\n @big_auth_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_auth_users_url) }\n format.xml { head :ok }\n end\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @bb_auth_user = BbAuthUser.find(params[:id])\n @bb_auth_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(bb_auth_users_url) }\n format.xml { head :ok }\n end\n end", "def delete_user (db, user_name)\n\tdb.execute(\"DELETE FROM users WHERE user_name=?\", [user_name])\nend" ]
[ "0.6878262", "0.6797821", "0.66255116", "0.6539781", "0.6521376", "0.65021044", "0.65009737", "0.6482622", "0.6478631", "0.64693964", "0.64634985", "0.6427895", "0.6395588", "0.63879114", "0.63869697", "0.6383369", "0.63735974", "0.6362089", "0.6355484", "0.6355484", "0.6344636", "0.6344636", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.63372433", "0.6325883", "0.6322266", "0.63216394", "0.63203764", "0.63110465", "0.6299006", "0.62927383", "0.6291191", "0.629105", "0.629105", "0.629105", "0.62858653", "0.62734157", "0.6246949", "0.62462145", "0.62237614", "0.62112015", "0.6205607", "0.6197095", "0.6190333", "0.6189406", "0.618613", "0.61656255", "0.61577845", "0.6147896", "0.6144898", "0.61416423", "0.6139", "0.61387247", "0.6127137", "0.61172557", "0.61164784", "0.60947853", "0.609157", "0.60903716", "0.60896516" ]
0.61984867
82
return labuser and it's lab info based on labuser uuid
def labinfo respond_to do |format| format.html { redirect_to(root_path, notice: 'Invalid request') } format.json { render :json=> ImportLabs.export_labuser(params[:uuid], params[:pretty]) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_user\n Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:lab_user]\n end", "def get_user(username)\n Chef::Log.info username\n user = @node[:users][username]\n Chef::Log.info user.inspect\n user\nend", "def lab_user_id\n plaintext_id = \"#{@view_options[:channel]}:#{user_or_session_id}\"\n Digest::SHA1.base64digest(storage_encrypt(plaintext_id)).tr('=', '')\n end", "def set_lab_user_info\n @lab_user_info = LabUserInfo.find(params[:id])\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def find_uuid(label, field)\n account = find_and_choose(label, field)\n\n return account['uuid'], account['label'] unless account.nil?\n end", "def get_user(uuid)\n {\n 'uuid' => uuid,\n 'first_name' => 'George',\n 'last_name' => 'Washington',\n 'date_of_birth' => '1809-02-12',\n 'email' => '[email protected]',\n 'created_at' => '2015-05-25 13:05:59 -0700'\n }\n end", "def invite_lab(user, invited_lab_id)\n # ユーザ再取得\n user = User.find_by(email: user.email)\n lab = Lab.find(invited_lab_id)\n one_time_token = OneTimeToken.find_by(mail_address: user.email)\n # nil チェック\n lab_user = LabUser.new({user_id: user.id, lab_id: lab.id})\n if lab_user.save\n one_time_token.destroy\n return lab_user\n else\n return nil\n end\n end", "def getUuid user\n\tres = HTTParty.post(\"https://api.mojang.com/profiles/minecraft\",\n\t { \n\t :body => user.to_json,\n\t :verify => false,\n\t\t:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}\n\t })\n\tif res.parsed_response.count == 0\n\t\tp \"User #{user} doesn't exist\"\n\t\treturn false\n\telse \n\t\treturn res.parsed_response[0][\"id\"]\n\tend\nend", "def get_user(name)\n user = nil\n \n @user_pool.info\n @user_pool.each{ |u|\n if u.name==name\n user=Hash.new\n\n user[:id] = u.id\n user[:name] = u.name\n user[:password] = u[:password]\n end\n }\n return user\n end", "def getusername()\r\n return getvalue(SVTags::USER_ID)\r\n end", "def fluidfeatures_current_user(verbose=false)\n if current_user\n if verbose\n {\n :id => @current_user[:id],\n :name => @current_user[:name],\n :uniques => {\n :twitter => @current_user[:twitter_id]\n },\n :cohorts => {\n # Example attributes for the user.\n # These can be any fields you wish to select users by.\n :company => {\n # \"display\" is used to help you find it in the dashboard.\n # Highly recommended unless you work with ids.\n # This display name can change over time without consequence. \n :display => @current_user[:company_name],\n # \"id\" should be unique this this cohort and must be static\n # over time.\n :id => @current_user[:company_id]\n },\n # For this boolean cohort \"true\"|\"false\" is the \"display\"\n # and the \"id\"\n :admin => @current_user[:admin]\n }\n }\n else\n {\n :id => @current_user.id\n }\n end\n else\n end\n end", "def getUser(user, info)\n @@users[user][info]\n end", "def userinfo\n @participant = Participant.find(session[:user])\n end", "def user_labs\n get_user # @user - either lab owner or current user\n if !@user && params[:username]\n logger.debug \"There is no user named '#{params[:username]}'\"\n flash[:notice] = \"There is no user named '#{params[:username]}'\"\n redirect_back fallback_location: my_labs_path+(params[:id] ? \"/#{params[:id]}\" : '')\n elsif !@admin && params[:username] then # simple user should not have the username in url\n logger.debug \"\\nmy_labs: Relocate user\\n\"\n # simple user should not have the username in url\n redirect_to(my_labs_path+(params[:id] ? \"/#{params[:id]}\" : ''))\n else\n get_user_labs(@user) # @labs (all labs), @started, @complete, @not_started\n # if no course is selected show the first one\n if params[:id]!=nil\n @lab = Lab.find(params[:id])\n else\n @[email protected] \n end\n\n if @labs!=[] && @labs.include?(@lab)\n @lab_user = LabUser.where('lab_id=? and user_id=?', @lab.id, @user.id).last if @lab\n elsif @labs!=[] # users with labs, that try to see others labs are redirected to error\n logger.debug \"\\n'#{current_user.username}' redirected: dont have lab '#{@lab.name}' (#{@lab.id}) \\n\"\n redirect_to(error_401_path) and return\n end\n end\n end", "def get_user_id(full_user_name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/users\"\n puts \"@url is #{@url}\"\n \n @payload={'search_term': full_user_name}\n puts(\"@payload is #{@payload}\")\n \n @getResponse = HTTParty.get(@url, :body => @payload.to_json, :headers => $header)\n puts(\" GET to get user has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n user_data = @getResponse.parsed_response\n user_id = nil\n\n user_data.each do |user_info|\n if user_info[\"name\"] == full_user_name\n user_id = user_info[\"id\"]\n end\n end\n\n return user_id\nend", "def get_user_name(user_id)\n if self.is_api then\n user = begin \n HuiMain.plugin_data.find_one(\"_id\" => BSON::ObjectId(user_id))\n rescue BSON::InvalidObjectId\n nil\n end\n if user then \n user[\"name\"]\n else\n nil\n end\n else # not api\n session[:current_user_name]\n end\n end", "def display_course_user(user)\n user.name\n end", "def suuid; uuid; end", "def get_user_name(line)\n\n if line[\"_links\"][\"assigned_user\"].is_a?(Hash)\n href = line[\"_links\"][\"assigned_user\"][\"href\"]\n else\n return \"Not Assigned\"\n end\n\n @map ||= {}\n @map[href] ||= begin\n self.make_request(:url => \"#{ENDPOINT}#{href}\")[\"name\"]\n end\n end", "def get_user(buf) \r\n return nil if buf[40,4].unpack('L').first <= 0 # UserSidLength\r\n\r\n name = 0.chr * MAX_SIZE\r\n name_size = [name.size].pack('L')\r\n domain = 0.chr * MAX_SIZE\r\n domain_size = [domain.size].pack('L')\r\n snu = 0.chr * 4\r\n \r\n offset = buf[44,4].unpack('L').first # UserSidOffset\r\n \r\n val = LookupAccountSid(\r\n @server,\r\n [buf].pack('P').unpack('L').first + offset,\r\n name,\r\n name_size,\r\n domain,\r\n domain_size,\r\n snu\r\n )\r\n \r\n # Return nil if the lookup failed\r\n return val ? name.nstrip : nil\r\n end", "def user_id\n username\n end", "def uid\n \"#{user_id}-#{team_id}\"\n end", "def user_name\n @user_name ||= InchCI::ProjectUID.new(uid).user_name\n end", "def getUserData(radio, username, api_url)\n if radio == \"username\"\n return HTTParty.get(api_url + \"predict_json_by_name?screen_name=#{username}\")\n else\n if radio == \"bd\"\n res = HTTParty.get(api_url + \"predict_json_by_id?user_id=#{get_bipolar()}\")\n res['profile']['name'] = \"Bipolar Patient\"\n res['profile']['screen_name'] = 'randomBipolarPatient'\n else\n res = HTTParty.get(api_url + \"predict_json_by_id?user_id=#{get_bpd()}\")\n res['profile']['name'] = \"BPD Patient\"\n res['profile']['screen_name'] = 'randomBPDPatient'\n end\n res['profile']['profile_image_url'] = 'https://pixabay.com/static/uploads/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png'\n res['profile']['profile_banner_url'] = 'https://pbs.twimg.com/profile_banners/6253282/1431474710/1500x500'\n res['profile']['description'] = ''\n end\n res\n end", "def get_user_record\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n user = CUL::FOLIO::Edge.patron_record(url, tenant, folio_token, netid)\n Rails.logger.debug(\"mjc12test6: Got FOLIO user #{user.inspect}\")\n render json: user\n end", "def getuid\n\t\trequest = Packet.create_request('stdapi_sys_config_getuid')\n\t\tresponse = client.send_request(request)\n\t\treturn response.get_tlv_value(TLV_TYPE_USER_NAME)\n\tend", "def get_user_id(username)\n # .........\n end", "def assigned_user\n User.find_by_id(assigned_id).full_name\n end", "def users\n result_hash['usr']\n end", "def get_slack_names_hash(user_id)\n uri = \"https://slack.com/api/users.list?token=#{ENV[\"API_TOKEN\"]}\"\n request = HTTParty.get(uri)\n response = JSON.parse(request.body)\n if response[\"ok\"]\n user = response[\"members\"].find { |u| u[\"id\"] == user_id }\n names = { :id => user_id, :name => user[\"name\"]}\n unless user[\"profile\"].nil?\n names[\"real_name\"] = user[\"real_name\"] unless user[\"real_name\"].nil? || user[\"real_name\"] == \"\"\n names[\"first_name\"] = user[\"profile\"][\"first_name\"] unless user[\"profile\"][\"first_name\"].nil? || user[\"profile\"][\"first_name\"] == \"\"\n names[\"last_name\"] = user[\"profile\"][\"last_name\"] unless user[\"profile\"][\"last_name\"].nil? || user[\"profile\"][\"last_name\"] == \"\"\n end\n else\n names = { :id => user_id, :name => \"Sean Connery\" }\n end\n names\nend", "def user()\n return @data[\"access\"][\"user\"]\n end", "def user_info_by_cid( id )\n\n print \"Looking up user details for #{id}...\"\n\n # lookup the user by computing id\n user_info = Helpers.lookup_user( id )\n if user_info.nil?\n puts \"not found\"\n return nil\n end\n\n puts \"done\"\n return user_info\n end", "def id_string\n return \"user_\"+self.username\n end", "def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend", "def getTexture uuid\n\tres = HTTParty.get(\"https://sessionserver.mojang.com/session/minecraft/profile/#{uuid}\",\n\t{\n\t\t:verify => false,\n\t\t:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}\n \t})\n\treturn res.parsed_response[\"properties\"][0][\"value\"]\nend", "def username\n @data['username']\n end", "def username\n @data['username']\n end", "def getUser login\n return false if !@usrData\n @usrData[login]\n end", "def user\n user_id.get_object\n end", "def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end", "def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['name']\n end", "def list_user(param = '1110')\n @group_users.each { |item| puts item.info(param) }\n end", "def employee_username\n general_info_table_element[0][1].text\n end", "def cmd_getuid(*args)\n print_line(\"Server username: #{client.sys.config.getuid}\")\n end", "def who \n version_user.to_label\n end", "def info\n {\n email: username\n }\n end", "def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end", "def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end", "def user\n\t\tdatastore['IRCNICK']\n\tend", "def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end", "def user_tuple(i, encrypt_pass = false)\n {:id => i, \n :mail => \"testuser#{i}@stamina.chefbe.net\", \n :nickname => \"testuser#{i}\", \n :password => encrypt_pass ? md5(\"testuser#{i}\") : \"testuser#{i}\", \n :admin_level => 0, \n :activation => \"\"}\n end", "def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end", "def drupal_user\n DrupalUsers.find_by_name(self.username)\n end", "def drupal_user\n DrupalUsers.find_by_name(self.username)\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def username\n @obj['username']\n end", "def basicInfo (userid)\n\t\tname = nil\n\t\ticonid = nil\n\t\tnameError = nil\n\t\ticonidError = nil\n\t\t\n\t\tbegin\n\t\t\tname = db_select_user_name(userid)\n\t\trescue Exception => ex\n\t\t\tnameError = ex.message\n\t\tend\n\t\t\n\t\tbegin\n\t\t\ticonid = db_select_usersicons_iconid(userid)\n\t\trescue Exception => ex\n\t\t\ticonidError = ex.message\n\t\tend\n\t\t\n\t\treturn generateJSON_BasicInfo(name, nameError, iconid, iconidError)\n\tend", "def get_user(userid)\n @result = User.select(:username).where(:id => userid)\n @result.each do |res|\n return res.username\n end\n end", "def get_target_by_uuid (uuid)\n\t\tinner_proxy = InnerProxy.new\n\t\turl = inner_proxy.conceptwiki_ep_get + \"?uuid=#{uuid}\"\n\n\t\tresponse = request(url, [])\n\t\tif response.code.to_i != 200\n\t\t\tputs \"ConceptWiki get service not working properly right now!\"\n\t\t\tnil\n\n\t\telse\n\t\t\tjson_hash = JSON.parse(response.body)\n\t\t\tresult = Hash.new\n\t\t\tresult[:uuid] = json_hash['uuid']\n\n\t\t\tlabels = json_hash['labels']\n\t\t\tpref_label = labels.select { |lb| lb['type'] == 'PREFERRED' }\n\t\t\tresult[:pref_label] = pref_label[0]['text']\n\n\t\t\turls = json_hash['urls']\n\t\t\tuniprot_url = urls.select { |url| url['value'] =~ /uniprot/ }\n\t\t\tresult[:uniprot_url] = uniprot_url[0]['value']\n\n\t\t\tresult\n\t\tend\n\tend", "def split_userinfo(ui)\n return nil, nil unless ui\n user, password = ui.split(':', 2)\n\n return user, password\n end", "def get_username(password)\n user_pool = OpenNebula::UserPool.new(client)\n rc = user_pool.info\n raise rc.message if check_rc(rc)\n\n password = password.to_s.delete(\"\\s\")\n\n xpath = \"USER[PASSWORD=\\\"#{password}\\\"]/NAME\"\n username = user_pool[xpath]\n\n if username.nil?\n user_pool.each do |x509_user|\n x509_user[\"PASSWORD\"].split('|').each do |x509_user_dn|\n if x509_user_dn == password\n username = x509_user[\"NAME\"]\n break\n end\n end if x509_user[\"AUTH_DRIVER\"] == \"x509\"\n\n break unless username.nil?\n end\n end\n\n username\n end", "def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend", "def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end", "def get_user_id(user)\n if user.id < 10\n return \"USR0\" + user.id.to_s\n else\n return \"USR\" + user.id.to_s\n end\n end", "def get_user_id(reaktoruser_id)\n IdStore.get(:reaktoruser, reaktoruser_id)\n end", "def find_user_data_by_ext_user_id(ext_user_id)\n # ap(find_user_data_by_ext_user_id: {ext_user_id: ext_user_id})\n if existing_record = @user_data.find_one(\"ext_user_id\" => ext_user_id)\n [existing_record[\"_id\"].to_s, reject_record_id(existing_record)]\n end\n end", "def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end", "def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end", "def get_study_group_title\n temp = sg_title.text.delete('()').gsub('client_division_uuid','').gsub('uuid','').split(':').map(&:strip)\n name_and_uuid = {}\n name_and_uuid[:name] = temp.first\n name_and_uuid[:uuid] = temp.last\n name_and_uuid\n end", "def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end", "def get_users input\n\t\t@users[input]\n\tend", "def user_id\n self.title_and_name\n end", "def user\n user = JSON.parse(RestClient.get(\"https://api.discord.bio/v1/user/details/#{slug}\"))\n\n DBio::User.new(user['payload'])\n end", "def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end", "def userinfo(username)\n @userinfo[username] ||= UserInfo.new(username)\n end", "def userinfo(username)\n @userinfo[username] ||= UserInfo.new(username)\n end", "def userinfo(username)\n @userinfo[username] ||= UserInfo.new(username)\n end", "def userinfo(username)\n @userinfo[username] ||= UserInfo.new(username)\n end", "def userinfo(username)\n @userinfo[username] ||= UserInfo.new(username)\n end", "def display_resource(user)\n user.username\n end", "def username\n name\n end", "def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end", "def to_label\n \"#{username}\"\n end", "def user_record_from_upi(figshare:, upi:, &block)\n figshare.institutions.accounts( institution_user_id: \"#{upi}@auckland.ac.nz\") do |a|\n figshare.other.private_account_info(impersonate: a['id'], &block)\n end\nend", "def display_user(user)\n user.name\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def collect_user_details\n cmd = 'lsuser -a ALL' # get all user names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n users_cache = []\n names.sort.uniq.each do |n|\n users_cache << AixUser(inspec, n)\n end\n users_cache\n end", "def get_instance(payload)\n UserInfoInstance.new(@version, payload)\n end", "def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end", "def instructor #want to return the instructor id and name from the users table\n # return Users.Section.where(:users.id => :section.id)\n return User.find(self.user_id)\n end", "def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end", "def user_name\n return User.find(user_id).name\n end", "def user_name\n return User.find(user_id).name\n end", "def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end", "def username\n @data[GROUPNAME]\n end", "def username\n account = github_accounts.first || slack_accounts.first\n account ? account.username : id\n end", "def user_for_paper_trail\n # or use just current_admin_user, which will store the id\n # then use to_i to join to admin_users table \n return current_admin_user #current_admin_user.username \n end", "def user_name\n object.user.dxuser\n end" ]
[ "0.63693494", "0.626337", "0.6244368", "0.62398934", "0.61564606", "0.59039146", "0.5831387", "0.5679249", "0.56510717", "0.5622008", "0.55465883", "0.55327034", "0.5517035", "0.54975665", "0.54561967", "0.54508966", "0.5444654", "0.5365396", "0.5363711", "0.53626484", "0.53436285", "0.53287596", "0.5327595", "0.5316064", "0.5307967", "0.5305204", "0.5305129", "0.5295685", "0.5278032", "0.52728146", "0.52675194", "0.52540785", "0.5253224", "0.5251057", "0.5250959", "0.5243886", "0.52403486", "0.52403486", "0.52304906", "0.5228513", "0.5227439", "0.5203937", "0.52021605", "0.5201692", "0.51811737", "0.51773006", "0.5172436", "0.5172415", "0.51697606", "0.5165795", "0.51594245", "0.51561177", "0.5152889", "0.51497126", "0.51497126", "0.5134061", "0.51292163", "0.51283026", "0.5118886", "0.51134616", "0.5106957", "0.50974166", "0.50925165", "0.5076275", "0.50755584", "0.5074218", "0.50694865", "0.5063818", "0.5063687", "0.5060311", "0.50579184", "0.5057839", "0.5054092", "0.50535893", "0.5050526", "0.5041808", "0.50372565", "0.50372565", "0.50372565", "0.50372565", "0.50372565", "0.50331795", "0.50304306", "0.5027091", "0.50243276", "0.5024084", "0.50218284", "0.5018949", "0.50172484", "0.50166506", "0.50155777", "0.5013337", "0.5011204", "0.5009615", "0.5009615", "0.5006105", "0.5005108", "0.5004206", "0.5001462", "0.4999679" ]
0.6041976
5
before_action :set_assignee, only: [:new, :create, :edit, :update, :destroy]
def index @photos = policy_scope(Photo) @photo = Photo.new @assignee = Assignee.find(params[:approver_id] || params[:guardian_id] || params[:recipient_id] || params[:assignee_id]) if params[:approver_id] || params[:guardian_id] || params[:recipient_id] || params[:assignee_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_assigner\n @assigner = Assigner.find(params[:id])\n end", "def set_assigner\n @assigner = Assigner.find(params[:id])\n end", "def assigner_params\n params.require(:assigner).permit(:task_id, :user_id)\n end", "def initialize(*args)\r\n super\r\n @action = :assign\r\nend", "def assignee=(assignee)\n @assignee = assignee.is_a?(Hash) ? Logan::Person.new(assignee) : assignee\n end", "def assignee=(assignee)\n @assignee = assignee.is_a?(Hash) ? Logan::Person.new(assignee) : assignee\n end", "def set_assigned_owner\n @assigned_owner = AssignedOwner.find(params[:id])\n end", "def set_assign\n @assign = Assign.find(params[:id])\n end", "def assignee_email= email\n \tself.assigned_to = User.find_by_email(email).id\n end", "def assigner_params\n params.require(:assigner).permit(:name)\n end", "def new\n @pto = Pto.new\n @assignees=User.assignee_list\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pto }\n end\n end", "def assignee_email\n \tself.assignee.email if self.assignee\n end", "def edit\n set_user\n end", "def set_assign_detail\n @assign_detail = AssignDetail.find(params[:id])\n end", "def create\n @assigner = Assigner.new(assigner_params)\n\n respond_to do |format|\n if @assigner.save\n format.html { redirect_to @assigner, notice: 'Assigner was successfully created.' }\n format.json { render :show, status: :created, location: @assigner }\n else\n format.html { render :new }\n format.json { render json: @assigner.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_now_assign\n @now_assign = NowAssign.find(params[:id])\n end", "def show\n @assignee = Task.finduser(params[:id])\n end", "def set_employee\n @employee = Employee.includes(:user).find(params[:id])\n authorize @employee\n end", "def edit\n require_user\n end", "def set_assignment_employee\n @assignment_employee = AssignmentEmployee.find(params[:id])\n end", "def update\n respond_to do |format|\n if @assigner.update(assigner_params)\n format.html { redirect_to @assigner, notice: 'Assigner was successfully updated.' }\n format.json { render :show, status: :ok, location: @assigner }\n else\n format.html { render :edit }\n format.json { render json: @assigner.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end", "def update!(**args)\n @old_assignee = args[:old_assignee] if args.key?(:old_assignee)\n end", "def set_task\n #byebug\n @task = Task.find(params[:id])\n\n case params[:action]\n when 'edit'\n admin_author_assignee_manager(@task, 'change this task') \n when 'update'\n admin_author_assignee_manager(@task, 'change this task') \n when 'destroy'\n admin_author_manager(@task, 'delete this task') \n end\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.id = current_user.id\n # pass the current_user id to the employee to keep the records tight\n edit\n \n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_AssignTo(value)\n set_input(\"AssignTo\", value)\n end", "def set_assigned\n @assigned = Assigned.find(params[:id])\n end", "def assign\n\t\t\n\t\t# Modifica a equipe\n\t\t@team = Team.find(params[:id])\n\t\[email protected]_ace = true\n\t\t\n\t\t# Modifica o usuario, atribuindo o novo coordenador\n\t\t@user = User.find(@team.user_id)\n\t\[email protected]_ace = true\n\t\tif current_user.user_role_id == 3\n\t\t\[email protected]_id = current_user.id\n\t\tend\n\t\t\n\t\tif @team.save && @user.save\n\t\t\t\n\t\t\t# Envia email avisando o usuario sobre a aprovacao\n\t\t\tFungosMailer.email_usuario_aprov(@user).deliver\n\t\t\t\n\t\t\tredirect_to coord_path, notice: \"User assigned successfully!\"\n\t\t\t\n\t\t\telse\n\t\t\t\n\t\t\tredirect_to :back, notice: \"Couldn't assign the user into this project. Please contact system administrator.\"\n\t\t\t\n\t\tend\n\tend", "def set_assignature\n @assignature = Assignature.find(params[:id])\n end", "def controller_resource\n Assignment\n end", "def assign\n # Must be POST request to create course\n return unless request.post?\n\n # Retrieves current user\n user = get_logged_user()\n return unless user\n return unless user.is? \"supervisor\"\n\n # Receives parameters from the course creation page\n course_id = params[:course_id]\n\n # Get course\n course = Course.find(course_id)\n\n # Assign\n user.courses << course\n\n redirect_back fallback_location: \"/\"\n end", "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def edit_current_user\n end", "def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end", "def set_resource\n @assignment = Assignment.find(params[:id])\n authorize @assignment\n end", "def create\n @assigned_owner = AssignedOwner.new(assigned_owner_params)\n\n respond_to do |format|\n if @assigned_owner.save\n format.html { redirect_to @assigned_owner, notice: 'Assigned owner was successfully created.' }\n format.json { render :show, status: :created, location: @assigned_owner }\n else\n format.html { render :new }\n format.json { render json: @assigned_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n authorize @volunteer_position\n end", "def issue_assignee(issue)\n issue.assignee\n end", "def assigner_user_id=(value)\n @assigner_user_id = value\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.employer = current_user.id\n \n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: 'New Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n redirect_to :back\n end\n end\n end", "def set_employee\n @employee = User.find(params[:id])\n end", "def assignees(options={})\n @assignees\n end", "def assignees(options={})\n @assignees\n end", "def edit\n \t@user = current_user\n end", "def set_employee\n @user = User.find(params[:id])\n end", "def assigned_owner_params\n params.require(:assigned_owner).permit(:task_id, :owner_id)\n end", "def set_student_responsible\n @student_responsible = StudentResponsible.find(params[:id])\n end", "def set_employee\n #@employee = Employee.find(params[:id])\n @employee = Employee.find(params[:id] || current_user.employee_id)\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_assign_stage\n @assign_stage = AssignStage.find(params[:id])\n end", "def apply_people_assign(event)\n end", "def edit\r\n \t@user = current_user\r\n end", "def correct_employee\n\t\tparams[:id]==current_user\n\tend", "def actions\n teamleader_id = params[:teamleader_id]\n user_id = params[:user_id]\n message = params[:message]\n department_id = params[:department_id]\n\n @user = User.find(user_id)\n \n if message.eql?\"assign\"\n respond_to do |format|\n if @user.update_attributes(team_leader_id: teamleader_id)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n elsif message.eql?\"remove\"\n respond_to do |format|\n if @user.update_attributes(team_leader_id: Department.find(department_id).manager_id)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def replace_assignee(old_assignee, new_assignee)\n remove_assignee old_assignee unless old_assignee.nil? || old_assignee.empty?\n add_assignee new_assignee unless new_assignee.nil? || new_assignee.empty?\n end", "def now_assign_params\n params.require(:now_assign).permit(:student_id)\n end", "def assign_this_note\n if !params[:assign].blank? && !params[:assign_comment].blank?\n @note.update_attributes(:assigned_to_user_id => params[:assigned_to_user_id], :updated_by_user_id => current_user.id)\n create_comment(@note,params[:comment])\n end\n end", "def create\n @now_assign = NowAssign.new(now_assign_params)\n\n respond_to do |format|\n if @now_assign.save\n format.html { redirect_to @now_assign, notice: 'Now assign was successfully created.' }\n format.json { render :show, status: :created, location: @now_assign }\n else\n format.html { render :new }\n format.json { render json: @now_assign.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @user =current_user\nend", "def assigned_params\n params.require(:assigned).permit(:grantor, :grantee, :relation, :can_grant)\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def edit\n @user = current_user\n end", "def user_assignment_params\n params.require(:user_assignment).permit(:user_id, :assignable_id, :role, :accepted)\n end", "def before_action \n end", "def edit_password\n @employee = current_employee\n end", "def assign_to(new_owner)\n if new_owner != \"congress\"\n @assigned_to = new_owner\n end\n end", "def set_user_assignment\n @user_assignment = UserAssignment.find(params[:id])\n end", "def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to this, edit should be used and user_assignment_controller for it\n respond_to do |format|\n if @assignment.save\n current_user.assignments << @assignment\n @assignment.update_attribute(:is_done, false)\n @assignment.user_assignments.first.update_attribute(:assignment_id, @assignment.id) # for each?\n format.html { redirect_to current_user, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { redirect_to :back }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user\n @attendee = Attendee.find(params[:id])\n end", "def user_assign(value)\n forget_value(\"user\")\n assign(value,\"user\")\n end", "def edit\n @user = @current_user\n end", "def set_employee\n if params[:id].nil? # if there is no user id in params, show current one\n @employee = current_user\n else\n @employee = User.find(params[:id])\n end\n end", "def set_employee\n @employee = current_user.employees.find(params[:id])\n end", "def update\n respond_to do |format|\n if @assign.update(assign_params)\n format.html { redirect_to @assign, notice: 'Assign was successfully updated.' }\n format.json { render :show, status: :ok, location: @assign }\n else\n format.html { render :edit }\n format.json { render json: @assign.errors, status: :unprocessable_entity }\n end\n end\n end", "def assignment_employee_params\n params.require(:assignment_employee).permit(:assignmnet_id, :employee_id)\n end", "def set_mentee\n @mentee = Mentee.find(params[:id])\n end", "def set_cr_committee_member\n @cr_committee_member = CrCommitteeMember.find(params[:id])\n end", "def set_employee\n @employee = User.find(params[:id])\n end", "def set_employee\n @employee = User.find(params[:id])\n end", "def set_user; end", "def set_student_action\n @student_action = StudentAction.find(params[:id])\n end", "def set_pr_committee_member\n @pr_committee_member = PrCommitteeMember.find(params[:id])\n end", "def assigned_to=(value)\n @assigned_to = value\n end", "def assigned_to=(value)\n @assigned_to = value\n end", "def set_employee_user\n @employee_user = if current_manager\n EmployeeUser.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n EmployeeUser.find(params[:id])\n end\n end", "def child_task_assignee(parent, params)\n if [:assigned_to_type, :assigned_to_id].all? { |key| params.key?(key) }\n super\n elsif (parent.type == DocketSwitchMailTask.name) && RequestStore[:current_user]\n RequestStore[:current_user]\n else\n ClerkOfTheBoard.singleton\n end\n end", "def set_employee\n @employee = current_user.employees.find(params[:id])\n end", "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "def set_assignment\n @assignment = Assignment.find(params[:id])\n end" ]
[ "0.7186971", "0.7186971", "0.68563867", "0.68222964", "0.667966", "0.667966", "0.66776174", "0.66749144", "0.66112024", "0.65751064", "0.6500225", "0.64775145", "0.63925564", "0.63865566", "0.6345604", "0.63261503", "0.631618", "0.63020486", "0.63016427", "0.62534374", "0.6252984", "0.62475026", "0.62380016", "0.6222441", "0.6206479", "0.61791015", "0.6163453", "0.6161096", "0.6124918", "0.61015016", "0.6078377", "0.6075648", "0.60582805", "0.6034917", "0.6033987", "0.60294133", "0.6014115", "0.6010773", "0.5991692", "0.5983736", "0.59827334", "0.5982661", "0.5982661", "0.59826183", "0.59738827", "0.596194", "0.5956604", "0.5956369", "0.595123", "0.595123", "0.59510475", "0.59508026", "0.5944033", "0.5943456", "0.5940119", "0.59385973", "0.5935058", "0.59265697", "0.59237456", "0.5918639", "0.59165424", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.59135723", "0.5908168", "0.5892509", "0.58911574", "0.58824253", "0.58812225", "0.5880479", "0.58632535", "0.5859177", "0.5857265", "0.5855759", "0.5846164", "0.5838639", "0.58317953", "0.5830653", "0.5826807", "0.5824188", "0.5824188", "0.5822041", "0.5820288", "0.58146286", "0.5810906", "0.5810906", "0.58107674", "0.5802254", "0.5801582", "0.57947946", "0.57947946", "0.57947946", "0.57947946" ]
0.0
-1
before_action :set_message, only: %i[ show edit update destroy ] GET /messages or /messages.json
def index @messages = Message.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_message\n @message = Message.find(params[:id])\n authorize @message\n end", "def set_message\n if (params[:id].nil?)\n # @message = Message.find(params[:id])\n end\n end", "def set_message\r\n @message = Message.find(params[:id])\r\n end", "def set_message\n @message = current_user.all_messages.find(params[:id]) # Can only access own msgs\n end", "def set_message\n @message = Message.find_by(id: params[:id])\n return @message if @message\n render json: {errors: \"message not found\"}\n end", "def set_message\n # TBD: verify that either user is admin or the message is from/to the current user\n MessagesController.current_message = @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_msg\n @msg = Message.find(params[:id])\n end", "def set_msg\n @msg = Message.find(params[:id])\n end", "def set_message\n @message = message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end" ]
[ "0.6668982", "0.65535486", "0.6497759", "0.6485363", "0.6466215", "0.6454117", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.6451692", "0.64188147", "0.64188147", "0.63941205", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194", "0.6383194" ]
0.0
-1
GET /messages/1 or /messages/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end", "def messages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_get ...'\n end\n # resource path\n local_var_path = '/messages'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'MessagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_messages(options = nil)\r\n @client.raw('get', '/content/messages', options, nil, @contact_v1_url)\r\n end", "def messages\n get_json('messages.json')\n end", "def get_messages(page = 0)\r\n if page > 0\r\n message_url = \"/message_threads?page=#{page}\"\r\n else\r\n message_url = \"/message_threads\"\r\n end\r\n response = self.class.get(message_url, headers: { \"authorization\" => @user_auth_token })\r\n JSON.parse(response.body)\r\n end", "def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end", "def my_messages(opts = {})\n client.get_my_messages(opts)\n end", "def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend", "def show\n authorize! :read, Message\n @messages = Message.find_conversation(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def read_all_messages\n post(\"/api/read_all_messages\")\n end", "def direct_messages(params = {})\n get \"direct_messages\", params\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :_message }\n end\n end", "def show\n @message = Message.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def index\n @messages = current_user.received_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @messages = current_user.received_messages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def read\n @message = Message.find(params[:id])\n @message.read(current_user)\n respond_to do |format|\n format.html # read.html.erb\n format.json { render json: @message }\n end\n end", "def index\n @messages = Message.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def messages_get(opts = {})\n data, _status_code, _headers = messages_get_with_http_info(opts)\n data\n end", "def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @messages = Message.all\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @messages}\n end\n end", "def show\n @message = Message.find(params[:id])\n render json: @message\n\n end", "def get_message(id, options = nil)\r\n @client.raw('get', \"/content/messages/#{id}\", options, nil, @contact_v1_url)\r\n end", "def index\n\t\t@messages = Message.all.order('created_at DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend", "def index\n\n if params[:user_id]\n @messages = Message.where(:user_id => params[:user_id].to_i)\n else\n @messages = Message.all\n end\n if params[:page] and params[:per_page]\n @messages = @messages.paginate(:per_page=>params[:per_page].to_i,:page=>params[:page].to_i).order(\"id desc\")\n @page = params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :messages }\n end\n end", "def index\n messages = Message.all\n render json: messages\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def message(*ids)\n result = records(\"post\", \"/msg/get/#{ids.join(\",\")}\")\n result.length == 1 ? result.first : result\n end", "def index\n @response_messages = @request_message.response_messages\n respond_to do |format|\n format.html { raise ActionController::RoutingError.new('Not Found') }\n format.json {}\n end\n end", "def get(key, options = {})\n messages.get(key, options)\n end", "def index\n @messages = current_user.received_messages.paginate(:page => params[:page])\n @title = \"Входящие сообщения\"\n @path = \"index\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end", "def index\n @messages = Message.order(\"time desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def message(id)\n Message.new(request(:get, \"messages/#{id}\"))\n end", "def message(id)\n Message.new(request(:get, \"messages/#{id.to_s}\"))\n end", "def index\n\t\t@messages = Message.where(:to_user => current_user.id)\n\t\trespond_with(@messages) \n\tend", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @messages = Message.all\n\n render json: @messages\n end", "def sent_messages\n get('/direct_messages/sent.json')\n end", "def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end", "def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end", "def get_all\n if @messages = Message.all\n render json: @messages\n else\n render json: \"Error!\"\n end\n\n end", "def messages_status_message_id_get_with_http_info(message_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_status_message_id_get ...'\n end\n # verify the required parameter 'message_id' is set\n if @api_client.config.client_side_validation && message_id.nil?\n fail ArgumentError, \"Missing the required parameter 'message_id' when calling MessagesApi.messages_status_message_id_get\"\n end\n # resource path\n local_var_path = '/messages/status/{messageId}'.sub('{' + 'messageId' + '}', message_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'MessageStatusResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_status_message_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end", "def show\n @message = Message.find(params[:id])\n respond_with(@message)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_template }\n end\n end", "def index\n @messaging_messages = Messaging::Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messaging_messages }\n end\n end", "def index\n\n if @current_user.admin?\n @v1_messages = V1::Message.all\n else\n @v1_messages = V1::Message.all.where(company_id: @current_user.company.id)\n end\n\n render json: @v1_messages\n end", "def index\n @client_name = nil\n if session[:cos_session_id]\n if @application_session = Session.find_by_id(session[:cos_session_id])\n @client_name = Client.find_by_id(@application_session.client_id).name\n end\n end\n unless @client_name == nil\n http = get_http_connection()\n path = '/messages/in.json?name='+@pysmsd_config.app_name+'&password='+@pysmsd_config.app_password+'&keyword='+@client_name\n resp = http.get(path)\n json = JSON.parse(resp.body)\n json['messages'].each do | message |\n @person = Person.find_by_phone_number(message['number'])\n if @person\n message['user_id'] = @person.guid\n end\n end\n\n render_json :entry => json and return\n end\n render_json :status => :bad_request, :messages => \"No matching application ID was found, cannot proceed to fetch SMS from server.\" and return\n end", "def show\n @store_manager_messages_read = Store::Manager::Messages::Read.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_messages_read }\n end\n end", "def show\n render json: get_message()\n end", "def show\n @user = User.find(params[:user_id])\n @message = @user.messages.find(params[:id])\n @message.update_attribute(:read, true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: user_messages_path(@user) }\n end\n end", "def show\n @home_searches_message = Home::Searches::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_message }\n end\n end", "def index\n @messages = current_user.messages\n respond_with(@messages)\n end", "def message\n @message ||= (request.GET[:msg] || Hash.new)\n end", "def index\n #@messages = Message.all\n \n @messages = Message.page(params[:page]).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def message(message)\n get(\"inbox/messages/#{message}\").pop\n end", "def index\n @messages = Message.find_all_by_user_id(session[:user_id], :order => \"timestamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end", "def show\n @message = @user.messages.find(params[:id]) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @message }\n end\n end", "def index\n @mod_messages = ModMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mod_messages }\n end\n end", "def show\n @chat = Chat.find(params[:id])\n @receiver = interlocutor(@chat)\n @messages = @chat.messages\n @message = Message.new\n render json: $message\n end", "def get_message\n @msg = Message.find_by_id(get_message_params[:message_id])\n\n if request.xhr?\n render :json => {\n :text => @msg.m_message,\n :offset => @msg.m_offset\n }\n end\n\n end", "def message_get( type, url, message, extra_parameters = {} )\n params = Hash.new\n if extra_parameters\n params.merge!(extra_parameters)\n end\n # compress GET requests to try and stay under that 8KB request limit\n #deflate of samlrequest\n params[type] = encode( deflate( message ) )\n #Logging.debug \"#{type}=#{params[type]}\"\n \n uri = Addressable::URI.parse(url)\n if uri.query_values == nil\n uri.query_values = params\n else\n # solution to stevenwilkin's parameter merge\n uri.query_values = params.merge(uri.query_values)\n end\n url = uri.to_s\n #Logging.debug \"Sending to URL #{url}\"\n return url\n end", "def message_get( type, url, message, extra_parameters = {} )\n params = Hash.new\n if extra_parameters\n params.merge!(extra_parameters)\n end\n # compress GET requests to try and stay under that 8KB request limit\n #deflate of samlrequest\n params[type] = encode( deflate( message ) )\n #Logging.debug \"#{type}=#{params[type]}\"\n \n uri = Addressable::URI.parse(url)\n if uri.query_values == nil\n uri.query_values = params\n else\n # solution to stevenwilkin's parameter merge\n uri.query_values = params.merge(uri.query_values)\n end\n url = uri.to_s\n #Logging.debug \"Sending to URL #{url}\"\n return url\n end", "def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end", "def index\n @messages = Room.find(params['room_id']).messages\n end", "def show\n @room_message = RoomMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room_message }\n end\n end", "def index\n @messages = Rails.cache.fetch('all_messages', :expires_in => 30.seconds) do\n Message.all\n end\n\n respond_to do |format|\n format.json { render json: @messages }\n end\n end", "def show\n @message = current_user.messages.find(params[:id])\n respond_to do |format|\n format.any(:html, :wml)\n end\n end", "def show\n\n # @conversation_partner = Message.find(params[:receiver])\n\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @mod_message = ModMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mod_message }\n end\n end", "def read_api_msg(msg, entry, json, exception = nil)\n [\n \"#{entry.url} #{msg} from #{json ? 'JSON' : 'LD'} API\",\n json ? \" [#{entry.json_api_url}]\" : '',\n exception ? \": #{exception}\" : ''\n ].join\n end", "def index\n messages = Message.all\n end", "def index\n render json: Message.all\n end", "def msg_arnoldbot\n uri = URI(\"https://arnoldbot-api.herokuapp.com/talk?msg=\"+params[:msg])\n resp = Net::HTTP.get(uri)\n render json: resp\n end", "def get_messages(&block)\n get(:messages) do |msgs|\n msgs = msgs.split ', '\n msgs.map! { |id| SkypeMessage.withId @skype, id.to_i }\n block.to_proc.call msgs\n end\n end", "def show\n @pmessage = Pmessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pmessage }\n end\n end", "def message\n response.body.match(/\"message\":\"(.*)\"/)[1]\n end" ]
[ "0.689082", "0.68518597", "0.683459", "0.68263704", "0.66642535", "0.6630801", "0.66219234", "0.6600434", "0.6595764", "0.65915227", "0.6583334", "0.6579721", "0.65685", "0.6539185", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.6535771", "0.65356386", "0.6510147", "0.65023845", "0.64823824", "0.6479355", "0.64783174", "0.6477581", "0.6477496", "0.6467225", "0.64658546", "0.64605355", "0.6450475", "0.6446008", "0.6392167", "0.6388533", "0.63666004", "0.63606143", "0.63602334", "0.6359189", "0.63435733", "0.6329392", "0.63292557", "0.6301951", "0.626801", "0.6267184", "0.6267184", "0.6249777", "0.6224924", "0.6212595", "0.6212582", "0.6206251", "0.6190821", "0.6175284", "0.616816", "0.6129892", "0.61085147", "0.6097078", "0.60929406", "0.608405", "0.6082889", "0.60672826", "0.60605025", "0.60559297", "0.6052614", "0.6048476", "0.6030325", "0.6029255", "0.60269964", "0.6018218", "0.601346", "0.6001059", "0.59993297", "0.59993297", "0.59982616", "0.59943086", "0.5993225", "0.59851086", "0.597351", "0.5958555", "0.5954038", "0.594326", "0.59375614", "0.5936792", "0.59296453", "0.59191054", "0.5890518", "0.58851826" ]
0.0
-1
POST /messages or /messages.json
def create message = Message.new({content: params[:message], chatroom_id: params[:chatroomId].to_i, user_id: params[:userId].to_i}) if message.save user = message.user message_reactions = message.message_reactions message_reactions.map {|reaction| {reaction: reaction, user: reaction.user}} updatedChatroom = Chatroom.find(params[:chatroomId]) ActionCable.server.broadcast( "chatroom_#{params[:chatroomId]}", { newMessage: {message: message, user: user}, messageReactions: message_reactions, user: user, updatedChatroom: updatedChatroom } ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: [:api, @message]\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to new_message_url, notice: t(\"messages.created\") }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def message(message)\n render json: {\n message: message,\n status: :success\n }, status: 200\n end", "def post(message)\n puts message\n end", "def message(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end", "def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: @message\n else \n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def typer(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end", "def create\n\n @message = current_user.messages.new(message_params)\n\n if @message\n respond_to do |format|\n if @message.save\n # debugger\n format.html do\n redirect_to @message, notice: 'Message was successfully created.'\n end\n format.json { render :_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n message = Message.new(message_params)\n message.messager = current_user\n\n if message.valid?\n message.save!\n render json: MessageSerializer.new(message).serialize\n else\n render json: { errors: message.errors.messages }, status: 422\n end\n end", "def create\n @message = Message.new(params[:message])\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(message)\n puts message\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end", "def create\n @message = Message.new(message: params[:message_content], from_id: current_user.id, to_id: params[:to_id])\n respond_to do |format|\n if @message.save\n format.html { redirect_to user_path(@message.to_id), notice: 'Message was successfully sent.' }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end", "def send_message\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessage = Conversation.new(user_id: params[:user_id], message_id: params[:message_id], request_id: params[:request_id])\n \t\tif message.save\n \t\t\tconversation = Conversation.find_by(request_id: params[:request_id])\n \t\t\trender json: conversation\n \t\tend\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end", "def create\n @message = Message.new(params[:message])\n @message.user_id = current_user.id\n \n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( params )\n return JSON.parse( uri.open.read )\n end", "def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end", "def create_message(user_id, recipient_id, token , subject, message)\n response = self.class.post('/messages', body: { \"user_id\": user_id, \"recipient_id\": recipient_id,\"token\": token , \"subject\": subject, \"stripped-text\": message }, headers: { \"authorization\" => @auth_token })\n puts response\n\n end", "def post(request, _params)\n formatter = WeChatMessageFormatter.new\n message = formatter.parse_incoming_message(request.body.read.to_s)\n # Parse the WeChat message XML format\n\n if message['valid']\n # Queue the message for delayed processing\n @db_manager.store_message(message)\n\n # WeChat always requires incoming user messages to be acknowledged at\n # least with an empty string (empty strings are not shown to users),\n # see: https://chatbotsmagazine.com/building-chatbots-for-wechat-part-1-dba8f160349\n # In this sample app, we simulate a \"Customer Service\"-like scenario\n # providing an instant reply to the user, announcing that a complete\n # reply will follow.\n reply = \"Thank you for your message. We will get back to you as soon as possible!\"\n return formatter.format_instant_reply(message, reply)\n end\n\n return 'Message was sent in a wrong format.'\n end", "def send_messages\n if Message.send_messages()\n render json: {status: :ok}\n else\n render json: \"Error\"\n end\n end", "def api_create\n @message = Message.new\n @message.user_id = params[:message][:user_id]\n @message.room_id = params[:message][:room_id]\n @message.content = params[:message][:content]\n @message.save\n\n #Generate de js to publish\n jsScript = createMessage(@message)\n PrivatePub.publish_to(\"/rooms/#{@message.room_id}\", jsScript)\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.json { render json: @message}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n @user = User.find(@message.user_id)\n @user.messages << @message\n render json: @message, status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: \"Message sent to #{@message.receiver.full_name}.\" }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to url_for(action: 'index'), notice: f(@message) }\n format.json { render :show, status: :created, location: url_for(action: 'show', id: @message) }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def respond_message message\n content_type :json\n {:text => message}.to_json\nend", "def send_simple_message\n user_email = params[ :from ]\n subject = params[ :subject ]\n text = params[ :text ]\n\n mailgun_api = Rails.application.secrets.secret_mailgun_api\n RestClient.post 'https://api:' + \"#{mailgun_api}\" +\n '@api.mailgun.net/v3/aondebrasil.com/messages',\n from: user_email,\n to: '[email protected]',\n subject: subject,\n text: text\n\n respond_to do |format|\n format.json { render json: \"enviado\".to_json }\n end\n end", "def create\n @room = Room.find_or_create_by(room_params)\n @message = @room.messages.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: [@room, @message]\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.deliver\n format.html { render :thank_you }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to user_url(@message.user_id), notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to admin_message_path(@message), notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def direct_messages_new(recipient, text)\n post_params = {:user => recipient, :text => text}\n post \"direct_messages/new\", post_params\n end", "def create\n mesg = Message.new({user_id: @current_user.id, receiver_id: params[:receiver_id], content: params[:content], request_id: params[:request_id]})\n if mesg.save\n render json: {\n status: 'success',\n message: 'Your message was sent',\n data: mesg,\n },\n status: :created\n else\n render json: {\n status: 'error',\n message: 'Message not sent',\n data: mesg.errors\n },\n status: :unprocessable_entity\n end\n end", "def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message crée avec succès.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n @message.user_sent_id = current_user.id\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :text => '{\"message\": \"Your messages has been sent\"}' }\n #format.json { render action: 'show', status: :created, location: @message }\n else\n format.html { render action: 'new' }\n format.json { render text: 'message'}\n end\n end\n end", "def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @message }\n else\n format.html { render action: 'new' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new sender_id: current_user.id, recipient_id: message_params[:recipient_id], verb: message_params[:verb]\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_request(from, to, title, message)\n RestClient.post API_URL+\"/messages\",\n :from => from.email,\n :to => to.email,\n :subject => \"UROP Application for \"+title+\" from \"+from.first_name+\" \"+from.last_name,\n :text => message\n end", "def post_message(params)\n self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|\n raise \"error posting message: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: { \"status\": \"success\" }, status: 200\n else\n render json: {}, status: 401\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end", "def create\n @conversation = Conversation.find(params[:conversation_id])\n if @conversation.messages.create(sender: current_user,\n content: params[:message][:content])\n redirect_to @conversation\n else\n flash[:error] = \"A problem occured\"\n redirect_to @conversation\n end\n #respond_to do |format|\n # format.js { render json: @message }\n # format.html { redirect_back_or_to :back }\n #end\n end", "def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def create\n @message = Message.new(post_params)\n respond_to do |format|\n if @message.save\n flash[:success] = \"문자가 성공적으로 업로드 되었습니다.\"\n format.html { render :show}\n else\n flash[:error] = \"부족한 곳을 채워주세요\"\n format.html { render :new}\n format.json { render json: @message.errors }\n end\n end\n end", "def create\n @message = @conversation.messages.build(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to conversation_messages_path(@conversation), notice: 'メッセージを送信しました。' }\n format.json { render :show, status: :created, location: conversation_messages_path(@conversation) }\n else\n format.html { render :index }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @msg = Msg.new(msg_params)\n\n respond_to do |format|\n if @msg.save\n format.html { redirect_to @msg, notice: 'Msg was successfully created.' }\n format.json { render action: 'show', status: :created, location: @msg }\n else\n format.html { render action: 'new' }\n format.json { render json: @msg.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_message\n response = RestClient::Request.new(\n :method => :post,\n :url => \"https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json\",\n :user => ENV['TWILIO_ACCOUNT_SID'],\n :password => ENV['TWILIO_AUTH_TOKEN'],\n :payload => { :Body => body,\n :To => Contact.find(self.contact_id).number,\n :From => ENV['USER_NUMBER'] }\n ).execute\n end", "def create\n @message = Message.new(message_params)\n @message.user = current_user\n respond_to do |format|\n if @message.save\n format.html { redirect_to root_path, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def render_message(message)\n render json: { message: message }, status: :ok\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n\n format.html { redirect_to outbox_path, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send\n inf = params.permit(:to, :from, :time, :priority, :message, :til)\n message = Message.new\n message.user = current_user\n message.entered = DateTime.now.in_time_zone\n message.year = DateTime.now.in_time_zone.year\n\n message.to = inf[:to]\n message.from = inf[:from]\n message.message_time = inf[:time]\n message.priority = inf[:priority]\n message.message = inf[:message]\n message.til = inf[:til]\n\n unless message.save\n render json: {message: @message.errors}.to_json, \\\n status: :unprocessable_entity\n end\n\n render json: {message: 'Success'}.to_json, status: 200\n end", "def create\n #If the POST contains either parameter we know we are dealing with multiple messages to sync\n if (params.has_key?(:total_in_messages) || params.has_key?(:total_out_messages))\n if (params.has_key?(:total_in_messages))\n i = 0\n while i < params[:total_in_messages] do\n message = Message.new()\n phoneNum = params[:in_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = phoneNum\n message.destination = \"DEVICE\"\n message.timestamp = params[:in_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:in_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n if (params.has_key?(:total_out_messages))\n i = 0\n while i < params[:total_out_messages] do\n message = Message.new()\n phoneNum = params[:out_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = \"DEVICE\"\n message.destination = phoneNum\n message.timestamp = params[:out_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:out_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n render :json => {:status => \"1\"}, :status => :created\n #Otherwise it's a single message we are syncing\n else\n @message = Message.new()\n phoneNum = params[:origin].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n @message.origin = phoneNum\n @message.message = params[:message]\n @message.timestamp = params[:timestamp]\n @message.user = User.find_by_username(params[:username])\n @message.destination = params[:destination]\n\n if @message.save\n render :json => {:status => \"1\"}, :status => :created\n else\n render :json => {:status => \"0\"}, :status => :unprocessable_entity\n end\n end\n end", "def create\n body = message_params[:Body]\n phone_number = message_params[:From]\n @message = Message.create(body: body, phone_number: phone_number)\n @message.reply_to_user\n head :ok\n end", "def create\n @message = Message.new(params[:message])\n @status = if @message.save then\n @message \n else\n render :json=> @message, :status=> :unprocessable_entity\n end\n end", "def create\n @message = Message.new(message_params)\n @message.sender_id = current_user.id\n @message.recipient_id = params[:recipient_id]\n\n respond_to do |format|\n if @message.save\n flash[:notice] = \"Mesaj gönderildi.\"\n format.json { render json: {success: true} } \n # Pusher.trigger('private-'+params[:recipient_id],'new_message', {:from => current_user.name, \n # :subject => @message.subject})\n else\n flash[:error] = \"Mesaj gönderilemedi.\"\n redirect_to '/'\n end\n end\n end", "def create\n\t\t@message = Message.create!(params[:message])\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def create\n @message = @ride_request.messages.new(message_params)\n @message.user = current_user\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to :back, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :back }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(params[:message])\n respond_to do |format|\n if @message.save\n # Save the submitted user name in the session for user's convenience #\n session[:user_name] = @message.user_name\n \n format.html { redirect_to messages_path }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n format.js { @new_message = Message.new }\n else\n @options = {:url => message_responses_path(:id => params[:message_id]), :method => :post}\n format.html { @new_message = @message; render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n format.js { @new_message = @message }\n end\n end\n end", "def new\n @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @message }\n end\n end", "def messages_send_post_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_send_post ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling MessagesApi.messages_send_post\"\n end\n # resource path\n local_var_path = '/messages/send'\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(body)\n auth_names = ['apiKey']\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 => 'MessageSendResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_send_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @message = Message.new\n @message.create_one!(params[:message])\n #Juggernaut.publish(1, parse_chat_message(params[:message][:message], current_user))\n respond_to do |format|\n format.html { redirect_to :index }\n format.js\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end" ]
[ "0.74819237", "0.6867244", "0.6867244", "0.67944425", "0.66470176", "0.66364", "0.66077125", "0.65904486", "0.6579336", "0.6530916", "0.65242887", "0.6514387", "0.64589214", "0.64374226", "0.6426772", "0.64240545", "0.64221734", "0.6412072", "0.6404961", "0.6401801", "0.6378272", "0.6376161", "0.63698375", "0.6368587", "0.6355799", "0.6352914", "0.6342654", "0.6310996", "0.63008493", "0.6289647", "0.6288747", "0.6283983", "0.62778205", "0.627589", "0.6275611", "0.6273548", "0.6273016", "0.62612045", "0.6260063", "0.6245512", "0.6240892", "0.6237106", "0.62362695", "0.6233069", "0.62304366", "0.6217787", "0.6217611", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.62042916", "0.61976767", "0.61970615", "0.61961263", "0.6193764", "0.61450714", "0.6143278", "0.61283684", "0.6127489", "0.6121551", "0.61135834", "0.61058694", "0.610356", "0.6097848", "0.60966337", "0.60935813", "0.6092522", "0.6072852", "0.60702556", "0.60687125", "0.6061527", "0.6053278", "0.60468525", "0.60467285", "0.6046694", "0.6046694", "0.603356", "0.6030228", "0.6027657", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264", "0.6027264" ]
0.0
-1
PATCH/PUT /messages/1 or /messages/1.json
def update respond_to do |format| if @message.update(message_params) format.html { redirect_to @message, notice: "Message was successfully updated." } format.json { render :show, status: :ok, location: @message } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @message.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end", "def update\n if @message.update(message_params)\n render json: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_back_to messages_path, flash: { success: 'Message was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end", "def update\n respond_to do |format|\n if @msg.update(msg_params)\n format.html { redirect_to @msg, notice: 'Msg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @msg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @message.update(message_params)\n render json: @message, status: :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end", "def update\n @message = Message.find(params[:id])\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully set.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @message.update(message_params) \n render json: @message, status: :ok, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n @message.update_attributes(params[:message])\n respond_with(@message)\n end", "def update\n message = Message.find_by(params[:id])\n if message.nil?\n render_error(\"message with id #{params[:id]} does not exist\", :not_found)\n elsif message.created_at < Time.now.utc - MAX_EDIT_PERIOD\n render_error(\"cannot update message more than #{MAX_EDIT_PERIOD} seconds old\", :forbidden)\n else\n render json: message.update(message_params)\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n if @message.update_attributes(message_params)\n head :no_content\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @msg.update(msg_params)\n format.html { redirect_to @msg, notice: 'Msg was successfully updated.' }\n format.json { render :show, status: :ok, location: @msg }\n else\n format.html { render :edit }\n format.json { render json: @msg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n authorize! :update, @message\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: t(\"messages.updated\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n # format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n # format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n endrender :'messages/create'\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Le message a bien été mis à jour.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\t\tdeny_access_unless(current_user?(@message.user))\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to outbox_path, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to admin_message_path(@message), notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mess.update(mess_params)\n format.html { redirect_to @mess, notice: 'Mess was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mess.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { redirect :back }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.headers[\"Authorization\"] == \"Basic 78f91d346838110d9edb6be3996624a9\"\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n\tif !checkme? @message then return end\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = current_user.messages.find_by_id(params[:id])\n if @message\n respond_to do |format|\n if @message.update_attributes(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :_message }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n else\n not_the_owner\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'El Mensaje ha sido actualizado correctamente!' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hello_message.update(hello_message_params)\n format.html { redirect_to @hello_message, notice: 'Hello message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hello_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n flash[:alert] = ' Message was successfully updated.'\n format.html { redirect_to @message }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # find and update a specific message\n end", "def update\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n if @text_message.update_attributes(params[:text_message])\n format.html { redirect_to @text_message, notice: 'Text message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to messages_url, notice: 'Message was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end" ]
[ "0.7184797", "0.70606303", "0.7021847", "0.698403", "0.6979361", "0.6976994", "0.6967576", "0.69522804", "0.69522804", "0.694486", "0.68902403", "0.68678486", "0.68517536", "0.6850133", "0.6848943", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.6847985", "0.684655", "0.6846236", "0.6827789", "0.6823385", "0.6812815", "0.6811307", "0.6811307", "0.68091977", "0.67682886", "0.6761987", "0.6759274", "0.67346805", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67339104", "0.67336726", "0.673296", "0.67249614", "0.67095304", "0.67028344", "0.66937363", "0.66885895", "0.6683632", "0.66731274", "0.6670131", "0.66416633", "0.66317046", "0.66252774", "0.6602876", "0.65662736", "0.6557277", "0.6548138", "0.65381855", "0.65043193", "0.6483051", "0.64684594", "0.6462742" ]
0.667852
86
DELETE /messages/1 or /messages/1.json
def destroy @message.destroy respond_to do |format| format.html { redirect_to messages_url, notice: "Message was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def destroy\n # delete a specific message\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'message.deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to noticias_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to [@member, :messages] }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to success_path, notice: _('Message deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to url_for(action: 'index'), notice: f(@message) }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Le message a bien été supprimé.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n respond_to do |format|\n if @message.destroy\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to sent_messages_url, notice: 'cannot delete message that has already been read' }\n format.json { head :no_content }\n end\n \n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.mark_deleted(current_user)\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'El Mensaje ha sido eliminado correctamente!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: t(:message_destroyed) }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Admin::Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.js # looks for destroy.js.erb in the views/messages folder\n end\n end", "def destroy\n @message = Message.find(params[:id])\n authorize! :destroy, @message\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: t(\"messages.deleted\") }\n format.json { head :no_content }\n end\n end", "def destroy\n if @message.destroy\n head :no_content\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def destroy\n @message = Messages.find(params[:id])\n @message.destroy\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n message = Message.find(params[:id])\n message.destroy\n end", "def destroy\n @message = Message.find(params[:id])\n\n @message.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to admin_messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url, notice: 'Msg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end", "def destroy\n @user = User.find(params[:user_id])\n @message = @user.messages.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to user_messages_path(@users) }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.77768886", "0.7708586", "0.7706946", "0.76591605", "0.7646406", "0.7640255", "0.7601341", "0.75992024", "0.75970477", "0.75970477", "0.75883824", "0.7588306", "0.7579826", "0.7579826", "0.7579826", "0.7579826", "0.75688785", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557959", "0.7557572", "0.75497115", "0.75269914", "0.7494702", "0.74946684", "0.7486992", "0.7473247", "0.7453634", "0.7442164", "0.7442164", "0.7426406", "0.7422205", "0.7409994", "0.7400127", "0.73967683", "0.7391627", "0.73880315", "0.73821217", "0.7380974", "0.7379559", "0.73786604", "0.7370998", "0.7368091", "0.7344269", "0.7341118", "0.7340619", "0.73380375", "0.73371077", "0.73331916", "0.73318064", "0.73318064", "0.73318064", "0.73318064", "0.7330892", "0.7314647", "0.7314629", "0.7306991", "0.72992927", "0.72883236", "0.72853595", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437", "0.728437" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_message @message = Message.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
Only allow a list of trusted parameters through.
def message_params params.require(:message).permit(:content, :user_id, :chatroom_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def params(list)\n @declared_params = list\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def 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 default_param_whitelist\n [\"mode\"]\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69485277", "0.6813547", "0.6799911", "0.6796169", "0.6745757", "0.6741778", "0.6527065", "0.65204644", "0.64925444", "0.64314413", "0.64314413", "0.64314413", "0.6398711", "0.6355623", "0.6355327", "0.6345812", "0.6343951", "0.6338371", "0.6327366", "0.6327366", "0.6327366", "0.63136744", "0.63001245", "0.6264419", "0.62613016", "0.6259317", "0.623719", "0.6227251", "0.6220037", "0.621864", "0.620889", "0.6199145", "0.61970234", "0.61728656", "0.61563927", "0.6155928", "0.6152361", "0.6136508", "0.6122662", "0.6109611", "0.60738647", "0.6072253", "0.6058575", "0.60571283", "0.6044282", "0.6033789", "0.6018841", "0.601607", "0.6014327", "0.6010113", "0.60086375", "0.60080284", "0.60060716", "0.6004647", "0.6004647", "0.5999453", "0.59945875", "0.5990942", "0.5983142", "0.5969449", "0.59688187", "0.5965012", "0.5964062", "0.5960668", "0.59599936", "0.59338915", "0.59288186", "0.5921217", "0.59072363", "0.59049433", "0.58997554", "0.58917797", "0.5890338", "0.5879621", "0.5879621", "0.5879621", "0.5872355", "0.58605725", "0.5853338", "0.58435106", "0.5842603", "0.58328134", "0.5830374", "0.5829657", "0.5828463", "0.5817261", "0.58149874", "0.58147764", "0.5810487", "0.5801209", "0.5801009", "0.5801009", "0.5794343", "0.5785498", "0.57794553", "0.5778505", "0.577467", "0.57682633", "0.5768243", "0.57627535", "0.5757951" ]
0.0
-1
returns an array of all the Employees who work at that role
def employees Employee.all.select{|employee| employee.role == self} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company_employee_list(company_id)\n roles = Role.where(company_id: company_id)\n workers = []\n User.where(id: roles.pluck(:user_id).uniq).each do |w|\n workers.push(\n id: w.id,\n email: w.email,\n roles: roles.where(user_id: w.id).select(:id, :name)\n )\n end\n workers\n end", "def getFullNameEmployees\n\n @employees = Array.new\n @EmployeesAndPeople= Employee.joins(person: :user).where(users: {role: [2,3,4,5]})\n\n @EmployeesAndPeople.all.each do |emp|\n @employees << [ emp.person.first_name + ' ' + emp.person.last_name, emp.id]\n end\n\n end", "def get_employees\n @employees = User.find_user_not_admin_not_client(get_company_id)\n end", "def employees\n Employee.all.select do |employee|\n employee.manager == self\n \n end\n end", "def employees\n Employee.all.select {|employees| employees.manager_name == self.name} \n end", "def role\n # get all the employee's role\n # binding.pry\n Role.all.select{|role| role.employee == self}\n end", "def all_employees\n self.workplace.employees\n end", "def employees\n self.employee_examination_sessions.map(&:employee)\n end", "def all_employees\n ServiceProvider.all(:conditions => [\"user_id IN (?)\", self.users.map(&:id)])\n end", "def people_with_the_role role\n mask = Person.mask_for_role(role)\n AdminDefinedRoleProject.where(role_mask: mask,project_id: self.id).collect{|r| r.person}\n end", "def index\n @employees = []\n if current_user.user_type <= 1\n @employees = Employee.all\n elsif current_user.user_type == 3 # manager\n @employees = Employee.where(department_id: current_user.role.department_id)\n end\n end", "def employees\n Employee.select{|employees| employees.manager == self.name}\nend", "def current_employees\n\tassignments = Assignment.current.for_store(self.id)\n\temployees = assignments.map{|a| Employee.find(a.employee_id)}\n\temployees = employees.sort_by { |e| [e.last_name, e.first_name] }\n\treturn employees\n end", "def work_day_employees\n all_week_employees = self.current_columns.each_slice(2).to_a\n\n return all_week_employees[Date.today.wday]\n end", "def employees\n Employee.all.select do |emp|\n emp.location == self\n end\n end", "def employees\n employee_array = []\n locations.each do |location|\n location.employees.each do |employee|\n employee_array << employee\n end\n end\n employee_array\n end", "def index\n if current_user.role == 'employee'\n @job_applications_made = current_user.employee.job_applications\n else\n @job_applications = JobApplication.all\n end\n end", "def people_with_the_role(role)\n Seek::Roles::ProjectRelatedRoles.instance.people_with_project_and_role(self, role)\n end", "def people_with_the_role(role)\n Seek::Roles::ProjectRelatedRoles.instance.people_with_project_and_role(self, role)\n end", "def index\n @employees = User.where(admin: true)\n end", "def index\n if current_employee.user_role == 'employee'\n @exams = Exam.eager_load(team: :team_members).where(\"team_members.employee_id = ?\", current_employee.id)\n else\n @exams = Exam.all\n end\n end", "def employee?(user_asking)\n user_asking.in? employees\n end", "def index\n @employees = Employee.where(\"users_id = ?\",current_user.id)\n end", "def staff\n staff = self.users.where(\"participants.role_id < 4\").all\n return staff\n end", "def index\n if current_company.users.include?(current_user)\n @employees = current_company.employees\n else\n redirect_to root_path\n end\n end", "def index\n @workers_roles = WorkersRole.all\n end", "def contacts\n @employees = User.where(admin: true)\n end", "def filter_employees\n @matter_clients = @matter.matter_peoples.client\n @employees.each do |employee|\n if @matter.employee_user_id== employee.user_id\n @employees = @employees - [employee]\n end\n @matter_clients.each do |matter_people|\n if matter_people.employee_user_id == employee.user_id\n @employees = @employees - [employee]\n end\n end\n end\n return @employees\n end", "def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end", "def get_assigned_employee_users(assigned_lawfirm_users)\n lawfirm_employees = self.employees.uniq.delete_if{|e| e.blank? || e.user.blank?}\n lawfirm_users = lawfirm_employees.map(&:user) if lawfirm_employees\n lawfirm_users.to_a & assigned_lawfirm_users.to_a\n end", "def employees\n emps = []\n url = prefix + \"liste\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n emps << User.new(u[\"id\"], @authid, @subdomain)\n end\n return emps\n else #failed\n return users\n end\n end", "def collaborators\n collab_roles = accepted_roles.for_name(\"collaborator\")\n User.find_by_sql(\"SELECT * FROM users INNER JOIN roles_users ON roles_users.user_id = users.id WHERE roles_users.role_id IN (12)\")\n end", "def employee?\n self.role == 'employee'\n end", "def find_other_people(my_role, their_role)\n events = find_events(my_role)\n other_participants = Array.new\n events.each do |e| \n e.participations.each do |p|\n other_participants << p.person if (p.role == their_role.to_s and !p.person.nil? and p.person != self)\n end\n end\n other_participants\n end", "def list \n @employees = Employee.find( :all ) # return an array of all Employees\n end", "def get_users_for_role(name)\n model.model['g']['g'].rm.get_users(name)\n end", "def students\n course_enrollments.where(course_role: CourseRole.student).map(&:user)\n end", "def team_team_members\n if has_team?\n Employee.where(id: team_team_positions.map(&:efective_id))\n else\n Employee.none\n end\n end", "def index\n @employees = User.all\n end", "def index\n @employees = User.all\n end", "def index\n @employees = User.all\n end", "def index\n\n @employee = Employee.where(\"employer = ?\", current_user.id)\n\n\nend", "def payroll_employess\n\t\tpayroll_last_payrolls.map(&:payroll_employee).uniq\n\tend", "def show\n\n @employeeDetails = Array.new\n employeeAll = Employee.all\n employeeAll.each do |emp|\n\tif emp.user_id != current_user.id\n\t\tuser = User.find_by id: emp.user_id\n\t\tobj = EmployeeDetails.new(emp.id, emp.user_id, emp.firstname, emp.lastname, user.roles_mask)\n\t\[email protected](obj)\n\tend\n end\n\n end", "def employee_details\n if current_user.role == \"SuperAdmin\"\n @employees = Employee.all\n \n render :status => 200,\n :json => { :success => true,\n \n :data => {:employees => @employees} }\n else\n render :status => 201,\n :json => { :success => false,\n \n :data => {:error => \"You dont have authority!\" }}\n end\n \nend", "def find_events(role)\n # note - Ruby should have a way to do this in one step - but I can't find it\n # map includes all elements, select includes entire object, need something that goes in between\n # not really sure why I need the to_s, but role is not string if I pass in :ROLE\n parts = participations.select { |p| (!p.event.nil? and p.role == role.to_s) }\n events = parts.map { |p| p.event }\n end", "def assigned_employee\n\t\tassignments.where(:is_active => true).first.employee \n\tend", "def index\n @employeds = Employed.all\n end", "def project_managers\n people_with_the_role(\"project_manager\")\n end", "def find_all_for_role(role)\n roles = role.get_parents\n roles << role\n return find_for_role(roles.collect(&:id))\n end", "def index\n @users = User.all\n \n \n @employees = Employee.all\n @eadmin_tasks = EadminTask.all\n @eadmin_tasks = current_user.eadmin_tasks\n\n\n \n end", "def index\n @employee_tasks = current_user.employee_tasks.all\n end", "def instructors\n course_enrollments.where(course_role: CourseRole.instructor).map(&:user)\n end", "def index\n @employees_rols = EmployeesRol.all\n end", "def employees\n if EMPLOYEES_VIEW_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n @employees = Employee.where(florist_id: session[\"found_florist_id\"]).order(\"primary_poc\", \"status\", \"name\")\n render(:employees) and return\n else\n redirect_to \"/employee/#{session[\"found_user_id\"]}\" and return\n end\n end", "def index\n @employments = Employment.confirmed\n end", "def employees\n times.map(&:employee).uniq\n end", "def index\n role = Role.find_by_name('Admin')\n @users = role.users\n end", "def accessible_people\n if self.role_names.include?('admin')\n Person\n elsif self.role_names.include?('executive') or self.role_names.include?('manager')\n self.authorized_employees\n elsif self.role_name.include?('user')\n self.person\n end\n end", "def unmarked_employees\n self.workplace.employees.where.not(id: self.employees.map(&:id))\n end", "def index\n @admin_employees = Employee.all\n end", "def accepts_who_with_role( role_name )\n self.users.select {|u| u.has_role? role_name, self} \n end", "def users\n raise \"No users are defined\" unless user_role.users.count.positive?\n user_role.users\n end", "def role_user_ids(role_name)\n return unless editable_and_viewable?\n\n UsersRole\n .joins(:role)\n .where(Role.arel_table[:resource_identifier].eq(roles_anchor_resource_identifier))\n .where(Role.arel_table[:name].in(role_name))\n .pluck(:user_id)\n .uniq\n end", "def index\n @employers = Employer.all\n end", "def index\n @employers = Employer.all\n end", "def managers\n course_enrollments.where(course_roles: { can_manage_course: true }).\n map(&:user)\n end", "def find_roles *roles\n role_model.where(:name => roles.flatten)\n end", "def index\n @employes = Employe.all\n end", "def index\n if params[:employee_id].present?\n @employee = Employee.find(params[:employee_id])\n @work_histories = @employee.work_histories\n skip_authorization\n else\n @work_histories = WorkHistory.all\n skip_authorization\n end\n end", "def my_department_members\n departments = employee&.departments&.ids || []\n Employee.where(id: Position.where.not(department_id: nil).where(department_id: departments).map(&:efective_id))\n end", "def \n # Adds the passed employee to the company employee list\n def hire_employee(employee)\n self.employees\n @employees\n end", "def index\n @job_roles = JobRole.all\n end", "def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end", "def index\n @employees_projects_rols = EmployeesProjectsRol.all\n end", "def index\n @program_employees = ProgramEmployee.all\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def index\n case current_user.role\n when 'admin'\n @jobs = Job.order(:start_date).select { |j| j.start_date >= Date.today }\n when 'agent'\n @jobs = Job.order(:start_date).select { |j| !j.agents.include?(current_agent) && j.start_date >= Date.today }\n end \n end", "def hire(user_to_hire)\n return if employees.include? user_to_hire\n user_to_hire.jobs << self\n true\n end", "def index\n @employees = Employee.where(department_id: current_employee.department_id)\n end", "def index\n role = Role.find_by_name('SuperAdmin')\n @users = role.users\n end", "def exhibitors\n find_related_frbr_objects( :is_exhibited_by, :which_roles?) \n end", "def find_all_by_role(role_or_id_or_name)\n role_id = case role_or_id_or_name\n when ::Role\n role_or_id_or_name[:id]\n when Symbol\n ::Role[role_or_id_or_name][:id]\n else\n role_or_id_or_name\n end\n\n ::User.with_role(role_id)\n end", "def role_assignments\n return @role_assignments\n end", "def index\n @employee_has_shifts = EmployeeHasShift.all\n end", "def index\n @users = User.where(\"role = 'employee'\")\n @users = @users.paginate(:page => params[:page], :per_page => 5)\n end", "def team_members\n if has_team?\n self.supervised ||= Employee.where(id: team_positions.map(&:efective_id))\n else\n Employee.none\n end\n end", "def employees\n emps = []\n url = prefix + \"liste\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n emps << ShareUser.new(u[\"id\"], @authid, @subdomain)\n end\n return emps\n else #failed\n return users\n end\n end", "def users\n Role.users id\n end", "def collect_anniversary_roles\n role_names = [\"Company Admin\", \"Executive\"]\n roles = []\n role_names.each do |role_name|\n roles << Role.find_by_long_name(role_name)\n end\n return roles\n end", "def current_manager\n Employment.joins(:store, :position).where(\"employments.end_date <= ? OR employments.end_date IS NULL\", Date.today.to_s).where(['stores.id = ?', self.id]).where('positions.name LIKE ?', 'Manager').first\n end", "def profitable_roles\n @agent_roles.select { |role| @trade_tracker.profitability_of(role).positive? }\n end", "def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end", "def employs?(user)\n employees.include?(user) or (affiliate == user) or user.admin?\n end", "def index\n if current_user.role == 'ADMIN'\n @users = User.includes(:jobs).all\n else\n #@user = User.eager_load(jobs: {taks_jobs: :task}, users_teams: {team: :users_teams}).find(current_user)\n @user = User.includes(:jobs).find(current_user.id)\n end\n end", "def index\n @jobs = Job.all\n if current_role == :admin\n @applications = Application.all\n elsif current_role == :recruiter\n @applications = Application.all.select{|n| @jobs.exists?(n.job_id) && @jobs.find(n.job_id).company_id == current_user.company_id}\n else\n @applications = Application.all.select{|n| n.user_id==current_user.id}\n end\n end", "def index\n #@proposals = Proposal.where(date: Time.now.next_week.all_week)\n @propositions = Proposal.a_traiter\n if current_collaborator.role == \"staffeur\" or current_collaborator.role == \"admin\" or current_collaborator.role == \"manager_dri\"\n @entites = Entity.all\n elsif current_collaborator.role == \"manager_dvt\"\n @entites = Entity.where(manager_id: current_collaborator.id)\n else\n @entites = []\n end\n end", "def list_employees(opts = {})\n data, _status_code, _headers = list_employees_with_http_info(opts)\n return data\n end", "def list_employees(opts = {})\n data, _status_code, _headers = list_employees_with_http_info(opts)\n return data\n end" ]
[ "0.7071529", "0.70429456", "0.68709403", "0.67674553", "0.6726405", "0.67206436", "0.66657573", "0.6642868", "0.6598172", "0.65895873", "0.64642835", "0.63845545", "0.6211491", "0.618306", "0.61317563", "0.60660416", "0.6055224", "0.6036162", "0.6036162", "0.6025784", "0.6012857", "0.6000311", "0.59785414", "0.59698033", "0.59146506", "0.58677995", "0.58627975", "0.58422816", "0.58031255", "0.5798563", "0.57939214", "0.5784792", "0.5768014", "0.5758246", "0.57363766", "0.57143736", "0.5688694", "0.56774515", "0.56770873", "0.56770873", "0.56770873", "0.5669951", "0.56348825", "0.5626772", "0.5626287", "0.56241536", "0.5582233", "0.5557884", "0.5556374", "0.55295587", "0.552742", "0.55214506", "0.54814816", "0.547053", "0.546557", "0.5465559", "0.54651356", "0.54526347", "0.54403734", "0.5433512", "0.54219455", "0.54175997", "0.54069614", "0.53956026", "0.53922725", "0.53922725", "0.5391003", "0.5389591", "0.5384999", "0.5368853", "0.5356568", "0.5352279", "0.53505594", "0.53409946", "0.53405625", "0.53399426", "0.5331614", "0.5331614", "0.53269875", "0.53259593", "0.53239167", "0.5317917", "0.5314055", "0.5309008", "0.5297144", "0.5286394", "0.5286329", "0.5280738", "0.5277901", "0.5274575", "0.5260096", "0.5248033", "0.5246748", "0.5241857", "0.52356964", "0.5233628", "0.5231982", "0.5229419", "0.5227021", "0.5227021" ]
0.8019726
0
build id > centroid cache
def build_centroids #sql = "SELECT b.ogc_fid as id, ST_AsGeoJSON(ST_centroid(b.wkb_geometry)) as geo FROM buildings b" sql = "SELECT b.ogc_fid as id, st_x(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lng, st_y(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lat FROM buildings b;" result_set = ActiveRecord::Base.connection.execute(sql) results = {} result_set.each do |row| results[row['id']] = [row['lng'],row['lat']] end results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_key(id); end", "def initialize\n @identity_map = Hash.new\n end", "def key_id=(_arg0); end", "def key_id; end", "def set_id_to_cache_key_map\n @ids.each do |id|\n @id_to_cache_key_map[id] = {\n kit: get_kit_cache_key(id),\n saas: get_saas_cache_key(id)\n }\n end\n end", "def load_identity!\n row_size.times do |r|\n column_size.times do |c|\n self[r, c] = (r == c ? 1 : 0)\n end\n end\n self\n end", "def analytics_cluster_id\n unless node['analytics-cluster']['id']\n node.set['analytics-cluster']['id'] = \"test-#{SecureRandom.hex(3)}\"\n node.save\n end\n\n node['analytics-cluster']['id']\n end", "def asigna_redis_id\n # El 2 inicial es para saber que es un region\n # El 1 en la segunda posicion denota que es un municipio\n # Y despues se ajusta a 8 digitos, para dar un total de 10 digitos\n self.redis = {} unless redis.present?\n self.redis[\"id\"] = \"21#{region_id.to_s.rjust(8,'0')}\".to_i\n end", "def geohash(key, member); end", "def build_id o=@origin_id, m=@metric_id\n\t\t\"#{o}#{SEP}#{m}\"\n\tend", "def generate_photo_cache_key(photo_id:)\n \"flickr_photo/#{photo_id}\"\n end", "def node_cluster_id() ; info[:node_cluster] ; end", "def cache_id\n index + 1\n end", "def target_id; genomic.entry_id; end", "def calculate_centroid\n\n # Clear the centroid vector\n @vcentroid.clear\n tcentroid = Hash.new(0)\n\n # Iterate through each feature vector\n @people.each do |person|\n\n # Sum the feature vectors in this cluster\n person.each do |key,value|\n tcentroid[key] = tcentroid.delete(key).to_i + value.to_i\n end\n\n end\n\n # Compute the average for the centroid\n tcentroid.each do |key,value|\n @vcentroid[key] = value.to_f / @people.length\n end\n\n end", "def ref_id\n 300_000_000 + data[0].to_i\n end", "def object_id_cache\n @object_id_cache ||= {\n # appeals: exported_records(Appeal).map { |appeal| [appeal[\"id\"], appeal[\"name\"]] }.to_h,\n orgs: exported_records(Organization).map { |org| [org[\"id\"], org[\"name\"]] }.to_h,\n users: exported_records(User).map { |user| [user[\"id\"], user[\"css_id\"]] }.to_h,\n tasks: exported_records(Task).map { |task| [task[\"id\"], \"#{task['type']}_#{task['id']}\"] }.to_h\n }\n end", "def local_id; end", "def _new_id\n @lock.synchronize do\n begin\n # Generate a random number. It's recommended to not store more than\n # 2**62 objects in the same store.\n id = rand(2**64)\n # Ensure that we don't have already another object with this ID.\n end while @in_memory_objects.include?(id) || @db.include?(id)\n\n id\n end\n end", "def id_for_update\n cc = self.class.column_for_attribute(self.class.cluster_by)\n { self.class.primary_key.to_s => __id,\n self.class.cluster_by.to_s => cc.type_cast_for_cql3(read_attribute(self.class.cluster_by.to_s)) }\n end", "def populate_id\n @id = Digest::SHA256.hexdigest(@source_url).slice(0, ID_LENGTH)\n end", "def cache_id\n \"#{self.class.name.underscore}:#{self.id}\"\n end", "def cache_ids()\n hit_values = File.open(@mzid_file) do |io|\n doc = Nokogiri::XML.parse(io, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML | Nokogiri::XML::ParseOptions::NOBLANKS | Nokogiri::XML::ParseOptions::STRICT)\n doc.remove_namespaces!\n root = doc.root\n \n cache_db_seq_entries(root)\n cache_pep_ev(root)\n \n peptide_lst = root.xpath('//Peptide')\n @pep_h = Hash.new\n @mod_h = Hash.new\n peptide_lst.each do |pnode|\n \n pep_id = pnode['id']\n pep_seq = get_peptide_sequence(pnode)\n mod_line = get_modifications(pnode)\n @pep_h[pep_id] = pep_seq \n @mod_h[pep_id] = mod_line \n end\n \n end\n end", "def build_activity_oid_map()\n activity_object_ids = {}\n activities = @primavera.get_activities(P6_PROJECT_ID)\n activities.each do |activity|\n activity_object_ids[activity[:id]] = activity[:object_id]\n end\n activity_object_ids\nend", "def rebuild_id_uri\n self.id_uri = build_id_uri\n end", "def initialize\n @id = {}\n end", "def make_id_to_stanza\n build_hash('id', nil)\n end", "def id() end", "def asigna_redis_id\n # El 2 inicial es para saber que es un region\n # El 0 en la segunda posicion denota que es un estado\n # Y despues se ajusta a 8 digitos el numero de estado, para dar un total de 10 digitos\n self.redis = {} unless redis.present?\n self.redis[\"id\"] = \"20#{region_id.to_s.rjust(8,'0')}\".to_i\n end", "def create_id_to_index!\n @id_to_index = {}\n get_delegate.each_with_index do |obj, i|\n @id_to_index[obj.id] = i\n end\n @id_to_index\n end", "def members_cache_key\n Member.cache_key_for_set(id)\n end", "def build_vuln_cache()\n r = Vulnerability.select(:id,:cve).pluck(:id, :cve)\n return r.inject({}) { |map, (id, cve)| map[cve] = id; map }\n end", "def generate_id\n if @document.attributes.has_key? 'sectids'\n sep = @document.attributes['idseparator'] || '_'\n pre = @document.attributes['idprefix'] || '_'\n base_id = %(#{pre}#{title.downcase.gsub(REGEXP[:illegal_sectid_chars], sep).tr_s(sep, sep).chomp(sep)})\n # ensure id doesn't begin with idprefix if requested it doesn't\n if pre.empty? && base_id.start_with?(sep)\n base_id = base_id[1..-1]\n base_id = base_id[1..-1] while base_id.start_with?(sep)\n end\n gen_id = base_id\n cnt = 2\n while @document.references[:ids].has_key? gen_id\n gen_id = \"#{base_id}#{sep}#{cnt}\"\n cnt += 1\n end \n gen_id\n else\n nil\n end\n end", "def assign_id\n Sufia::IdService.mint if Sufia.config.enable_noids\n end", "def id_by_pref\n @id_by_pref ||= pref_by_city.inject({}) { |hash, item|\n k, v = item\n hash[k] ||= v\n hash\n }\n end", "def identify(path, key) = Zlib.crc32(\"#{path.keyname}/#{key}\") % MAX_ID", "def asigna_redis_id\n # El 2 inicial es para saber que es un region\n # El 2 en la segunda posicion denota que es una ANP\n # Y despues se ajusta a 8 digitos, para dar un total de 10 digitos\n self.redis = {} unless redis.present?\n self.redis[\"id\"] = \"22#{region_id.to_s.rjust(8,'0')}\".to_i\n end", "def object_id() end", "def cluster_ids\n []\n end", "def generate_id \n end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def initialize_ISG_marker(uid)\n\t\t\t# create dictionary\n\t\t\t@dict = self.attribute_dictionary 'IterativeSG', true\n\t\t\t\n\t\t\t# UIDs are a bit different - when shape is copied, they should\n\t\t\t# not remain the same. So make sure to change them even if they exist.\n\t\t\tcurrent_uid = @dict.get_attribute 'IterativeSG', 'UID'\n\t\t\tif current_uid == nil\n\t\t\t\t@UID = uid\n\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', uid\n\t\t\telse\n\t\t\t\tif Controller.UIDs.include? current_uid\n\t\t\t\t\t@UID = uid\n\t\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', uid\n\t\t\t\telse\n\t\t\t\t\t@UID = current_uid\n\t\t\t\tend\n\t\t\tend\n\t\t\t# define current position for faster access\n\t\t\tself.update_shape\n\t\t\t\n\t\t\treturn @UID\n\t\tend", "def build_index\n index = {}\n count = 0\n (0...rows).each do |row|\n (0...cols).each do |col|\n next unless used?(row, col)\n index[[row, col]] = count\n count += 1\n end\n end\n\n index\n end", "def root_id\n @values.fetch('ai.operation.rootId') { \n @values['ai.operation.rootId'] = nil\n }\n end", "def local_rid=(_arg0); end", "def cache_key\n \"#{self.class.cache_key_base}/#{self.id}\"\n end", "def resident_key=(_arg0); end", "def get_unique_area_id\n session[:request_counter] = 0 if session[:request_counter] > 10000 # Sicherstellen, das keine Kumulation ohne Ende\n \"a#{session[:request_counter]}\"\n end", "def get_id_affiliation(name,city,country)\n \"NS:\"+Digest::MD5.hexdigest(\"#{name}|#{city}|#{country}\")\n end", "def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end", "def canonical_id\n @canonical_id ||= crate.resolve_id(id)\n end", "def cache_key_base\n \"georeferencer/#{Georeferencer::VERSION}/#{self.to_s.underscore}\"\n end", "def id=(_arg0); end", "def id=(_arg0); end", "def id=(_arg0); end", "def __id__() end", "def first_centroids\n #LABELS.to_a.uniq{|filename, label| label}.map{|filename, label| @data_names.index()}\n LABELS.to_a\n .uniq{|filename, label| label}\n .map{|filename, label| DATA_PATH+filename}\n .map{|path| @data[@data_names.index(path)]}\n end", "def cannabinoid; end", "def generate_new_id()\n\t\tbegin\n\t\t\t(id = rand(9000)+1000)\n\t\tend while @objects[id]\n\t\treturn id\n\tend", "def id_generator; end", "def next_rid; end", "def make_coordinate_hash\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @coordinates[[x,y]] = move\n end\n end\n end", "def simple_cache_key\n \"#{self.class.name.underscore}/#{id}\"\n end", "def hash\n \tcustom_unique_id.hash\n end", "def generate_primary_key\n self[self.class.primary_key] ||= self.class.new_primary_key(10_000)\n end", "def idpath; @idpath ||= define_idpath end", "def cache_locations\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |citizen, col_idx|\n citizen.location = [col_idx, row_idx]\n end\n end\n end", "def cache_point(point_key, scope_hash)\n c_scope = @_point_keys[point_key] \n c_point = c_scope.inject(point_key.to_s) do |s, i| \n s << ::Cachecataz::Config[:namespace_delimiter] << (scope_hash[i.to_s] || scope_hash[i]).to_s \n end\n\n ::Cachecataz[:set, c_point, ::Cachecataz::Config[:random] ? rand(10000).to_s : \"0\"] unless ::Cachecataz[:exist?, c_point]\n return c_point\n end", "def center\n Center.find(center_ids.first)\n end", "def new_id\n dbm = self.class.dbm\n\n max = dbm.keys.map { |k| k.to_i }.max || 0\n id = max + 1\n\n dbm[id.to_s] ||= \"\"\n\n id.to_s\n end", "def current_map_id\n return @data[@index][:id]\n end", "def gid\n self.class.key(id)\n end", "def gid\n self.class.key(id)\n end", "def index_and_memoize!(key:, object:, id:)\n\n object.keys.each do |key|\n tokenize(object[key]).each do |name|\n @index[name] = @index.fetch(name, Array.new) << id\n end\n end\n\n @documents[id] = Document.new(object)\n end", "def numid=(_); end", "def hash\r\n id.hash\r\n end", "def hash\n @id.hash\n end", "def counter_key\n @counter_key ||= [*name.downcase.split(\"::\"), :idcnt].join(\":\")\n end", "def numid; end", "def hash\n @id\n end", "def facture_id\n @facture_id ||= data[:id][0..31]\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def cache_key\n end", "def local_rid; end", "def set_id\n\t\t\trand(111111111...999999999)\n\t\tend", "def id\n @__metadata__.key || @id\n end", "def construct_initial_clusters\n timer = Array.new(4, 0)\n startg = Time.now\n\n @documents.each do |document|\n start = Time.now\n # get the appeared items in the document\n present_freq_items = document.doc_vector.get_present_items(true)\n timer[0] += (Time.now - start)\n\n start = Time.now\n covered_clusters = Clusters.new\n # get all clusters that can cover this doc\n @cluster_warehouse.find_covered_clusters(present_freq_items, covered_clusters)\n timer[1] += (Time.now - start)\n\n start = Time.now\n # assign doc to all the covered clusters\n assign_doc_to_clusters(document, covered_clusters)\n timer[2] += (Time.now - start)\n end\n\n timer[3] = (Time.now - startg)\n puts \"duration: #{timer}\" if Configuration.debug\n end", "def hash\n return @id.hash\n end", "def generate_gid(type, id)\n Base64.strict_encode64([\"0\", type.length, \":\", type, id.to_s].join)\nend", "def hash\n @id\n end", "def id; \"#{@x}-#{@y}\"; end", "def chilean_id; end", "def generate_key; end", "def instant_places=(id)\n \n #self.ville_id = country_tokens.find_in_batches(:batch_size => 5000) do |villes|\n self.ville_id = id\n #end\n end", "def gid=(p0) end", "def gid=(p0) end", "def generate_id\n @mutex.synchronize { @current_id += 1 }\n end", "def query_id; @hit.mrna.entry_id; end", "def cache_key\n\t [object, scope]\n\tend" ]
[ "0.593164", "0.5630838", "0.5594484", "0.5537156", "0.5518913", "0.5458449", "0.54288363", "0.54115874", "0.54096395", "0.5408406", "0.53992057", "0.53882325", "0.5386415", "0.5376187", "0.53726834", "0.53705853", "0.53212446", "0.53114766", "0.52939475", "0.52934694", "0.52839094", "0.52809983", "0.527985", "0.5278565", "0.52675724", "0.52623916", "0.5246279", "0.52339906", "0.5231617", "0.5224678", "0.5224037", "0.5210615", "0.5193371", "0.51723367", "0.51632106", "0.51595557", "0.5149141", "0.514093", "0.5132163", "0.5130178", "0.5115893", "0.51155674", "0.5112994", "0.50982904", "0.50735915", "0.50727504", "0.5067744", "0.50595474", "0.5059185", "0.50576764", "0.50566995", "0.5049264", "0.50476086", "0.50476086", "0.50476086", "0.5041976", "0.5038808", "0.5037002", "0.5036386", "0.5031891", "0.502864", "0.5012309", "0.5010185", "0.5006695", "0.5002079", "0.50014454", "0.49976146", "0.49972686", "0.49873266", "0.4982039", "0.498127", "0.4967116", "0.4967116", "0.4964607", "0.4947879", "0.49468952", "0.49437633", "0.49387372", "0.4936153", "0.49248925", "0.49234304", "0.49215513", "0.49215513", "0.49202755", "0.49165833", "0.49099308", "0.49056837", "0.49048567", "0.49047074", "0.49034733", "0.49003243", "0.48994917", "0.48927534", "0.4891791", "0.48889542", "0.48833528", "0.48833528", "0.48829865", "0.48765144", "0.48749828" ]
0.60702795
0
null object parent Sobreescribimos el metodo de current_user que nos da devise
def current_user super || guest_user #Super quiere decir que exactamente con los valores #del metodo original sin cambiar nada end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n current_parent\n end", "def parent\n User.find(self.user_id)\n end", "def current_user\n current_user ||= Parent.find_by(id: session[:id])\n\n end", "def current_user\n current_usuario\n end", "def current_user\n nil\n end", "def current_user\n super\n end", "def current_user\n super\n end", "def current_user\n nil\n end", "def current_user()\n nil\n end", "def current_user\n @user\n end", "def current_user\n #super the main class of devise current_user\n super || guest_user\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def current_user\n self.class.current_user\n end", "def current_user\r\n super || guest_user\r\n end", "def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything normal, and ignore right hand side\n # if super == false, call right hand side\n\n # super comes from devise class\n # meanwhile the r.h.s comes from open struct class\n super || guest_user\n end", "def current_user\n @current_user\n end", "def current_user\r\n super || guest_user\r\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def user\n self.class == User ? self : super\n end", "def current_user\n return @current_user if @current_user\n \n @current_user = super.decorate if super\n @current_user\n end", "def current_user\n # if a user is logged in we just use devise's implementation.\n super || guest_user\n end", "def current_user\n self.class.current_user\n end", "def current_user\n user.user\n end", "def current_user\n UserDecorator.decorate(super) unless super.nil?\n end", "def current_user\n UserDecorator.decorate(super) unless super.nil?\n end", "def current_resource_owner\n return @current_resource_owner if defined?(@current_resource_owner)\n\n super\n end", "def current_user\n @current_user\n end", "def user\n if user_id\n super\n else\n billable_to.owner # always a User\n end\n end", "def parent_id_attr\n 'end_user_login'\n end", "def current_user\n # super = use the devise current_user method || create a new open struct with 1 attr of full name\n super || OpenStruct.new(full_name: 'Guest')\n end", "def current_user\n super || guest_user\n end", "def current_user\n super || guest_user\n end", "def current_user\n super || guest_user\n end", "def current_user\n @current_user = current_mentor || current_student\n end", "def current_user\n raise NotImplementedError\n end", "def current_user\n raise NotImplementedError\n end", "def parent\n owner\n end", "def current_user\n @current_user ||= nil\n end", "def owner\n return self.user\n end", "def current_user\n logger.debug 'ApplicationController:current_user'\n @current_user ||= super\n @current_user && @current_user.is_guest? ? nil : @current_user\n end", "def user\n owner\n end", "def user_id\n self.user.id unless user.nil?\n end", "def set_current_data\n if current_user.parent?\n current_user.add_current_child\n elsif current_user.teacher? || current_user.school_manager?\n current_user.add_current_classroom\n else\n ### TODO: Exception => No Parent/Teacher/SchoolManager User.\n end\n end", "def current_user\n\t\tview_context.current_user\n\tend", "def current_user\n # Designer.first\n current_designer\n end", "def forem_user\n current_user\n end", "def current_user\n super\n if @current_user\n return @current_user\n end\n\n authenticate_user!\n @current_user\n end", "def pundit_user\n \tcurrent_usuario\n end", "def current_user\n super || guest_user\n # super = dont change anything, I want the same feature of the method we are overriding\n end", "def current_user\n @user || @api_user || @social_user\n end", "def user\n object.user\n end", "def current_user\n User.first\n end", "def current_user\n User.first\n end", "def current_user\n User.first\n end", "def current_user\n current_session.user\n end", "def get_parent_object\n nil\n end", "def current_user\n @current_user ||= User.find_by(idCadastro: session[:idCadastro])\n end", "def current_inviter\n if user_signed_in?\n super\n else\n @current_inviter ||= User.new(params[:user])\n end\n end", "def user_id\n self.user.id\n end", "def begin_of_association_chain\n self.action_name != 'index' ? current_user : super\n end", "def current_user\n User.find(current_user_id)\n end", "def parent_profile\n @parent_profile ||= Profile.where(\"parent_type.email\"=> email).first #if has_role?(:parent)\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n @current_user if logged_in?\n end", "def parent\n nil\n end", "def current_parent\n\t Parent.where(id: session[\"parent_id\"]).first\n\tend", "def current_user\n current_account.user\n end", "def set_self_as_user\n @user = self.current_user\n end", "def current_user\n Designer.first\n end", "def current_user \n #will never return NIL, create a fake user\n #will return the super value (logged in user) OR the guest infos.\n super || guest_user\n end", "def user_for_paper_trail \n current_usuario\n end", "def current_user\n current_customer\n end", "def parent\n @parent\n end", "def parent\n @parent\n end", "def current_user_id\n 1\n end", "def current_user\n super || OpenStruct.new(name: \"Guest User\", first_name: \"Guest\",\n last_name: \"User\", email: \"[email protected]\")\n end", "def parent\n nil\n end", "def current_user\n master.current_user\n end", "def current_user\n cu = super\n return cu unless cu.blank?\n return nil unless doorkeeper_token && doorkeeper_token.accessible?\n @current_user ||= User.find_by_id(doorkeeper_token.resource_owner_id)\n end", "def current_user\n current_account\n end", "def current_user\n @authenticated_user\n end", "def current_user\n @authenticated_user\n end", "def owner\n user\n end", "def owner\n user\n end", "def parent\n @parent || NullResource.new\n end", "def current_user\n User.current\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def current_user\n current_admin || current_consumer || current_employee\n end", "def privacy_owner\r\n\t\t\tself.user\r\n\t\tend" ]
[ "0.72876644", "0.7139101", "0.7115013", "0.70647514", "0.70472246", "0.70463896", "0.70463896", "0.6932307", "0.68133706", "0.6777462", "0.6753491", "0.67210376", "0.67210376", "0.67210376", "0.67210376", "0.67173916", "0.67162454", "0.6668918", "0.66334194", "0.6625624", "0.6623784", "0.6623784", "0.6599322", "0.6584376", "0.6582897", "0.65496176", "0.6549129", "0.65174603", "0.65174603", "0.64980036", "0.64862376", "0.6481301", "0.6470081", "0.6440632", "0.6437732", "0.6437732", "0.6437732", "0.641357", "0.64002895", "0.64002895", "0.63984364", "0.63909966", "0.63709104", "0.63430655", "0.6314424", "0.6291764", "0.6291397", "0.6286766", "0.6283862", "0.62652564", "0.62602913", "0.6257343", "0.6245951", "0.6232611", "0.62309223", "0.6229449", "0.6229449", "0.6229449", "0.622809", "0.62204164", "0.6219929", "0.6216649", "0.62152714", "0.6212952", "0.6201707", "0.61968255", "0.6180656", "0.6180656", "0.61746866", "0.61645883", "0.6161842", "0.6141094", "0.6135314", "0.61308753", "0.61288047", "0.61234653", "0.61231357", "0.61231357", "0.6120977", "0.61188483", "0.61161035", "0.6109079", "0.6108704", "0.6108101", "0.61070687", "0.61070687", "0.6104998", "0.6104998", "0.61000156", "0.6096191", "0.6079237", "0.6079237", "0.6079237", "0.6079237", "0.6079237", "0.6079237", "0.6079237", "0.6079237", "0.6069716", "0.60656714" ]
0.70095533
7
Called by NGINX. Sends streamup over websockets to users watching, and returns redirect response to nginx to internally redirect stream to the restricted hlsout RTMP app
def start if params[:name] streaming_user = User.where('stream_key = ?', params[:name]).first if streaming_user async_confirm_and_set_stream_state(streaming_user) # Sending a redirect causes NGINX rtmp module to redirect the stream # to the restricted hlsout application. This also effectively translates # the users stream key to their username for client-side use. redirect_to "rtmp://127.0.0.1/hlsout/" + streaming_user.username.downcase else render status: :not_found end else render status: :not_found end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_drop_stream\n unless self.is_being_seeded || Rails.env.development? || Rails.env.test?\n params = {\n 'app' => 'stream',\n 'name' => stream_key_was\n }\n x = Net::HTTP.post_form(\n URI.parse(\n Rails.configuration.x.saber.stream_rtmp_control_url\n ),\n params\n )\n end\n end", "def livestream\n system(\"/home/pi/bin/startstream\") or raise \"Something went wrong.\"\n redirect_to :back\n end", "def forwardvideo\n Pusher['photo-call'].trigger('next-video' , {\n control: \"1\"\n })\n render text: \"ok\"\n end", "def serve_stream_request! in_stream, out_stream\n serve_request! in_stream, out_stream\n end", "def stream_callback(name, options = {}, &block)\n if not block\n throw ArgumentError\n end\n\n\n # Set instance variable for original rendering before streaming is established\n instance_variable_set(\"@#{name}\", block.call)\n\n # Check if the request is initial or for streaming content\n #\n # If the request is not for streaming ignore the rest of the code\n unless params[STREAMING_PARAM]\n return false\n else\n\n response.headers['Content-Type'] = 'text/event-stream'\n\n connection = Strwatch::Connection.new(response.stream, name)\n\n lambda { connection.stream(block.call, options) }\n end\n end", "def stream\n Shot.stream\n redirect_to shots_path\n end", "def index\n last_event_id = 0\n key = params[:key]\n response.headers['Content-Type'] = 'text/event-stream'\n puts \"subscribing to #{key}\"\n begin\n sse = SSE.new(response.stream)\n ticker = Thread.new do\n sse.write 0, event: 'ack'\n sleep 5\n end\n\n r = Redis.new\n streamer = Thread.new do\n r.subscribe(key) do |on|\n on.message do |channel, message|\n response.stream.write(message)\n end\n end\n end\n\n ticker.join\n streamer.join\n rescue IOError\n puts \"ioerror:: #{$!}\"\n ensure\n Thread.kill(ticker) if ticker\n Thread.kill(streamer) if streamer\n sse.close\n r.quite\n end\n end", "def index\n @quacks = Quack.all\n # SSE expects the `text/event-stream` content type\n response.headers['Content-Type'] = 'text/event-stream'\n\n sse = Reloader::SSE.new(response.stream)\n begin\n loop do\n sse.write({ :time => Time.now })\n sleep 1\n end\n rescue IOError\n # When the client disconnects, we'll get an IOError on write\n ensure\n sse.close\n end\n end", "def unicast_redirect_state\n super\n end", "def stream!\n before_run\n\n #\n # figure out how we want to call streaming client\n #\n if @handlers[:search]\n method = :filter\n args = streamify_search_options(@handlers[:search].opts)\n else\n method = :user\n args = {\n stall_warnings: \"true\"\n }\n end\n\n streaming_client.send(method, args) do |object|\n handle_streaming_object(object)\n end\n after_run\n end", "def send_stream_state(state, streaming_user)\n WebSocket::Client::Simple.connect(\n Rails.configuration.x.saber.chat_server,\n headers: { \"streamstate-auth\": Rails.application.credentials.stream_state_auth }\n ) do |ws|\n ws.on :open do\n ws.send({\n type: \"StreamState\",\n data: {\n state: state,\n username: streaming_user.username.downcase\n }\n }.to_json)\n ws.close\n end\n end\n end", "def serve_request! in_stream, out_stream\n request = request_ok = result = result_ok = exception = nil\n request = receive_request(in_stream)\n request_ok = true\n result = invoke_request!(request)\n result_ok = true\n rescue Exception => exc\n exception = exc\n _log [ :request_error, exc ]\n ensure\n if out_stream\n begin\n if request_ok \n if exception && ! result_ok\n result = EncapsulatedException.new(exception)\n end\n send_response(result, out_stream)\n end\n rescue Exception => exc\n _log [ :response_error, exc ]\n end\n else\n raise exception if exception\n end\n end", "def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end", "def redirect(client)\n header = ['HTTP/1.1 301 Moved Permanently',\n 'location: http://localhost:9292/game',\n \"date: #{Time.now.strftime('%a, %e %b %Y %H:%M:%S %z')}\",\n 'server: ruby',\n 'content-type: text/html; charset=iso-8859-1\\r\\n\\r\\n'].join(\"\\r\\n\")\n client.puts header\n end", "def websocket; end", "def websocket; end", "def async_confirm_and_set_stream_state(streaming_user)\n Thread.new do\n stream_state_confirmed = false\n retries = 30\n retry_count = 0\n confirmations = 15\n confirmation_count = 0\n stream_found_count = 0\n stream_not_found_count = 0\n\n until stream_state_confirmed do\n # Check stream once per second\n sleep 1\n url = URI.parse(Rails.configuration.front_end_hostname +\n '/hls/' + streaming_user.username.downcase + '/index.m3u8')\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n\n # If stream manifest is found, increment found_count and reset\n # not_found count. Otherwise, do the opposite\n if res.code == \"200\"\n stream_found_count += 1\n stream_not_found_count = 0\n else\n stream_not_found_count += 1\n stream_found_count = 0\n end\n\n # If stream is confirmed, set status to true, and send a 'stream-up'\n # message to all users in the broadcasters chat room.\n if stream_found_count == confirmations\n streaming_user.user_public_datum.online_status = true\n if streaming_user.user_public_datum.save!\n send_stream_state(\"stream-up\", streaming_user)\n stream_state_confirmed = true\n break\n end\n elsif stream_not_found_count == confirmations\n streaming_user.user_public_datum.online_status = false\n if streaming_user.user_public_datum.save!\n send_stream_state(\"stream-down\", streaming_user)\n stream_state_confirmed = true\n break\n end\n end\n\n # If retries exceed the limit, the stream is either down or unstable.\n # Send 'stream-down' message to all chat room users.\n if retry_count >= retries\n streaming_user.user_public_datum.online_status = false\n if streaming_user.user_public_datum.save!\n send_stream_state(\"stream-down\", streaming_user)\n stream_state_confirmed = true\n end\n break\n end\n\n retry_count += 1\n end\n end\n end", "def stream(name, url)\n gateway_check\n update_status(@status, name, url)\n name\n end", "def _send_response response_payload, stream\n _write response_payload, stream\n end", "def shout_playlist\n @clg_name = College.find(params[:id])\n #mount_name = @clg_name.mount_point\n #mount = \"/#{mount_name}.m3u\" # doc[0].split.third unless doc[0].split.third.present? #\"/#{mount_name}.m3u\" # \"/#{object.name.split.join.downcase}.m3u\"\n # s.charset = \"UTF-8\"\n # s.port = 8022\n # s.host = \"localhost\"\n # s.user = \"source\"\n # s.pass = \"bpsi@123\"\n # s.format = Shout::MP3\n #@s.description ='song classic'\n \n # @s.connect\n #puts \"open VLC and open network -> http://#{@s.host}:#{@s.port}\"+\"#{@s.mount}\"\n \n # puts s.description\n # filename = \"#{Rails.root}/public/Playlist/qwerty.m3u\"\n # #ARGV.each do |filename|\n # debugger\n # File.open(filename) do |file|\n # puts \"sending data from #{file}\"\n # m = ShoutMetadata.new\n # m.add 'filename', filename\n # m.add 'title', 'title'\n # @s.metadata = m\n\n # while data = file.read(BLOCKSIZE)\n # @s.send data\n # @s.sync\n # end\n\n # end\n #end\n\n # s.disconnect \n #redirect_to :back\n #s.connect\n render :text => \"Connect\"\n end", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def redirect_to_stream_if_logged_in\n redirect_to user_stream_path(current_user) if signed_in?\n end", "def to_sse\n response = Thin::AsyncResponse.new(request.env, 200, 'Content-Type' => 'text/event-stream')\n response.send_headers\n\n output_stream = ActionController::Live::SSE.new(response, retry: 300, event: 'row')\n db_handler = DbHandler.new(output_stream)\n\n rethink_handle = rethink_query.em_run(NoBrainer.connection.raw, db_handler)\n\n pinger = EventMachine::PeriodicTimer.new(PING_INTERVAL) do\n output_stream.write('PING', event: 'ping')\n end\n\n response.callback do # aka client disconnected\n pinger.cancel\n rethink_handle.close\n end\n\n head -1 # aka throw :async\n end", "def send_data_with_http_tunnel(data)\n #msg_data = Base64::encode64(data)\n #@socket_srv.print \"GET /office_send_msg?#{msg_data} HTTP/1.1\\r\\n\"\n # Zip deflate avoid to have special character in the encoded argument\n msg_data = Zlib::Deflate.deflate( data, 1 ).unpack('H*').first \n @socket_srv.print \"GET /office_send_msg?#{msg_data} HTTP/1.1\\r\\n\"\n #@socket_srv.print \"GET /office_send_msg HTTP/1.1\\r\\n\"\n @socket_srv.print \"Host: #{@host_server}:#{@port_server}\\r\\n\"\n @socket_srv.print \"X-Cup-Session-Id: #{@id_http_session}\\r\\n\" if @id_http_session\n @socket_srv.print \"User-Agent: Mozilla/5.0\\r\\n\"\n @socket_srv.print \"Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\"\n @socket_srv.print \"Keep-Alive: 300\\r\\n\"\n @socket_srv.print \"Connection: keep-alive\\r\\n\"\n @socket_srv.print \"\\r\\n\" #end message\n #http_packet = \n #@socket_srv.write(http_packet)\n end", "def nginx_send_file(file)\n headers['X-Accel-Redirect'] = File.expand_path(file)\n return\n end", "def events\n response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)\n room_id = params[:room_id]\n sse = Streamer::SSE.new(response.stream) # Opens server sent event stream\n redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread\n # --- Adds all the subscription events for each room --- \n redis.subscribe([\"add_song_#{room_id}\", \"add_user_#{room_id}\", \"change_song_#{room_id}\", \"remove_user_#{room_id}\", \"like_or_dislike_#{room_id}\", \"add_message_#{room_id}\", \"heart\"]) do |on|\n on.message do |event, data|\n \tif event == \"add_song_#{room_id}\" # For the add song subscription\n \t\tsse.write(data, event: \"add_song_#{room_id}\")\n \telsif event == \"add_user_#{room_id}\" # For the add user subscription\n \tsse.write(data, event: \"add_user_#{room_id}\")\n elsif event == \"change_song_#{room_id}\" # For the change song subscription\n \tsse.write(data, event: \"change_song_#{room_id}\")\n elsif event == \"remove_user_#{room_id}\" # For the remove user subscription\n \tsse.write(data, event: \"remove_user_#{room_id}\")\n elsif event == \"like_or_dislike_#{room_id}\" # For the like/dislike subscription\n \tsse.write(data, event: \"like_or_dislike_#{room_id}\")\n elsif event == \"add_message_#{room_id}\" # For the add message subscription\n \tsse.write(data, event: \"add_message_#{room_id}\")\n elsif event == \"heart\" # For the heartbeat subscription\n \tsse.write(data, event: \"heart\")\n \tend\n end\n end\n # --- end ---\n rescue IOError\n # Client disconnected\n redis.quit\n sse.close\n response.stream.close\n ensure\n \t# When not being used, threads close\n redis.quit\n sse.close\n response.stream.close\n end", "def stop\n if params[:name]\n streaming_user = User.where('stream_key = ?', params[:name]).first\n if streaming_user\n async_confirm_and_set_stream_state(streaming_user)\n render status: :ok\n else\n render status: :not_found\n end\n else\n render status: :not_found\n end\n end", "def sendfile_via_litespeed(path)\r\n #@file_to_send = session[:filename] # a session variable set in a view or other function\r\n #filename = path # create the URI, must be under /public \r\n headers[\"Location\"] = path # set the 'Location header\r\n redirect_to(path) # redirect\r\n end", "def send_file stream_id, file\n res_headers = { \"status\" => \"200 OK\", \"version\" => \"HTTP/1.1\" }\n res_headers[\"Content-Type\"] = Rack::Mime.mime_type File.extname(file)\n\n # File contents\n data = if File.exists? file\n File.binread(file)\n elsif File.exists? \"#{file}.erb\"\n Tilt.new(\"#{file}.erb\").render\n else\n res_headers[\"Content-Type\"] = \"text/plain\"\n res_headers[\"status\"] = \"404 Not Found\"\n\n \"404 Not Found\"\n end\n\n res_headers[\"Content-Length\"] = data.size.to_s\n\n # Create response stream.\n # See hello_world.rb for detailed SPDY protocol instructions.\n syn_reply = SPDY::Protocol::Control::SynReply.new zlib_session: @parser.zlib_session\n\n # Send headers.\n send_data syn_reply.create(stream_id: stream_id, headers: res_headers).to_binary_s\n\n # Send contents.\n send_data SPDY::Protocol::Data::Frame.new.create(stream_id: stream_id, data: data).to_binary_s\n\n # Finalize response.\n fin = SPDY::Protocol::Data::Frame.new\n send_data fin.create(stream_id: stream_id, flags: 1).to_binary_s\n end", "def open_stream(env, hndlr)\n env[:subscription] = hndlr.stream_data{ |data| env.stream_send MultiJson.dump(data).concat(\"\\n\") }\n end", "def subscribed\n super\n increase_current_users\n stream_from channel\n end", "def log_connect(stream_obj)\n puts \"STREAM: connect for #{stream_obj.request_path} from #{request.ip}\" if VERBOSE\n # REDIS.PUBLISH 'stream.admin.connect', stream_obj.to_json\nend", "def stream(socket); end", "def proxy_pass; end", "def call(env)\n # trace __FILE__, __LINE__, self, __method__, \"env=#{env}\"\n protocols = nil\n options = { ping: 5 } # keep socket alive : Chrome seems to time out in about 10?\n socket = Faye::WebSocket.new(env, protocols, options)\n connect!(socket)\n # trace __FILE__, __LINE__, self, __method__\n socket.rack_response\n end", "def upgrade\n fail ProtocolError unless @stream_id == 1\n send_connection_preface\n new_stream(state: :half_closed_local)\n end", "def handle_push(url_text)\n parsed = URI.parse(url_text)\n\n push_url = @request.uri.dup\n push_url.host = parsed.host if parsed.host\n push_url.scheme = parsed.scheme if parsed.scheme\n push_url.path = parsed.path if parsed.path\n\n logger.debug \"[#{@stream_id}] Server Push of #{url_text} requested, push URL is #{push_url} (path #{push_url.path})\"\n\n resource_stream_id = @session.send_syn_stream(@stream_id, { 'url' => push_url.to_s })\n\n backend_headers = @request.headers.dup\n backend_headers.delete 'path'\n backend_headers['url'] = push_url.path\n\n push_request = Request.new(headers: backend_headers)\n push_backend_reply = @backend.prepare(push_request)\n\n push_backend_reply.on_headers do |headers|\n @session.send_headers resource_stream_id, headers\n logger.debug \"[#{resource_stream_id}] headers came in from backend\"\n end\n push_stream = Stream.new resource_stream_id, @session\n\n push_backend_reply.on_body do |chunk|\n push_stream.send_data chunk\n end\n\n push_backend_reply.on_complete do\n logger.debug \"[#{resource_stream_id}] Push Request completed\"\n push_stream.eof!\n end\n\n push_backend_reply.dispatch!\n end", "def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend", "def handle_server_stanza(stanza)\n puts '<-- handle server stanza'\n print ' '\n puts stanza\n if stanza.name == 'stream' and stanza.prefix == 'stream'\n # The <stream:stream> opening tag\n send(stanza.to_s.sub(/\\/>$/, '>'))\n else\n # Stanzas are only sent if no user-script callback returns +true+\n unless Proxy::process_server(stanza, self)\n stanza.delete_element('//starttls')\n send(stanza)\n end\n end\n end", "def stream_connect(params)\n puts('-- stream connect')\n @options = {\n timeout: 0,\n method: 'get',\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n },\n params: params\n }\n @request = Typhoeus::Request.new(@stream_url, @options)\n @request.on_body do |chunk|\n if chunk.eql?(\"\\r\\n\")\n else\n response = JSON.parse(chunk).to_h\n ap response\n doc = response['data']\n doc['users'] = response ['includes']['users']\n # insert the tweet object into the DB\n id = TWDB[opts[:tweetcoll]].insert_one(doc)\n puts \"\\n----------------------------\\n\"\n puts \"#{Time.now - @t} secs since last event\"\n @t = Time.now\n end\n end\n @request.run\nend", "def upstream_response\n http = EM::HttpRequest.new(url).get\n logger.debug \"Received #{http.response_header.status} from NextBus\"\n http.response\n end", "def on_request( request, response )\n \n \n BetterCap::Logger.info \"Hacking http://#{request.host}\"\n # is it a html page?\n if response.content_type =~ /^text\\/html.*/\n \n if request.host =~ /example.com.*/\n response.redirect!(\"https://webtwob.de\")\n \n \n \n #found = false\n #BetterCap::Logger.info \"Redirecting\"\n #for h in response.headers\n # if h.include?(\"Location:\")\n # found = true\n # if !h.include?(\"https://webtwob.de\")\n # h.replace(\"Location: http://webtwob.de\")\n # end\n # end\n #end\n \n #if !found \n # BetterCap::Logger.info \"No Location header found, adding one.\"\n # # Replace HTTP Response code with 302\n # response.headers.\n # # This is an ugly hack to get around github issue #117\n # response.headers.reject! { |header| header.empty? }\n # # This is our payload line that is fine\n # response.headers << \"Location: https://webtwob.de\"\n # # This line is also necessary because of github issue #117\n # response.headers << \"\"\n # \n #end\n end\n \n \n #BetterCap::Logger.info \"Hacking http://#{request.host}#{request.url}\"\n # make sure to use sub! or gsub! to update the instance\n response.body.sub!( '</body>', ' <script> alert(42); </script> </body>' )\n end\n end", "def close\n if @status == CONNECTED\n send(\"</stream:stream>\")\n end\n super\n end", "def stream_request\n puts \"==================================\\n\\n\"\n puts \"Start Grabing Info from the Stream\"\n \n @request_url = 'http://stream.twitter.com/1/statuses/filter.json'\n \n #(Note) the more values in the track= the less things actually show up\n \n http = EventMachine::HttpRequest.new(@request_url).post :head => {'Authorization'=> [$user[:username],$user[:password]],'Content-Type'=>\"application/x-www-form-urlencoded\"}, :body => \"track=Editions,webaim,joystiq,myAOL\"\n #puts http.inspect\n buffer = \"\"\n \n # Grab initial headers\n http.headers {\n #pp http.response_header.status\n if http.response_header.status.to_i == 401\n raise \"Error. Authentication Required. Please add your username and password to the command line. eg. ruby server.rb twitter_username twitter_password\"\n end\n }\n \n # Grab stream as it becomes available\n http.stream do |chunk|\n buffer += chunk\n while line = buffer.slice!(/.+\\r?\\n/)\n Parser.new(line) unless line.bytesize < 10\n end\n \n end\n \n # Stream is now complete, issue reconnection\n http.callback {\n # pp http.response_header.status\n # pp http.response\n \n puts \"connection closed by Twitter. Reconnect\"\n \n if http.response_header.status == 420\n @wait_time += 60\n $new_messages.call(\"Easy there, Turbo. Too many requests recently. Enhance your calm. (Have to wait #{@wait_time.to_s})\")\n elsif http.response_header.status == 200\n @wait_time = 10\n else\n @wait_time = WAIT_TIME_DEAFULT\n end\n \n puts \"Next run in #{@wait_time.to_s}\"\n EventMachine::Timer.new(@wait_time) do\n stream_request\n end\n \n }\n \n # Error connecting, try again\n http.errback {\n puts \"error on that one. try again\"\n #$new_messages.call(\"Error on HTTP Stream. Reconnecting\")\n EventMachine::Timer.new(@wait_time) do\n stream_request\n end\n }\n \nend", "def redirect_to_api\n cache_duration 3600\n redirect \"http://#{ DropFetcher.base_uri }#{ request.path }\", 301\n end", "def run\n websocket.run\n end", "def infinite_stream\n Net::HTTP.start(@uri.host, @uri.port, :use_ssl => @uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new @uri\n request['Authorization'] = @header['Authorization'] #applying authentication header obtained by user\n http.request request do |response|\n open @stream_temp_file, 'w' do |io|\n response.read_body do |chunk|\n io.write chunk\n end\n end\n end\n end\n end", "def wall_authenticate\n session[:user_id] ||= \"wall_\" + SecureRandom.random_number(10000000).to_s\n if request.ip == HUNT_WALL_IP\n session[:user_id] = 'hunt_' + session[:user_id]\n HuntWallConnectionLogger.info session[:user_id]\n end\n\n auth_data = {\n user_id: session[:user_id]\n }\n response = Pusher['presence-listen_to_wikipedia'].authenticate(params[:socket_id], auth_data)\n render :json => response\n end", "def callout(initial_msg, data = nil, connection_url = nil)\n token = @auth_client.authorize\n STDERR.puts \"Type for the url group: #{@type}\"\n connection_url ||= \"#{@options[@type]}?watson-token=#{token}\"\n response = WatsonTtsAsrClient::Model::SocketResponse.new()\n file_sent = false\n \n EM.run do\n trap(\"TERM\") { stop }\n trap(\"INT\") { stop }\n ws = WebSocket::EventMachine::Client.connect(:uri => connection_url)\n ws.onopen do\n #or send binary data...\n ws.send(initial_msg)\n end\n #this is awful, I can't believe I wrote it, fuck...fix this!!!!\n ws.onmessage do |msg, type|\n STDERR.puts \"response #{msg}\"\n if @type == :tts_url\n if type == :text\n response.set_json(msg)\n #should probably find a way to pass this in as a block eventually\n #if response is { \"state\" : \"listening\" } send audio file\n elsif type == :binary\n response.data << msg\n else\n STDERR.puts \"~~Error recieved other message: #{message} of type: #{type}\"\n end\n else\n if type == :text\n res = JSON.parse(msg, object_class: OpenStruct)\n if res.respond_to?(:state) && res.state == \"listening\"\n if file_sent == true\n yield response\n stop \n end\n data.bytes.each_slice(WebsocketClient.chunk_size) { |chunk| ws.send(chunk.pack(\"C*\"), type: :binary) }\n ws.send(\"\", type: :binary)\n file_sent = true\n elsif res.respond_to?(:results)\n STDERR.puts \"responds to results\"\n response.set_json(msg)\n else\n STDERR.puts \"It does not respond to listening\"\n end\n elsif type == :binary\n response.data << msg\n end\n end\n end\n\n ws.onclose do |code, reason|\n STDERR.puts \"Disconnected with status code: #{code}\"\n yield response\n stop\n end\n\n ws.onping do |msg|\n STDERR.puts \"Recevied ping: #{msg}\"\n end\n\n ws.onpong do |msg|\n STDERR.puts \"Received pong: #{msg}\"\n end\n\n ws.onerror do |e|\n STDERR.puts \"Error in websocket connection to IBM: #{e}\"\n STDERR.puts \"For url: #{connection_url}\"\n yield e\n stop\n end\n\n def stop\n EventMachine.stop_event_loop\n end\n end\n end", "def proxy\n uri = URI.parse(params[:url])\n open(uri.to_s) do |f|\n # TODO: instead of using f.read below, perhaps read it a bit at a time and\n # stream it a bit at a time. Look into response chunking for Rails.\n data = f.read\n # disposition: :inline means not an attachment -- render right to browser\n send_data data, type: f.content_type, disposition: :inline\n end\n end", "def show\n @event = Event.last\n\n if request.protocol.include?(\"https\")\n if running_rpi?\n broadcast_id_fn = `ls /home/pi/rails/tam4dummies/stream/create_broadcast/ | awk '{ print $NF }'`\n else\n broadcast_id_fn = `ls /Users/paulonegrao/codecore/railsdir/tam_for_dummies_app/stream/create_broadcast/ | awk '{ print $NF }'`\n end\n\n if broadcast_id_fn != \"\"\n fn_array = broadcast_id_fn.split(\"@@t4d@@\")\n stream_id = fn_array[0]\n broadcast_id = fn_array[1]\n stream_name = fn_array[2]\n stream = Stream.find stream_id\n stream.update_attributes(:broadcast_id => broadcast_id, :stream_name => stream_name)\n if running_rpi?\n `rm /home/pi/rails/tam4dummies/stream/create_broadcast/*`\n else\n `rm /Users/paulonegrao/codecore/railsdir/tam_for_dummies_app/stream/create_broadcast/*`\n end\n\n cookies[:broadcast_id] = broadcast_id\n end\n end\n\n respond_to do |format|\n format.js { render :show }\n end\n end", "def redirect path \n full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path\n res = Rack::Response.new\n res.redirect(full)\n res.finish\n\n #$Utter.map(full) do\n #\tputs \"Redirect: #{full}\"\n #\trun lambda { |env| [200, {\"Content-Type\" => \"application/json\"}, [$Utter.instance_exec(&block)]] }\n #end\n end", "def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend", "def stream(name, url)\n gateway_check\n update_status(@idletime, name, url)\n name\n end", "def proxy_receive_data data\n @proxystatus = :headers if !@proxystatus\n \n if @proxystatus == :headers\n # First gather the headers\n @proxybuffer += data\n if @proxybuffer =~ /\\r\\n\\r\\n/\n\n # Detected end of headers\n header_data = @proxybuffer[0...($~.begin(0))]\n @proxybuffer = @proxybuffer[($~.end(0))..-1]\n\n # Try the webrick parser\n headers = {}\n header_lines = header_data.split(/[\\r\\n]+/)\n status = header_lines[0]\n header_lines[1..-1].each do |line|\n h = line.split(/:\\s*/, 2)\n headers[h[0]] = h[1]\n end\n \n # The rest of the incoming connection \n @proxystatus = :stream\n end\n end\n \n if @proxystatus == :stream\n send_data header_lines[0] + \"\\r\\n\"\n send_data \"Content-Type: \" + headers['Content-Type'] + \"\\r\\n\"\n send_data \"Content-Length: \" + headers['Content-Length'] + \"\\r\\n\"\n send_data \"\\r\\n\"\n send_data @proxybuffer\n\n # Any further data is piped through \n EM::enable_proxy proxy_conn, self, 1024*10\n end\n end", "def on_upstream_message(payload)\n return unless handle_event? payload\n id, req, responses, event, nodes = self.extract(payload)\n info \"on_upstream_message: event = #{event.to_hash}\"\n intersection = self.nodeUrns & nodes\n info \"Node Intersection is #{intersection.to_yaml}\"\n hash = {type: :message, nodeUrn: intersection.to_a.first, timestamp: event.timestamp, payload: Base64.encode64(event.messageBytes)}\n hash[:requestId] = id if id\n info \"status hash: #{hash}\"\n\n self.inform_status(hash)\n end", "def on_open(env)\n req = ::Rack::Request.new(env)\n @cid = req.params['cid']\n @path = req.path\n @subscription = Firehose::Subscription.new(cid, path)\n\n subscription.subscribe do |message, subscription|\n Firehose.logger.debug \"WS sent `#{message}` to `#{cid}@#{path}`\"\n send_data message\n end\n Firehose.logger.debug \"WS subscribed to `#{cid}@#{path}`\"\n end", "def remote_keepalive(sender, body)\nend", "def perform\n logger.debug \"Preparing to start stream\"\n @stream_processor = nil\n type = request_method\n http = EventMachine::HttpRequest.new(full_url).send(type, http_options(type))\n authorization_method.add_header_to(http)\n # Handle failures correctly so we can back off\n @current_request = http\n http.errback { fail!(:network)}\n http.callback { http.response_header.status > 299 ? fail!(:http) : perform }\n http.stream { |c| receive_chunk(c) }\n end", "def stream_handler(broadcasting, user_handler, coder: T.unsafe(nil)); end", "def supports_streaming?; end", "def capture_request\n already_exist = false\n already_exist = true if Trap.find_by(name: params[:trap_name])\n @trap = Trap.find_or_create_by(name: params[:trap_name])\n header = Hash.new\n request.headers.each { |key, value| header[key] = value.to_s unless value.is_a?(Hash) }\n @req = create_request(@trap, request.remote_ip, request.method, request.scheme, request.query_string,\n request.query_parameters, request.cookies, header)\n\n respond_to do |format|\n if @trap\n WebsocketRails[:trap].trigger 'new', render_to_string(partial: 'traps/trap') unless already_exist\n WebsocketRails[:request].trigger 'new', render_to_string(partial: 'traps/request') if @req\n format.html { redirect_to traps_path, notice: 'Request was successfully captured.'}\n else\n format.html { redirect_to traps_path, notice: 'Request wasn\\'t captured.'}\n end\n end\n end", "def default_stream_handler(broadcasting, coder:); end", "def websocket port = nil\n host = @source[\"resource\"].first\n path = @source[\"resource\"][1..-1].join('/')\n if port.nil?\n connection_uri = \"ws://#{host}:#{@config.port.outbound}/#{path}\"\n else\n connection_uri = \"ws://#{host}:#{port}/#{path}\"\n end\n\n begin \n ws = EM::WebSocketClient.connect connection_uri\n ws.callback do \n ws.send_msg @source.to.json\n @config.logger.debug @source.to_s\n ws.close_connection_after_writing\n end\n rescue RuntimeError => e\n EM.run do\n ws = EM::WebSocketClient.connect connection_uri\n\n ws.callback do \n ws.send_msg @source.to.json\n @config.logger.debug @source.to_s\n ws.close_connection_after_writing\n end\n\n ws.disconnect do \n EM::stop_event_loop\n end\n end\n end\n end", "def stream(controller, parms=Hash.new)\n parms = {:dsid=>self.dsid, :pid=>self.pid, :finished=>false}.merge parms\n controller.headers['Last-Modified'] = self.lastModifiedDate || Time.now.ctime.to_s\n if self.dsSize\n controller.headers['Content-Length'] = self.dsSize.to_s\n else\n controller.headers['Transfer-Encoding'] = 'chunked'\n end\n #controller.response_body = ActiveFedora::Datastreams::Streamable::Streamer.new parms\n controller.response_body = Enumerator.new do |blk|\n repo = ActiveFedora::Base.connection_for_pid(parms[:pid])\n repo.datastream_dissemination(parms) do |res|\n res.read_body do |seg|\n puts \"writing #{seg.length} bytes\"\n blk << seg\n end\n end\n end\n end", "def start_url_redirect\n puts \">> start_url_redirect...\"\n # UrlVerifier.new.delay.vu_starter\n UrlVerifier.new.vu_starter\n end", "def call_tus_server(env)\n Tus::Server.call env.merge(\n \"rack.url_scheme\" => (env[\"options\"][:ssl] ? \"https\" : \"http\"), # https://github.com/postrank-labs/goliath/issues/210\n \"async.callback\" => nil, # prevent Roda from calling EventMachine when streaming\n )\n end", "def get_upstream_channels\r\n logger.debug \"Upstream1 Channels\"\r\n upstream_channels=UpstreamChannel.find(:all)\r\n logger.debug \"Upstream Channels2\"\r\n chlist=upstream_channels.collect {|ch| {:freq=>ch.freq, :bandwidth => ch.bandwidth, :name => ch.name}}\r\n logger.debug \"Upstream Channels3\"\r\n logger.debug upstream_channels.inspect()\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => chlist.to_x }\r\n format.amf { \r\n logger.debug \"Returning upstream_channels\"\r\n logger.debug \"Returning #{upstream_channels}\"\r\n render :amf => chlist\r\n }\r\n end\r\n end", "def online\n gateway_check\n update_status(:online, @activity, @streamurl)\n end", "def open(event)\n Firehose.logger.debug \"WebSocket subscribed to `#{@req.path}`. Waiting for message_sequence...\"\n end", "def forward_request(env)\n rewrite_request(env)\n options = http_request_options(env)\n url = @request[:host] + @request[:uri]\n\n result = Tom::Http.make_request(@request[:method], url, options)\n\n headers = {\"Downstream-Url\" => url}.merge result.response_header\n [result.response_header.status, headers, result.response]\n end", "def new\n # Because the module ActionController::Live contains methods that can block send file.\n # So can't simply include ActionController::Live in class, otherwise include this module only on this method.\n self.class.send(:include, ActionController::Live)\n\n response.headers[\"Content-Type\"] = Mime[Stream::TRANSCODE_FORMAT]\n\n send_stream(filename: \"#{@stream.name}.mp3\") do |stream_response|\n File.open(@stream.transcode_cache_file_path, \"w\") do |file|\n @stream.each do |data|\n stream_response.write data\n file.write data\n end\n end\n end\n end", "def streaming_endpoint\n encoded_url = URI.encode(\"#{SITE_URL}#{STREAM_URL}\".strip)\n URI.parse(encoded_url)\n end", "def execute_streaming(request, options: {}, &block)\n redirector = Puppet::HTTP::Redirector.new(options.fetch(:redirect_limit, @default_redirect_limit))\n\n basic_auth = options.fetch(:basic_auth, nil)\n unless basic_auth\n if request.uri.user && request.uri.password\n basic_auth = { user: request.uri.user, password: request.uri.password }\n end\n end\n\n redirects = 0\n retries = 0\n response = nil\n done = false\n\n while !done do\n connect(request.uri, options: options) do |http|\n apply_auth(request, basic_auth)\n\n # don't call return within the `request` block\n http.request(request) do |nethttp|\n response = Puppet::HTTP::ResponseNetHTTP.new(request.uri, nethttp)\n begin\n Puppet.debug(\"HTTP #{request.method.upcase} #{request.uri} returned #{response.code} #{response.reason}\")\n\n if redirector.redirect?(request, response)\n request = redirector.redirect_to(request, response, redirects)\n redirects += 1\n next\n elsif @retry_after_handler.retry_after?(request, response)\n interval = @retry_after_handler.retry_after_interval(request, response, retries)\n retries += 1\n if interval\n if http.started?\n Puppet.debug(\"Closing connection for #{Puppet::HTTP::Site.from_uri(request.uri)}\")\n http.finish\n end\n Puppet.warning(_(\"Sleeping for %{interval} seconds before retrying the request\") % { interval: interval })\n ::Kernel.sleep(interval)\n next\n end\n end\n\n if block_given?\n yield response\n else\n response.body\n end\n ensure\n # we need to make sure the response body is fully consumed before\n # the connection is put back in the pool, otherwise the response\n # for one request could leak into a future response.\n response.drain\n end\n\n done = true\n end\n end\n end\n\n response\n end", "def send_to_next(req)\n if !req.session['next'].nil?\n redirect req.session['next']\n else\n false\n end\n end", "def download_stream\n\n #Read the AIS data from C4. This gives the info required to get the flv via rtmpdump\n doc = download_ais(@mp4_program_id)\n\n #Parse it - the inspiration for this comes from http://code.google.com/p/nibor-xbmc-repo/ too.\n token = (doc/\"//token\").text\n epid = (doc/\"//e\").text\n cdn = (doc/\"//cdn\").text\n streamUri = (doc/\"//streamuri\").text\n decoded_token = decode_token(token)\n\n if cdn == 'll'\n file = streamUri.split(\"/e1/\")[1]\n out_file = file.split(\"/\")[1].gsub(\".mp4\",\".flv\")\n auth = \"e=#{epid}&h=#{decoded_token}\"\n\n rtmpUrl = \"rtmpe://ll.securestream.channel4.com/a4174/e1\"\n app = \"a4174/e1\"\n playpath = \"/#{file}?#{auth}\"\n\n else\n file = streamUri.split(\"/4oD/\")[1]\n fingerprint = (doc/\"//fingerprint\").text\n slist = (doc/\"//slist\").text\n auth = \"auth=#{decoded_token}&aifp=#{fingerprint}&slist=#{slist}\"\n\n rtmpUrl = streamUri.match('(.*?)mp4:')[1].gsub(\".com/\",\".com:1935/\")\n rtmpUrl += \"?ovpfv=1.1&\" + auth\n\n app = streamUri.match('.com/(.*?)mp4:')[1]\n app += \"?ovpfv=1.1&\" + auth\n\n playpath = streamUri.match('.*?(mp4:.*)')[1]\n playpath += \"?\" + auth\n\n end\n\n @log.debug \"rtmpUrl: #{rtmpUrl} app: #{app} playpath: #{playpath}\"\n\n #build rtmpdump command\n command = \"rtmpdump --rtmp \\\"#{rtmpUrl}\\\" \"\n command += \"--app \\\"#{app}\\\" \"\n command += \"--playpath \\\"#{playpath}\\\" \"\n command += \"-o \\\"#{@out_file}.flv\\\" \"\n command += '-C O:1 -C O:0 '\n command += '--flashVer \"WIN 10,3,183,7\" '\n command += '--swfVfy \"http://www.channel4.com/static/programmes/asset/flash/swf/4odplayer-11.35.swf\" '\n @log.debug command\n\n @log.info \"Downloading file for Program ID #{@mp4_program_id} - saving to #{@out_file}.flv\"\n success = system(command)\n\n if not success\n raise \"Something went wrong running rtmpdump :(. Your file may not have downloaded.\"\n end\n\n @log.info \"Download complete.\"\n\n end", "def send_twitch(event)\n Twitch::update_twitch_streams\n streams = Twitch::active_streams\n\n event << \"Currently active N related Twitch streams #{format_time}:\"\n if streams.map{ |k, v| v.size }.sum == 0\n event << \"None :shrug:\"\n else\n str = \"\"\n streams.each{ |game, list|\n if list.size > 0\n str += \"**#{game}**: #{list.size}\\n\"\n ss = list.take(20).map{ |stream| Twitch::format_stream(stream) }.join(\"\\n\")\n str += format_block(Twitch::table_header + \"\\n\" + ss)\n end\n }\n event << str if !str.empty?\n end\nrescue => e\n lex(e, \"Error getting current Twitch N++ streams.\", event: event)\nend", "def response(env)\n status, headers, body = finalize(env)\n\n env[STREAM_START].call(status, headers)\n\n operation = proc { body.each { |chunk| env.stream_send(chunk) } }\n callback = proc { env.stream_close }\n\n EM.defer(operation, callback) # use an outside thread pool for streaming\n\n nil\n end", "def start(controller = Stream::StreamController.instance)\n # make sure all the keys are set\n validate_keys\n\n options = update_config_options\n\n # create a new server\n @server = WEBrick::HTTPServer.new(Port: options[:port])\n\n # start singleton stream controller\n @controller = controller.start\n\n # mount the REST server on webrick\n @server.mount '/', Http::HttpEndpoint\n\n trap_signals\n\n logger.info(\"Server starting with PID #{Process.pid}\")\n\n @server.start\n end", "def before_stream\n end", "def online\n gateway_check\n update_status(nil, @game, @streamurl)\n end", "def run!(frequency = 0)\n while @jabber.connected?\n @jabber.received_messages do |message|\n start = Time.now\n \n from = message.from.to_s.split('/').first\n parts = message.body.strip.split(':', 2)\n hash = parts.first\n path_parts = parts.last.split('?', 2)\n request = Request.new(hash, from, path_parts.first, ((path_parts.length == 2) ? path_parts.last : ''))\n # TODO: DRY this portion up.\n if @debug\n # Allow errors to fall through and kill the process.\n controller_response = @controller.route!(request)\n response = {:status => 200, :data => ''}.merge(controller_response)\n respond_to request, :status => response[:status], :data => response[:data]\n puts \"Responded to '#{from}' in #{(Time.now - start).to_s} seconds.\"\n else\n # Capture the errors so that the server keeps on running.\n begin\n controller_response = @controller.route!(request)\n response = {:status => 200, :data => ''}.merge(controller_response)\n respond_to request, :status => response[:status], :data => response[:data]\n rescue\n respond_to request, :status => 500\n puts \"Error responding to #{message.from.to_s.strip}:\"\n puts $!\n else\n puts \"Responded to '#{from}' in #{(Time.now - start).to_s} seconds.\"\n end\n end\n #puts \"\\n\"\n end\n if frequency > 0\n # Keep it from hogging up CPU cycles.\n sleep frequency\n end\n end\n end", "def onmessage(&block)\n super( &proc do |msg|\n msg = JSON.parse(msg)\n Hammer.logger.debug \"Websocket recieved: #{msg}\" if config[:logger][:show_traffic]\n block.call msg\n end)\n end", "def sendfile_serving(env)\n header = @sendfile_header || env['sendfile.type'] || env['HTTP_X_SENDFILE_TYPE']\n unless(header)\n raise 'Failed to determine proper sendfile header value' unless @args[:sendfile_fail_gracefully]\n setup_remote\n do_redefines('remote')\n call(env)\n end\n prefix = (@args[:sendfile_prefix] || env['HTTP_X_ACCEL_REMOTE_MAPPING']).to_s.sub(/^\\//, '').sub(/\\/$/, '')\n [200, {\n \"Last-Modified\" => last_modified,\n \"Content-Type\" => content_type,\n \"Content-Length\" => size,\n \"Redirect-URL\" => @path,\n \"Redirect-Host\" => @path.scan(%r{^https?://([^/\\?]+)}).first.first,\n header => \"/#{prefix}\"\n },\n ['']]\n end", "def handle_close\n NewRelic::Agent.logger.debug('The gRPC Trace Observer closed the stream with OK response. ' \\\n 'Restarting the stream.')\n start_streaming\n end", "def stream_url\n\t\t\"http://www.google.com\"\n\tend", "def rails(port, num)\n pputs \"upstream #{port}_cluster {\"\n num.times {|i| pputs \" server 127.0.0.1:#{port+i};\"}\n pputs \"}\\n\"\n\n oputs <<-eos\n location / {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header Host $http_host;\n proxy_redirect off;\n\n if (-f $request_filename/index.html) {\n rewrite (.*) $1/index.html break;\n }\n\n if (-f $request_filename.html) {\n rewrite (.*) $1.html break;\n }\n\n if (!-f $request_filename) {\n proxy_pass http://#{port}_cluster;\n break;\n }\n }\n eos\nend", "def serve!\n if TinyProxy::Cache.has? request.uri\n serve_from_cache!\n else\n serve_from_remote!\n end\n end", "def stream_one_chunk\n loop do\n if @io.eof?\n @connection.send_data \"0\\r\\n\\r\\n\" if @http_chunks\n succeed\n break\n end\n\n if @connection.respond_to?(:get_outbound_data_size) && (@connection.get_outbound_data_size > FileStreamer::BackpressureLevel)\n EventMachine::next_tick { stream_one_chunk }\n break\n end\n\n if @io.read(CHUNK_SIZE, @buff)\n @connection.send_data(\"#{@buff.length.to_s(16)}\\r\\n\") if @http_chunks\n @connection.send_data(@buff)\n @connection.send_data(\"\\r\\n\") if @http_chunks\n end\n end\n end", "def do_CONNECT(req, res)\n proxy_auth(req, res)\n\n ua = Thread.current[:WEBrickSocket] # User-Agent\n raise WEBrick::HTTPStatus::InternalServerError, \"[BUG] cannot get socket\" unless ua\n\n # HERE is what I override: Instead to the target host; point the traffic\n # to the local ssl_server that acts as a man-in-the-middle.\n # host, port = req.unparsed_uri.split(\":\", 2)\n host = local_ssl_host\n port = local_ssl_port\n\n begin\n @logger.debug(\"CONNECT: upstream proxy is `#{host}:#{port}'.\")\n os = TCPSocket.new(host, port) # origin server\n @logger.debug(\"CONNECT #{host}:#{port}: succeeded\")\n res.status = WEBrick::HTTPStatus::RC_OK\n rescue => ex\n @logger.debug(\"CONNECT #{host}:#{port}: failed `#{ex.message}'\")\n res.set_error(ex)\n raise WEBrick::HTTPStatus::EOFError\n ensure\n if handler = @config[:ProxyContentHandler]\n handler.call(req, res)\n end\n res.send_response(ua)\n access_log(@config, req, res)\n\n # Should clear request-line not to send the response twice.\n # see: HTTPServer#run\n req.parse(WEBrick::NullReader) rescue nil\n end\n\n begin\n while fds = IO::select([ua, os])\n if fds[0].member?(ua)\n buf = ua.sysread(1024);\n @logger.debug(\"CONNECT: #{buf.bytesize} byte from User-Agent\")\n os.syswrite(buf)\n elsif fds[0].member?(os)\n buf = os.sysread(1024);\n @logger.debug(\"CONNECT: #{buf.bytesize} byte from #{host}:#{port}\")\n ua.syswrite(buf)\n end\n end\n rescue => ex\n os.close\n @logger.debug(\"CONNECT #{host}:#{port}: closed\")\n end\n\n raise WEBrick::HTTPStatus::EOFError\n end", "def start\n configure\n\n @on_startup.call if @on_startup\n\n if not @stream\n log \"not bothering with stream for #@username\"\n return\n end\n\n log \"starting stream for #@username\"\n @stream.on_error do |msg|\n log \"ERROR: #{msg}\"\n end\n\n @stream.on_inited do\n log \"Online!\"\n end\n\n @stream.on_event(:follow) do |event|\n next if event[:source][:screen_name] == @username\n log \"Followed by #{event[:source][:screen_name]}\"\n @on_follow.call(event[:source]) if @on_follow\n end\n\n @stream.on_direct_message do |dm|\n next if dm[:sender][:screen_name] == @username # Don't reply to self\n log \"DM from @#{dm[:sender][:screen_name]}: #{dm[:text]}\"\n @on_message.call(dm) if @on_message\n end\n\n @stream.userstream do |ev|\n next unless ev[:text] # If it's not a text-containing tweet, ignore it\n next if ev[:user][:screen_name] == @username # Ignore our own tweets\n\n meta = {}\n mentions = ev.attrs[:entities][:user_mentions].map { |x| x[:screen_name] }\n\n reply_mentions = mentions.reject { |m| m.downcase == @username.downcase }\n reply_mentions = [ev[:user][:screen_name]] + reply_mentions\n\n meta[:reply_prefix] = reply_mentions.uniq.map { |m| '@'+m }.join(' ') + ' '\n meta[:limit] = 140 - meta[:reply_prefix].length\n\n mless = ev[:text]\n begin\n ev.attrs[:entities][:user_mentions].reverse.each do |entity|\n last = mless[entity[:indices][1]..-1]||''\n mless = mless[0...entity[:indices][0]] + last.strip\n end\n rescue Exception\n p ev.attrs[:entities][:user_mentions]\n p ev[:text]\n raise\n end\n meta[:mentionless] = mless\n\n # To check if this is a mention, ensure:\n # - The tweet mentions list contains our username\n # - The tweet is not being retweeted by somebody else\n # - Or soft-retweeted by somebody else\n if mentions.map(&:downcase).include?(@username.downcase) && !ev[:retweeted_status] && !ev[:text].start_with?('RT ')\n log \"Mention from @#{ev[:user][:screen_name]}: #{ev[:text]}\"\n @on_mention.call(ev, meta) if @on_mention\n else\n @on_timeline.call(ev, meta) if @on_timeline\n end\n end\n end", "def events\n response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)\n room_id = params[:room_id]\n sse = Streamer::SSE.new(response.stream) # Opens server sent event stream\n redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread\n # --- Adds all the subscription events for each room --- \n redis.subscribe([\"add_message_#{room_id}\", \"remove_message_#{room_id}\", \"heart\"]) do |on|\n on.message do |event, data|\n if event == \"add_message_#{room_id}\" # For the add song subscription\n sse.write(data, event: \"add_message_#{room_id}\")\n elsif event == \"remove_message_#{room_id}\"\n sse.write(data, event: \"remove_message_#{room_id}\")\n end\n end\n end\n # --- end ---\n rescue IOError\n # Client disconnected\n redis.quit\n sse.close\n response.stream.close\n ensure\n # When not being used, threads close\n redis.quit\n sse.close\n response.stream.close\n end", "def propagate_session(env, status, headers, response)\n propagate_flag = env.delete(SESSION_PROPAGATE_KEY)\n location = headers[\"Location\"]\n if propagate_flag and location\n # we've been told to rewrite the location header and it is present\n uri = URI::parse(location)\n prefix = uri.query ? \"&\" : \"\"\n # append handshake param to query\n uri.query = [uri.query, prefix, SessionInjector.generate_handshake_parameter(Rack::Request.new(env), propagate_flag[0], propagate_flag[1])].join\n headers[\"Location\"] = uri.to_s\n end\n [ status, headers, response]\n end", "def on_simple_outbound\n nil\n end", "def forward\n end", "def shibboleth_passive_login_check\n unless user_signed_in? || session[:_check_passive_shibboleth]\n session[:_check_passive_shibboleth] = true\n # Set the redirect to a callback function that we'll handle\n # Double escape the eventual origin\n target_url = \"#{CGI::escape(\"#{passive_shibboleth_url}?origin=#{CGI::escape(request.url)}\")}\"\n redirect_to \"#{PASSIVE_SHIBBOLETH_URL_STRING}#{target_url}\"\n end\n end", "def stream(url)\n uri = URI.parse(url)\n Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|\n request_class = request.head? ? Net::HTTP::Head : Net::HTTP::Get\n\n outbound_request = request_class.new(uri.request_uri)\n PASS_THROUGH_REQUEST_HEADERS.each do |header|\n outbound_request[header] = request.headers[header]\n end\n\n http.request(outbound_request) do |outbound_response|\n response.status = outbound_response.code.presence&.to_i\n PASS_THROUGH_RESPONSE_HEADERS.each do |header|\n response.headers[header] = outbound_response[header] if outbound_response[header].present?\n end\n\n outbound_response.read_body { |chunk| response.stream.write chunk }\n end\n end\n ensure\n response.stream.close\n end", "def record_stream\n duration = (record_time * 60)\n Thread.new do \n system \"streamripper #{ENV['stream_url']} -A -l #{duration} -i -m 300 -a #{file_path}\"\n end\n\n self.update(:recording_file_name => file_path)\n end", "def ws_single(stream:, methods:)\n create_stream(\n \"#{base_url}/ws/#{stream_url(stream)}\",\n methods: methods,\n )\n end", "def share\n @event_portal = \"#{SiteConfig.hhd_event_portal}/wx/event/portal?\" + request.query_string\n #\n # request.headers['foo'] = 'bar'\n # url = request.original_url#\"#{SiteConfig.hhd_event_portal}/wx/event/portal?\" + request.original_url.split('?').last\n #\n # redirect_url = \"#{SiteConfig.wx_auth_redirect_uri}?url=#{url}\"#\"#{wechat_auth_redirect_url}?url=#{request.original_url}\"\n #\n # @wechat_auth_url = \"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{SiteConfig.wx_app_id}&redirect_uri=#{Rack::Utils.escape(redirect_url)}&response_type=code&scope=snsapi_userinfo&state=yujian#wechat_redirect\"\n # redirect_to @event_portal\n end" ]
[ "0.58280367", "0.57718873", "0.5579982", "0.5522775", "0.53750527", "0.536677", "0.5360725", "0.53053564", "0.52383673", "0.52051324", "0.52019185", "0.51858497", "0.5163819", "0.51257485", "0.5105848", "0.5105848", "0.5103562", "0.5079626", "0.50751495", "0.5059812", "0.5007642", "0.5003895", "0.4996434", "0.4985082", "0.49681863", "0.4966369", "0.4959818", "0.49564046", "0.495395", "0.49490926", "0.49476832", "0.49339673", "0.49286774", "0.49254578", "0.49232846", "0.4922007", "0.49213484", "0.4914487", "0.49088928", "0.48883215", "0.4884259", "0.48731095", "0.48708716", "0.4869127", "0.4867494", "0.48631993", "0.48548996", "0.48442873", "0.48282576", "0.4827805", "0.48241827", "0.48230925", "0.48051786", "0.4796109", "0.47904575", "0.47896203", "0.47848085", "0.47760016", "0.4772379", "0.47703573", "0.4763938", "0.47457868", "0.4745652", "0.47372532", "0.4735125", "0.4729392", "0.4728266", "0.4722961", "0.4719094", "0.47126642", "0.47062248", "0.47055355", "0.4704901", "0.4696805", "0.46963972", "0.4694779", "0.46940944", "0.46921593", "0.4690873", "0.46766406", "0.46765122", "0.46720427", "0.46634093", "0.46628672", "0.46577814", "0.46441457", "0.46418568", "0.46362546", "0.46306488", "0.46269125", "0.46243507", "0.46234083", "0.4606712", "0.46015894", "0.45961726", "0.45815796", "0.45749795", "0.4568891", "0.4564231", "0.45615652" ]
0.6716026
0
Called by NGINX. Sends streamdown over websockets to users watching stream
def stop if params[:name] streaming_user = User.where('stream_key = ?', params[:name]).first if streaming_user async_confirm_and_set_stream_state(streaming_user) render status: :ok else render status: :not_found end else render status: :not_found end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @quacks = Quack.all\n # SSE expects the `text/event-stream` content type\n response.headers['Content-Type'] = 'text/event-stream'\n\n sse = Reloader::SSE.new(response.stream)\n begin\n loop do\n sse.write({ :time => Time.now })\n sleep 1\n end\n rescue IOError\n # When the client disconnects, we'll get an IOError on write\n ensure\n sse.close\n end\n end", "def run\n websocket.run\n end", "def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end", "def cycle\n @initialized = true\n @socket = UDPSocket.new\n @socket.bind(@listen_address, @listen_port)\n \n initial_counters = {}\n \n if @counters_list_file && File.exist?(@counters_list_file)\n counter_keys = IO.read(@counters_list_file).split(\"\\n\")\n counter_keys.each do |key|\n initial_counters[key] = 0\n end\n end\n \n # block will be called when a request comes from the core\n # if exit is received the method will return\n network_loop(pipe, @socket, initial_counters) do |msg, counters, gauges|\n data = {}\n \n values = gauges\n \n counters.each do |k, v|\n values[k] = v / interval_in_seconds()\n end\n \n unless values.empty?\n if @host\n data['host'] = @host\n end\n \n data[@app] = {}\n data[@app][@res] = values\n end\n \n send_metrics(data)\n end\n \n end", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def websocket; end", "def websocket; end", "def subscribed\n super\n increase_current_users\n stream_from channel\n end", "def index\n last_event_id = 0\n key = params[:key]\n response.headers['Content-Type'] = 'text/event-stream'\n puts \"subscribing to #{key}\"\n begin\n sse = SSE.new(response.stream)\n ticker = Thread.new do\n sse.write 0, event: 'ack'\n sleep 5\n end\n\n r = Redis.new\n streamer = Thread.new do\n r.subscribe(key) do |on|\n on.message do |channel, message|\n response.stream.write(message)\n end\n end\n end\n\n ticker.join\n streamer.join\n rescue IOError\n puts \"ioerror:: #{$!}\"\n ensure\n Thread.kill(ticker) if ticker\n Thread.kill(streamer) if streamer\n sse.close\n r.quite\n end\n end", "def onmessage(&block)\n super( &proc do |msg|\n msg = JSON.parse(msg)\n Hammer.logger.debug \"Websocket recieved: #{msg}\" if config[:logger][:show_traffic]\n block.call msg\n end)\n end", "def call(env)\n # trace __FILE__, __LINE__, self, __method__, \"env=#{env}\"\n protocols = nil\n options = { ping: 5 } # keep socket alive : Chrome seems to time out in about 10?\n socket = Faye::WebSocket.new(env, protocols, options)\n connect!(socket)\n # trace __FILE__, __LINE__, self, __method__\n socket.rack_response\n end", "def push_to_web_sockets\n if created_at_changed?\n ActionCable.server.broadcast(\"posts\", \n data: json_view\n )\n end\n end", "def websocket_update\n json = self.to_jsonapi\n watching_users.each do |user|\n UpdatesChannel.broadcast_to(user, {loadModels: [json]})\n end\n end", "def run!(frequency = 0)\n while @jabber.connected?\n @jabber.received_messages do |message|\n start = Time.now\n \n from = message.from.to_s.split('/').first\n parts = message.body.strip.split(':', 2)\n hash = parts.first\n path_parts = parts.last.split('?', 2)\n request = Request.new(hash, from, path_parts.first, ((path_parts.length == 2) ? path_parts.last : ''))\n # TODO: DRY this portion up.\n if @debug\n # Allow errors to fall through and kill the process.\n controller_response = @controller.route!(request)\n response = {:status => 200, :data => ''}.merge(controller_response)\n respond_to request, :status => response[:status], :data => response[:data]\n puts \"Responded to '#{from}' in #{(Time.now - start).to_s} seconds.\"\n else\n # Capture the errors so that the server keeps on running.\n begin\n controller_response = @controller.route!(request)\n response = {:status => 200, :data => ''}.merge(controller_response)\n respond_to request, :status => response[:status], :data => response[:data]\n rescue\n respond_to request, :status => 500\n puts \"Error responding to #{message.from.to_s.strip}:\"\n puts $!\n else\n puts \"Responded to '#{from}' in #{(Time.now - start).to_s} seconds.\"\n end\n end\n #puts \"\\n\"\n end\n if frequency > 0\n # Keep it from hogging up CPU cycles.\n sleep frequency\n end\n end\n end", "def make_websocket\n require 'em-websocket'\n require 'sanitize'\n\nsoc = []\n\n\n\nEM::WebSocket.start(host: '10.20.4.130' , port: 4000) do |ws|\n\n ws.onopen{soc << ws;puts \"#{soc.length} clients present\";}\n ws.onmessage { |msg| ; soc.each do |s| \n msg = Sanitize.clean(msg.html_safe , :elements => %w(font) , :attributes => {'font' => ['color']})\n\t\t\t\ts.send(\"#{msg}\")\n\t\t\t\tend ; $redis.LPUSH 'msg', \"#{msg}\" }\n ws.onclose {puts \"Someone dissconected \" ; soc.delete(ws)}\n end\n end", "def receive(websocket_message); end", "def start\n @redis = Redis.new(:host => \"#{Settings.redis.host}\", :port => Settings.redis.port)\n\n \n Thread.new do\n EventMachine.run do\n \tputs '='*80, \"Starting websockets server at ws://#{Settings.websocket.host}:#{Settings.websocket.port}\", '='*80\n \n EventMachine::WebSocket.start(:host => \"#{Settings.websocket.host}\", :port => Settings.websocket.port) do |ws|\n ws.onopen do\n \n puts \"#{Time.now.strftime('%H:%M:%S')} : Client connected\", '-'*80\n SOCKETS << ws\n end\n\n ws.onclose do\n \n puts \"#{Time.now.strftime('%H:%M:%S')} : Client disconnected\", '-'*80\n SOCKETS.delete ws\n end\n end\n end\n end\n\n \n Thread.new do\n @redis.subscribe('ws') do |on|\n \n on.message do |chan, msg|\n \n puts \"#{msg}\"\n SOCKETS.each {|s| s.send msg} \n \n end\n end\n end\n\n sleep\n \n end", "def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend", "def listen\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n run(route, args)\n end\n end\n \n loop do\n sleep 1\n end\n end\n end", "def events\n response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)\n room_id = params[:room_id]\n sse = Streamer::SSE.new(response.stream) # Opens server sent event stream\n redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread\n # --- Adds all the subscription events for each room --- \n redis.subscribe([\"add_song_#{room_id}\", \"add_user_#{room_id}\", \"change_song_#{room_id}\", \"remove_user_#{room_id}\", \"like_or_dislike_#{room_id}\", \"add_message_#{room_id}\", \"heart\"]) do |on|\n on.message do |event, data|\n \tif event == \"add_song_#{room_id}\" # For the add song subscription\n \t\tsse.write(data, event: \"add_song_#{room_id}\")\n \telsif event == \"add_user_#{room_id}\" # For the add user subscription\n \tsse.write(data, event: \"add_user_#{room_id}\")\n elsif event == \"change_song_#{room_id}\" # For the change song subscription\n \tsse.write(data, event: \"change_song_#{room_id}\")\n elsif event == \"remove_user_#{room_id}\" # For the remove user subscription\n \tsse.write(data, event: \"remove_user_#{room_id}\")\n elsif event == \"like_or_dislike_#{room_id}\" # For the like/dislike subscription\n \tsse.write(data, event: \"like_or_dislike_#{room_id}\")\n elsif event == \"add_message_#{room_id}\" # For the add message subscription\n \tsse.write(data, event: \"add_message_#{room_id}\")\n elsif event == \"heart\" # For the heartbeat subscription\n \tsse.write(data, event: \"heart\")\n \tend\n end\n end\n # --- end ---\n rescue IOError\n # Client disconnected\n redis.quit\n sse.close\n response.stream.close\n ensure\n \t# When not being used, threads close\n redis.quit\n sse.close\n response.stream.close\n end", "def polling\n while true do\n publish\n end\n end", "def on_open(env)\n req = ::Rack::Request.new(env)\n @cid = req.params['cid']\n @path = req.path\n @subscription = Firehose::Subscription.new(cid, path)\n\n subscription.subscribe do |message, subscription|\n Firehose.logger.debug \"WS sent `#{message}` to `#{cid}@#{path}`\"\n send_data message\n end\n Firehose.logger.debug \"WS subscribed to `#{cid}@#{path}`\"\n end", "def unsubscribed\n stop_all_streams\n end", "def notification\n request.websocket do |ws|\n ws.onopen do\n settings.sockets << ws\n end\n notifications\n ws.onclose do\n settings.sockets.delete(ws)\n end\n end\n end", "def remote_keepalive(sender, body)\nend", "def run\n AMQP.start(:host => \"localhost\"){\n\n @update_channel = EM::Channel.new\n\n url = \"#{DB_URI}/rooms/_changes?feed=continuous&since=#{@seq}&heartbeat=500\"\n http = EM::HttpRequest.new(url).get\n http.stream{|chunk|\n msg = JSON.parse chunk rescue nil\n update msg if msg\n }\n http.callback{ DaemonKit.logger.debug \"CouchDB connection closed\" }\n\n MQ.queue(WEBSOCKET_QUEUE).subscribe{|json|\n #begin\n msg = JSON.parse(json)\n DaemonKit.logger.debug(\"Websocket:MQ: \" + msg.inspect)\n @deferred_responses[msg[\"id\"]].succeed(msg)\n #rescue\n # DaemonKit.logger.debug \"Got error: #{$!}\" \n #end\n }\n \n EM::WebSocket.start({\n :host => \"0.0.0.0\",\n :port => WEBSOCKET_PORT,\n :secure_proxy => true\n }) do |ws|\n ws.onopen { onopen ws }\n\n ws.onmessage {|json| onmessage ws, json}\n\n ws.onclose {\n DaemonKit.logger.debug(\"Connection on #{ws.signature} closed\")\n }\n end\n }\n end", "def send_keepalive\n# rt_debug \"* sending keepalive!\"\n queue_message(:keepalive)\n end", "def stream!\n before_run\n\n #\n # figure out how we want to call streaming client\n #\n if @handlers[:search]\n method = :filter\n args = streamify_search_options(@handlers[:search].opts)\n else\n method = :user\n args = {\n stall_warnings: \"true\"\n }\n end\n\n streaming_client.send(method, args) do |object|\n handle_streaming_object(object)\n end\n after_run\n end", "def stop_polling!; end", "def stream(event)\nexp = [\"#bonjour_monde\"]\n client.event(track: exp.join(\",\")) do |object|\n stream(var_like, var_follow)\n end\nend", "def run\n if not @receive then\n sendUDPStream\n else\n receiveUDPStream\n end\n end", "def open(event)\n Firehose.logger.debug \"WebSocket subscribed to `#{@req.path}`. Waiting for message_sequence...\"\n end", "def send_drop_stream\n unless self.is_being_seeded || Rails.env.development? || Rails.env.test?\n params = {\n 'app' => 'stream',\n 'name' => stream_key_was\n }\n x = Net::HTTP.post_form(\n URI.parse(\n Rails.configuration.x.saber.stream_rtmp_control_url\n ),\n params\n )\n end\n end", "def start\n\n logger.info('Starting the WebSocket Client...')\n\n EventMachine.run do\n\n puts '='*80, \"Connecting to websockets server at ws://#{Settings.websocket.host}:#{Settings.websocket.port}\", '='*80\n\n http = EventMachine::HttpRequest.new(\"ws://#{Settings.websocket.host}:#{Settings.websocket.port}/websocket\").get :timeout => 0\n\n http.errback do\n logger.error \"something was wrong in the websocket_client\"\n end\n\n http.callback do\n puts \"#{Time.now.strftime('%H:%M:%S')} : Connected to server\"\n end\n\n http.stream do |msg|\n puts msg\n end\n\n end\n \n end", "def bot_watch(event, url, css)\n event.respond 'okay! i will watch it..'\n @url = url\n @css = css\n @id = event.message.author.id\n\n quit_thread(event) unless @thread.nil?\n make_watcher(event)\n end", "def listen\r\n end", "def test1 #fails\n\n EventMachine::WebSocket.start(:host => \"0.0.0.0\", :port => 8567) do |ws|\n ws.onopen do\n puts \"WebSocket opened\"\n conn = Bunny.new\n conn.start\n#ch = conn.default_channel\n q = $ch.queue(\"tweets\")\n q.subscribe(:block => true) do |delivery_info, properties, body|\n puts \"Received tweet\\n\"\n ws.send \"test\"\n end\n end\n ws.onclose do\n ws.close(code = nil, body = nil)\n puts \"WebSocket closed\"\n# exit\n end\n end\nend", "def stats(&blk)\n if block_given?\n websocket.subscribe :stats, &blk\n else\n http.get :stats\n end\n end", "def play socket\n end", "def listen!\n EM.run do\n EM.add_periodic_timer(1) do\n if url = get_new_url\n puts \"[#{name}] Reading #{url}\"\n #check for maximum fork number here\n if pid = fork\n Process.detach pid\n else\n Worker.new url\n end\n end\n end\n end\n end", "def send(hash)\n Hammer.logger.debug \"Websocket sending: #{hash}\" if config[:logger][:show_traffic]\n super hash.to_json\n end", "def initialize(url, cookies, logs: false, &handler)\n @super_logger = Logger.new(logs ? 'ws_super_logger.log' : '/dev/null')\n\n @uri = URI.parse(url)\n @url = \"ws#{@uri.scheme.split(\"\")[4]}://#{@uri.host}\"\n\n if @uri.scheme.split(\"\")[4] == 's'\n @socket = TCPSocket.new(@uri.host, 443)\n @super_logger.info \"Opened TCP socket for (port 443) #{@uri} (#{@socket})\"\n @socket = OpenSSL::SSL::SSLSocket.new(@socket)\n @socket.connect\n @super_logger.info \"Upgrade TCP socket to SSL socket socket for #{@uri} (#{@socket})\"\n else\n @socket = TCPSocket.new(@uri.host, 80)\n @super_logger.info \"Opened TCP socket for (port 80) #{@uri} (#{@socket})\"\n end\n\n @handler = handler\n @logger = Logger.new(logs ? \"realtime.log\" : '/dev/null')\n @restart = true\n @super_logger.info \"Set @restart to #{@restart}\"\n\n @driver = WebSocket::Driver.client(self)\n @driver.add_extension PermessageDeflate\n @driver.set_header \"Cookies\", cookies if cookies\n @driver.set_header \"Origin\", \"#{@uri.scheme}://#{@uri.host.split('.')[-2..-1].join('.')}\"\n\n @driver.on :connect, ->(_e) {}\n\n @driver.on :open, ->(_e) do\n send \"155-questions-active\"\n @super_logger.info \"Socket open. Subscribed to 155-questions-active\"\n @logger.info \"WebSocket is open!\"\n end\n\n @driver.on :message do |e|\n @logger.info(\"Read: #{e.data}\")\n data = JSON.parse(e.data)\n if data[\"action\"] == \"hb\"\n send \"hb\"\n else\n @handler.call(data)\n end\n end\n\n @driver.on :close, ->(_e) do\n @logger.info \"Realtime WebSocket is closing.\"\n @super_logger.info \"Socket was closed. @restart == #{@restart}\"\n if @restart\n @logger.info \"Attempting to reopen websocket...\"\n @super_logger.info \"Attempting to reopen socket\"\n @driver.start\n end\n end\n\n @driver.on :error, ->(e) { @logger.error e }\n\n @driver.start\n\n @dead = false\n @thread = Thread.new do\n trap(\"SIGINT\") do\n @restart = false\n @dead = true\n @super_logger.info \"Got SIGINT. Dying.\"\n close\n Thread.exit\n end\n begin\n @driver.parse(@socket.is_a?(TCPSocket) ? @socket.recv(1) : @socket.sysread(1)) until @dead\n rescue IOError, SystemCallError => e\n @super_logger.warn \"Got some kind of interrupt in the thread. Panic.\"\n @logger.warn \"Recieved #{e} closing TCP socket. You shouldn't be worried :)\"\n end\n @super_logger.warn \"Left TCPSocket.recv loop. If you're reading this, panic.\"\n end\n\n at_exit { @thread.join }\n end", "def perform(data)\n User.find(data[\"user_id\"]).update(status: false, online: false)\n ActionCable.server.broadcast 'chat_channel', content: \"qwertyuiop\"\n end", "def stream_request\n puts \"==================================\\n\\n\"\n puts \"Start Grabing Info from the Stream\"\n \n @request_url = 'http://stream.twitter.com/1/statuses/filter.json'\n \n #(Note) the more values in the track= the less things actually show up\n \n http = EventMachine::HttpRequest.new(@request_url).post :head => {'Authorization'=> [$user[:username],$user[:password]],'Content-Type'=>\"application/x-www-form-urlencoded\"}, :body => \"track=Editions,webaim,joystiq,myAOL\"\n #puts http.inspect\n buffer = \"\"\n \n # Grab initial headers\n http.headers {\n #pp http.response_header.status\n if http.response_header.status.to_i == 401\n raise \"Error. Authentication Required. Please add your username and password to the command line. eg. ruby server.rb twitter_username twitter_password\"\n end\n }\n \n # Grab stream as it becomes available\n http.stream do |chunk|\n buffer += chunk\n while line = buffer.slice!(/.+\\r?\\n/)\n Parser.new(line) unless line.bytesize < 10\n end\n \n end\n \n # Stream is now complete, issue reconnection\n http.callback {\n # pp http.response_header.status\n # pp http.response\n \n puts \"connection closed by Twitter. Reconnect\"\n \n if http.response_header.status == 420\n @wait_time += 60\n $new_messages.call(\"Easy there, Turbo. Too many requests recently. Enhance your calm. (Have to wait #{@wait_time.to_s})\")\n elsif http.response_header.status == 200\n @wait_time = 10\n else\n @wait_time = WAIT_TIME_DEAFULT\n end\n \n puts \"Next run in #{@wait_time.to_s}\"\n EventMachine::Timer.new(@wait_time) do\n stream_request\n end\n \n }\n \n # Error connecting, try again\n http.errback {\n puts \"error on that one. try again\"\n #$new_messages.call(\"Error on HTTP Stream. Reconnecting\")\n EventMachine::Timer.new(@wait_time) do\n stream_request\n end\n }\n \nend", "def receive_data(data)\n @buffer.extract(data).each do |line|\n payload = { :uuid => @uuid, \n :message => line,\n :host => @host,\n :user => @user }\n @global_history_fanout.publish(payload.to_json)\n end\n end", "def to_sse\n response = Thin::AsyncResponse.new(request.env, 200, 'Content-Type' => 'text/event-stream')\n response.send_headers\n\n output_stream = ActionController::Live::SSE.new(response, retry: 300, event: 'row')\n db_handler = DbHandler.new(output_stream)\n\n rethink_handle = rethink_query.em_run(NoBrainer.connection.raw, db_handler)\n\n pinger = EventMachine::PeriodicTimer.new(PING_INTERVAL) do\n output_stream.write('PING', event: 'ping')\n end\n\n response.callback do # aka client disconnected\n pinger.cancel\n rethink_handle.close\n end\n\n head -1 # aka throw :async\n end", "def run\n AMQP.start(:host => \"localhost\") {\n @mq = MQ.new\n @update_channel = EM::Channel.new\n @deferred_responses = {}\n\n @queue_name = \"cmdr:websocket:#{self.object_id}\"\n @queue = @mq.queue(@queue_name)\n \n # watch for responses from devices\n @queue.subscribe{|json|\n msg = JSON.parse(json)\n puts \"Got response: #{msg}\"\n if @deferred_responses[msg[\"id\"]]\n @deferred_responses.delete(msg[\"id\"]).succeed(msg)\n end\n }\n\n topic = @mq.topic(EVENT_TOPIC)\n @mq.queue(\"cmdr:websocket:#{self.object_id}:response\").bind(topic, :key => \"device.*\").subscribe do |json|\n handle_event json\n end\n\n setup\n\n EM::WebSocket.start({\n :host => \"0.0.0.0\",\n :port => 8000,\n :debug => false\n #:secure => true \n }) do |ws|\n\n ws.onopen { onopen ws }\n \n ws.onmessage {|json| onmessage ws, json}\n \n ws.onclose do\n @update_channel.unsubscribe(@sid) if @sid\n DaemonKit.logger.debug \"Connection on #{ws.signature} closed\"\n end\n\n ws.onerror do\n DaemonKit.logger.debug \"Error on #{ws.signature}\"\n end\n end\n }\n end", "def events\n response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)\n room_id = params[:room_id]\n sse = Streamer::SSE.new(response.stream) # Opens server sent event stream\n redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread\n # --- Adds all the subscription events for each room --- \n redis.subscribe([\"add_message_#{room_id}\", \"remove_message_#{room_id}\", \"heart\"]) do |on|\n on.message do |event, data|\n if event == \"add_message_#{room_id}\" # For the add song subscription\n sse.write(data, event: \"add_message_#{room_id}\")\n elsif event == \"remove_message_#{room_id}\"\n sse.write(data, event: \"remove_message_#{room_id}\")\n end\n end\n end\n # --- end ---\n rescue IOError\n # Client disconnected\n redis.quit\n sse.close\n response.stream.close\n ensure\n # When not being used, threads close\n redis.quit\n sse.close\n response.stream.close\n end", "def log_connect(stream_obj)\n puts \"STREAM: connect for #{stream_obj.request_path} from #{request.ip}\" if VERBOSE\n # REDIS.PUBLISH 'stream.admin.connect', stream_obj.to_json\nend", "def monitor_redis\n # redis.dup.subscribe(REDIS_CHANNEL) do |on|\n redis.subscribe(REDIS_CHANNEL) do |on|\n on.message do |_, message|\n l = REDIS_HEAD_FIELD_LENGTH\n channel = message[0, l].strip\n client_id = message[l, l].strip\n json = message[(l * 2)..-1]\n send_json_message(client_id: client_id, channel: channel, json: json)\n end\n end\n end", "def send_stream_state(state, streaming_user)\n WebSocket::Client::Simple.connect(\n Rails.configuration.x.saber.chat_server,\n headers: { \"streamstate-auth\": Rails.application.credentials.stream_state_auth }\n ) do |ws|\n ws.on :open do\n ws.send({\n type: \"StreamState\",\n data: {\n state: state,\n username: streaming_user.username.downcase\n }\n }.to_json)\n ws.close\n end\n end\n end", "def run_event_machine\n EventMachine.run do\n # ws = Current Web Socket.\n EventMachine::WebSocket.start(:host => '0.0.0.0', :port => port) do |ws|\n \n ws.onopen do\n prepare(ws)\n onopen\n end\n\n ws.onmessage do |mes|\n prepare(ws)\n onmessage mes\n end\n \n ws.onclose do\n prepare(ws)\n onclose\n end\n end\n end\n \n end", "def stream(socket); end", "def realtime_sender() \n loop {\n @sender_plugin.send_data(@data.pop)\n }\n end", "def sendStreaming(devInfo, devState)\r\n msg = {\r\n :type => \"streaming\", \r\n :version => devInfo.swVersion,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\", \r\n :value => devState.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\", \r\n :value => devState.humidity, \r\n :time => Time.now.to_i\r\n }\r\n ] \r\n }\r\n sendMsg(msg)\r\n end", "def run()\n # let's install signal handlers\n Signal.trap(\"INT\") { EventMachine.stop }\n Signal.trap(\"TERM\") { EventMachine.stop }\n # let's generate config file for statsd router\n File.open(SR_CONFIG_FILE, \"w\") do |f|\n f.puts(\"log_level=1\")\n f.puts(\"data_port=#{SR_DATA_PORT}\")\n f.puts(\"control_port=#{SR_CONTROL_PORT}\")\n f.puts(\"downstream_health_check_interval=#{SR_DS_HEALTH_CHECK_INTERVAL}\")\n f.puts(\"downstream_flush_interval=#{SR_DS_FLUSH_INTERVAL}\")\n f.puts(\"downstream_ping_interval=#{SR_DS_PING_INTERVAL}\")\n f.puts(\"ping_prefix=#{SR_PING_PREFIX}\")\n f.puts(\"threads_num=#{THREADS_NUM}\")\n f.puts(\"downstream=#{(0...DOWNSTREAM_NUM).to_a.map {|x| BASE_DS_PORT + 2 * x}.map {|x| \"127.0.0.1:#{x}:#{x + 1}\"}.join(',')}\")\n end\n @downstream = []\n # socket for sending data\n @data_socket = UDPSocket.new\n # here we start event machine\n EventMachine::run do\n # let's init downstreams\n (0...DOWNSTREAM_NUM).each do |i|\n sm = StatsdMock.new(BASE_DS_PORT + 2 * i, BASE_DS_PORT + 2 * i + 1, i, self)\n @downstream << sm\n end\n # start statsd router\n EventMachine.popen(\"#{SR_EXE_FILE} #{SR_CONFIG_FILE}\", OutputHandler, self)\n sleep 1\n # and set timer to interrupt test in case of timeout\n EventMachine.add_timer(@timeout) do\n abort(\"Timeout\")\n end\n advance_test_sequence()\n end\n end", "def start_watchdog!\n while true\n sleep 10\n @stream_parser.begin_read unless @stream_parser.alive?\n end\n end", "def ping(&blk)\n if block_given?\n websocket.subscribe :ping, &blk\n else\n http.get :ping\n end\n end", "def on_upstream_message(payload)\n return unless handle_event? payload\n id, req, responses, event, nodes = self.extract(payload)\n info \"on_upstream_message: event = #{event.to_hash}\"\n intersection = self.nodeUrns & nodes\n info \"Node Intersection is #{intersection.to_yaml}\"\n hash = {type: :message, nodeUrn: intersection.to_a.first, timestamp: event.timestamp, payload: Base64.encode64(event.messageBytes)}\n hash[:requestId] = id if id\n info \"status hash: #{hash}\"\n\n self.inform_status(hash)\n end", "def start\n if params[:name]\n streaming_user = User.where('stream_key = ?', params[:name]).first\n if streaming_user\n async_confirm_and_set_stream_state(streaming_user)\n # Sending a redirect causes NGINX rtmp module to redirect the stream\n # to the restricted hlsout application. This also effectively translates\n # the users stream key to their username for client-side use.\n redirect_to \"rtmp://127.0.0.1/hlsout/\" + streaming_user.username.downcase\n else\n render status: :not_found\n end\n else\n render status: :not_found\n end\n end", "def process_messages\n # Check status for all streams, reopen as necessary\n @streams.each { |_, stream| try { stream.keep_alive } }\n\n # Actual processing of incoming messages happens in event callbacks\n # Oбрабатываем пришедшее сообщение в интерфейсах обратного вызова\n @conn.ProcessMessage2(100)\n end", "def stream_one_chunk\n loop do\n if @io.eof?\n @connection.send_data \"0\\r\\n\\r\\n\" if @http_chunks\n succeed\n break\n end\n\n if @connection.respond_to?(:get_outbound_data_size) && (@connection.get_outbound_data_size > FileStreamer::BackpressureLevel)\n EventMachine::next_tick { stream_one_chunk }\n break\n end\n\n if @io.read(CHUNK_SIZE, @buff)\n @connection.send_data(\"#{@buff.length.to_s(16)}\\r\\n\") if @http_chunks\n @connection.send_data(@buff)\n @connection.send_data(\"\\r\\n\") if @http_chunks\n end\n end\n end", "def run\n Lita.logger.debug 'Slack::run started'\n sleep\n rescue Interrupt\n Lita.logger.info 'Slack::shutting down'\n end", "def pre_process_with_websocket\n @request.env['async.connection'] = self\n pre_process_without_websocket\n end", "def stream\n #kills all tweet streaming processes\n #system \"pkill -f stream_tweets\"\n\n #invokes rake task for streaming tweets for 2 different brands\n system \"rake stream_tweets BRAND1=#{@battle.brand1} BRAND2=#{@battle.brand2} BATTLE_ID=#{@battle.id} &\"\n end", "def websocket port = nil\n host = @source[\"resource\"].first\n path = @source[\"resource\"][1..-1].join('/')\n if port.nil?\n connection_uri = \"ws://#{host}:#{@config.port.outbound}/#{path}\"\n else\n connection_uri = \"ws://#{host}:#{port}/#{path}\"\n end\n\n begin \n ws = EM::WebSocketClient.connect connection_uri\n ws.callback do \n ws.send_msg @source.to.json\n @config.logger.debug @source.to_s\n ws.close_connection_after_writing\n end\n rescue RuntimeError => e\n EM.run do\n ws = EM::WebSocketClient.connect connection_uri\n\n ws.callback do \n ws.send_msg @source.to.json\n @config.logger.debug @source.to_s\n ws.close_connection_after_writing\n end\n\n ws.disconnect do \n EM::stop_event_loop\n end\n end\n end\n end", "def start\n $0 = \"vines: #{@id}\"\n\n @connection.connect\n @publisher.broadcast(:online)\n @subscriber.subscribe\n\n EM.add_periodic_timer(1) { heartbeat }\n\n at_exit do\n @publisher.broadcast(:offline)\n @sessions.delete_all(@id)\n end\n end", "def listen\n connect do\n routes.each do |queue|\n @client.subscribe(queue) do |args|\n run(queue, args)\n end\n end\n end\n while (!Thread.current[:shutdown]) do\n sleep(self.class.sleep_time)\n end\n end", "def on_message(data)\n op, stat, value, *tags = data.split(' ')\n if stat && value && (op == 'count' || op == 'gauge' || op == 'timing')\n dogstatsd.public_send(op, stat, value.to_i, tags: tags)\n write '1'\n end\n rescue => e\n puts e.message\n end", "def message(event)\n msg = JSON.parse(event.data, :symbolize_names => true) rescue {}\n seq = msg[:message_sequence]\n if msg[:ping] == 'PING'\n Firehose.logger.debug \"WS ping received, sending pong\"\n @ws.send JSON.generate :pong => 'PONG'\n elsif !@subscribed && seq.kind_of?(Integer)\n Firehose.logger.debug \"Subscribing at message_sequence #{seq}\"\n subscribe seq\n end\n end", "def on_open\n if(Iodine::VERSION >= \"0.5.0\")\n subscribe :shootout, as: :binary\n else\n subscribe channel: :shootout\n end\n end", "def on_message data\n\t\t# broadcast sends an asynchronous message to all sibling instances, but not to self.\n\t\tdata = ERB::Util.html_escape data\n\t\tbroadcast :_print_out, data\n\t\tresponse << \"You said: #{data}\"\n\t\tresponse << (request.ssl? ? \"FYI: Yes, This is an SSL connection...\" : \"FYI: Nope, this isn't an SSL connection (clear text).\") if data.match /ssl\\?/i\nend", "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "def pong_everyone\n #log \"trying to pong\"\n if @sockets.length > 0 && !self.stopped?\n #log \"ponging\"\n broadcast_message(nil, \"PONG\", [build_handle_list])\n #sleep 5\n clean_handles\n end\n end", "def receive_data(data)\n\n if data.match 'SOURCE'\n p data\n send_data(\"HTTP 200 OK\\r\\n\\r\\n\")\n else\n # require 'pry'; binding.pry\n p data.size\n @channel.push(data.bytes)\n end\n end", "def handle_close\n NewRelic::Agent.logger.debug('The gRPC Trace Observer closed the stream with OK response. ' \\\n 'Restarting the stream.')\n start_streaming\n end", "def ws_server(opts = {})\n EM::WebSocket.run({ host: WS_HOST, port: WS_PORT }.merge(opts)) { |ws|\n yield ws if block_given?\n }\nend", "def start\n while listen\n # Loop for-ev-er\n end\n end", "def handler\r\n\t loop do \r\n\t socket = @rqueue.pop\r\n\t req = Request.new socket \r\n\t if req.broadcast == true\r\n\t handle_broadcast req \r\n\t else\r\n\t handle_listen req\r\n\t end\r\n\t \r\n\t end\r\n \tend", "def subscribe_webhook\n @redis = EM::Hiredis.connect(Settings.redis)\n pubsub = @redis.pubsub\n pubsub.subscribe(subscribed_channel)\n pubsub.on(:message) do |channel, message|\n render(message, event: :webhook)\n end\n end", "def proxy (port)\n $CACHE = Cache.new()\n\n # open the server connection so that we can listen\n # in on the given port\n server = TCPServer.open(\"localhost\", port)\n\n # start listening for requests\n loop do\n Thread.start(server.accept) do |client|\n MixPanel.track(\"Client Connection Accepted\", properties = {\n \"token\"=>$MIXPANEL_API_TOKEN,\n \"Event Time\"=>Time.now\n })\n\n process_transaction(client)\n client.close\n end\n end\nend", "def livestream\n system(\"/home/pi/bin/startstream\") or raise \"Something went wrong.\"\n redirect_to :back\n end", "def stream_callback(name, options = {}, &block)\n if not block\n throw ArgumentError\n end\n\n\n # Set instance variable for original rendering before streaming is established\n instance_variable_set(\"@#{name}\", block.call)\n\n # Check if the request is initial or for streaming content\n #\n # If the request is not for streaming ignore the rest of the code\n unless params[STREAMING_PARAM]\n return false\n else\n\n response.headers['Content-Type'] = 'text/event-stream'\n\n connection = Strwatch::Connection.new(response.stream, name)\n\n lambda { connection.stream(block.call, options) }\n end\n end", "def start_polling\n settings.guarddog.connect!\n EM.add_periodic_timer(settings.poll_tick) do\n guarddog_response = settings.guarddog.poll\n # $logger.debug \"Guarddog message received: #{guarddog_response.inspect}\"\n events = settings.guarddog_parser.parse(guarddog_response)\n # $logger.debug \"GuarddogParser response: #{events.inspect}\"\n send_to_all(events) unless events.empty?\n end\n EM.add_shutdown_hook do\n settings.guarddog.close!\n end\n settings.timer_running = true\n end", "def increment_listened_times\n increment(:listened_times)\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def _start_updates\n\n t = Thread.new do\n packet_manager = PacketManager.instance\n loop do\n # update pacekts\n list_updated = packet_manager.update_streams\n # send\n @clients.each_index do |i|\n c = @clients[i]\n list_updated.each do |p|\n begin\n send_stream(c, p)\n rescue => e\n @clients[i] = nil # to be removed\n PadoaukLog.info \"terminated connection from #{c.peeraddr.to_s}\", self\n c.close\n break # break list_updated.each\n end\n end\n end\n @clients.delete_if { |e| e == nil }\n\n Thread.stop\n end\n end\n\n add_task(t)\n\n end", "def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end", "def start\n return if @continue_sending\n\n @continue_sending = true\n Thread.new do\n while @continue_sending\n if @subscriber && !empty_queue?\n payload = @sse_queue.pop\n stream_sse_payload(payload)\n end\n end\n\n unsubscribe\n end\n end", "def run\n @router_socket = Hastur::Util.connect_socket @ctx, ZMQ::DEALER, @routers, :linger => 1, :hwm => 10_000\n @poller.register_readable @router_socket\n\n set_up_local_ports\n\n Hastur.start\n @running = true\n\n last_system_stat_time = Time.now\n last_heartbeat_time = Time.now - 61\n\n while @running\n poll_noop\n poll_registration_timeout\n poll_ohai_info_timeout\n poll_heartbeat_timeout\n poll_ack_timeouts\n poll_plugin_pids\n poll_zmq rescue nil # Temp: 2012-05-02, should properly detect & log bad messages\n send_agent_stats unless @no_agent_stats\n\n if select([@udp_socket], [], [], 0.25)\n poll_udp\n end\n\n now = Time.now\n # agent doesn't use the Hastur background thead, send a heartbeat every minute\n if (now - last_heartbeat_time) >= 60\n Hastur.heartbeat(\"hastur.agent.process_heartbeat\")\n last_heartbeat_time = now\n end\n\n # send Linux stats every 10 seconds\n if (now - last_system_stat_time) >= 10 and File.exists?(\"/proc/net/dev\")\n Hastur::Agent::LinuxStats.run\n last_system_stat_time = now\n end\n end\n\n msg = Hastur::Message::Log.new :from => @uuid, :payload => \"Hastur Agent #{@uuid} exiting.\"\n _send(msg)\n\n @router_socket.close\n end", "def get_booking\n response.headers['Content-Type'] = 'text/event-stream'\n sse = Lawnstream::SSE.new(response.stream)\n begin \n lawnbookings = Lawnbookings.where(\"booking_date >= ? AND booking_date <= ?\",Time.now.to_date , 9.days.from_now.to_date).order(\"booking_date ASC\")\n Lawnbookings.uncached do\n lawnbookings.each do |lawnbook|\n sse.write({ :booking_date => lawnbook.booking_date, :lawn_no => lawnbook.lawn_no}, :event => \"update\")\n sleep 0.1\n end\n end\n rescue\n # When client disconnects, we'll get an IOError on write\n ensure\n sse.close\n end\n end", "def listen\n # TODO\n self\n end", "def start\n # Eventmachine run\n EM.run do\n # set what to do on message from websocket\n on_message\n\n # set what to do on close of websocket connection\n on_close\n end\n end", "def send_twitch(event)\n Twitch::update_twitch_streams\n streams = Twitch::active_streams\n\n event << \"Currently active N related Twitch streams #{format_time}:\"\n if streams.map{ |k, v| v.size }.sum == 0\n event << \"None :shrug:\"\n else\n str = \"\"\n streams.each{ |game, list|\n if list.size > 0\n str += \"**#{game}**: #{list.size}\\n\"\n ss = list.take(20).map{ |stream| Twitch::format_stream(stream) }.join(\"\\n\")\n str += format_block(Twitch::table_header + \"\\n\" + ss)\n end\n }\n event << str if !str.empty?\n end\nrescue => e\n lex(e, \"Error getting current Twitch N++ streams.\", event: event)\nend", "def subscribed\n stream_from channel_name\n end", "def start\n loop do\n now = Time.now\n msg = \"%02d:%02d:%02d\" % [now.hour, now.min, now.sec]\n @mutex.synchronize {\n\[email protected] { |c|\n # If the connection is closed while writing this could occur. Just\n # the nature of async systems.\n puts \"--- write failed\" unless c.write(msg)\n\t}\n }\n sleep(1)\n end\n end", "def run\n listen\n broadcast\n loop do\n sleep(10)\n @all_clients.each {|client| client.puts \"Krazy Joe #{KJ_VERBS.sample} #{KJ_POS.sample} #{KJ_NOUNS.sample}!\"} \n end\nend", "def start\n uri = URI.parse(\"ws://#{host}\")\n scheme = uri.port == 443 ? 'wss' : 'ws'\n @socket = Faye::WebSocket::Client.new(\"#{scheme}://#{uri.host}\")\n @socket.onopen = lambda {|event| on_open(event)}\n @socket.onclose = lambda {|event| on_close(event)}\n @socket.onmessage = lambda {|event| on_message(event)}\n true\n end" ]
[ "0.610678", "0.6084596", "0.6043035", "0.58969367", "0.58438325", "0.5815156", "0.5815156", "0.5779583", "0.5752698", "0.5662101", "0.5658571", "0.56455475", "0.5612067", "0.5581128", "0.5558989", "0.5548527", "0.54962933", "0.54947215", "0.5463059", "0.5456812", "0.543579", "0.5432431", "0.5420164", "0.54160625", "0.54060316", "0.5398273", "0.5384828", "0.53816354", "0.53784466", "0.5371506", "0.5364795", "0.53644776", "0.53311074", "0.53310186", "0.53008085", "0.5291519", "0.5288357", "0.52825654", "0.5270382", "0.52690184", "0.52625346", "0.5260289", "0.5232164", "0.52186924", "0.52121454", "0.52078027", "0.5204356", "0.51940227", "0.51741034", "0.516988", "0.515512", "0.51526475", "0.5139879", "0.51226467", "0.5107693", "0.5100027", "0.50878537", "0.507803", "0.5075549", "0.5061887", "0.5060951", "0.5056096", "0.5053335", "0.504528", "0.50440675", "0.50373554", "0.5034841", "0.50223875", "0.5021759", "0.50215936", "0.5019335", "0.5017169", "0.5017144", "0.5017144", "0.5013114", "0.5009804", "0.5002871", "0.5002737", "0.49984142", "0.49955508", "0.49916953", "0.49904266", "0.49847716", "0.4982455", "0.4974977", "0.49725094", "0.4969449", "0.4969449", "0.4969449", "0.4968936", "0.4967932", "0.49647915", "0.49625292", "0.49623123", "0.49587765", "0.4958322", "0.49542755", "0.4951334", "0.4941051", "0.4940697", "0.49374828" ]
0.0
-1
Wait until HLS files are avaiable or unavailable for streaming before setting online status
def async_confirm_and_set_stream_state(streaming_user) Thread.new do stream_state_confirmed = false retries = 30 retry_count = 0 confirmations = 15 confirmation_count = 0 stream_found_count = 0 stream_not_found_count = 0 until stream_state_confirmed do # Check stream once per second sleep 1 url = URI.parse(Rails.configuration.front_end_hostname + '/hls/' + streaming_user.username.downcase + '/index.m3u8') req = Net::HTTP.new(url.host, url.port) req.use_ssl = true res = req.request_head(url.path) # If stream manifest is found, increment found_count and reset # not_found count. Otherwise, do the opposite if res.code == "200" stream_found_count += 1 stream_not_found_count = 0 else stream_not_found_count += 1 stream_found_count = 0 end # If stream is confirmed, set status to true, and send a 'stream-up' # message to all users in the broadcasters chat room. if stream_found_count == confirmations streaming_user.user_public_datum.online_status = true if streaming_user.user_public_datum.save! send_stream_state("stream-up", streaming_user) stream_state_confirmed = true break end elsif stream_not_found_count == confirmations streaming_user.user_public_datum.online_status = false if streaming_user.user_public_datum.save! send_stream_state("stream-down", streaming_user) stream_state_confirmed = true break end end # If retries exceed the limit, the stream is either down or unstable. # Send 'stream-down' message to all chat room users. if retry_count >= retries streaming_user.user_public_datum.online_status = false if streaming_user.user_public_datum.save! send_stream_state("stream-down", streaming_user) stream_state_confirmed = true end break end retry_count += 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_not_full; end", "def wait\n Kernel.sleep self.interval until check_files\n end", "def online\n gateway_check\n update_status(nil, @game, @streamurl)\n end", "def poll_status_url(url)\n loop do\n response = connection.get(url)\n yield response.body\n if response.success?\n break if response.status != 202\n else\n raise Samson::Hooks::UserError, \"error polling status endpoint\"\n end\n sleep poll_period\n end\n end", "def wait_for_active\n until details['status'] == 'ACTIVE'\n log \"Not online yet. Waiting...\"\n sleep 10\n end\n end", "def online\n gateway_check\n update_status(:online, @activity, @streamurl)\n end", "def wait_until_complete\n tries = 0\n status = nil\n sleep 1\n while tries < 100\n status = self.status\n puts \"Waiting... status=\" + status[\"status\"]\n if status[\"status\"] != \"queued\" && status[\"status\"] != \"running\"\n break\n end\n sleep 2\n end\n status\n end", "def wait_for_online\n Puppet.debug \"Waiting #{RETRY_COUNT * RETRY_STEP} seconds for Pacemaker to become online\"\n retry_block_until_true do\n is_online?\n end\n Puppet.debug 'Pacemaker is online'\n end", "def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end", "def poll_for_lc_ready(options={})\n options = {:timeout => 30 * 60}.merge(options)\n\n resp = remote_services_api_status\n return if resp[:lcstatus] == \"0\"\n\n # If ConnectNetworkISOImage has been executed, LC will be locked until the image is disconnected.\n resp = get_network_iso_image_connection_info\n disconnect_network_iso_image if resp[\"image_name\"]\n\n # Similarly, if BootToNetworkISO has been executed, LC will be locked until\n # the image is attached. Note that GetAttachStatus will return 1 both for\n # BootToNetworkISO and ConnectNetworkISOImage so it is important to check\n # ConnectNetworkISOImage first.\n resp = get_attach_status\n detach_iso_image if resp[\"iso_attach_status\"] == \"1\"\n\n max_sleep_secs = 60\n resp = ASM::Util.block_and_retry_until_ready(options[:timeout], RetryException, max_sleep_secs) do\n resp = remote_services_api_status\n unless resp[:lcstatus] == \"0\"\n logger.info(\"LC status on %s: %s\" % [host, Parser.response_string(resp)])\n raise(RetryException)\n end\n resp\n end\n logger.info(\"LC services are ready on %s\" % host)\n resp\n rescue Timeout::Error\n raise(Error, \"Timed out waiting for LC. Final status: %s\" % Parser.response_string(resp))\n end", "def wait_for_running\n while !self.running?\n sleep Profitbricks::Config.polling_interval\n end\n end", "def meta_dl_wait\n $meta_dl_wait_cb = Proc.new if block_given?\n if $metadata_dl_list.values.any? # still downloading\n EM.add_timer(1) { meta_dl_wait } # check again 1s later\n else\n if $meta_fail ### failed !!!!\n meta_fail\n else\n cb = $meta_dl_wait_cb\n $meta_dl_wait_cb = nil\n cb.call\n end\n end\nend", "def do_poll\n\t\tstatus_lamp\n\t\tstatus_input\n\t\tprojector_information\n\t\tstatus_error\n\tend", "def wait_readable_or_timeout; end", "def check_server_status\n @server_status_array = Array.new(@lpar_id_array)\n until @server_status_array.empty?\n @server_status_array.each do |lpar|\n lpar_name_index = @server_status_array.find_index(lpar)\n @lpar_name_deployed = @lpar_name_array[lpar_name_index]\n puts \"Checking status of #{@lpar_name_deployed}\"\n get_url('compute')\n @server_status = rest_get(\"#{@resource_url}/servers/#{lpar}\", @token_id)\n @server_id_status = JSON.parse(@server_status)['server']['status']\n puts \"Status of #{@lpar_name_deployed} is #{@server_id_status}\"\n if @server_id_status =~ /ACTIVE/ || @server_id_status =~ /ERROR/\n @server_status_array.delete(lpar)\n else\n puts 'Waiting for 20 seconds'\n sleep 20\n end\n end\n end\n puts 'All LPARs have been deployed, proceed to login to the LPARs.'\n end", "def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end", "def check_status!\n events\n if should_be_offline?\n if online?\n events.create!(key: :offline).notify\n update_attribute(:online, false)\n end\n else # should be online\n if offline?\n events.create!(key: :online).notify\n update_attribute(:online, true)\n end\n end\n if low_balance?\n events.create!(key: :low_balance).notify if online?\n end\n end", "def wait\n\t\t\t\[email protected]\n\t\t\tend", "def loop_until_server_online\n\t\tcs_conn=self.cloud_server_init\n\n\t\terror_message=\"Failed to build server.\"\n\n\t\ttimeout=self.server_online_timeout-(Time.now-self.updated_at).to_i\n\t\ttimeout = 120 if timeout < 120\n\n\t\tbegin\n\t\t\tTimeout::timeout(timeout) do\n\n\t\t\t\t# poll the server until progress is 100%\n\t\t\t\tcs=cs_conn.find_server(\"#{self.cloud_server_id_number}\")\n\t\t\t\tuntil cs.progress == 100 and cs.status == \"ACTIVE\" do\n\t\t\t\t\tcs=cs_conn.find_server(\"#{self.cloud_server_id_number}\")\n\t\t\t\t\tsleep 1\n\t\t\t\tend\n\n\t\t\t\terror_message=\"Failed to ssh to the node.\"\t\n\n\t\t\t\tif ! system(%{\n\n\t\t\t\t\t\tCOUNT=0\n\t\t\t\t\t\twhile ! ssh -o \"StrictHostKeyChecking no\" -T -i #{self.server_group.ssh_key_basepath} root@#{cs.addresses[:public][0]} /bin/true > /dev/null 2>&1; do\n\t\t\t\t\t\t\tif (($COUNT > 23)); then\n\t\t\t\t\t\t\t\texit 1\n\t\t\t\t\t\t\tfi\n\t\t\t\t\t\t\t((COUNT++))\n\t\t\t\t\t\t\tsleep 15\n\t\t\t\t\t\tdone\n\t\t\t\t\t\texit 0\n\n\t\t\t\t}) then\n\t\t\t\t\tfail_and_raise error_message\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tfail_and_raise error_message\n\t\tend\n\n\tend", "def wait_for_ready\n sleep 0.1 until ready?\n end", "def start\n while @mStatus <= 0\n connect\n monitor\n sleep 5\n end\n end", "def wait_for_provisioning\n while !self.provisioned?\n sleep Profitbricks::Config.polling_interval\n end\n end", "def wait_to_download(file_name)\n unless File.exist?(Dir.pwd + \"/tmp/downloads/#{file_name}*.csv\")\n sleep 0.1\n end\n sleep 1\nend", "def update_status!\n status = :online\n\n if !is_port_open?(@address, @port)\n status = :offline\n end\n\n if status != @status\n time = Time.now\n if status == :offline\n puts \"Server is currently offline\"\n else\n puts \"Server is currently online\"\n end\n\n @status = status\n if @status == :online\n @last_status_change = @last_launch\n else\n @last_status_change = time\n end\n end\n end", "def poll_changed_directories\n until stopped\n sleep(latency)\n report_changes\n end\n end", "def wait_until_running\n until @running\n ControllableThread.sleep POLL_INTERVAL\n check_key\n end\n end", "def viable?\n\t\t\t\t\t\t@ready && @stream&.connected?\n\t\t\t\t\tend", "def wait_until_open_confirmed; end", "def wait_until_available\n return unless locked?\n\n @mutex.synchronize {}\n end", "def wait_for_snapshots\n timeout=1500\n step=10\n while timeout > 0\n puts \"Checking for snapshot completed\"\n snapshots = behavior(:find_snapshots)\n status= snapshots.map { |x| x.aws_status } \n break unless status.include?(\"pending\")\n sleep step\n timeout -= step\n end\n raise \"FATAL: timed out waiting for all snapshots in lineage #{@lineage} to complete\" if timeout == 0\n end", "def low_frequency\n log \"Updating event status\"\n M2mhub::Event.open_or_recently_closed.each(&:update_status!)\n log \"Finished\"\n true\n end", "def wait_connection; end", "def wait_connection; end", "def availability_check_response(_msg_id, data)\n if false\n response = JSON.parse(data)\n # TODO: format of fifi_ready value is not defined yet\n status = response['result'] == 'ok' && response['fifi_ready'].to_i == 1 ? STATUS_AVAILABLE : STATUS_UNAVAILABLE\n\n if status == STATUS_UNAVAILABLE\n logger.warn(\"Source #{source_id} is unavailable. Reason: #{response['message']}\")\n end\n\n update_source(source_id, status)\n else\n # woohoo, always successful\n update_source(source_id, STATUS_AVAILABLE)\n end\n end", "def wait_until_ready!\n Timeout.timeout(timeout) do\n begin\n Chef::Log.debug \"trying to open #{endpoint}\"\n open(endpoint)\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n OpenURI::HTTPError => e\n # If authentication has been enabled, the server will return an HTTP\n # 403. This is \"OK\", since it means that the server is actually\n # ready to accept requests.\n return if e.message =~ /^403/\n Chef::Log.debug(\"Redmine is not accepting requests - #{e.message}\")\n sleep(0.5)\n retry\n end\n end\n rescue Timeout::Error\n raise RedmineNotReady.new(endpoint, timeout)\n end", "def wait_until_available\n return unless @locked\n\n @mutex.lock\n @mutex.unlock\n end", "def poll(_) end", "def check_monitoring\n @servers.each do |server|\n server.settings\n response = nil\n count = 0\n until response || count > 20 do\n begin\n response = server.monitoring\n rescue\n response = nil\n count += 1\n sleep 10\n end\n end\n raise \"Fatal: Failed to verify that monitoring is operational\" unless response\n#TODO: pass in some list of plugin info to check multiple values. For now just\n# hardcoding the cpu check\n sleep 60 # This is to allow monitoring data to accumulate\n monitor=server.get_sketchy_data({'start'=>-60,'end'=>-20,'plugin_name'=>\"cpu-0\",'plugin_type'=>\"cpu-idle\"})\n idle_values = monitor['data']['value']\n raise \"No cpu idle data\" unless idle_values.length > 0\n raise \"No idle time\" unless idle_values[0] > 0\n puts \"Monitoring is OK for #{server.nickname}\"\n end\n end", "def wait_to_startup\n begin\n Timeout.timeout(5) do\n loop do\n begin\n sleep 1; Net::HTTP.new(@host, @port).head(\"/\"); return true\n rescue Errno::ECONNREFUSED; end\n end\n end\n rescue Timeout::Error\n l \"Error\", \"failed to start benchmark script\"; return false\n end\n end", "def wait_for_xml_upload # 모바일용 지면보기 XML 콘테이너/업데이트정보 생성될 때 까지 2분간격 확인\n year = date.year\n month = date.month.to_s.rjust(2, '0')\n day = date.day.to_s.rjust(2, '0')\n issue_date = \"#{year}#{month}#{day}\"\n ip = '211.115.91.68'\n id = 'jimeun'\n pw = 'sodlfwlaus2018!@#$'\n ftp_folder = \"#{year}/#{month}/#{day}\"\n found = false\n 100.times do\n Net::FTP.open(ip, id, pw) do |ftp|\n ftp.chdir(ftp_folder)\n files_in_folder = ftp.list\n files_in_folder.each do |file|\n found = true if file.include?('Container.xml')\n break if found\n end\n end\n return true if found\n puts \"+++++++ Container.xml 파일이 생성되지 않았습니다.\"\n sleep 120 # 2 min\n end\n found\nend", "def wait_for_solr_to_be_current\n host = ENV['SOLR_URL'].present? ? URI(ENV['SOLR_URL']).host : 'localhost'\n uri = \"http://#{host}:8983/solr/admin/cores?action=STATUS&core=test\"\n \n current = false\n count = 0\n while (!current && count < 5)\n sleep(1)\n result = Net::HTTP.get(URI(uri))\n current_str = /<bool name=\"current\">(.+?)<\\/bool>/.match(result)[1]\n current = current_str == 'true'\n count += 1\n end\n end", "def good?\n\t\t\t\t\[email protected]?\n\t\t\t\tend", "def poll\n until @stop\n next if @paused\n\n start = Time.now.to_f\n @callback.call(@directories.dup, :recursive => true)\n @turnstile.signal\n nap_time = @latency - (Time.now.to_f - start)\n sleep(nap_time) if nap_time > 0\n end\n rescue Interrupt\n end", "def wait!\n until query_done?\n check_cancel\n periodic_callback\n sleep @poll_every\n end\n check_errors\n end", "def wait_on_status(jobid)\r\n uri = URI(\"http://api.idolondemand.com/1/job/status/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n obj = JSON.parse(res.body)\r\n\r\n if obj['status'] == 'queued'\r\n puts \"job [#{jobid}] #{obj['status']}, waiting #{$status_wait} seconds\"\r\n sleep($status_wait)\r\n wait_on_status(jobid)\r\n end\r\nend", "def wait; end", "def wait; end", "def wait; end", "def aws_obj_wait_till_available(obj)\n log \"AWS: waiting for #{obj.class.to_s.split(\"::\").last} '#{obj.id}' status to change to ':available'\"\n begin\n Timeout.timeout(120) do \n sleep 1 while aws_call(\n 'aws_obj_state', \n obj: obj, \n errs: { \n AWS::EC2::Errors::InvalidVpcID::NotFound => 60,\n AWS::EC2::Errors::InvalidSubnetID::NotFound => 60\n } \n ) != :available\n end\n rescue Timeout::Error => e\n raise \"AWS: timeout while waiting for #{obj.class.to_s.split(\"::\").last} '#{obj.id} status to change to ':available'\"\n end\n end", "def verify_job_complete(base_64_urn,access_token)\n is_complete = false\n\n while(!is_complete)\n response = RestClient.get(\"#{API_URL}/modelderivative/v2/designdata/#{base_64_urn}/manifest\",\n { Authorization: \"Bearer #{access_token}\"} )\n json = JSON.parse(response.body)\n if(json[\"progress\"]==\"complete\")\n is_complete = true\n puts(\"***** Finished translating your file to SVF - status: #{json['status']}, progress: #{json['progress']} \")\n else\n puts(\"***** Haven't finished translating your file to SVF - status: #{json['status']}, progress: #{json['progress']} \")\n sleep 1\n end\n end\n\n return response\nend", "def wait_for_download\n if @pending\n logger.info(\"Waiting for first sync\")\n logger.flush if logger.respond_to?(:flush)\n while @pending\n sleep(0.1)\n end\n end\n end", "def check_package (url)\n Net::HTTP.start('dl.iuscommunity.org') do |http|\n http.open_timeout = 2\n http.read_timeout = 2\n http.head(url).code == '200'\n end\nend", "def polling\n while true do\n publish\n end\n end", "def supports_streaming?; end", "def observe uris\n while true\n time_init = Time.now.to_i\n uris.each do |uri|\n puts \"Pinging #{uri}...\"\n request :uri=>uri\n end\n time = options.repository.time * 60 - (Time.now.to_i - time_init)\n puts \"Sleeping until #{Time.now + time}...\"\n sleep time\n end\n end", "def wait_readable\n ::IO.select([@io], [], [])\n true\n rescue IOError\n false\n end", "def poll_for_remote\n attempts = 1\n is_pushed = false\n file_identifier = \"#{study_file.bucket_location}:#{study_file.id}\"\n while !is_pushed && attempts <= MAX_ATTEMPTS\n Rails.logger.info \"Preparing to push #{file_identifier} to #{study.bucket_id}\"\n study.send_to_firecloud(study_file)\n Rails.logger.info \"Polling for upload of #{file_identifier}, attempt #{attempts}\"\n remote = ApplicationController.firecloud_client.get_workspace_file(study.bucket_id, study_file.bucket_location)\n if remote.present?\n is_pushed = true\n else\n interval = 30 * attempts\n sleep interval\n attempts += 1\n end\n end\n is_pushed\n end", "def build_status_observer(id)\n completed = false\n\n until completed do\n sleep 10\n response = http.get do |req|\n req.url build_status_url(id)\n end \n\n body = JSON.parse(response.body)\n if body[\"status\"] == \"succeeded\"\n completed = true\n notifier.success\n elsif body[\"status\"] == \"failed\"\n completed = true\n notifier.failure\n end\n end\n end", "def wait\n loop do\n refresh\n fail Exceptions::PushJobFailed, @job if timed_out?\n fail Exceptions::PushJobFailed, @job if failed?\n break if successful?\n pause\n end\n end", "def ready?\n status == \"RUNNING\"\n end", "def wait_writable_or_timeout; end", "def poll_readable?\n false\n end", "def wait\n true\n end", "def wait_action_cable_subscription\n sleep 1\n end", "def wait_for_results\n wait_until(Config.medium_wait) { elements(result_rows).any? }\n end", "def poll_changed_dirs\n until @stop\n sleep(@latency)\n report_changes\n end\n end", "def poll_readable?\n true\n end", "def poll_changed_directories\n until stopped\n next if paused\n\n start = Time.now.to_f\n callback.call(directories.dup, :recursive => true)\n turnstile.signal\n nap_time = latency - (Time.now.to_f - start)\n sleep(nap_time) if nap_time > 0\n end\n rescue Interrupt\n end", "def wait_resource_status(url, status, timeout: 300, interval: 10)\n res = nil\n success = wait_for(timeout) {\n res = rest_run(url, :get, nil, os_token)\n if res[:success]\n if res[:parsed].all? {|k, v| v[\"status\"] == status}\n return res[:parsed]\n end\n else\n raise \"error obtaining resource:\\n\" << res.to_yaml\n end\n }\n\n raise \"after timeout status not #{status} but: \" + res[:parsed].map {|k, v| \"#{k}:#{v[\"status\"]}\"}.join(',')\n end", "def check_monitoring\n @servers.each do |server|\n obj_behavior(server, :settings)\n response = nil\n count = 0\n until response || count > 20 do\n begin\n response = obj_behavior(server, :monitoring)\n rescue\n response = nil\n count += 1\n sleep 10\n end\n end\n raise \"Fatal: Failed to verify that monitoring is operational\" unless response\n#TODO: pass in some list of plugin info to check multiple values. For now just\n# hardcoding the cpu check\n unless server.multicloud\n sleep 180 # This is to allow monitoring data to accumulate\n monitor = obj_behavior(server, :get_sketchy_data, {'start' => -60,\n 'end' => -20,\n 'plugin_name' => \"cpu-0\",\n 'plugin_type' => \"cpu-idle\"})\n idle_values = monitor['data']['value']\n raise \"No cpu idle data\" unless idle_values.length > 0\n raise \"CPU idle time is < 0: #{idle_values}\" unless idle_values[0] > 0\n puts \"Monitoring is OK for #{server.nickname}\"\n end\n end\n end", "def waiting; end", "def waiting; end", "def set_online_status(status)\n case status\n when :available, :online\n @notification_server.chg \"NLN\", 0\n when :busy\n @notification_server.chg \"BSY\", 0\n when :idle\n @notification_server.chg \"IDL\", 0\n when :brb, :be_right_back\n @notification_server.chg \"BRB\", 0\n when :away\n @notification_server.chg \"AWY\", 0\n when :phone, :on_the_phone\n @notification_server.chg \"PHN\", 0\n when :lunch, :out_to_lunch\n @notification_server.chg \"LUN\", 0\n else\n raise \"Wrong online status: #{status}\"\n end\n end", "def poll_sleep\n @sleeping = true\n handle_shutdown { sleep 5 }\n @sleeping = false\n true\n end", "def monitorOpencastWorkflow(ingestResponse, secondsBetweenChecks, secondsUntilGiveUpMax, meetingId)\n\n ### Wait for Opencast to be done\n secondsUntilGiveUpCounter = 0\n isOpencastDoneYet = false\n\n # Get the id of the workflow\n doc = Nokogiri::XML(ingestResponse)\n workflowID = doc.xpath(\"//wf:workflow\")[0].attr('id')\n mediapackageID = doc.xpath(\"//mp:mediapackage\")[0].attr('id')\n\n # Keep checking whether the started workflow is still running or not\n while !isOpencastDoneYet do\n # Wait between checks\n sleep(secondsBetweenChecks)\n\n # Request check\n response = OcUtil::requestIngestAPI($oc_server, $oc_user, $oc_password,\n :get, '/workflow/instance/' + workflowID + '.xml', DEFAULT_REQUEST_TIMEOUT, {},\n \"There has been a problem in OC with the workflow for mediapackage \" + mediapackageID + \" for BBB recording \" + meetingId + \". Aborting...\" )\n\n # Request workflow information\n doc = Nokogiri::XML(response)\n elems = doc.xpath(\"//wf:workflow\")\n state = elems[0].attr('state')\n\n # Check state\n if (state == \"SUCCEEDED\")\n BigBlueButton.logger.info( \"Workflow for \" + mediapackageID + \" succeeded.\")\n isOpencastDoneYet = true\n elsif (state == \"RUNNING\" || state == \"INSTANTIATED\")\n BigBlueButton.logger.info( \"Workflow for \" + mediapackageID + \" is \" + state)\n else\n BigBlueButton.logger.error(\" Workflow for \" + mediapackageID + \" is in state + \" + state + \", meaning it is neither running nor has it succeeded. Recording data for \" + meetingId + \" will not be cleaned up. Aborting...\")\n exit 1\n end\n\n # Fail-safe. End this process after some time has passed.\n secondsUntilGiveUpCounter += secondsBetweenChecks\n if ( secondsUntilGiveUpCounter >= secondsUntilGiveUpMax )\n BigBlueButton.logger.error(\" \" + secondsUntilGiveUpMax.to_s + \" seconds have passed since the mediapackage with id \" + mediapackageID + \" was ingested. Mercy killing process for recording \" + meeting_id)\n exit 1\n end\n\n end\nend", "def wait_for_status_checks(status)\n @logger.notify(\"netscaler: Now wait for all hosts' status checks to reach state #{status}\")\n @hosts.each do |host|\n instance = host['instance']\n name = host.name\n\n @logger.notify(\"netscaler: Wait for status check #{status} for node #{name}\")\n\n # TODO: should probably be a in a shared method somewhere\n for tries in 1..10\n begin\n if instance.client.describe_instance_status({:instance_ids => [instance.id]})[:instance_status_set].first[:system_status][:status] == status\n # Always sleep, so the next command won't cause a throttle\n backoff_sleep(tries)\n break\n elsif tries == 10\n raise \"Instance never reached state #{status}\"\n end\n rescue AWS::EC2::Errors::InvalidInstanceID::NotFound => e\n @logger.debug(\"Instance #{name} not yet available (#{e})\")\n end\n backoff_sleep(tries)\n end\n end\n end", "def wait_for_status(status, secs_to_wait)\n start_time = Time.now\n sleep_secs = 2\n until (status == \"started\") ? @started : @running\n sleep sleep_secs\n #\n # Specifically check the shutdown flag in case we've been asked\n # to wait for a different flag.\n #\n break if @shutdown\n #\n # Check if we've waited the specified number of seconds.\n #\n current_time = Time.now\n if current_time - start_time > secs_to_wait\n elapsed = current_time - start_time\n msg = \"ERROR: Maximum time for a call to VixDiskLib has been reached after #{elapsed} seconds.\"\n msg += \"\\nShutting down VixDiskLib Service\"\n @shutdown = true\n shut_down_service(msg)\n raise VixDiskLibError, msg\n end\n end\n end", "def wait_on_table_status(table_status:, table_name:)\n begin\n connection.wait_until(table_status, table_name: table_name) do |w|\n w.interval = 1\n w.max_attempts = 10\n end\n rescue Aws::Waiters::Errors => e\n p \"Waiter failed: #{ e .inspect }\"\n return false\n end\n return true\n end", "def set_online_status\n self.online_status = \"offline\"\n end", "def online?\n status != :offline\n end", "def poll\n @connection.poll\n end", "def wait_for_callback\n turnstile.wait unless paused\n end", "def wait_and_open\n info \"Attempting to connect to the web site...\"\n Http.head \"http://127.0.0.1:3000/\"\n rescue Errno::ECONNREFUSED\n sleep(0.5)\n retry if (self.try += 1) < max\n info \"Server not found, sorry.\"\n raise\n else\n Launchy.open(\"http://127.0.0.1:3000/\")\n end", "def online?\n Browser.get(url).code != 0\n end", "def wait_for_progress\n sleep 2\n wait_for(timeout: 60) { element_does_not_exist \"* marked:'#{loading_screen}'\" }\n end", "def check_status\n render text: Mtheory::DecksterConfiguration.streaming.to_s\n end", "def poll_monitors\n (1..MAX_POLL_COUNT).each do |count|\n if @monitors.all? {|monitor| monitor.done?}\n show_complete\n break\n end\n @monitors.each{|monitor| monitor.poll}\n @verbose && print(\"Poll #{count} of #{MAX_POLL_COUNT}: \")\n print @monitors.inject(0) {|sum, monitor| sum + monitor.servers_not_done.length}, ' '\n @verbose && print(\"servers remain\\n\")\n sleep(POLL_SLEEP_SECONDS)\n end\n\n unless @monitors.all? {|monitor| monitor.done?}\n puts \"\\nTIME OUT.\\nSpent #{MAX_POLL_COUNT * POLL_SLEEP_SECONDS} seconds waiting for the deployment\\n\" +\n \"to finish. I can't wait any longer!\"\n show_complete\n end\n end", "def poll_civ_updates\n while @connected\n sleep 10\n turn = civ_turn\n if @last_turn != turn && turn != 0\n @reported_players = Set.new\n report_turn\n end\n\n needed = civ_unsubmitted_players\n if (@last_needed != needed) && (!needed.empty?) && (!needed.proper_subset? @reported_players)\n @reported_players |= needed\n report_needed\n end\n end\n end", "def wait(timeout: nil)\n wait_until = timeout && (Time.now + timeout)\n\n until operational?\n if timeout && wait_until < Time.now\n log(:fatal, 'Timed while waiting for LXCFS to become operational')\n raise Lxcfs::Timeout, \"Timed out while waiting for LXCFS to become operational\"\n end\n\n log(:info, 'Waiting for LXCFS to become operational')\n sleep(1)\n end\n end", "def wait_done\n sleep 0.01 until done?\n end", "def wait\n while source\n saved_source = source\n saved_source.wait\n break if saved_source.equal?(source)\n end\n end", "def ready?\n return false unless @status =~ /down/i\n volumes.each do |volume|\n return false if volume.status =~ /locked/i\n end\n true\n end", "def wait_for_pending_sends; end", "def wait_all_sent\n verify_not_closed\n @clients.each do |pub|\n pub.wait_all_sent\n end\n end", "def wait_for_results\n wait_until(Config.long_wait) { elements(result_rows).any? }\n end", "def refresh_live_status\n self.status.live?\n end", "def wait_vlanid(vnet)\n retries = 5\n i = 0\n while vnet[\"VLAN_ID\"].nil?\n raise \"cannot get vlan_id\" if i >= retries\n sleep 1\n i +=1\n vnet.info\n end\nend", "def wait_until_unhealthy!\n agent = consul.get(\"/agent/self\")[\"Member\"][\"Name\"]\n consul.get_while(\"/health/node/#{agent}\") do |data|\n status = data.detect {|x| x[\"CheckID\"] == \"service:#{name}\" }[\"Status\"]\n status == 'passing'\n end\n end", "def wait_for_complete(iterator)\n loop do\n states = iterator.each_app_screenshot.map { |_, _, app_screenshot| app_screenshot }.each_with_object({}) do |app_screenshot, hash|\n state = app_screenshot.asset_delivery_state['state']\n hash[state] ||= 0\n hash[state] += 1\n end\n\n is_processing = states.fetch('UPLOAD_COMPLETE', 0) > 0\n return states unless is_processing\n\n UI.verbose(\"There are still incomplete screenshots - #{states}\")\n sleep(5)\n end\n end", "def main\n doc = Nokogiri::HTML(open(START_URI))\n dirs_to_search = doc.css('a').map{|x|x[:href]}.grep(%r{/SolaceSounds/SolaceSounds})\n\n streams_to_rip = []\n\n dirs_to_search.each do |dir|\n puts \"Searching #{HOST}#{dir}\"\n\n # don't overwhelm the server\n sleep 1\n\n subdir = Nokogiri::HTML(open(HOST + dir))\n streams_to_grab = subdir.css('a').map{|x|x[:href]}.grep(%r{\\.mp3})\n streams_to_rip.concat(streams_to_grab)\n end\n\n # we've found all of the mp3 streams, now we grab them\n streams_to_rip.each do |url|\n if stream_already_downloaded(url)\n puts \"skipping url: #{url}\"\n next\n end\n rip_stream(url)\n move_ripped_file(url)\n set_mp3_tags(url)\n end\nend" ]
[ "0.6226796", "0.6190148", "0.61010474", "0.60171115", "0.5984374", "0.5982183", "0.5863519", "0.5859245", "0.5849903", "0.58445406", "0.5832351", "0.5740435", "0.5730877", "0.5720811", "0.5709433", "0.5694138", "0.5678089", "0.5647087", "0.56369615", "0.5625646", "0.560188", "0.55965483", "0.5555213", "0.5526406", "0.55207986", "0.55101335", "0.5494407", "0.54911816", "0.5484608", "0.54832655", "0.5471733", "0.54712105", "0.54712105", "0.54549", "0.543792", "0.542403", "0.53879666", "0.53849137", "0.53669393", "0.5365115", "0.5357245", "0.5356738", "0.5340072", "0.5332878", "0.53247386", "0.5324595", "0.5324595", "0.5324595", "0.5320288", "0.5319482", "0.5317859", "0.5293952", "0.52894396", "0.5286116", "0.52778405", "0.52688414", "0.5261342", "0.52568656", "0.5249532", "0.524822", "0.524255", "0.52411073", "0.52264494", "0.5220275", "0.5212715", "0.5209363", "0.5204962", "0.5199216", "0.5195301", "0.51951486", "0.5194067", "0.5194067", "0.5193371", "0.51893026", "0.51785296", "0.5172367", "0.5168991", "0.5164305", "0.51611054", "0.51537263", "0.5150212", "0.51498675", "0.51414335", "0.51409537", "0.5137815", "0.51364523", "0.5133897", "0.5133235", "0.51215136", "0.51190865", "0.5118847", "0.5118838", "0.5110252", "0.51046556", "0.51036304", "0.51018083", "0.51014805", "0.50921303", "0.50918025", "0.5091389" ]
0.5716096
14
Send stream state over websocket to user channel
def send_stream_state(state, streaming_user) WebSocket::Client::Simple.connect( Rails.configuration.x.saber.chat_server, headers: { "streamstate-auth": Rails.application.credentials.stream_state_auth } ) do |ws| ws.on :open do ws.send({ type: "StreamState", data: { state: state, username: streaming_user.username.downcase } }.to_json) ws.close end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_message state\n stream.with_stream! do | io |\n state.in_stream = io\n _write(state.message_payload, io, state)\n end\n end", "def async_confirm_and_set_stream_state(streaming_user)\n Thread.new do\n stream_state_confirmed = false\n retries = 30\n retry_count = 0\n confirmations = 15\n confirmation_count = 0\n stream_found_count = 0\n stream_not_found_count = 0\n\n until stream_state_confirmed do\n # Check stream once per second\n sleep 1\n url = URI.parse(Rails.configuration.front_end_hostname +\n '/hls/' + streaming_user.username.downcase + '/index.m3u8')\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n\n # If stream manifest is found, increment found_count and reset\n # not_found count. Otherwise, do the opposite\n if res.code == \"200\"\n stream_found_count += 1\n stream_not_found_count = 0\n else\n stream_not_found_count += 1\n stream_found_count = 0\n end\n\n # If stream is confirmed, set status to true, and send a 'stream-up'\n # message to all users in the broadcasters chat room.\n if stream_found_count == confirmations\n streaming_user.user_public_datum.online_status = true\n if streaming_user.user_public_datum.save!\n send_stream_state(\"stream-up\", streaming_user)\n stream_state_confirmed = true\n break\n end\n elsif stream_not_found_count == confirmations\n streaming_user.user_public_datum.online_status = false\n if streaming_user.user_public_datum.save!\n send_stream_state(\"stream-down\", streaming_user)\n stream_state_confirmed = true\n break\n end\n end\n\n # If retries exceed the limit, the stream is either down or unstable.\n # Send 'stream-down' message to all chat room users.\n if retry_count >= retries\n streaming_user.user_public_datum.online_status = false\n if streaming_user.user_public_datum.save!\n send_stream_state(\"stream-down\", streaming_user)\n stream_state_confirmed = true\n end\n break\n end\n\n retry_count += 1\n end\n end\n end", "def send msg\n return unless @state == :state_inited\n @ws.send msg.to_json\n end", "def websocket; end", "def websocket; end", "def subscribed\n super\n increase_current_users\n stream_from channel\n end", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def sendStreaming(devInfo, devState)\r\n msg = {\r\n :type => \"streaming\", \r\n :version => devInfo.swVersion,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\", \r\n :value => devState.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\", \r\n :value => devState.humidity, \r\n :time => Time.now.to_i\r\n }\r\n ] \r\n }\r\n sendMsg(msg)\r\n end", "def receive(websocket_message); end", "def websocket_update\n json = self.to_jsonapi\n watching_users.each do |user|\n UpdatesChannel.broadcast_to(user, {loadModels: [json]})\n end\n end", "def subscribed\n stream_from channel_name\n end", "def run\n websocket.run\n end", "def perform(data)\n User.find(data[\"user_id\"]).update(status: false, online: false)\n ActionCable.server.broadcast 'chat_channel', content: \"qwertyuiop\"\n end", "def test1 #fails\n\n EventMachine::WebSocket.start(:host => \"0.0.0.0\", :port => 8567) do |ws|\n ws.onopen do\n puts \"WebSocket opened\"\n conn = Bunny.new\n conn.start\n#ch = conn.default_channel\n q = $ch.queue(\"tweets\")\n q.subscribe(:block => true) do |delivery_info, properties, body|\n puts \"Received tweet\\n\"\n ws.send \"test\"\n end\n end\n ws.onclose do\n ws.close(code = nil, body = nil)\n puts \"WebSocket closed\"\n# exit\n end\n end\nend", "def set_stream\n @stream = current_user.stream\n end", "def open_stream(env, hndlr)\n env[:subscription] = hndlr.stream_data{ |data| env.stream_send MultiJson.dump(data).concat(\"\\n\") }\n end", "def open(event)\n Firehose.logger.debug \"WebSocket subscribed to `#{@req.path}`. Waiting for message_sequence...\"\n end", "def stream(socket); end", "def notification\n request.websocket do |ws|\n ws.onopen do\n settings.sockets << ws\n end\n notifications\n ws.onclose do\n settings.sockets.delete(ws)\n end\n end\n end", "def start\n\n logger.info('Starting the WebSocket Client...')\n\n EventMachine.run do\n\n puts '='*80, \"Connecting to websockets server at ws://#{Settings.websocket.host}:#{Settings.websocket.port}\", '='*80\n\n http = EventMachine::HttpRequest.new(\"ws://#{Settings.websocket.host}:#{Settings.websocket.port}/websocket\").get :timeout => 0\n\n http.errback do\n logger.error \"something was wrong in the websocket_client\"\n end\n\n http.callback do\n puts \"#{Time.now.strftime('%H:%M:%S')} : Connected to server\"\n end\n\n http.stream do |msg|\n puts msg\n end\n\n end\n \n end", "def send_stream_header\n features = REXML::Element.new('stream:features')\n if @stream_state == :initial\n tls = features.add_element('starttls')\n tls.add_namespace(NAMESPACES[:tls])\n tls.add_element('required')\n elsif @stream_state == :started_tls\n mechanisms = features.add_element('mechanisms')\n mechanisms.add_namespace(NAMESPACES[:sasl])\n mechanisms.add_element('mechanism').add_text('EXTERNAL')\n elsif @stream_state == :authenticated\n @stream_state = :negotiation_complete\n end\n [stream_xml, features.to_s].each {|xml| send_data(xml) }\n end", "def websocket_update\n UpdatesChannel.broadcast_to(user, {loadModels: [self.to_jsonapi]})\n end", "def websocket port = nil\n host = @source[\"resource\"].first\n path = @source[\"resource\"][1..-1].join('/')\n if port.nil?\n connection_uri = \"ws://#{host}:#{@config.port.outbound}/#{path}\"\n else\n connection_uri = \"ws://#{host}:#{port}/#{path}\"\n end\n\n begin \n ws = EM::WebSocketClient.connect connection_uri\n ws.callback do \n ws.send_msg @source.to.json\n @config.logger.debug @source.to_s\n ws.close_connection_after_writing\n end\n rescue RuntimeError => e\n EM.run do\n ws = EM::WebSocketClient.connect connection_uri\n\n ws.callback do \n ws.send_msg @source.to.json\n @config.logger.debug @source.to_s\n ws.close_connection_after_writing\n end\n\n ws.disconnect do \n EM::stop_event_loop\n end\n end\n end\n end", "def stream\n render json: { state: Settings.app_state, content: serialized_content }\n end", "def send_drop_stream\n unless self.is_being_seeded || Rails.env.development? || Rails.env.test?\n params = {\n 'app' => 'stream',\n 'name' => stream_key_was\n }\n x = Net::HTTP.post_form(\n URI.parse(\n Rails.configuration.x.saber.stream_rtmp_control_url\n ),\n params\n )\n end\n end", "def ws_single(stream:, methods:)\n create_stream(\n \"#{base_url}/ws/#{stream_url(stream)}\",\n methods: methods,\n )\n end", "def start\n if params[:name]\n streaming_user = User.where('stream_key = ?', params[:name]).first\n if streaming_user\n async_confirm_and_set_stream_state(streaming_user)\n # Sending a redirect causes NGINX rtmp module to redirect the stream\n # to the restricted hlsout application. This also effectively translates\n # the users stream key to their username for client-side use.\n redirect_to \"rtmp://127.0.0.1/hlsout/\" + streaming_user.username.downcase\n else\n render status: :not_found\n end\n else\n render status: :not_found\n end\n end", "def upgrade\n fail ProtocolError unless @stream_id == 1\n send_connection_preface\n new_stream(state: :half_closed_local)\n end", "def send(hash)\n Hammer.logger.debug \"Websocket sending: #{hash}\" if config[:logger][:show_traffic]\n super hash.to_json\n end", "def broadcast_state(nick, state)\n #TODO: write function\n #get users clist, get the contacts clists and check their authorization to get the state\n #if its fine -> send the message to their queues\n\n return true\nend", "def stream_send(data)\n self[STREAM_SEND].call(data)\n end", "def update\n\t\t\t# assumes body is JSON - more handling could be done using the params (which hold parsed JSON data).\n\t\t\tbroadcast :_push, request[:body] \n\t\t\t{message: 'write_chat', data: {id: params[:id], token: cookies['example_token'], example_data: 'message sent.'}}.to_json\n\t\tend", "def send_binary(data)\n if @handler\n @handler.send_frame(:binary, data)\n else\n raise WebSocketError, \"Cannot send binary before onopen callback\"\n end\n end", "def websocket\n @web_socket ||= WebSocket.new\n end", "def send_data( data )\n raise \"channel not open\" unless @state == :open\n @channel.send_data data\n end", "def on_message\n websocket_client.on(:message) do |event|\n websocket_response = websocket_response_data_class.new(\n data: event.data,\n bot_params_class: bot_params_class\n )\n\n bot.handle_data(websocket_response.bot_params) do |message|\n websocket_request = websocket_request_data_class.new(message: message, data: websocket_response.bot_params)\n websocket_client.send(websocket_request.data_to_send)\n end\n end\n end", "def send_message\n self.get_message\n self.conn.get.status\n end", "def ws_server(opts = {})\n EM::WebSocket.run({ host: WS_HOST, port: WS_PORT }.merge(opts)) { |ws|\n yield ws if block_given?\n }\nend", "def stream_handler(broadcasting, user_handler, coder: T.unsafe(nil)); end", "def set_state(is_on)\n state = { :on => is_on }\n payload = { :state => state }\n client.publish(state_topic, payload.to_json, true, 1)\n state\n end", "def subscribe_to_channel; end", "def stream_connect(params)\n puts('-- stream connect')\n @options = {\n timeout: 0,\n method: 'get',\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n },\n params: params\n }\n @request = Typhoeus::Request.new(@stream_url, @options)\n @request.on_body do |chunk|\n if chunk.eql?(\"\\r\\n\")\n else\n response = JSON.parse(chunk).to_h\n ap response\n doc = response['data']\n doc['users'] = response ['includes']['users']\n # insert the tweet object into the DB\n id = TWDB[opts[:tweetcoll]].insert_one(doc)\n puts \"\\n----------------------------\\n\"\n puts \"#{Time.now - @t} secs since last event\"\n @t = Time.now\n end\n end\n @request.run\nend", "def listen port, &block\n if @state != :state_inited\n return\n end\n @state = :state_started\n begin\n @server = WebSocket::EventMachine::Server.start(:host => '0.0.0.0', :port => port.to_s) { |ws|\n ws_context = {\n # 'monitor' or 'client'\n :type => nil,\n # for monitor connection\n :server_id => nil, :server_type => nil, :server_info => nil,\n # for client connection\n :client_id => nil,\n # for both connection\n :username => nil, :registered => false\n }\n ws.onopen {\n @wss[ws.signature] = ws\n peer_port, peer_host = Socket.unpack_sockaddr_in ws.get_peername\n emit 'connection', { :id => ws.signature, :ip => peer_host }\n }\n ws.onmessage { |msg, type|\n begin\n event, msg = parse msg\n case event\n when 'register'\n process_register_msg ws, ws_context, msg\n when 'monitor'\n process_msg_from_monitor ws, ws_context, msg\n when 'client'\n process_msg_from_client ws, ws_context, msg\n else\n end\n rescue => err\n end\n }\n ws.onclose {\n @wss.delete ws.signature\n if ws_context[:registered]\n case ws_context[:type]\n when 'monitor'\n remove_monitor_connection(ws_context[:server_id],\n ws_context[:server_type], ws_context[:server_info])\n when 'client'\n remove_client_connection ws_context[:client_id]\n else\n end\n emit 'disconnect', ws_context\n end\n }\n ws.onerror { |err|\n emit 'err', err\n }\n }\n block_given? && yield\n rescue => err\n emit 'error', err\n end\n on('connection') { |obj| ip_filter obj }\n end", "def make_websocket\n require 'em-websocket'\n require 'sanitize'\n\nsoc = []\n\n\n\nEM::WebSocket.start(host: '10.20.4.130' , port: 4000) do |ws|\n\n ws.onopen{soc << ws;puts \"#{soc.length} clients present\";}\n ws.onmessage { |msg| ; soc.each do |s| \n msg = Sanitize.clean(msg.html_safe , :elements => %w(font) , :attributes => {'font' => ['color']})\n\t\t\t\ts.send(\"#{msg}\")\n\t\t\t\tend ; $redis.LPUSH 'msg', \"#{msg}\" }\n ws.onclose {puts \"Someone dissconected \" ; soc.delete(ws)}\n end\n end", "def broadcast_chat_status(channel, status)\n mensaje_raw = FayeMessagesController.new.generate_chat_status_output current_user.id, status\n send_via_faye \"#{FAYE_CHANNEL_PREFIX}#{channel}\", mensaje_raw\n end", "def default_stream_handler(broadcasting, coder:); end", "def onStreamStateChanged(stream, new_state)\n state = \"Stream #{stream.StreamName} state: #{@deal_stream.state_text(new_state)}\"\n case new_state\n when P2::DS_STATE_CLOSE, P2::DS_STATE_ERROR\n # @opened = false\n end\n log.puts(state)\n end", "def stream(name, url)\n gateway_check\n update_status(@status, name, url)\n name\n end", "def start\n uri = URI.parse(\"ws://#{host}\")\n scheme = uri.port == 443 ? 'wss' : 'ws'\n @socket = Faye::WebSocket::Client.new(\"#{scheme}://#{uri.host}\")\n @socket.onopen = lambda {|event| on_open(event)}\n @socket.onclose = lambda {|event| on_close(event)}\n @socket.onmessage = lambda {|event| on_message(event)}\n true\n end", "def on_session_open(session)\n\t\t\t\tprint_status(\"Session received Sending Message to #{@user}\")\n\t\t\t\tsend_direct(\"Source: #{@source} Session: #{session.sid} IP: #{session.session_host} Peer: #{session.tunnel_peer} Platform: #{session.platform} Type: #{session.type}\")\n\t\t\t\treturn\n\t\t\tend", "def on_stream_receive(item)\n parsed = JSON.parse(item)\n\n tw = Tweet.new({\n :tweet_id => parsed['id_str'],\n :text => parsed['text'],\n :twitter_id => parsed['user']['id'],\n :screen_name => parsed['user']['screen_name'],\n :profile_image_url => parsed['user']['profile_image_url'],\n :location => parsed['user']['location']\n })\n tw.save!\n\n # Delete old tweets\n oldest_tweet_saved = Tweet.order('created_at desc').limit(1).offset(50).first\n if oldest_tweet_saved\n Tweet.where(\"created_at < ?\", oldest_tweet_saved.created_at).each { |tw| tw.destroy }\n end\n\n ::PubSub.channel(\"ws_server\").publish tw.to_json\n end", "def start\n @redis = Redis.new(:host => \"#{Settings.redis.host}\", :port => Settings.redis.port)\n\n \n Thread.new do\n EventMachine.run do\n \tputs '='*80, \"Starting websockets server at ws://#{Settings.websocket.host}:#{Settings.websocket.port}\", '='*80\n \n EventMachine::WebSocket.start(:host => \"#{Settings.websocket.host}\", :port => Settings.websocket.port) do |ws|\n ws.onopen do\n \n puts \"#{Time.now.strftime('%H:%M:%S')} : Client connected\", '-'*80\n SOCKETS << ws\n end\n\n ws.onclose do\n \n puts \"#{Time.now.strftime('%H:%M:%S')} : Client disconnected\", '-'*80\n SOCKETS.delete ws\n end\n end\n end\n end\n\n \n Thread.new do\n @redis.subscribe('ws') do |on|\n \n on.message do |chan, msg|\n \n puts \"#{msg}\"\n SOCKETS.each {|s| s.send msg} \n \n end\n end\n end\n\n sleep\n \n end", "def handle_message(is_bot, channel, user, text, modes=[])\n puts \"Received message from IRC: #{channel} #{user} #{text}\"\n\n HTTParty.post \"#{$config['streaming_pub']}?id=#{channel.gsub('#','')}\", {\n body: {\n text: text,\n nick: user.nick\n }.to_json,\n verify: false\n }\nend", "def log_connect(stream_obj)\n puts \"STREAM: connect for #{stream_obj.request_path} from #{request.ip}\" if VERBOSE\n # REDIS.PUBLISH 'stream.admin.connect', stream_obj.to_json\nend", "def data_channel_open\n puts \"Data channel open!\"\n data_channel = $$.data_channel\n # send_message(\"ALIVE\")\nend", "def stream\n @stream ||=\n connect!\n end", "def initialize(url, cookies, logs: false, &handler)\n @super_logger = Logger.new(logs ? 'ws_super_logger.log' : '/dev/null')\n\n @uri = URI.parse(url)\n @url = \"ws#{@uri.scheme.split(\"\")[4]}://#{@uri.host}\"\n\n if @uri.scheme.split(\"\")[4] == 's'\n @socket = TCPSocket.new(@uri.host, 443)\n @super_logger.info \"Opened TCP socket for (port 443) #{@uri} (#{@socket})\"\n @socket = OpenSSL::SSL::SSLSocket.new(@socket)\n @socket.connect\n @super_logger.info \"Upgrade TCP socket to SSL socket socket for #{@uri} (#{@socket})\"\n else\n @socket = TCPSocket.new(@uri.host, 80)\n @super_logger.info \"Opened TCP socket for (port 80) #{@uri} (#{@socket})\"\n end\n\n @handler = handler\n @logger = Logger.new(logs ? \"realtime.log\" : '/dev/null')\n @restart = true\n @super_logger.info \"Set @restart to #{@restart}\"\n\n @driver = WebSocket::Driver.client(self)\n @driver.add_extension PermessageDeflate\n @driver.set_header \"Cookies\", cookies if cookies\n @driver.set_header \"Origin\", \"#{@uri.scheme}://#{@uri.host.split('.')[-2..-1].join('.')}\"\n\n @driver.on :connect, ->(_e) {}\n\n @driver.on :open, ->(_e) do\n send \"155-questions-active\"\n @super_logger.info \"Socket open. Subscribed to 155-questions-active\"\n @logger.info \"WebSocket is open!\"\n end\n\n @driver.on :message do |e|\n @logger.info(\"Read: #{e.data}\")\n data = JSON.parse(e.data)\n if data[\"action\"] == \"hb\"\n send \"hb\"\n else\n @handler.call(data)\n end\n end\n\n @driver.on :close, ->(_e) do\n @logger.info \"Realtime WebSocket is closing.\"\n @super_logger.info \"Socket was closed. @restart == #{@restart}\"\n if @restart\n @logger.info \"Attempting to reopen websocket...\"\n @super_logger.info \"Attempting to reopen socket\"\n @driver.start\n end\n end\n\n @driver.on :error, ->(e) { @logger.error e }\n\n @driver.start\n\n @dead = false\n @thread = Thread.new do\n trap(\"SIGINT\") do\n @restart = false\n @dead = true\n @super_logger.info \"Got SIGINT. Dying.\"\n close\n Thread.exit\n end\n begin\n @driver.parse(@socket.is_a?(TCPSocket) ? @socket.recv(1) : @socket.sysread(1)) until @dead\n rescue IOError, SystemCallError => e\n @super_logger.warn \"Got some kind of interrupt in the thread. Panic.\"\n @logger.warn \"Recieved #{e} closing TCP socket. You shouldn't be worried :)\"\n end\n @super_logger.warn \"Left TCPSocket.recv loop. If you're reading this, panic.\"\n end\n\n at_exit { @thread.join }\n end", "def close\n if @status == CONNECTED\n send(\"</stream:stream>\")\n end\n super\n end", "def write_to_stream(stanza)\n client.write stanza\n end", "def send_message(event, from_ws, msg)\n push payload(event, from_ws, msg)\n end", "def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end", "def StreamStateChanged(stream, new_state)\n @ole._invoke(1, [stream, new_state], [VT_BYREF|VT_DISPATCH, VT_DISPATCH])\n end", "def send_whisper(user, message)\n @handler.send_whisper user, message\n end", "def send_msg(data, ws)\n @@em.schedule { ws.send(data) }\n end", "def update\n @stream.update(stream_params)\n end", "def stream(event)\nexp = [\"#bonjour_monde\"]\n client.event(track: exp.join(\",\")) do |object|\n stream(var_like, var_follow)\n end\nend", "def send_websocket(opts = {})\n send_websocket_with_http_info(opts)\n return nil\n end", "def publish(stream, event_name, data)\n stream = stream_name(stream)\n connection.xadd(stream, { \"#{event_name}\": data })\n end", "def open_stream\n %Q[<stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" to=\"#{session.domain}\" version=\"1.0\">]\n end", "def post_init\n @state = :connecting\n @handshake = ::WebSocket::Handshake::Server.new(:secure => @secure_proxy)\n start_tls(@tls_options) if @secure\n end", "def pushStream(hash={})\n\t\t$room_count += 1 if hash['id'] == 'room'\n\t\t@@streams.push(hash['id'])\n\tend", "def message(event)\n msg = JSON.parse(event.data, :symbolize_names => true) rescue {}\n seq = msg[:message_sequence]\n if msg[:ping] == 'PING'\n Firehose.logger.debug \"WS ping received, sending pong\"\n @ws.send JSON.generate :pong => 'PONG'\n elsif !@subscribed && seq.kind_of?(Integer)\n Firehose.logger.debug \"Subscribing at message_sequence #{seq}\"\n subscribe seq\n end\n end", "def start\n configure\n\n @on_startup.call if @on_startup\n\n if not @stream\n log \"not bothering with stream for #@username\"\n return\n end\n\n log \"starting stream for #@username\"\n @stream.on_error do |msg|\n log \"ERROR: #{msg}\"\n end\n\n @stream.on_inited do\n log \"Online!\"\n end\n\n @stream.on_event(:follow) do |event|\n next if event[:source][:screen_name] == @username\n log \"Followed by #{event[:source][:screen_name]}\"\n @on_follow.call(event[:source]) if @on_follow\n end\n\n @stream.on_direct_message do |dm|\n next if dm[:sender][:screen_name] == @username # Don't reply to self\n log \"DM from @#{dm[:sender][:screen_name]}: #{dm[:text]}\"\n @on_message.call(dm) if @on_message\n end\n\n @stream.userstream do |ev|\n next unless ev[:text] # If it's not a text-containing tweet, ignore it\n next if ev[:user][:screen_name] == @username # Ignore our own tweets\n\n meta = {}\n mentions = ev.attrs[:entities][:user_mentions].map { |x| x[:screen_name] }\n\n reply_mentions = mentions.reject { |m| m.downcase == @username.downcase }\n reply_mentions = [ev[:user][:screen_name]] + reply_mentions\n\n meta[:reply_prefix] = reply_mentions.uniq.map { |m| '@'+m }.join(' ') + ' '\n meta[:limit] = 140 - meta[:reply_prefix].length\n\n mless = ev[:text]\n begin\n ev.attrs[:entities][:user_mentions].reverse.each do |entity|\n last = mless[entity[:indices][1]..-1]||''\n mless = mless[0...entity[:indices][0]] + last.strip\n end\n rescue Exception\n p ev.attrs[:entities][:user_mentions]\n p ev[:text]\n raise\n end\n meta[:mentionless] = mless\n\n # To check if this is a mention, ensure:\n # - The tweet mentions list contains our username\n # - The tweet is not being retweeted by somebody else\n # - Or soft-retweeted by somebody else\n if mentions.map(&:downcase).include?(@username.downcase) && !ev[:retweeted_status] && !ev[:text].start_with?('RT ')\n log \"Mention from @#{ev[:user][:screen_name]}: #{ev[:text]}\"\n @on_mention.call(ev, meta) if @on_mention\n else\n @on_timeline.call(ev, meta) if @on_timeline\n end\n end\n end", "def send_handshake_response(socket, ws_accept)\n\tsocket << \"HTTP/1.1 101 Switching Protocols\\r\\n\" +\n\t\"Upgrade: websocket\\r\\n\" +\n\t\"Connection: Upgrade\\r\\n\" +\n\t\"Sec-WebSocket-Accept: #{ws_accept}\\r\\n\"\n end", "def stream_url\n \"https://stream.gitter.im/v1/rooms/#{@config.room_id}/chatMessages\"\n end", "def _send_result state\n unless @one_way || state.message.one_way\n # $stderr.write \"\\n _send_result #{state.result_payload.inspect}\\n\\n\"\n _write(state.result_payload, state.out_stream, state)\n true\n end\n end", "def push_to_online\n transition_to :online\n end", "def update_stream(name, params={})\n stream = ::M2X::Client::Stream.new(@client, self, \"name\" => name)\n\n stream.update!(params)\n end", "def send(data)\r\n @connected.callback { send_data data }\r\n end", "def send(data)\r\n @connected.callback { send_data data }\r\n end", "def send_voice_state_update(server_id, channel_id, self_mute, self_deaf)\n data = {\n guild_id: server_id,\n channel_id: channel_id,\n self_mute: self_mute,\n self_deaf: self_deaf\n }\n\n send_packet(Opcodes::VOICE_STATE, data)\n end", "def start\n EM.run do\n @__conn = EventMachine::WebSocketClient.connect(@__socket_url)\n\n @__callbacks[:connection_established] &&\n @__conn.callback do\n instance_exec(&@__callbacks[:connection_established])\n end\n\n @__callbacks[:error] &&\n @__conn.errback do |e|\n instance_exec(e, &@__callbacks[:error])\n end\n\n @__conn.stream do |msg|\n @__conn.close_connection if msg.data == \"done\"\n\n event = JSON.parse(msg.data)[1]\n case event['type']\n when 'paired'\n @__event_pool[:paired] = event\n\n when 'connected'\n break unless @__callbacks[:connected]\n instance_exec(&@__callbacks[:connected])\n @__event_pool[:connected] = event\n\n when 'arm_synced'\n @__event_pool[:arm_synced] = event\n\n when 'unlocked'\n puts(\"unlocked!\")\n @__event_pool[:unlocked] ||= false\n @__event_pool[:unlocked] = true\n\n when 'pose'\n\n break unless @__callbacks[:pose]\n pose = event['pose']\n puts \"this is pose: \" + pose\n #instance_exec(@__event_pool[:pose][:pose], :off, &@__callbacks[:pose]) if @__event_pool[:pose][:pose]\n instance_exec(pose, :on, &@__callbacks[:pose])\n @__event_pool[:pose] = event\n\n when 'orientation'\n break unless @__callbacks[:periodic]\n e = OpenStruct.new({\n :accel => OpenStruct.new({\n :x => event['accelerometer'][0],\n :y => event['accelerometer'][1],\n :z => event['accelerometer'][2]\n }),\n :gyro => OpenStruct.new({\n :x => event['gyroscope'][0],\n :y => event['gyroscope'][1],\n :z => event['gyroscope'][2]\n }),\n :orientation => OpenStruct.new(event['orientation'])\n })\n @__event_pool[:orientation] = e\n instance_exec(e, &@__callbacks[:periodic])\n\n end\n end\n\n @__conn.disconnect do\n EM::stop_event_loop\n end\n end\n end", "def stream!\n fail StateError, \"body has already been consumed\" if @streaming == false\n @streaming = true\n end", "def start\n @thread = Thread.new do\n EM::WebSocket.start(ws_options) do |ws|\n ws.onopen do |handshake|\n log \"onopen: #{handshake.headers}\"\n @clients << ws\n end\n\n ws.onclose do |event|\n log \"closed: #{event}\"\n @clients.delete ws\n end\n\n ws.onmessage do |msg|\n log \"received: #{msg}\"\n end\n end\n end\n end", "def online\n gateway_check\n update_status(:online, @activity, @streamurl)\n end", "def on_ws_open(ws)\n #puts \">>>> ON_WS_OPEN\"\n @ws = ws\n @data_sources.each do |name, table|\n table.on_row_added(self.object_id) do |row|\n begin\n # may want to queue events to group events into larger messages\n msg = [{:stream => name, :events => [row]}]\n ws.send_data msg.to_json\n rescue Exception => ex\n warn ex\n end\n end\n end\n end", "def send_twitch(event)\n Twitch::update_twitch_streams\n streams = Twitch::active_streams\n\n event << \"Currently active N related Twitch streams #{format_time}:\"\n if streams.map{ |k, v| v.size }.sum == 0\n event << \"None :shrug:\"\n else\n str = \"\"\n streams.each{ |game, list|\n if list.size > 0\n str += \"**#{game}**: #{list.size}\\n\"\n ss = list.take(20).map{ |stream| Twitch::format_stream(stream) }.join(\"\\n\")\n str += format_block(Twitch::table_header + \"\\n\" + ss)\n end\n }\n event << str if !str.empty?\n end\nrescue => e\n lex(e, \"Error getting current Twitch N++ streams.\", event: event)\nend", "def start_twitter_stream\n @twitter_stream = Twitter::JSONStream.connect(\n :path => '/1/statuses/filter.json',\n :auth => Settings.twitter_auth,\n :method => 'POST',\n :content => 'track='+URI.encode(@track.join(','))\n )\n @twitter_stream.each_item(&method(:on_stream_receive))\n @twitter_stream.on_error(&method(:on_stream_error))\n @twitter_stream.on_reconnect(&method(:on_stream_reconnect))\n @twitter_stream.on_max_reconnects(&method(:on_stream_max_reconnects))\n end", "def on_open(client)\n client.subscribe \"chat\"\n # let everyone know we arrived\n client.publish \"chat\", \"#{@name} entered the chat.\"\n end", "def push_to_web_sockets\n if created_at_changed?\n ActionCable.server.broadcast(\"posts\", \n data: json_view\n )\n end\n end", "def stream_callback(name, options = {}, &block)\n if not block\n throw ArgumentError\n end\n\n\n # Set instance variable for original rendering before streaming is established\n instance_variable_set(\"@#{name}\", block.call)\n\n # Check if the request is initial or for streaming content\n #\n # If the request is not for streaming ignore the rest of the code\n unless params[STREAMING_PARAM]\n return false\n else\n\n response.headers['Content-Type'] = 'text/event-stream'\n\n connection = Strwatch::Connection.new(response.stream, name)\n\n lambda { connection.stream(block.call, options) }\n end\n end", "def send_data(raw_data)\n encoded_message = encode(raw_data)\n Rails.logger.debug { \"#{Time.zone.now.getutc.inspect}: Sending to #{@socket.url}: #{encoded_message.inspect}\" }\n # Send the message to the WebSocket connection _immediately_\n # by scheduling it for the next execution of the EventMachine reactor run.\n # Otherwise, the message might be queued causing delays for users.\n EventMachine.next_tick do\n @socket.send(encoded_message)\n end\n end", "def send_whisper(user, message)\n @bot.message_queue.push(\"PRIVMSG #jtv :/w #{user} #{message}\")\n end", "def push(stream, object)\n post stream, object\n end", "def send_raw(to, msg, dlr_url='')\n log_an_event(\"Gateway::TestSession\", \"send raw #{[to, msg, dlr_url].join(' ')} \")\n @events.push([\"send_raw\", {:to=>to, :msg=>msg, :dlr_url=>dlr_url}])\n\n wait_for_response = false\n status = \"sent\"\n status_string = \"TestSession\"\n [wait_for_response, status, status_string]\n end", "def stream(name, url)\n gateway_check\n update_status(@idletime, name, url)\n name\n end", "def publish_to_socket(params)\n message = params.to_json\n data = \"~m~#{message.length}~m~#{message}\"\n @socket.send(data)\n end", "def send(event, data = {})\n\t\[email protected]({:event => event, :data => data}.to_json)\n\tend", "def start\n # Eventmachine run\n EM.run do\n # set what to do on message from websocket\n on_message\n\n # set what to do on close of websocket connection\n on_close\n end\n end", "def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end" ]
[ "0.6672159", "0.6465095", "0.6435608", "0.6408094", "0.6408094", "0.6188834", "0.61855716", "0.5950496", "0.59468573", "0.5927827", "0.590224", "0.5900619", "0.5715108", "0.5707985", "0.56854737", "0.56694293", "0.5641432", "0.5627343", "0.56225497", "0.5613962", "0.5593259", "0.5591205", "0.55718446", "0.5537879", "0.55120045", "0.5509483", "0.55066514", "0.54828376", "0.54712605", "0.5467473", "0.53918135", "0.5376183", "0.5368663", "0.53588665", "0.5343076", "0.53378075", "0.5308946", "0.5306033", "0.53000206", "0.529945", "0.529133", "0.528434", "0.5271332", "0.52710533", "0.5254941", "0.52537477", "0.52499783", "0.5247283", "0.5246843", "0.52352417", "0.5229581", "0.52209634", "0.52180976", "0.52079123", "0.52031684", "0.5197985", "0.5176886", "0.51724225", "0.5171066", "0.5149972", "0.51473063", "0.51456434", "0.5139128", "0.51379335", "0.5135548", "0.51285076", "0.51278615", "0.51265955", "0.5117583", "0.51118857", "0.51101863", "0.510164", "0.5101107", "0.509508", "0.5090382", "0.50879055", "0.50826335", "0.5081591", "0.5077758", "0.5077758", "0.50728506", "0.5063142", "0.50617385", "0.5057392", "0.5053843", "0.50506496", "0.50488955", "0.5042565", "0.50393385", "0.50369644", "0.5035088", "0.50304264", "0.50297767", "0.5029257", "0.5028673", "0.5022299", "0.5016205", "0.5014978", "0.5002109", "0.49864942" ]
0.86023664
0
Generate a Clickatellstyle response like ID: ny4eiyiac4qfy7do4mgrydqyacoen652 To: 2348162522097 ID: dxvtg2o9jhbqe4edifn026905st8mpz4 To: 2348162522102
def generate_response if @numbers.size == 1 @mock_response = "ID: #{rand_string(32)}" # Phone number is not given when it's the only one else @mock_response = @numbers.map{|number| "ID: #{rand_string(32)} To: #{number}"}.join("\n") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate\n blake160_bin = [blake160[2..-1]].pack(\"H*\")\n type = [\"01\"].pack(\"H*\")\n bin_idx = [\"P2PH\".each_char.map { |c| c.ord.to_s(16) }.join].pack(\"H*\")\n payload = type + bin_idx + blake160_bin\n ConvertAddress.encode(@prefix, payload)\n end", "def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end", "def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n details = [uid, code]\n parameters = {\n uid: uid,\n code: code\n }\n query_string = parameters.to_a.map { |x| \"#{x[0]}=#{x[1]}\" }.join(\"&\")\n url = \"https://api.wavecell.com/otp/v1/#{sub_account}/#{uid}?code=#{code}\"\n HTTParty.get(url.to_str,\n :body => parameters.to_json,\n :headers => {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{api_key}\"\n })\n end", "def generate_response_xml\n builder = Builder::XmlMarkup.new\n builder.instruct!\n\n builder.imsx_POXEnvelopeResponse(\"xmlns\" => \"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0\") do |env|\n env.imsx_POXHeader do |header|\n header.imsx_POXResponseHeaderInfo do |info|\n info.imsx_version \"V1.0\"\n info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier\n info.imsx_statusInfo do |status|\n status.imsx_codeMajor @code_major\n status.imsx_severity @severity\n status.imsx_description @description\n status.imsx_messageRefIdentifier @message_ref_identifier\n status.imsx_operationRefIdentifier @operation\n end\n end\n end #/header\n env.imsx_POXBody do |body|\n unless unsupported?\n if @operation == OutcomeRequest::READ_REQUEST\n body.tag!(@operation + 'Response') do |request|\n request.result do |res|\n res.resultScore do |res_score|\n res_score.language \"en\" # 'en' represents the format of the number\n res_score.textString @score.to_s\n end\n end #/result\n end\n else\n body.tag!(@operation + 'Response')\n end #/operationResponse\n end\n end #/body\n end\n end", "def build_response_packet\n rpacket = RCon::Packet::Source.new\n total_size = 0\n request_id = 0\n type = 0\n response = \"\"\n message = \"\"\n message2 = \"\"\n\n tmp = @socket.recv(4)\n if tmp.nil?\n return nil\n end\n size = tmp.unpack(\"V1\")\n tmp = @socket.recv(size[0])\n request_id, type, message, message2 = tmp.unpack(\"V1V1a*a*\")\n total_size = size[0]\n \n #puts \"size: \"+size.to_s \n #puts \"type: \"+type.to_s\n #puts \"message: \"+message\n #puts \"message2: \"+message2\n \n rpacket.packet_size = total_size\n rpacket.request_id = request_id\n rpacket.command_type = type\n \n # strip nulls (this is actually the end of string1 and string2)\n message.sub! /\\x00\\x00$/, \"\"\n message2.sub! /\\x00\\x00$/, \"\"\n rpacket.string1 = message\n rpacket.string2 = message2\n return rpacket\n end", "def build_response(response)\n \"HTTP/1.1 #{response[:status_code]} #{response[:status_message]}\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{response[:bytesize]}\\r\\n\" +\n \"Connection: close\\r\\n\"\n end", "def generate_free_insurance_id\n return 'AiShanXing' + DateTime.current.in_time_zone('Beijing').to_s(:number) + ('0'..'9').to_a.shuffle[0..3].join\n end", "def generic_Generate_Response(initial,headers,body)\n\ts=initial\n\ts << \"\\r\\n\" << headers # headers start in second line\n\tif body.length>0\n\t\ts << \"\\r\\n\" << body # body start after a blank line, first \\r\\n is for change line from headers, second is for blank line\n\tend\n\treturn s\nend", "def next_id!\n\t\t\t# Using sequential numbers for the query ID is generally a bad thing because over UDP they can be spoofed. 16-bits isn't hard to guess either, but over UDP we also use a random port, so this makes effectively 32-bits of entropy to guess per request.\n\t\t\tSecureRandom.random_number(2**16)\n\t\tend", "def construct_route_id rtsys, rtnumber, city, county\n size = if rtnumber.size == 8\n # It looks like sometimes the Jurisdiction is included...\n 8\n elsif rtnumber =~ /[A-Z]/\n 5\n else\n 4\n end\n \n jurisdiction = if rtnumber.size == 8\n \"\"\n elsif [\"01\", \"02\", \"03\"].include? rtsys\n \"0000\"\n elsif [\"05\", \"10\"].include? rtsys\n city\n else\n \"#{county}00\"\n end\n \n \"#{rtsys}#{jurisdiction}#{rtnumber.rjust(size, '0')}\"\n end", "def build_response_packet\n rpacket = RCon::Packet::Source.new\n total_size = 0\n request_id = 0\n type = 0\n response = \"\"\n message = \"\"\n \n\n loop do\n break unless IO.select([@socket], nil, nil, 10)\n\n #\n # TODO: clean this up - read everything and then unpack.\n #\n\n tmp = @socket.recv(14)\n if tmp.nil?\n return nil\n end\n size, request_id, type, message = tmp.unpack(\"VVVa*\")\n total_size += size\n \n # special case for authentication\n break if message.sub! /\\x00\\x00$/, \"\"\n\n response << message\n\n # the 'size - 10' here accounts for the fact that we've snarfed 14 bytes,\n # the size (which is 4 bytes) is not counted, yet represents the rest\n # of the packet (which we have already taken 10 bytes from)\n\n tmp = @socket.recv(size - 10)\n response << tmp\n response.sub! /\\x00\\x00$/, \"\"\n end\n \n rpacket.packet_size = total_size\n rpacket.request_id = request_id\n rpacket.command_type = type\n \n # strip nulls (this is actually the end of string1 and string2)\n rpacket.string1 = response.sub /\\x00\\x00$/, \"\"\n return rpacket\n end", "def build_client_algorithm_packet; end", "def build_transaction_info\r\n if info_available?\r\n @message = qsi_response\r\n all_keys.each do |key|\r\n key.chomp!\r\n @response[key] = digital_reciept_info(key)\r\n end \r\n end\r\n end", "def build_tracking_id\n self.tracking_id ||= SecureRandom.base64(6)\n end", "def build_packet\n return [@request_id, @command_type, @string1, @string2].pack(\"VVa#{@string1.length}a2\")\n end", "def logs_response\n \"\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35272 ttl=52 time=36.9 ms\\n\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35273 ttl=52 time=35.3 ms\\n\"\n end", "def build_xur_message(response)\n # Set up our client\n destiny_client = DestinyAPI::Base.new(api_key)\n # Set xur to our clients xur method\n xur = destiny_client.xur\n\n items = []\n xur.each do |key, value|\n value.each do |key, value|\n item_name = destiny_client.get_manifest_item(6, key[:item_hash])['itemName']\n item_cost = key[:item_cost]\n item_cost_name = destiny_client.get_manifest_item(6, key[:item_cost_hash])['itemName']\n constructed_item = \"#{item_name}, #{item_cost} #{item_cost_name}\"\n items << constructed_item\n end\n end\n \n # Check vendorDetails to see if anything is availible.\n if xur.nil?\n # If nothing, send to chat that he isn't there.\n response.reply \"Xur isn't in game right now.\"\n else\n #If something, send to chat what he is selling.\n response.reply \"*Xur is selling:*\\n#{items.join(\"\\n\")}\"\n end\n end", "def build_xur_message(response, color)\n # Set up our client\n destiny_client = Destiny::Client.new(api_key)\n # Set xur to our clients xur method\n xur = destiny_client.xur\n\n # Check vendorDetails to see if anything is availible.\n if xur.nil?\n # If nil, send to chat that he isn't there.\n response.reply \"Xur isn't in the game world right now.\"\n else\n # If not nil, cycle over items and build our items array.\n items = []\n xur.each do |key, value|\n value.each do |key, value|\n item_name = destiny_client.get_manifest_item(6, key[:item_hash])['itemName']\n item_cost = key[:item_cost]\n item_cost_name = destiny_client.get_manifest_item(6, key[:item_cost_hash])['itemName']\n constructed_item = \"#{item_name}, #{item_cost} #{item_cost_name}\"\n items << constructed_item\n end\n end\n # Once parsed, send completed message to chat.\n response.reply \"*Xur is selling:*\\n#{items.join(\"\\n\")}\"\n end\n end", "def request_results\n\t\t\">0002009300\\r00\"\n\tend", "def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n puts `curl -X POST https://api.wavecell.com/sms/v1/#{sub_account}/single -H \"Authorization: Bearer #{api_key}\" -H \"Content-Type: application/json\" -d $'{ \"source\": \"#{source}\", \"destination\": \"+63#{destination}\", \"text\": \"#{text}\", \"encoding\": \"#{encoding}\" }'`\n end", "def generate\n generate_full_payload_address\n end", "def to_s\n [1, message_id, self.class.expires_at, 0, 32, device_token, 0, payload_size, payload].pack('ciiccH*cca*')\n end", "def create_packet(lookup_host, transaction_ID) \n packet = [transaction_ID, FLAGS, QUESTIONS, ANSWERS, AUTHORITY_RRS, ADDITIONAL_RRS].pack(\"S>S>S>S>S>S>\")\n packet += encode_lookup_host(lookup_host)\n packet += [TYPE_A, CLASS_IN].pack(\"S>S>\")\n \n return packet\nend", "def send_response\n\t # Create response packet\n udp_packet = PacketFu::UDPPacket.new(:config => @cfg)\n \n udp_packet.udp_src = @packet.udp_dst\n udp_packet.udp_dst = @packet.udp_src\n udp_packet.eth_daddr = @victim_mac\n udp_packet.ip_daddr = @victim_ip\n udp_packet.ip_saddr = @packet.ip_daddr\n udp_packet.payload = @packet.payload[0, 2]\n \n udp_packet.payload += \"\\x81\\x80\" + \"\\x00\\x01\" + \"\\x00\\x01\"\n udp_packet.payload += \"\\x00\\x00\" + \"\\x00\\x00\"\n \n @domain_name.split('.').each do |part|\n udp_packet.payload += part.length.chr\n udp_packet.payload += part\n end # @domain_name.split('.').each do |part|\n\n udp_packet.payload += \"\\x00\\x00\\x01\\x00\" + \"\\x01\\xc0\\x0c\\x00\"\n udp_packet.payload += \"\\x01\\x00\\x01\\x00\" + \"\\x00\\x1b\\xf9\\x00\" + \"\\x04\"\n \n # Address\n spoof_ip = @spoof_ip.split('.')\n udp_packet.payload += [spoof_ip[0].to_i, spoof_ip[1].to_i, spoof_ip[2].to_i, spoof_ip[3].to_i].pack('c*')\n \n udp_packet.recalc\n \n\t send(udp_packet, @iface) \n end", "def bookdevice(token, duration = 5 , id)\n\nuri = URI.parse(\"https://device.pcloudy.com/api/book_device\")\n@toSend = {\n \"token\" => token ,\"duration\"=>duration, \"id\"=>id\n}.to_json\n\nhttps = Net::HTTP.new(uri.host,uri.port)\nhttps.use_ssl = true\n\nreq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n\nreq.body = \"#{@toSend}\"\nres = https.request(req)\nputs \"Response #{res.code} #{res.message}: #{res.body}\"\nbookingdetails = JSON.parse(res.body)\n\nrid = bookingdetails[\"result\"][\"rid\"]\nreturn rid\nend", "def encode_SAMLResponse(nameID, opts = {})\n now = Time.now.utc\n response_id, reference_id = UUID.generate, UUID.generate\n audience_uri = opts[:audience_uri] || saml_acs_url[/^(.*?\\/\\/.*?\\/)/, 1]\n issuer_uri = opts[:issuer_uri] || (request && request.url) || \"http://example.com\"\n assertion_attributes = opts[:attributes] || []\n\n # Additional assertion attributes\n attr_assertions = \"\"\n assertion_attributes.each do |key,value|\n real_value = ((value.is_a?(Hash) || value.is_a?(Array)) ? value.to_json : value)\n attr_assertions += %[<Attribute Name=\"#{key}\"><AttributeValue>#{real_value}</AttributeValue></Attribute>]\n end\n\n assertion = %[<Assertion xmlns=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"_#{reference_id}\" IssueInstant=\"#{now.iso8601}\" Version=\"2.0\"><Issuer>#{issuer_uri}</Issuer><Subject><NameID Format=\"#{NAME_ID_FORMAT}\">#{nameID}</NameID><SubjectConfirmation Method=\"urn:oasis:names:tc:SAML:2.0:cm:bearer\"><SubjectConfirmationData InResponseTo=\"#{@saml_request_id}\" NotOnOrAfter=\"#{(now+3*60).iso8601}\" Recipient=\"#{@saml_acs_url}\"></SubjectConfirmationData></SubjectConfirmation></Subject><Conditions NotBefore=\"#{(now-5).iso8601}\" NotOnOrAfter=\"#{(now+60*60).iso8601}\"><AudienceRestriction><Audience>#{audience_uri}</Audience></AudienceRestriction></Conditions><AttributeStatement><Attribute Name=\"mno_uid\"><AttributeValue>#{nameID}</AttributeValue></Attribute>#{attr_assertions}</AttributeStatement><AuthnStatement AuthnInstant=\"#{now.iso8601}\" SessionIndex=\"_#{reference_id}\"><AuthnContext><AuthnContextClassRef>urn:federation:authentication:windows</AuthnContextClassRef></AuthnContext></AuthnStatement></Assertion>]\n\n digest_value = Base64.encode64(algorithm.digest(assertion)).gsub(/\\n/, '')\n\n signed_info = %[<ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-#{algorithm_name}\"></ds:SignatureMethod><ds:Reference URI=\"#_#{reference_id}\"><ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"></ds:Transform><ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig##{algorithm_name}\"></ds:DigestMethod><ds:DigestValue>#{digest_value}</ds:DigestValue></ds:Reference></ds:SignedInfo>]\n\n signature_value = sign(signed_info).gsub(/\\n/, '')\n\n signature = %[<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">#{signed_info}<ds:SignatureValue>#{signature_value}</ds:SignatureValue><KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><ds:X509Data><ds:X509Certificate>#{self.x509_certificate}</ds:X509Certificate></ds:X509Data></KeyInfo></ds:Signature>]\n\n assertion_and_signature = assertion.sub(/Issuer\\>\\<Subject/, \"Issuer>#{signature}<Subject\")\n\n xml = %[<samlp:Response ID=\"_#{response_id}\" Version=\"2.0\" IssueInstant=\"#{now.iso8601}\" Destination=\"#{@saml_acs_url}\" Consent=\"urn:oasis:names:tc:SAML:2.0:consent:unspecified\" InResponseTo=\"#{@saml_request_id}\" xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"><Issuer xmlns=\"urn:oasis:names:tc:SAML:2.0:assertion\">#{issuer_uri}</Issuer><samlp:Status><samlp:StatusCode Value=\"urn:oasis:names:tc:SAML:2.0:status:Success\" /></samlp:Status>#{assertion_and_signature}</samlp:Response>]\n\n Base64.encode64(xml)\n end", "def response_for_offer_create(params)\n {\"response\" => { \"status\" => 1, \"data\" => rand(1_000_000).to_s } }\n end", "def to_string()\n\t\t# Make sure there is a carridge return, so remove it if there is one and add it back\n\t\treturn encrypt @response.to_s.chomp + \"\\n\"\n\tend", "def to_s\n flags = [ ]\n flags << 'qr' if (response?)\n flags << 'aa' if (authorative?)\n flags << 'tc' if (truncated?)\n flags << 'rd' if (recursion_desired?)\n flags << 'ra' if (recursion_available?)\n \n \";; HEADER:\\n;; opcode: #{opcode.to_s.upcase} status: #{response_code.to_s.upcase} id: #{id} \\n\" +\n \";; flags: #{flags.join(' ')}; QUERY: #{questions.length}, ANSWER: #{answers.length}, AUTHORITY: #{nameservers.length}, ADDITIONAL: #{additional_records.length}\" +\n \"\\n\" +\n \";; QUESTION SECTION:\\n\" +\n questions.collect(&:to_s).join(\"\\n\") + \"\\n\" +\n \";; ANSWER SECTION:\\n\" +\n answers.collect(&:to_s).join(\"\\n\") + \"\\n\" +\n \";; NAMESERVER SECTION:\\n\" +\n nameservers.collect(&:to_s).join(\"\\n\") + \"\\n\" +\n \";; ADDITIONAL SECTION:\\n\" +\n additional_records.collect(&:to_s).join(\"\\n\") + \"\\n\"\n end", "def response_line\n \"#{Protocol::NAME}/#{@version} #{@code} #{@message}#{Protocol::CRLF}\"\n end", "def get_trans_id()\n return @RESPONSE_HASH['RRNO']\n end", "def get_verification_details\n make_gps_server_handshake\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n attributes['Consent'] = consent unless consent.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:Response', attributes) {\n xml << issuer.to_xml unless issuer.nil?\n xml << signature.to_xml unless signature.nil?\n # TODO: add extensions support\n xml << status.to_xml unless status.nil?\n assertions.each { |assertion| xml << assertion.to_xml }\n encrypted_assertions.each { |encrypted_assertion| xml << encrypted_assertion.to_xml }\n }\n end", "def request_id\n SecureRandom.hex(17)\n end", "def request_id\n SecureRandom.hex(17)\n end", "def response\n response_parts = []\n response_parts << '\"version\": \"1.1\"'\n response_parts << '\"id\": ' + @id.to_json if @id\n if @error\n response_parts << '\"error\": ' + {:name => 'JSONRPCError'}.merge(@error).to_json\n else\n response_parts << '\"result\": ' + @result.to_json\n end\n '{' + response_parts.join(', ') + \"}\\n\" \n end", "def build_id o=@origin_id, m=@metric_id\n\t\t\"#{o}#{SEP}#{m}\"\n\tend", "def generate_id\n SecureRandom.urlsafe_base64 21\n end", "def successful_purchase_response\n 'response=1&responsetext=SUCCESS&authcode=123456&transactionid=1869031575&avsresponse=N&cvvresponse=N&orderid=1&type=auth&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end", "def generateTripElement(id, trip)\n from = nil ;\n to = nil ;\n via = [] ;\n trip.each{|edge|\n if(from.nil?) then\n from = edge ;\n else\n via.push(edge) ;\n end\n }\n to = via.pop() ;\n \n tripXmlHead = [nil, 'trip',\n ['id', id],\n ['from', from],\n ['to', to],\n ['depart', \"0\"]] ;\n if(via.length > 0) then\n viaString = via.join(' ') ;\n tripXmlHead.push(['via', viaString]) ;\n end\n \n return [tripXmlHead] ;\n end", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end", "def generate_id(_)\n accurate_timestamp = (Time.now.to_f * 1000).round\n time_part = (accurate_timestamp - DISCORD_EPOCH) << 22\n random_part = rand(0...2**22)\n\n time_part | random_part\n end", "def api_url(id)\n name = get_tourney_name(id)\n return \"https://api.challonge.com/v1/tournaments/uxie#{id}#{name}\"\nend", "def outboundcall\n # This FromPhoneNumber should have been verified in the associated sub-account\n render_twiml generateTwiml(params[:FromPhoneNumber], params[:ToPhoneNumber])\n end", "def build_UUID\n uuid = \"\"\n segment = \"\"\n character_set = ('a'..'f').to_a + (0..9).to_a\n\n sections = [8, 4, 4, 4, 12]\n uuid = sections.map do |section|\n segment = \"\"\n section.times do \n segment += character_set.sample.to_s \n end\n segment\n end.join('-')\nend", "def generate_server_challenge(&block)\n \"\\x11\\x22\\x33\\x44\\x55\\x66\\x77\\x88\"\n end", "def generate(n=1, idspace=0)\n failures ||= 0\n\n if failures > 0\n disconnect\n connect\n elsif @socket.nil?\n connect\n end\n\n request_id(n, idspace)\n fetch_id(n)\n\n rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EPIPE\n failures += 1\n retry if failures < MAX_RETRIES\n raise\n end", "def get_token\n campaign_id = Campaign.find(params[:id]).id \n call = Call.new\n call.campaign_id = campaign_id\n call.target_name = call.campaign.target_name\n call.twilio_token\n render :json => call\n end", "def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end", "def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def return_uuid\n possible = []\n possible << ('a'..'f').to_a\n possible << ('0'..'9').to_a\n possible.flatten!\n uuid = ''\n\n sample = [8, 4, 4, 4, 12]\n\n sample.each_with_index do | value, index |\n value.times { uuid += possible.sample }\n uuid += '-' unless sample.size <= index + 1\n end\n\n uuid\nend", "def generate_account\n toll_free = @client.available_phone_numbers('US').toll_free.list(limit: 1)\n\n toll_free.each do |record|\n \n incoming_phone_number = @client.incoming_phone_numbers.create(phone_number: record.phone_number)\n\n puts incoming_phone_number.sid\n end\n\n \n end", "def create\n #Persist AT API Params\n @ussd = Ussd.new(sessionId: params[:sessionId], serviceCode: params[:serviceCode], phoneNumber: params[:phoneNumber], text: params[:text])\n @response = Response.new\n if @ussd.save\n # redirect_to ussd_path, :notice => \"Your post was saved\"\n # Reads the variables sent via POST from our gateway\n sessionId = @ussd.sessionId\n serviceCode = @ussd.serviceCode\n phoneNumber = @ussd.phoneNumber\n text = @ussd.text\n\n if ( text == \"\" )\n\n # This is the first request. Note how we start the response with CON\n response = \"CON What would you like to do? \\n\"\n response += \"1. is the value of happiness \\n\"\n response += \"2. is the formula of laughing\"\n @response.now = response\n\n elsif ( text == \"1\" )\n\n # Your business logic to determine the account number goes here\n accountNumber = \"ACC1001\"\n # This is a terminal request. Note how we start the response with END\n response = \"END Your account number is $accountNumber\"\n @response.now = response\n\n elsif ( text == \"2\" )\n\n # Your business logic to determine the balance goes here\n balance = \"KES 1,000\"\n # This is a terminal request. Note how we start the response with END\n response = \"END Your balance is $balance\"\n @response.now = response\n end\n\n # Print the response onto the page so that our gateway can read it\n #header('Content-type: text/plain');\n render plain: @response.now\n puts \"Content-Type: text/plain\"\n puts @response.now\n\n # DONE!!!\n else\n render \"new\"\n end\n end", "def response_id\n self['id']\n end", "def outgoing\n from_phone = parse_sim_sid(params[:From])\n response = Twilio::TwiML::VoiceResponse.new\n response.dial(caller_id: from_phone) do |d|\n d.number params[:To]\n end\n\n render xml: response.to_xml\n end", "def build_line(id)\n mailaddr = encode_mail(id)\n status = @stats[id]\n \"#{id},#{@names[id]},#{@passwords[id]},#{mailaddr},\" \\\n \"#{build_winlose(**status)}\"\n end", "def convert_id(opts)\n opts = opts.clone\n req = build_soap! do |type, builder|\n if(type == :header)\n else\n builder.nbuild.ConvertId {|x|\n }\n end\n end\n do_soap_request(req)\n end", "def make_id(msg)\n msg_hash = JSON.parse(msg)\n hostname = msg_hash['server']['hostname']\n package = msg_hash['package']['name']\n arch = msg_hash['package']['arch']\n Base64.encode64(hostname + package + arch)\n end", "def generate_notification\n service_msg_number =\n sigparams =\n requried_service_params =\n SacPS::Auth::Banklink.generate_signature(service_msg_number, sigparams, required_service_params)\n end", "def to_reference\n \"#{ @sender },#{ @identifier },#{ RCAP.to_s_for_cap( @sent )}\"\n end", "def get_request_id()\n\t\t\t@random_instance ||= Random.new\n\t\t\tBase64.urlsafe_encode64(@random_instance.bytes(12))\n\t\tend", "def build_response(options={})\n\t\t\n\t\tresponses = []\n\n\t\tone_response = ''\n\n\t\tputs \"sample ids are:\"\n\t\tputs self.sample_ids\n\n\t\treturn responses unless sample_ids\n\n\t\tself.sample_ids.each_with_index {|sid,key|\n\t\t\tputs \"doing sample id: #{sid}\"\n\t\t\t## tests are got from the requisitions hash.\n\t\t\ttests = get_tests(sid)\n\t\t\tputs \"tests are: #{tests}\"\n\t\t\t## default sequence number is 0 (THIS MAY LEAD TO PROBLEMS.)\n\t\t\tsequence_number = \"#{key.to_s}\"\n\n\t\t\t## default patient id:\n\t\t\tpatient_id = \"abcde#{Time.now.to_i.to_s}\"\n\t\t\t\n\t\t\tpatient = Patient.new({:sequence_number => sequence_number, :patient_id => patient_id})\n\t\t\t\n\t\t\torder = Order.new({:sequence_number => patient.sequence_number, :specimen_id => sid, :tests => tests, :priority => \"R\"})\n\n\t\t\tresponses << (patient.build_response(options) + order.build_response(options.merge({sequence_number: self.sequence_number, carrier_number: self.carrier_number, position_number: self.position_number, sample_type: self.sample_type, container_type: self.container_type})))\n\n\t\t}\n\n\t\tputs \"responses are:\"\n\t\tputs responses.to_s\n\n\t\treturn responses\n\t\t\n\tend", "def generate_identifier_token\n self.identifier_token ||= loop do\n token = ('%015i' % random_number)\n break token unless self.class.find_by_identifier_token(token)\n end\n\n self.twilio_conference_name ||= identifier_token\n end", "def generate_trace_id\n loop do\n id = Random.bytes(16)\n return id unless id == INVALID_TRACE_ID\n end\n end", "def create_b2bua_response(session, orig_response=session.iresponse)\n peer_session = get_peer_session(session)\n if peer_session\n r = peer_session.create_response(orig_response.code)\n r.copy_from(orig_response, :content, :content_type, :path, :service_route, :privacy, :warning)\n return r\n else\n @ilog.warn(\"No peer session found, cannot create the response\") if @ilog.warn?\n raise \"Unable to create response\"\n end \n end", "def rest_generate_token(id)\n db = Mysql.new(config['mysql_server'], config['mysql_admin'], config['mysql_admin_password'], \"tatoc\")\n uuid = nil\n rows = db.query(\"select uuid from rest where id=#{id}\")\n rows.each do |row|\n uuid = row[0]\n end\n if uuid == nil\n response = Hash.new\n response['error']=\"Invalid Session ID\"\n return response\n end\n timestamp = Time.now.to_i\n private_key = Digest::MD5.hexdigest(\"#{uuid}#{timestamp}\")\n\n db.query(\"update rest set private_key=\\\"#{private_key}\\\", key_generated_at=#{timestamp} where id=#{id}\")\n response = Hash.new\n response['token']=private_key\n response['expires']=timestamp + 30\n response\n end", "def generate_short_url\n # encode base 10 id as base 62 string as seen here https://gist.github.com/zumbojo/1073996\n i = id\n return Constants::ALPHABET[0] if i.zero?\n s = ''\n base = Constants::ALPHABET.length\n while i > 0\n s << Constants::ALPHABET[i.modulo(base)]\n i /= base\n end\n update_attributes(short_url: s.reverse)\n end", "def response_mailing_information(id, action = 'sends', params = {})\n get(\"/response/#{id}/#{action}\", params)\n end", "def printhostresp(response)\n text = \"\"\n response.each do |resp|\n if resp[:body].is_a?(String)\n text += \"#{resp[:senderid]}:\"\n text += \" \" + resp[:body].split(\"\\n\").join(\"\\n \") + \"\\n\\n\"\n elsif resp[:body].is_a?(Array)\n text += \"#{resp[:senderid]}:\"\n text += \" \" + resp[:body].join(\"\\n \") + \"\\n\\n\"\n else\n text += \"#{resp[:senderid]} responded with a #{resp[:body].class}\"\n end\n end\n\n text\n end", "def build_enrollment_response!(csr)\n extract_challenge_password!(csr)\n generate_device_certificate!(csr)\n degenerate_sequence = build_degenerate_sequence\n enveloped_data_sequence = build_enveloped_data_sequence(degenerate_sequence)\n @enrollment_response = build_signed_data_sequence(enveloped_data_sequence)\n end", "def capturar_prox_indece_representante\n\n require \"rubygems\"\n require 'json'\n require \"net/http\"\n require 'yaml'\n \n uri = URI( 'http://162.243.215.24/PDV/COUNTERS_get_next')\n resp = Net::HTTP.post_form(uri,'counter'=>\"pdd\" )\n @record=JSON.parse(resp.body)\n @record['id']\n #função ok\n end", "def get_response\n\t\tauthenticator = Authenticators::IamAuthenticator.new(\n \t\tapikey: @room.apikey\n\t\t)\n\t\t\n\t\tassistant = AssistantV2.new(\n \t\tversion: \"2019-02-28\",\n \t\tauthenticator: authenticator\n\t\t)\n\t\t\n\t\terror = false\n\t\tbegin\n\t\t\tresponse = assistant.message(\n\t\t\t\tassistant_id: @room.assistantid,\n\t\t\t\tsession_id: @room.sessionid,\n\t\t\t\tinput: {\n\t\t\t\t\ttext: @room_message.message\n\t\t\t\t}\n\t\t\t)\n\t\t\t\n\t\t\t#check if session is expired\n\t\t\trescue IBMWatson::ApiException => ex\n\t\t\t\terror = true\n\t\t\t\trefresh_session\n\t\tend\n\t\t\n\t\tinterpret_response(response) if !error\n end", "def sip_responses\n hashed_sip[appt_id]\n end", "def create_response(response)\r\n\r\n#\r\n#\tSetup default response values.\r\n#\r\n message = nil\r\n authorization = nil\r\n success = false\r\n exception = nil\r\n#\r\n#\tExtract key elements from the response.\r\n#\r\n reasonCode = response.Get(RocketGate::GatewayResponse::REASON_CODE);\r\n message = @@response_codes[('r' + reasonCode).to_sym] || \"ERROR - \" + reasonCode\r\n responseCode = response.Get(RocketGate::GatewayResponse::RESPONSE_CODE);\r\n if ((responseCode != nil) && (responseCode == \"0\"))\r\n success = true; # Transaction succeeded\r\n authorization = response.Get(RocketGate::GatewayResponse::TRANSACT_ID);\r\n else\r\n exception = response.Get(RocketGate::GatewayResponse::EXCEPTION);\r\n end\r\n\r\n#\r\n#\tExtract values that are not dependent up success/failure.\r\n#\r\n avsResponse = response.Get(RocketGate::GatewayResponse::AVS_RESPONSE)\r\n cvv2Response = response.Get(RocketGate::GatewayResponse::CVV2_CODE)\r\n fraudResponse = response.Get(RocketGate::GatewayResponse::SCRUB_RESULTS)\r\n\r\n#\r\n#\tCreate the response object.\r\n#\r\n card_hash = response.Get(RocketGate::GatewayResponse::CARD_HASH)\r\n Response.new(success, message, {:result => responseCode, :exception => exception, :card_hash => card_hash},\r\n :test => test?,\r\n :authorization => authorization,\r\n :avs_result => {:code => avsResponse},\r\n :cvv_result => cvv2Response,\r\n :fraud_review => fraudResponse\r\n )\r\n end", "def successful_purchase_response\n \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\r\\n<string xmlns=\\\"https://ws101.pelecard.biz/\\\">0000000532610035128471011000409153300000100 000000001011 150 0000000000000000000000000073001062 \\xC6\\x92\\xCB\\x9C\\xE2\\x80\\x94\\xCB\\x9C\\xCB\\x86\\xE2\\x80\\x98\\xC2\\x8E/\\xE2\\x80\\x9E\\xC2\\x90\\xE2\\x80\\xB0\\xCB\\x86\\xC2\\x8C\\xE2\\x80\\x9D0 \\r\\n</string>\"\n end", "def translate_response(start_locations, end_locations, response)\n final_output = {}\n o_addresses = response[\"origin_addresses\"]\n d_addresses = response[\"destination_addresses\"]\n rows = response[\"rows\"]\n\n start_locations.each_with_index do |location, o_index|\n\n dest_hash = {\"origin_address\" => o_addresses[o_index], \"destinations\" => {} }\n\n rows[o_index][\"elements\"].each_with_index do |destination_details, d_index|\n d = {}\n d[\"distance\"] = destination_details[\"distance\"][\"value\"]\n d[\"distance_text\"] = destination_details[\"distance\"][\"text\"]\n d[\"duration\"] = destination_details[\"duration\"][\"value\"]\n d[\"duration_text\"] = destination_details[\"duration\"][\"text\"]\n d[\"address\"] = d_addresses[d_index]\n\n dest_hash[\"destinations\"][end_locations[d_index]] = d\n end\n\n final_output[location] = dest_hash\n end\n\n final_output\nend", "def tingyun_externel_guid\n guid = ''\n 16.times do\n guid << (0..15).map{|i| i.to_s(16)}[rand(16)]\n end\n guid\n end", "def generate_id\n SecureRandom.hex(8)\n end", "def send_code_to_land(number)\n # generate random 4 digit number\n @random_4 = rand(9999).to_s\n logger.info(\"random digits generated for land: \" + @random_4)\n \n # call a landline number\n # TODO: update the \"805\" in the URL to be dynamic\n begin\n @cloudvox_api[\"/api/v1/http/applications/872/dial\"].post :destination => number, :random_4 => @random_4\n rescue Exception => e\n logger.error(\"Exception from 'send_code_to_land': \" + e.message)\n return nil\n else\n return @random_4\n end\n end", "def _convertN3() \n\t\tretval = \"\"\n\t\tself.response.each do |l|\n\t\t\tretval += l\n end\n\t\treturn retval\n\tend", "def message_send_device_id() -1003; end", "def create( options )\n\t\t\topt = { :transaction_id => nil, \n\t\t\t\t:in_response_to => nil,\n\t\t\t\t:status => \"urn:oasis:names:tc:SAML:2.0:status:Success\", \n\t\t\t\t:extra_parameters => nil }.merge(options)\n\t\t\treturn nil if opt[:transaction_id].nil?\n\t\t\t@response = REXML::Document.new\n\t\t\[email protected][:attribute_quote] = :quote\n\t\t\tuuid = \"_\" + UUID.new.generate\n\t\t\ttime = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n\t\t\troot = @response.add_element \"saml2p:LogoutResponse\", { \"xmlns:saml2p\" => PROTOCOL }\n\t\t\troot.attributes['ID'] = uuid\n\t\t\troot.attributes['IssueInstant'] = time\n\t\t\troot.attributes['Version'] = \"2.0\"\n\t\t\t# Just convenient naming to accept both names as InResponseTo\n\t\t\tif opt[:transaction_id] \n\t\t\t\troot.attributes['InResponseTo'] = opt[:transaction_id]\n\t\t\telsif opt[:in_response_to]\n\t\t\t\troot.attributes['InResponseTo'] = opt[:in_response_to]\n\t\t\tend\n\t\t\tif opt[:status]\n\t\t\t\tstatus = root.add_element \"saml2p:Status\"\n\t\t\t\tstatus_code = status.add_element \"saml2p:StatusCode\", {\n\t\t\t\t\t\t\"Value\" => opt[:status]\n\t\t\t\t}\n\t\t\tend\n\t\t\tif @settings && @settings.issuer\n\t\t\t\tissuer = root.add_element \"saml:Issuer\", {\n\t\t\t\t\t\"xmlns:saml\" => \"urn:oasis:names:tc:SAML:2.0:assertion\"\n\t\t\t\t}\n\t\t\t\tissuer.text = @settings.issuer\n\t\t\tend\n\t\t\tmeta = Metadata.new( @settings )\n\t\t\tLogging.debug \"Created LogoutResponse:\\n#{@response}\"\n\t\t\treturn meta.create_slo_response( to_s, opt[:extra_parameters] )\n\t\t\t\n\t\t\t#root.attributes['Destination'] = action\n\t\t\t\n\t\tend", "def to_s\n \"#{ self.sender }/#{ self.identifier }/#{ self.sent }\"\n end", "def get_short_url_from_id n\n # Map to store 62 possible characters \n map = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"; \n \tshorturl = \"\"\n\n # Convert given integer id to a base 62 number \n while n!=0 do\n # use above map to store actual character in short url \n shorturl += map[n%62]; \n n = n/62; \n \t\tend\n # Reverse shortURL to complete base conversion \n shorturl.reverse!\n end", "def make_gps_server_handshake\n api_path = \"/api/v1/services/handshake?api_key=#{client_id}\"\n make_api_call(api_path)\n end", "def generate_and_send_password\n self.reload\n update_attribute :password, ('a'..'z').to_a[rand(26)].to_s + (0...5).map{ [rand(10)] }.join\n post_data = Net::HTTP.post_form URI.parse('http://3001300.ru/create_client_from_bonus.php'),\n { \n 'email' => self.email,\n 'password' => self.password\n }\n mail = InformMail.create! client: self, body: \"#{MessageText.welcome.sms.encode} #{self.password}\".encode(\"cp1251\")\n end", "def generate_sid\n \"%0#{@default_options[:sidbits] / 4}x\" %\n rand(2**@default_options[:sidbits] - 1)\n end", "def build_xml( result )\n xml = ::Builder::XmlMarkup.new\n \n xml.ProcessResponse do \n xml.PxPayUserId ::Pxpay::Base.pxpay_user_id\n xml.PxPayKey ::Pxpay::Base.pxpay_key\n xml.Response result\n end\n end", "def id_gen(source, exclude)\n\tid = Digest::SHA1.hexdigest(\"#{ENCODING_PHRASE}-#{source}-#{exclude}-#{@client_id}\")\n\treturn id\nend", "def generate_response(code = 503, text)\n \"HTTP/1.1 #{code} #{CODES[code]}\\r\\nContent-type: text/plain\\r\\nContent-length: #{text.length}\\r\\n\\r\\n#{text}\"\n end", "def generate_response(sha1, last_update)\n if sha1.empty?\n response = {:error => ERROR_MESSAGE}\n else\n response = {:code => {:sha1 => \"#{sha1}\",:updated_at => \"#{last_update}\"}}\n end\n response\n end", "def request_id\n SecureRandom.hex(5)\n end", "def response_generator number\n case number\n when 1\n \"It is certain\"\n when 2\n \"It is decidedly so\"\n when 3\n \"Without a doubt\"\n when 4\n \"Yes definitely\"\n when 5\n \"You may rely on it\"\n when 6\n \"As I see it yes\"\n when 7\n \"Most likely\"\n when 8\n \"Outlook good\"\n when 9\n \"Yes\"\n when 10\n \"Signs point to yes\"\n when 11\n \"Reply hazy try again\"\n when 12\n \"Ask again later\"\n when 13\n \"Better not tell you now\"\n when 14\n \"Cannot predict now\"\n when 15\n \"Concentrate and ask again\"\n when 16\n \"Don't count on it\"\n when 17\n \"My reply is no\"\n when 18\n \"My sources say no\"\n when 19\n \"Outlook not so good\"\n when 20\n \"Very doubtful\"\n end\nend", "def to_s\n result = \"Response header: \" + @response_version.to_s + \" \"+ @response_code.to_s + \" \"+ @response_message.to_s + \"\\n\"\n result += \"Content-length: \" + @content_length + \"\\n\" if ! @content_length.nil?\n result += \"Spam: \"+ @spam.to_s + \"\\n\"+ @score.to_s + \"/\"+ @threshold.to_s + \"\\n\" if ! @spam.nil?\n result += @tags.join(\"\\n\") if ! @tags.nil?\n result += @report.to_s if ! @report.nil?\n end", "def serpoint_generate_no\n office = params[:id]\n # Builds code, if possible\n code = office == '$' ? '$err' : serpoint_next_no(office)\n @json_data = { \"code\" => code }\n render json: @json_data\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('samlp:AssertionIDRequest') {\n assertion_id_refs.each { |assertion_id_ref| xml << assertion_id_ref.to_xml }\n }\n end", "def to_s\n res = response_line\n @headers.each do |key,val|\n res << \"#{key}: #{val}#{Protocol::CRLF}\"\n end\n res << Protocol::CRLF\n end", "def getgenerate\n @api.request 'getgenerate'\n end", "def payer_identification_loop(repeat = 1)\n payer = get_payer \n if payer\n Output835.log.info \"\\n payer is #{payer.name}\"\n payer_segments = []\n repeat.times do\n payer_segments << payer_identification(payer)\n payer_segments << address(payer)\n payer_segments << geographic_location(payer)\n payer_segments << unique_output_payid(payer) if @client_name == \"QUADAX\" && (((output_payid(payer).present?))|| @eob_type == 'Patient')\n payer_segments << payer_additional_identification(payer)\n payer_segments << payer_technical_contact(payer) if ((@output_version && @output_version != '4010'))\n end\n payer_segments.compact\n end\n end" ]
[ "0.5749803", "0.56259435", "0.5623994", "0.558258", "0.55555594", "0.55321133", "0.5463289", "0.5434888", "0.54205745", "0.5410976", "0.5382934", "0.53603685", "0.5352169", "0.5337962", "0.53250355", "0.5305058", "0.5304313", "0.5279206", "0.52769774", "0.52545005", "0.52401805", "0.5205364", "0.5181953", "0.51790035", "0.51684356", "0.5164889", "0.51630574", "0.51603436", "0.51538354", "0.5149873", "0.51489806", "0.5147679", "0.51472366", "0.5141847", "0.5141847", "0.5141642", "0.5140326", "0.5136213", "0.51346946", "0.5125949", "0.51221967", "0.51207966", "0.5115106", "0.51127934", "0.508908", "0.50762296", "0.505792", "0.50530046", "0.5049797", "0.50473803", "0.5044984", "0.50412446", "0.5041081", "0.503535", "0.5032494", "0.502915", "0.5025123", "0.5020548", "0.5020416", "0.5016909", "0.5011117", "0.50086737", "0.4998891", "0.49966314", "0.4994605", "0.49939886", "0.4987998", "0.49821407", "0.49809378", "0.4978768", "0.49775258", "0.496674", "0.49660116", "0.49636945", "0.49616036", "0.49572936", "0.49550572", "0.4948342", "0.49458233", "0.4945293", "0.49405295", "0.49386853", "0.4933042", "0.4928145", "0.49274608", "0.49236986", "0.4918442", "0.4906716", "0.49059647", "0.49052143", "0.48947537", "0.48943996", "0.48942593", "0.48917884", "0.4888128", "0.48842806", "0.4878495", "0.48764825", "0.48686603", "0.48646507" ]
0.6687389
0
Yet to be tested DELETE /nodes/:node_id
def delete_server(server_id) @options = {:path => "/servers/delete", :body => ""}.merge(@options) @options[:query]=@options[:query].merge(server_id) request( :expects => 200, :method => :delete, :body => @options[:body] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Node was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def ajax_delete_node\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # If node exits, then remove the node\n if !node.nil?\n node.destroy\n end\n\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_path }\n format.json { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :ok }\n end\n end", "def destroy\n n = Node.find_key(params[:id] || params[:name])\n render api_delete Node\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end", "def destroy\n authorize! :destroy, @node\n\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n b.node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @node.destroy\r\n respond_to do |format|\r\n format.html { redirect_to nodes_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @map_node = Map::Node.find(params[:id])\n @map_node.destroy\n\n respond_to do |format|\n format.html { redirect_to map_nodes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end", "def delete\r\n \tProductPackageNode.delete params[:node_ids]\r\n render :nothing => true\r\n end", "def destroy\n @server_node = ServerNode.find(params[:id])\n @server_node.destroy\n\n respond_to do |format|\n format.html { redirect_to server_nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @compute_node = ComputeNode.find(params[:id])\n @compute_node.destroy\n\n respond_to do |format|\n format.html { redirect_to compute_nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n myWorkingName = @node.working_name\n @node.destroy\n\n respond_to do |format|\n flash[:notice] = (\"Node \" + myWorkingName + \" has been deleted\")\n format.html { redirect_to root_path(tab:\"nodelist\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @pm_node.destroy\n respond_to do |format|\n format.html { redirect_to pm_nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task = Node.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_path}\n format.json { head :no_content }\n end\n \n end", "def delete_node(current_node)\n\nend", "def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node_index = NodeIndex.find(params[:id])\n @node_index.destroy\n\n respond_to do |format|\n format.html { redirect_to node_indices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gnode = Gnode.find(params[:id])\n @gnode.destroy\n\n respond_to do |format|\n format.html { redirect_to gnodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @newnode.destroy\n respond_to do |format|\n format.html { redirect_to newnodes_url, notice: 'Newnode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(node)\n remove_node(node)\n end", "def deleteNode(nodeInfo)\r\n\t\tnum = 0\r\n\t\tnode_id = 0\r\n\t\tnodeInfo.each_pair { | name, value |\r\n\t\t\tif(name == \"node_id\")\r\n\t\t\t\tnode_id = value\r\n\t\t\telse\r\n\t\t\t\tputs \"wrong parameter: #{name}\"\r\n\t\t\t\treturn \"wrong parameter: #{name}\"\r\n\t\t\tend\t\t\t\t\r\n\t\t}\r\n\r\n\t\tputs \"Connecting to database...\"\r\n\t\tbegin\r\n\t\t\t# connect to the MySQL server\r\n\t\t\tdbh = DBI.connect(\"DBI:Mysql:#{$db}:#{$db_ip}\",\"#{$user}\", \"#{$pass}\")\r\n\t\t\t\r\n\t\t\tnum = dbh.do(\"DELETE FROM node_list WHERE id = '#{node_id}'\")\r\n\t\t\tif (num == 1)\r\n\t\t\t\tputs \"Node deleted...\"\r\n\t\t\t\treturn 0\r\n\t\t\tend\r\n\t\t\t\r\n\t\trescue DBI::DatabaseError => e\r\n\t\t\tputs \"An error occurred\"\r\n\t\t\tputs \"Error code: #{e.err}\"\r\n\t\t\tputs \"Error message: #{e.errstr}\"\r\n\t\tensure\r\n\t\t\t# disconnect from server\r\n\t\t\tdbh.disconnect if dbh\r\n\t\tend\r\n\t\t\t\r\n\t\treturn -1\r\n\tend", "def destroy\n @f5_node = F5Node.find(params[:id])\n @f5_node.destroy\n\n respond_to do |format|\n format.html { redirect_to f5_nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy_empty\n @obj = Node.find(params[:id])\n @obj.destroy_empty\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @comment_node = CommentNode.find(params[:id])\n @comment_node.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_nodes_url }\n format.json { head :ok }\n end\n end", "def delete_node\n node.destroy if node\n end", "def delete_node\n delete(@nodename)\n end", "def destroy\n @obj = Node.find(params[:id])\n @obj.destroy\n\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "def destroy_nodes(nodes)\n ids = nodes.map do |node|\n case node\n when Node\n node.id\n when Hash\n node[:id] || node['id']\n else\n node\n end\n end\n ids_query = ids.map { |id| \"id=#{id}\" }.join('&')\n response = @connection.lbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes?#{ids_query}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end", "def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def delete_deleted_node_with_http_info(node_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TrashcanApi.delete_deleted_node ...\"\n end\n # verify the required parameter 'node_id' is set\n fail ArgumentError, \"Missing the required parameter 'node_id' when calling TrashcanApi.delete_deleted_node\" if node_id.nil?\n # resource path\n local_var_path = \"/deleted-nodes/{nodeId}\".sub('{format}','json').sub('{' + 'nodeId' + '}', node_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrashcanApi#delete_deleted_node\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @registration = NodeRegistration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @argument_node = ArgumentNode.find(params[:id])\n @argument_node.destroy\n\n respond_to do |format|\n format.html { redirect_to argument_nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if !signed_in_and_master?\n flash[:notice] = \"Sorry. Only technical manager can delete data. Please, contact Roberto SPURIO to do it.\"\n redirect_to altitude_types_path\n else\n\n @title = \"Taxonomy node - organism relationships\"\n\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end\n end", "def test_nodes\n node1 = create(:node)\n node2 = create(:node, :deleted)\n node3 = create(:node)\n node4 = create(:node, :with_history, :version => 2)\n node5 = create(:node, :deleted, :with_history, :version => 2)\n\n # check error when no parameter provided\n get :nodes\n assert_response :bad_request\n\n # check error when no parameter value provided\n get :nodes, :params => { :nodes => \"\" }\n assert_response :bad_request\n\n # test a working call\n get :nodes, :params => { :nodes => \"#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}\" }\n assert_response :success\n assert_select \"osm\" do\n assert_select \"node\", :count => 5\n assert_select \"node[id='#{node1.id}'][visible='true']\", :count => 1\n assert_select \"node[id='#{node2.id}'][visible='false']\", :count => 1\n assert_select \"node[id='#{node3.id}'][visible='true']\", :count => 1\n assert_select \"node[id='#{node4.id}'][visible='true']\", :count => 1\n assert_select \"node[id='#{node5.id}'][visible='false']\", :count => 1\n end\n\n # check error when a non-existent node is included\n get :nodes, :params => { :nodes => \"#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0\" }\n assert_response :not_found\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def test_delete\n private_user = create(:user, :data_public => false)\n private_user_changeset = create(:changeset, :user => private_user)\n private_user_closed_changeset = create(:changeset, :closed, :user => private_user)\n private_node = create(:node, :changeset => private_user_changeset)\n private_deleted_node = create(:node, :deleted, :changeset => private_user_changeset)\n\n ## first try to delete node without auth\n delete :delete, :params => { :id => private_node.id }\n assert_response :unauthorized\n\n ## now set auth for the non-data public user\n basic_authorization private_user.email, \"test\"\n\n # try to delete with an invalid (closed) changeset\n content update_changeset(private_node.to_xml, private_user_closed_changeset.id)\n delete :delete, :params => { :id => private_node.id }\n assert_require_public_data(\"non-public user shouldn't be able to delete node\")\n\n # try to delete with an invalid (non-existent) changeset\n content update_changeset(private_node.to_xml, 0)\n delete :delete, :params => { :id => private_node.id }\n assert_require_public_data(\"shouldn't be able to delete node, when user's data is private\")\n\n # valid delete now takes a payload\n content(private_node.to_xml)\n delete :delete, :params => { :id => private_node.id }\n assert_require_public_data(\"shouldn't be able to delete node when user's data isn't public'\")\n\n # this won't work since the node is already deleted\n content(private_deleted_node.to_xml)\n delete :delete, :params => { :id => private_deleted_node.id }\n assert_require_public_data\n\n # this won't work since the node never existed\n delete :delete, :params => { :id => 0 }\n assert_require_public_data\n\n ## these test whether nodes which are in-use can be deleted:\n # in a way...\n private_used_node = create(:node, :changeset => private_user_changeset)\n create(:way_node, :node => private_used_node)\n\n content(private_used_node.to_xml)\n delete :delete, :params => { :id => private_used_node.id }\n assert_require_public_data \"shouldn't be able to delete a node used in a way (#{@response.body})\"\n\n # in a relation...\n private_used_node2 = create(:node, :changeset => private_user_changeset)\n create(:relation_member, :member => private_used_node2)\n\n content(private_used_node2.to_xml)\n delete :delete, :params => { :id => private_used_node2.id }\n assert_require_public_data \"shouldn't be able to delete a node used in a relation (#{@response.body})\"\n\n ## now setup for the public data user\n user = create(:user, :data_public => true)\n changeset = create(:changeset, :user => user)\n closed_changeset = create(:changeset, :closed, :user => user)\n node = create(:node, :changeset => changeset)\n basic_authorization user.email, \"test\"\n\n # try to delete with an invalid (closed) changeset\n content update_changeset(node.to_xml, closed_changeset.id)\n delete :delete, :params => { :id => node.id }\n assert_response :conflict\n\n # try to delete with an invalid (non-existent) changeset\n content update_changeset(node.to_xml, 0)\n delete :delete, :params => { :id => node.id }\n assert_response :conflict\n\n # try to delete a node with a different ID\n other_node = create(:node)\n content(other_node.to_xml)\n delete :delete, :params => { :id => node.id }\n assert_response :bad_request,\n \"should not be able to delete a node with a different ID from the XML\"\n\n # try to delete a node rubbish in the payloads\n content(\"<delete/>\")\n delete :delete, :params => { :id => node.id }\n assert_response :bad_request,\n \"should not be able to delete a node without a valid XML payload\"\n\n # valid delete now takes a payload\n content(node.to_xml)\n delete :delete, :params => { :id => node.id }\n assert_response :success\n\n # valid delete should return the new version number, which should\n # be greater than the old version number\n assert @response.body.to_i > node.version,\n \"delete request should return a new version number for node\"\n\n # deleting the same node twice doesn't work\n content(node.to_xml)\n delete :delete, :params => { :id => node.id }\n assert_response :gone\n\n # this won't work since the node never existed\n delete :delete, :params => { :id => 0 }\n assert_response :not_found\n\n ## these test whether nodes which are in-use can be deleted:\n # in a way...\n used_node = create(:node, :changeset => create(:changeset, :user => user))\n way_node = create(:way_node, :node => used_node)\n way_node2 = create(:way_node, :node => used_node)\n\n content(used_node.to_xml)\n delete :delete, :params => { :id => used_node.id }\n assert_response :precondition_failed,\n \"shouldn't be able to delete a node used in a way (#{@response.body})\"\n assert_equal \"Precondition failed: Node #{used_node.id} is still used by ways #{way_node.way.id},#{way_node2.way.id}.\", @response.body\n\n # in a relation...\n used_node2 = create(:node, :changeset => create(:changeset, :user => user))\n relation_member = create(:relation_member, :member => used_node2)\n relation_member2 = create(:relation_member, :member => used_node2)\n\n content(used_node2.to_xml)\n delete :delete, :params => { :id => used_node2.id }\n assert_response :precondition_failed,\n \"shouldn't be able to delete a node used in a relation (#{@response.body})\"\n assert_equal \"Precondition failed: Node #{used_node2.id} is still used by relations #{relation_member.relation.id},#{relation_member2.relation.id}.\", @response.body\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def delete\n node_tag = DrupalNodeCommunityTag.find(:first,:conditions => {:nid => params[:nid], :tid => params[:tid]})\n # check for community tag too...\n if node_tag.uid == current_user.uid || current_user.role == \"admin\" || current_user.role == \"moderator\"\n\n node_tag.delete\n respond_with do |format|\n format.html do\n if request.xhr?\n render :text => node_tag.tid\n else\n flash[:notice] = \"Tag deleted.\"\n redirect_to node_tag.node.path\n end\n end\n end\n else\n flash[:error] = \"You must own the tag to delete it.\"\n redirect_to DrupalNode.find_by_nid(params[:nid]).path\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @star_node.destroy\n respond_to do |format|\n format.html { redirect_to star_nodes_url, notice: \"Star node was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(\n id,\n deadline: nil\n )\n req = V1::NodeDeleteRequest.new()\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.delete(req, metadata: @parent.get_metadata(\"Nodes.Delete\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = NodeDeleteResponse.new()\n resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def remove\n service = FolderService.new(@context)\n nodes = Node.editable_by(@context).where(id: unsafe_params[:ids])\n result = service.remove(nodes)\n\n if result.success?\n type = :success\n text = \"Node(s) successfully removed.\"\n else\n type = :error\n text = \"Error when Node(s) removing: #{result.value[:message]}.\"\n end\n\n path = params[:scope] == Scopes::SCOPE_PUBLIC ? everybody_api_files_path : api_files_path\n\n render json: { path: path, message: { type: type, text: text } }, adapter: :json\n end", "def delete!\n # delete changes the node.modified_index\n @etcd_node = etcd.delete(etcd_key).node\n end", "def destroy\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n @auditflows_flownode.destroy\n\n respond_to do |format|\n format.html { redirect_to(auditflows_flownodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n\n # # ******************\n # # Check permissions!\n # main_tree_node = @resource.tree_nodes.select{ |e| e.is_main == true }.first\n # if not (main_tree_node && main_tree_node.can_administrate?)\n # flash[:notice] = \"Access denied. User can't delete tree node\"\n # redirect_to session[:referer]\n # end\n # # ******************\n\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to session[:referer] }\n format.xml { head :ok }\n end\n end", "def delete_path(path)\n @zk.delete(path)\n logger.info(\"Deleted ZK node #{path}\")\n rescue ZK::Exceptions::NoNode => ex\n logger.info(\"Tried to delete missing znode: #{ex.inspect}\")\n end", "def remove(node)\n end", "def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend", "def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def destroy\n @node_rack = @object\n begin\n @node_rack.destroy\n rescue Exception => destroy_error\n respond_to do |format|\n flash[:error] = destroy_error.message\n format.html { redirect_to node_rack_url(@node_rack) and return}\n format.xml { head :error } # FIXME?\n end\n end\n \n # Success!\n respond_to do |format|\n format.html { redirect_to node_racks_url }\n format.xml { head :ok }\n end\n end", "def test_putpoi_delete_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n current_node = Node.find(result[3].to_i)\n assert_equal false, current_node.visible\n end", "def delete_node(node, host, &block)\n pubsub.delete(node, host, &callback_logging(__method__, node, &block))\n end", "def test_putpoi_delete_already_deleted\n nd = create(:node, :deleted)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal nd.id, result[2]\n end", "def test_with_node_some\r\n link1 = @linklist.add_link(@node1, @node3, false)\r\n link2 = @linklist.add_link(@node2, @node3, false)\r\n link3 = @linklist.add_link(@node1, @node6, false)\r\n link4 = @linklist.add_link(@node3, @node4, false)\r\n link5 = @linklist.add_link(@node4, @node5, false)\r\n \r\n assert(@linklist.with_node(@node3).size == 3)\r\n \r\n @mymodel.node_list.delete_node(@node1)\r\n \r\n assert(@mymodel.link_list.size == 3)\r\n end", "def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end", "def delete_node(l)\n node = Node.find_by(layer: l).destroy\n Connection.destroy_all(parent_id: node.id)\n Connection.destroy_all(child_id: node.id)\n end", "def removeNode\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n roomname = params[:removenode][\"roomname\"]\n collectionname = params[:removenode][\"collectionname\"]\n nodename = params[:removenode][\"nodename\"]\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n\n myroominfo = am.getRoomInfo(roomname)\n if(!myroominfo.nil? and myroominfo.isConnected == true)\n result = am.removeNode(roomname, collectionname, nodename)\n flash[:result] = \"removeNode result success: \" + result + \" \" + acc.roomURL + \" \" + collectionname + \" \" + nodename\n else\n result = \"Room is shutdown, this feature only available when room is started.\"\n flash[:notice] = result\n end\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node_message.destroy\n respond_to do |format|\n format.html { redirect_to node_messages_url, notice: 'Node message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def disconnectnode(params)\n address = params[\"address\"]\n node_id = params[\"nodeid\"]\n raise Error, \"Set Python node\" unless @node != nil\n raise ConnectionError if @mock_connection_error\n begin\n throw \"Specify address or node_id\" if address.nil? && node_id.nil?\n if address.nil?\n return @node.disconnectnode(nodeid: node_id)\n elsif node_id.nil?\n return @node.disconnectnode(address: address)\n else\n return @node.disconnectnode(address: address, nodeid: node_id)\n end\n rescue Error => e\n raise Error, \"disconnectnode(#{ address }, #{ node_id}) failed for #{@name_with_version} (id=#{@node_id}): \" + e.message\n end\n end", "def destroy\n @node_history.destroy\n respond_to do |format|\n format.html { redirect_to node_histories_url, notice: 'Node history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n end", "def show # NOT USED \n puts \"xxxxxxx NodeAttrC a:show - used for HACK for DEL but now fixed xxxxxxx\"\n \n # puts \"xxxxxxx NodeAttr a:show xxxxxxx\"\n # id = params[:id]\n # @node_attrb = NodeAttrb.find(id)\n\n destroy\n\n end", "def delete!\n\t\t\tClient.delete @root\n\t\tend", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete path\n make_request(path, \"delete\", {})\n end", "def test_delete_node_tree_r_2_nodes\n # Prep\n tree = BST::Tree.new\n val = [8, 10]\n val.each {|v| tree.insert(v)}\n tree.delete(val.last)\n # Test\n _delete_node_tree_hlpr(val, tree)\n end", "def delete\n self.class.fire_event(NodeDeletedEvent.new(self))\n relations.each {|r| r.delete}\n @internal_node.delete\n lucene_index.delete(neo_node_id)\n end", "def delete\n request(:delete)\n end", "def destroy\n @taxonomy = Taxonomy.find(params[:id])\n taxonomy_type = @taxonomy.taxonomy_type \n @taxonomy.delete_node_keep_sub_nodes\n @taxonomy.reload\n @taxonomy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomies_url(:taxonomy_type => taxonomy_type) }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {}, env = {}, &block)\n env[:request_method] = \"DELETE\"\n mock_request(path, params, env, &block)\n end", "def destroy\n @node_rack_node_assignment = @object\n @node_rack = @node_rack_node_assignment.node_rack\n return unless filter_perms(@auth,@node_rack,'updater')\n @node = @node_rack_node_assignment.node\n return unless filter_perms(@auth,@node,'updater')\n\n @node_rack_node_assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to node_rack_node_assignments_url }\n format.js {\n render(:update) { |page|\n page.replace_html 'node_rack_node_assignments', {:partial => 'node_racks/node_assignments', :locals => { :node_rack => @node_rack} }\n # We expect this AJAX deletion to come from one of two places,\n # the rack show page or the node show page. Depending on\n # which we do something slightly different.\n if request.env[\"HTTP_REFERER\"].include? \"node_racks\"\n page.replace_html 'node_rack_node_assignments', :partial => 'node_racks/node_assignments', :locals => { :node_rack => @node_rack }\n elsif request.env[\"HTTP_REFERER\"].include? \"nodes\"\n page.replace_html 'node_rack_node_assignments', :partial => 'nodes/node_rack_assignment', :locals => { :node => @node }\n end\n }\n }\n format.xml { head :ok }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n @tree_node_ac_rights.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tree_node_tree_node_permissions_path }\n format.xml { head :ok }\n end\n end", "def delete_kubernetes_node_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.delete_kubernetes_node ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.delete_kubernetes_node\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Nodes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.delete_kubernetes_node\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#delete_kubernetes_node\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_delete_link\r\n @node5.measurement = 45.8\r\n @node4.value_function = ValueFunction.new(0, 100, 'elephants')\r\n \r\n link = @linklist.add_link(@node5, @node4, true)\r\n\r\n (0..1).each { |i| assert_in_delta(@node4.evidence[i], 0.458, 0.0001) } \r\n \r\n @linklist.remove_link(link)\r\n assert_equal(Evidence.undefined, @node4.evidence) \r\n \r\n @node5.measurement = 10\r\n assert_equal(Evidence.undefined, @node4.evidence) \r\n end", "def update_remove\n get_node_and_network(params[:id] || params[:name])\n if params[:submit] == t('nodes.edit.allocate')\n @node.allocated = true\n flash[:notice] = t('nodes.edit.allocate_node_success') if save_node\n elsif params[:submit] == t('nodes.edit.save')\n flash[:notice] = t('nodes.edit.save_node_success') if save_node\n else\n Rails.logger.warn \"Unknown action for node edit: #{params[:submit]}\"\n flash[:notice] = \"Unknown action: #{params[:submit]}\"\n end\n\n redirect_to nodes_path(:selected => @node.name)\n end", "def delete!\n request! :delete\n end", "def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.76476693", "0.7589126", "0.75564736", "0.75471574", "0.75142425", "0.75023645", "0.75023645", "0.75023645", "0.74632853", "0.74632853", "0.74632853", "0.74632853", "0.74632853", "0.74330837", "0.74310005", "0.7331386", "0.7305195", "0.726349", "0.7163339", "0.71597904", "0.711843", "0.711843", "0.711843", "0.70381665", "0.7004218", "0.69991785", "0.6937685", "0.6885729", "0.6817295", "0.68171805", "0.6815104", "0.6805726", "0.6804585", "0.67909956", "0.6787501", "0.67751324", "0.67252153", "0.6705937", "0.6703078", "0.668261", "0.666719", "0.6664902", "0.66554105", "0.6651859", "0.66480285", "0.66279453", "0.66040117", "0.65991145", "0.6588202", "0.65563107", "0.6552468", "0.65179724", "0.64701843", "0.6451125", "0.64446443", "0.6409544", "0.6407361", "0.6382104", "0.6306596", "0.63051146", "0.6246534", "0.6207534", "0.61819005", "0.6172754", "0.6165795", "0.6163202", "0.61598927", "0.61524516", "0.61376107", "0.61334133", "0.6133118", "0.612304", "0.6112849", "0.6109593", "0.61051005", "0.6086176", "0.6071903", "0.6056032", "0.603587", "0.60344785", "0.60262394", "0.6021574", "0.6012963", "0.60068005", "0.6000439", "0.59850854", "0.5981849", "0.5975483", "0.59708214", "0.59658086", "0.59643865", "0.59607226", "0.59607106", "0.5949425", "0.59448594", "0.5939428", "0.5930045", "0.59263176", "0.5905288", "0.59036124", "0.5896544" ]
0.0
-1
Override to_json to sanitize output
def serializable_hash(options = {}) pre_sanitized_hash = super({ :only => [:id, :name, :email] }.merge(options)) # Sanitize pre_sanitized_hash.merge({ "name" => Rack::Utils.escape_html(self.name), "email" => Rack::Utils.escape_html(self.email) }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json\n to_raw.to_json\n end", "def to_json!\n self.to_hash.to_json\n end", "def to_json\n raise StandardError, \"Not implemented!\"\n end", "def to_json\n @json ||= get_json\n end", "def to_json_raw(*args)\n #This is a stub, used for indexing\n end", "def to_json\n to_s.to_json\n end", "def as_json(options={})\n options[:except] ||= ['errors']\n super.except(options)\n end", "def to_json\n to_parsed.to_json\n end", "def to_json arg\n as_json.to_json\n end", "def as_json(_opts={})\n raise NotImplementedError\n end", "def to_json\n @json.to_json\n end", "def to_json\n to_json_object.to_json\n end", "def to_nice_json\n JSON.pretty_generate to_hash\n end", "def to_nice_json\n JSON.pretty_generate to_hash\n end", "def to_json\n Formatter::JSON.render(self)\n end", "def to_json(_ = {}, spec: nil, escape: false, wrapper: false)\n if spec\n # Get a string containing the JSON data\n ret = Data.export(self.class.json_spec_path, spec, self)\n\n # Wrap the resulting JSON for message passing\n if wrapper && wrapper.responds_to?(:wrap)\n ret = wrapper.wrap(ret)\n end\n\n # Escape key characters when rendering directly into javascript\n if escape\n ret = ret.to_json\n ret = ret.html_safe if ret.responds_to?(:html_safe)\n end\n return ret\n elsif defined?(super)\n super\n end\n end", "def to_json(options = {})\n options[:except] ||= [:UtilityBits]\n super(options)\n end", "def as_json(options={})\n super(options.merge({:except => [:errors, :validation_context]}))\n end", "def as_json(options={})\n options[:except] ||= @@secure_fields\n super(options)\n end", "def as_json(options={})\n options[:except] ||= @@secure_fields\n super(options)\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def to_json(options={})\n options[:except] ||= ConfigCenter::User::ExcludedJsonAttributes\n super(options)\n end", "def to_json\r\n to_hash.to_json\r\n end", "def as_json\n to_s.as_json\n end", "def to_json(*)\n to_hash.to_json\n end", "def to_json\n return to_hash.to_json\n end", "def to_json\n\n end", "def to_json *args \n self.to_hash.to_json\n end", "def to_json *args \n self.to_hash.to_json\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end", "def to_json(*attrs); super self.class.params; end", "def to_json(*attrs); super self.class.params; end", "def to_json(*attrs); super self.class.params; end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json(*options)\n as_json(*options).to_json(*options)\n \tend", "def to_json\n JSON(as_json)\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n return self.to_hash.to_json\n end", "def to_json(val = nil)\n self.to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n self.to_hash.to_json\n end", "def to_json\n self.to_hash.to_json\n end", "def to_json\n self.to_hash.to_json\n end", "def to_json(*args); end", "def as_json(options = {})\n super(options.merge(except: %w[association_class unfiltered_collection collection]))\n end", "def as_json(options={})\n\toptions[:except] ||= [:id, :chat_id]\n super\n end", "def to_json\n to_h.to_json\n end", "def to_json\n to_h.to_json\n end", "def to_json(*options)\n\t\tas_json(*options).to_json(*options)\n\tend", "def tojson\n\t\tend", "def as_json(*args)\n super.merge({\n \"id\" => self.obj_key,\n \"obj_key\" => self.obj_key,\n \"link_path\" => self.public_path,\n \"to_title\" => self.to_title,\n \"edit_path\" => self.admin_edit_path\n }).merge(self.json.stringify_keys!)\n end", "def to_json(opts = {})\n as_json.to_json\n end", "def as_json(*_args)\n to_s\n end", "def to_json\n\t\tto_h.to_json\n\tend", "def to_json\n\t\tto_h.to_json\n\tend", "def as_json(*args)\n attributes.as_json.reject { |key, val| val.nil? }\n end", "def to_json\n self.to_h.to_json\n end", "def as_json options=nil\n {}\n end", "def to_json(*)\n #This is a stub, used for indexing\n end", "def to_json(*args)\n method_missing(:to_json, *args)\n end", "def to_json(_options = nil)\n @json ||= @hash ? @hash.to_json : \"\"\n end", "def to_json(*)\n\t\t\t# to_json needs to not care about arguments with the C extension\n\t\t\t# version of the JSON gem.\n\t\t\t# See json-1.5.1/ext/json/ext/generator/generator.c:902\n\t\t\tto_hash.to_json\n\t\tend", "def to_json(*options)\n as_json.to_json(*options)\n end", "def to_json(*args)\n {\n 'json_class' => self.class.name,\n 'data' => to_s\n }.to_json(*args)\n end", "def to_json(*_args)\n JSON.dump as_json\n end", "def to_json\n object.to_json\n end", "def jsonify(input); end", "def as_json(_options = nil)\n to_s\n end", "def to_json\n return Json.dump(to_hash)\n end", "def to_json(*args)\n as_json.to_json(*args)\n end", "def json_serialize\n end", "def get_json\n return to_json()\nend", "def to_s\n to_json\n end", "def as_json(*)\n to_h\n end", "def to_json(**opts)\n JSON.generate as_json, **opts\n end", "def as_json(*args)\n { EXTENDED_JSON_KEY => to_s }\n end", "def json\n {}\n end", "def to_json(options={})\n\t\toptions[:except] ||= [:hashed_password, :salt]\n\t\tsuper(options)\n end", "def to_json\n to_a.to_json\n end", "def to_json *args\n as_json.to_json *args\n end", "def json(obj)\n obj.to_json.html_safe\n end", "def json(obj)\n obj.to_json.html_safe\n end", "def to_s\n to_json.to_s\n end", "def to_json(options={})\n canonical(options).to_json\n end", "def to_json(options = {})\n super(self.class.serialize_options_update(options))\n end", "def as_json(*args)\n {}.as_json\n end", "def to_json\n obj = @options.clone\n # Remove non-JSON objects.\n obj.reject!{|k,v|\n !k.is_a?(String) && !k.is_a?(Symbol) || !@@valid_types.include?(v.class)\n }\n # Split at every even number of unescaped quotes. This gives either strings\n # or what is between strings.\n # If it's not a string then turn Symbols into String and replace => and nil.\n json_string = obj.inspect.split(/(\\\"(?:.*?[^\\\\])*?\\\")/).\n collect{|s|\n (s[0..0] != '\"') ? # If we are not inside a string\n s.gsub(/\\:(\\S+?(?=\\=>|\\s|,|\\}))/, \"\\\"\\\\1\\\"\"). # Symbols to String\n gsub(/\\=\\>/, \":\"). # Arrow to colon\n gsub(/\\bnil\\b/, \"null\") : # nil to null\n s # If it's a string don't touch it.\n }.join\n return json_string\nend" ]
[ "0.71091324", "0.7070944", "0.7013781", "0.70020175", "0.69998175", "0.6885053", "0.68568146", "0.68413514", "0.6804717", "0.6778572", "0.6772898", "0.6740202", "0.673947", "0.673947", "0.6723391", "0.67147934", "0.67142653", "0.67085356", "0.6708394", "0.6708394", "0.67068225", "0.6704874", "0.6703813", "0.66959697", "0.66505194", "0.66430616", "0.6615374", "0.661459", "0.661459", "0.661358", "0.6613131", "0.6613131", "0.6613131", "0.66039044", "0.66039044", "0.66039044", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.66019493", "0.65943193", "0.65880305", "0.6584001", "0.6583584", "0.6576043", "0.65742534", "0.65742534", "0.65692157", "0.65692157", "0.65602225", "0.6550771", "0.6545855", "0.6540899", "0.65398544", "0.65398544", "0.6530685", "0.6526764", "0.6520091", "0.65165067", "0.6510209", "0.65100443", "0.65100443", "0.6494964", "0.64891577", "0.64850533", "0.64849085", "0.6480784", "0.6469711", "0.64573586", "0.64477354", "0.644745", "0.64414835", "0.64387167", "0.6435208", "0.6432051", "0.64316434", "0.6427838", "0.6405723", "0.640436", "0.64020944", "0.639961", "0.63896275", "0.6388652", "0.6387227", "0.6384039", "0.63743544", "0.63735026", "0.6369984", "0.6369394", "0.63610613", "0.6355141", "0.63507545", "0.63479996", "0.6344447" ]
0.0
-1
returns a hash mapping each letter to its frequency. Do not include spaces.
def letter_count(str) counts = {} str.each_char do |char| next if char==" " counts[char] =0 unless counts.include?(char) counts[char]+=1 end counts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frequency\n # normal string which has assigned all the alphabets\n name = 'abcdefghijklmnopqrstuvwxyz'\n # this line will first split 'name' string and then assign it to hash\n @letters = name.split('').reduce(@letters){|alphabet,count| alphabet[count] +=0; alphabet}\n # this will convert all the alphabets of 'str' to lower case\n @str = @str.downcase\n # this will remove special characters from the string and only allow lower case alphabets\n @str = @str.gsub(/[^a-z]/, '')\n # this will split the 'str' and assign the letters to hash and add 1 each time the letter appeared\n @letters = @str.split('').reduce(@letters){|alphabet,count| alphabet[count] +=1; alphabet}\n\n end", "def letter_frequency(text)\n\n #create blank hash\n character_hash = Hash.new\n character_hash.default = 0\n\n #delete other characters\n text.delete! \"^a-zA-Z\"\n\n #all lower case\n text = text.downcase\n\n #turn string into array\n text_array = text.chars\n\n #move each letter to hash with number of times it appears in the array\n text_array.each do |letter|\n character_hash[letter] +=1\n end \n character_hash\n\n#sort hash in descending order unless values are the same, then sort alphabetically\n character_hash.sort do |(letter1, value1), (letter2, value2)|\n if value1 == value2\n letter1 <=> letter2\n else\n value2 <=> value1\n end\n end\n\nend", "def letter_counts(word)\n hash = {}\n word.chars.uniq.each {|char| hash[char] = word.count(char)}\n hash\nend", "def letter_counts(word)\n hashed = word.chars.map {|char| [char, word.count(char)]}.flatten\n return Hash[*hashed]\nend", "def letter_frequency_x(s)\n s.downcase.chars.\n each_with_object(Hash.new(0)) {|c,h| h[c] += 1 if c !~ /[^a-z]/}.\n sort_by {|k,v| [-v,k]}\nend", "def frequencies(chars)\n freq = Hash.new(0)\n chars.each do |char|\n freq[char] += 1\n end\n freq = freq.sort_by { |char, count| count } # order by highest frequency\n freq.reverse!\n freq = Hash[freq]\n return freq\nend", "def letter_counts(word)\n hash = Hash.new(0)\n word.each_char do |ch|\n hash[ch] += 1\n end\n hash\nend", "def frequency(text)\n text = text.downcase.gsub(/\\s*/, '')\n chars = text.split('')\n freqs = Hash[('a'..'z').to_a.zip([0] * 26)]\n\n chars.each { |c| freqs[c] += 1 }\n\n freqs\n end", "def letter_counts(word)\n hash = Hash.new(0)\n word.chars {|letter| hash[letter] += 1}\n hash\nend", "def letter_counts(word) =\n word.chars.each_with_object(Hash.new(0)) { |c, counts| counts[c] += 1 }", "def letter_counts(word)\n hsh = Hash.new(0)\n\n word.each_char { |ch| hsh[ch] += 1 }\n\n hsh\nend", "def count_letters(input_string)\n letter = input_string.scan /\\w/\n freq = Hash.new(0)\n\n # this will create a histogram count for each letter\n letter.each do |letter|\n freq[letter] += 1\n end\n\n\n\n # output letter and count\n freq.each do |letter, count|\n puts letter + \" \" + count.to_s\n end\n\nend", "def letter_counts(word)\n answer = Hash.new(0)\n word.each_char { |chr| answer[chr] += 1 }\n answer\nend", "def letter_counts(word)\n count = Hash.new(0)\n word.each_char { |char| count[char] += 1}\n count\nend", "def letter_counts(word)\n counter = Hash.new(0)\n word.chars.each do |x|\n counter[x] += 1\n end\n counter\nend", "def letter_counts(word)\n letters = word.split(\"\")\n letter_hash = Hash.new(0)\n letters.each {|char| letter_hash[char]+= 1}\n letter_hash\nend", "def string_frequency(string, hash)\n string.each_char do |char|\n hash[char]+=1\n end\n return hash\n end", "def frequent_letters(string)\n output = []\n count_table = Hash.new(0)\n\n string.each_char do |char|\n count_table[char] += 1\n if count_table[char] == 3\n output.push(char)\n end\n end\n\n return output\nend", "def frequency(char)\n return 0 if (@size.nil? || @size <= 0)\n @map[char.upcase] * 100/@size\n end", "def frequent_letters(string)\n count = Hash.new(0)\n string.each_char { |char| count[char] += 1 }\n\n frequents = []\n count.each do |char, num|\n if num > 2\n frequents << char\n end\n end\n return frequents\nend", "def letter_counts(word)\n wordArray = word.split(\"\")\n hash = {}\n wordArray.each do |element|\n if hash[element] == nil\n hash[element] = 1\n else\n hash[element] += 1\n end\n end\n return hash\nend", "def frequent_letters(string)\n hash = Hash.new(0)\n string.each_char { |char| hash[char] += 1 }\n\n frequent = []\n hash.each_key do |k|\n if hash[k] > 2\n frequent << k\n end\n end\n return frequent\nend", "def letter_frequency(s)\n s.downcase.scan(/[a-z]/).group_by(&:itself).\n transform_values(&:size).sort_by {|k,v| [-v, k]}\nend", "def frequent_letters(string)\n hash = Hash.new(0)\n results = []\n\n string.each_char do |char|\n hash[char] += 1\n end\n\n hash.each do |k, v|\n if v > 2\n results << k\n end\n end\n\n return results\nend", "def frequent_letters(string)\n array = []\n count = Hash.new(0)\n string.each_char { |c| count[c] += 1 }\n count.each { |k, v| array << k if v > 2}\n array\nend", "def charFreq(someFile)\ntext = \"\"\nFile.open(someFile, 'r') do |file|\n text = file.to_a.to_s.downcase.gsub(/[^a-z\\s]/, '')\nend\n\nfreq = {}\nchar = text.split(\"\")\nfreq = char.uniq.each{|c| freq[c] = char.count(c)}\n\ncounts = {}\nfor c in char \n if counts.key?(c)\n counts[c] += 1\n else \n counts[c] = 1\n end\nend \n\nprint(counts)\nend", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def hash_letter_freq( array )\n\n i = 0 # keeps track of outter loop\n hash = Hash.new()\n\n while( array.length > i )\n\n count = 1\n\n i2 = 1 + i # keeps track of inner while loop\n\n while( array.length > i2 ) # this will never check the last element of the array - otherwise have i2 check itself by doing i2 = i\n\n # puts(\"i #{i} | i2 #{i2}\") -- check if iteration is made right\n\n if( array[i] == array[i2] )\n count += 1\n end\n\n i2 += 1\n end # inner - while\n\n # alternative cond: hash.has_key?(\"#{array[i]}\") http://ruby-doc.org/core-1.9.3/Hash.html#method-i-has_key-3F\n if( hash[\"#{array[i]}\"] == nil ) # checks if key exists\n hash[\"#{array[i]}\"] = count\n end\n\n # for the last element in the array -- skipped by i2\n if( i2 == array.length )\n if( hash[\"#{array[i]}\"] == nil )\n hash[\"#{array[i]}\"] = 1\n end\n end\n\n\n i += 1\n end # while -outter\n\n # puts( hash )\n return hash\n\nend", "def frequent_letters(string)\n frequent = []\n letters_count = Hash.new(0)\n\n string.each_char { | char | letters_count[char] += 1 }\n letters_count.each do | k, v |\n if v > 2\n frequent << k\n end\n end\n\n return frequent\nend", "def letter_count(string)\n\tfrequency = Hash.new(0)\n\tstring.each_char do |i|\n\t\tfrequency[i] += 1 unless i == \" \"\n\tend\n\tfrequency\nend", "def most_common_letter(string)\nletters = string.split(\"\")\n# Making a new hash \nfrequencies = Hash.new (0)\n# Add one to the key's value every time the key appears\nletters.each { |letter| frequencies|letter| += 1 }\n# Sorting frequencies by the value of letter \nfrequencies = frequencies.sort_by do |letters, letter| \n letter\nend\n \n puts letters + \" \" + letter \nend", "def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "def frequent_letters(str)\n letter_count = Hash.new(0)\n str.each_char { |char| letter_count[char] += 1 }\n\n frequent_chars = []\n letter_count.each do |char, num|\n if num > 2\n frequent_chars << char\n end\n end\n return frequent_chars\nend", "def genFreqTable(string)\n freqTable = Hash.new\n string.split(\"\").each do |i| #loop through every character in the string\n if freqTable.has_key?(string[i]) #if key already exists\n freqTable[string[i]] += 1 #increments its frequency\n else\n freqTable[string[i]] = 1 #else its a new key so set its frequency to 1\n end\n end\n return freqTable\nend", "def alphabet_frequency string, letter\n decode_attempt = c_decode string, letter\n frequency_total_array = []\n $frequencies.each do |key, array|\n frequency_total_array.push((frequency_value(decode_attempt.split(\"\"), key) - $frequencies[key]).abs)\nend\nfrequency_total_array.inject(0, :+)\nend", "def word_sizes(input)\n hash = {}\n input .split.each do |word|\n num_of_letters = word.chars.count\n if hash.has_key?(num_of_letters)\n hash[num_of_letters] += 1\n else\n hash[num_of_letters] = 1\n end\n end\n hash\nend", "def letter_counts(word)\n letter_counts = Hash.new(0)\n\n word.split(\"\").each do |ele| \n letter_counts[ele] += 1\n end\n letter_counts\nend", "def hash_word(word)\n word_count = Hash.new(0)\n word.each_char do |c|\n word_count[c] += 1\n end\n return word_count\nend", "def histogram(a_string)\n an_array = Array.new(a_string.length)\n ls_compact_string = a_string.delete(' ')\n an_array = ls_compact_string.downcase\n str_hash = Hash.new(0)\n for idx in 0..an_array.length\n item = an_array[idx]\n str_hash[item] += 1\n end\n return str_hash\nend", "def count_frequencies s\n s.downcase.split(//).inject(Hash.new(0)) do |hash,item|\n hash[item] += 1\n hash\n end\n end", "def build_char_frequency_table(phrase)\n table = Array.new(26, 0)\n\n phrase.each_char do |char|\n x = get_char_number(char)\n if x != -1\n table[x] += 1\n end\n end\n\n table\nend", "def letter_counter(string)\n hash = {}\n string.split.each do |word|\n if hash.has_key?(word.size)\n hash[word.size] += 1\n else \n hash[word.size] = 1\n end\n end\n hash\nend", "def letter_hash s\n s.each_char.to_a.sort.join('')\nend", "def compute_freq_map(str)\n # OPTIMIZATION IDEA: Make this function also be able to determine if the curr_freq_map matches the last_freq_map\n freq_map = {}\n str.each_char do |char|\n if freq_map[char]\n freq_map[char] += 1\n else\n freq_map[char] = 1\n end\n end\n return freq_map\nend", "def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend", "def frequent_letters(string)\n hash = Hash.new(0)\n string.each_char do |char|\n hash[char] += 1\n end\n\n hash.keys.select { |k| hash[k] > 2 }\nend", "def word_hash(sentence)\n letters = Hash.new(0)\n sentence.split.each { |word| letters[word.length] += 1 }\n letters\nend", "def count_frequency(word_list)\n counts = Hash.new(0)\n for word in word_list\n counts[word] += 1\n end\n counts\nend", "def letter_count(str)\n characters = str.downcase.split(\"\")\n hashes = {}\n \n characters.each do |character|\n \n if character >= \"a\" && character <= \"z\"\n hashes[character] = hashes[character] ? hashes[character] + 1 : 1\n end\n \n end\n \n hashes\nend", "def frequent_letters(string)\n count_letters = Hash.new{0}\n frequent_letter = []\n string.each_char do |char|\n count_letters[char] += 1\n if count_letters[char] > 2 && frequent_letter.include?(char) == false\n frequent_letter << char\n end\n end\n return frequent_letter.reverse\nend", "def letter_counter2(string)\n string.split.each_with_object({}) do | word, hash| # word (calling on array)\n if hash.has_key?(word.size) \n hash[word.size] += 1\n else\n hash[word.size] = 1\n end\n end\nend", "def letter_counts(word)\n counter = Hash.new(0)\n word.split('').each do |letter| #could also do each_char instead of split\n counter[letter] += 1\n end\n counter\nend", "def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend", "def frequency_of_each_word(text)\n words = text.split(\" \")\n frequency = Hash.new(0)\n words.each { |word| frequency[word] += 1 }\n frequency\nend", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def frequency(letter)\n\treturn $letter_frequency[:letter]\nend", "def frequency(string,char)\n\t\tstring.count(char) / string.length.to_f\n\tend", "def letter_count(str)\n letters_hash = {}\n letters_array = str.split(\"\")\n \n letters_array.delete(\" \")\n \n letters_array.each {|x| letters_hash[x] = (letters_hash[x] or 0) + 1}\n letters_hash\nend", "def word_sizes(str)\n arr = str.split(' ')\n hsh = Hash.new(0)\n \n arr.each {|word|\n hsh[word.delete('^A-Za-z').length] += 1\n }\n \n hsh\nend", "def character_count(str)\n character_frequency = Hash.new(0)\n str.each_char do |char|\n character_frequency[char] += 1\n end\n return character_frequency\nend", "def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end", "def count_letters_in_word(word)\n letters = Hash.new(0)\n word.chars.each { |letter| letters[letter] += 1 }\n letters\nend", "def count_letters(line, all_inputs)\n freq = Hash.new\n line.chars do |c|\n if freq.has_key?(c)\n freq[c] += 1\n else\n freq[c] = 1\n end\n end\n if freq.value?(2)\n two_letters = 1\n else\n two_letters = 0\n end\n if freq.value?(3)\n three_letters = 1\n else\n three_letters = 0\n end\n if freq.value?(4)\n puts \"4 letters!\"\n end\n #puts \"#{line.chars.sort} two_l=#{two_letters} three_l=#{three_letters}\"\n puts \"#{line} two_l=#{two_letters} three_l=#{three_letters}\"\n all_inputs[line] = {\n '2' => two_letters,\n '3' => three_letters\n }\n return two_letters, three_letters\nend", "def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend", "def letter_case_count(str)\n lower = str.count(\"[a-z]\")\n upper = str.count(\"[A-Z]\")\n non = str.size - (lower + upper) \n \nhash = {\"lowercase:\" => lower, \"uppercase:\" => upper, \"neither:\" => non}\n\nputs hash \n \nend", "def count_occurrences(array)\n frequncies = Hash.new(0)\n\n array.each do |word|\n frequncies[word] += 1\n end\n\n frequncies.each do |word, frequency|\n puts \"#{word} => #{frequency}\"\n end\nend", "def letter_count(str)\n\tr = Hash.new\nstr.delete(' ').split('').each {|letter| r[letter] == nil ? r[letter] = 1 : r[letter] += 1}\nr\nend", "def letter_count(str)\n freequency = Hash.new(0)\n str.gsub(/\\s+/, \"\").each_char do |char|\n freequency[char] += 1\n end\n freequency\nend", "def countChars(str)\n\thash = {}\n\thash.default = 0\n\tletters = str.chars\n\tletters.each do |letter|\n\t\thash[letter] += 1\n\tend \n\treturn hash\nend", "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 ae_count(str)\n ae_counter = Hash.new(0)\n my_hash = {}\n str.each_char do |char|\n if char == 'a' || char == 'e'\n ae_counter[char] += 1\n end\n end\n sorted = ae_counter.sort_by {|key, val| key}\n my_hash[sorted[0][0]] = sorted[0][1]\n my_hash[sorted[1][0]] = sorted[1][1]\n return my_hash\nend", "def count_frequency(word_list)\n\tcounts = Hash.new(0)\n\tfor word in word_list\n\t\tcounts[word] += 1\n\tend\n\tcounts\nend", "def character_count(string)\n hash = {}\n hash.default = 0\n letters=string.downcase.chars\n letters.each do |letter|\n hash[letter] +=1\n end\n hash\nend", "def letter_count(str)\n # With default hash\n # counted_letters = Hash.new(0)\n # str.each_char do |char|\n # counted_letters[char.downcase] += 1\n # end\n # return counted_letters\n\n # without default hash\n counted_letters = {}\n str.each_char do |char|\n if counted_letters.has_key?(char.downcase)\n counted_letters[char.downcase] += 1\n else\n counted_letters[char.downcase] = 1\n end\n end\n return counted_letters\nend", "def letter_count(str)\n counts = Hash.new(0)\n str.each_char do |char|\n counts[char.downcase] += 1\n end\n return counts\nend", "def word_sizes(str)\n arr = str.split(' ')\n hsh = Hash.new(0)\n \n arr.each {|word|\n hsh[word.length] += 1\n }\n \n hsh\nend", "def letterCount(word)\n obj = {}\n word.chars.map do |currentLetter|\n if (!!obj[currentLetter])\n obj[currentLetter] += 1\n else\n obj[currentLetter] = 1\n end\n end\n obj\n end", "def duplicate_count(text)\n # create an array with properly formatted elements\n letters = text.downcase.split('')\n\n # make the hash deafult to 0 so that += will work correctly\n stats = Hash.new(0)\n\n # iterate over the array and count number of times each letter occur\n letters.each {|letter| stats[letter] += 1}\n\n # delete key-value pairs from the hash which occur only once\n stats.delete_if {|key, value| value == 1}\n\n # return the number of remaining key-value pairs\n return stats.values.count\nend", "def letter_count(str)\nresult = Hash.new(0)\nstr.each_char do |letter| result[letter] += 1 unless letter == \" \"\nend\nresult\nend", "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "def alphabet_map_for_letters(letters)\n alphabet = ('A'..'Z').to_a\n\n letter_count_of_available_letters = {}\n alphabet.each { |letter|\n new_letter = {letter => 0}\n letter_count_of_available_letters.merge!(new_letter)\n }.flatten\n\n letters.each { |letter|\n letter_count_of_available_letters[letter.upcase] += 1\n }\n\n letter_count_of_available_letters\n end", "def letter_count(str)\n res=Hash.new(0)\n str.each_char do |ch|\n res[ch]+=1 unless ch==' '\n end\n return res\nend", "def freqOfChar(my_str)\n\t# convert the string into array\n\tarr = my_str.chars\n\t# get the number of elements in the array\n\tlen = arr.size\n\n\t# an empty hash object, which store the key-value object, like dictionary\n\tmy_dict = {}\n\n\t# some run vairables\n\ti = 0\n\tj = 0\n\t# the frequency of char\n\tcount = 0\n\n\t# loop through the array\n\twhile(i < len)\n\t\t# every char appears at least once\n\t\tcount = 1\n\t\t\n\t\t# if we hit the last element of the array, put the char(`arr[i]`) and its freq(which is 1) into the `dictionary` and exit the loop\n\t\tif(i == len - 1)\n\t\t\tmy_dict[arr[i]] = count\n\t\t\tbreak\n\t\telse\n\t\t\t# if not, get the next index\n\t\t\tj = i + 1\n\t\tend\n\n\t\t# `while` 2 consecutive chars are the same\n\t\t# increase the count by 1 -> freq increase\n\t\t# remove the second char(`delete_at(index_want_to_remove)`)\n\t\t# decrease the `len`\n\t\twhile(arr[i] == arr[j])\n\t\t\tcount += 1\n\t\t\tarr.delete_at(j)\n\t\t\tlen -= 1\n\t\t\t# if we hit the last element when removing element, exit the loop\n\t\t\tif(i == len - 1)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\t# put the current char and its freq into hash `my_dict`\n\t\tmy_dict[arr[i]] = count\n\t\t# increase the run variable so that we won't create an infinite loop\n\t\ti += 1\n\tend\n\n\t# give the hash object `my_dict` back to the main flow\n\treturn my_dict\nend", "def letter_percentages(string)\n total_count = string.size\n character_hash = {}\n\n character_hash[:lowercase] = (string.count(\"a-z\").to_f / total_count) * 100\n character_hash[:uppercase] = (string.count(\"A-Z\").to_f / total_count) * 100\n character_hash[:neither] = (string.count(\"^a-zA-Z\").to_f / total_count) * 100\n\n character_hash\nend", "def char_count2(list)\n list.join().chars.inject(Hash.new(0)){ |h, c| h[c] += 1; h }\nend", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def letter_count(str)\n\tletters = {}\n\tletters.default = 0\n\nstr.each_char do |letter| if str.include?(letter) \n\t\tletters[\"#{letter}\"] += 1 unless letter == \" \"\n\tend\nend\nreturn letters\nend", "def letter_count(str)\nletters = {}\nletters.default = 0\n\n\tstr.each_char do |letter| letters[\"#{letter}\"] += 1 unless letter == \" \" end\n\n\t\treturn letters\n\tend", "def make_hash(word)\n hash = {}\n word.each do |i|\n if hash.has_key?(i)\n hash[i] += 1\n else\n hash[i] = 1\n end\n end\n return hash\nend", "def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n h1 = Hash.new(0)\n str.split.each do |element|\n h1[element.size] += 1\n end\n h1\nend", "def char_count (arr, hash)\n arr.each_with_index do |k, i|\n hash[k] = 0\n end\n \n arr.each_with_index do |char, j|\n if hash.has_key?(char)\n hash[char] += 1\n end\n end\n\n return hash\nend", "def count\n @letters = Hash.new(0)\n puts \"Hey let's find how many times each letter shows up in your sentence\"\n input = gets.strip.gsub(' ','').split('').sort\n input.each do |x|\n @letters[x] += 1\n end\n \n @letters.each do |key, value|\n puts \"Ther letter #{key} is in your sentence #{value} times.\"\n end\n\nend", "def character_count(str)\n # takes in a string\n # counts how many times each character appears in a string\n # ignores case\n # returns the hash\n h = Hash.new(0)\n str.each_char do |c|\n h[c.downcase] +=1\n end\n h\nend", "def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end", "def contar(texto)\n palavras = texto.split\n\n frequencies = Hash.new(0)\n\n palavras.each do |word|\n frequencies [word] += 1\n end\n\n frequencies = frequencies.sort_by do |wor, count|\n end\n frequencies.reverse!\n\n frequencies.each do |wor, count|\n puts wor + \" \" + count.to_s\n end\nend", "def letter_count(str)\nletters = Hash.new(0)\n\tstr.each_char do |letter| letters[letter] += 1 end\n\t\treturn letters\nend", "def letter_case_count(string)\n uppercase_count = string.count(string.upcase)\n lowercase_count = string.count(string.downcase)\n\n hash = {\n :lowercase => lowercase_count,\n :uppercase => uppercase_count,\n }\n\nend", "def count_letters (name, counts)\n sum = 0\n $alphabet.each_with_index { |val, index| counts[index] += name.count(val) }\n counts\nend", "def ae_count(string)\n hash = Hash.new(0)\n string.each_char do |char|\n if char == 'a' || char == 'e'\n hash[char] += 1 \n end\n end\n\n hash\nend", "def word_sizes(str)\n hsh = {}\n new_str = str.gsub(/[^a-z ]/i, '')\n arry = new_str.split.map(&:size)\n arry.map { |word| hsh[word] = arry.count(word) }\n hsh\nend" ]
[ "0.8173194", "0.8149677", "0.81445986", "0.8137479", "0.79474926", "0.79324096", "0.7926586", "0.7902801", "0.78996736", "0.78863686", "0.7857806", "0.7782786", "0.775013", "0.76953506", "0.76889914", "0.7668839", "0.76588756", "0.75699896", "0.7553269", "0.7549146", "0.75149196", "0.74890137", "0.74586594", "0.7432172", "0.7417011", "0.74135816", "0.73954195", "0.73935354", "0.73464656", "0.73444617", "0.73307747", "0.73305327", "0.73211884", "0.7313435", "0.73070604", "0.7300091", "0.7295978", "0.7295104", "0.72911566", "0.7267788", "0.724367", "0.7241093", "0.7233958", "0.72305745", "0.7220669", "0.721949", "0.71937066", "0.7149331", "0.7138508", "0.70922935", "0.7081573", "0.707028", "0.7069171", "0.70621467", "0.70361716", "0.7035409", "0.7026748", "0.7021981", "0.7005664", "0.6994793", "0.69885993", "0.6987454", "0.69864535", "0.69776356", "0.69546515", "0.69545525", "0.69154525", "0.69086754", "0.6906646", "0.68947685", "0.68920684", "0.6884824", "0.68774194", "0.6875796", "0.6874515", "0.6870422", "0.68659323", "0.68645513", "0.686343", "0.68622446", "0.68548656", "0.685278", "0.6845464", "0.6842155", "0.6831756", "0.6825119", "0.68053365", "0.68034923", "0.67989916", "0.67965317", "0.6791083", "0.6786163", "0.67851835", "0.6785021", "0.6781016", "0.67807895", "0.677945", "0.6776472", "0.6769643", "0.6765891" ]
0.67525136
100
FUNCTIONS USED BY THE APP Default rate limiting method
def check_rate if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2 sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i puts("Waiting for #{sleep_time} seconds to allow for rate limit to be reset") sleep sleep_time end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throttle_api\n Rate::Limiter.new(request.env['REMOTE_ADDR'], request.env['REQUEST_PATH']).set\n end", "def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end", "def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end", "def rate_limit\n connection.rate_limit\n end", "def throttled_response; end", "def rate_limit\n options[:rate_limit]\n end", "def check_for_rate_limits\n rate_limit_remaining < 10\n end", "def throttles; end", "def throttle; end", "def post_action_rate_limiter\n return unless is_flag? || is_bookmark? || is_like?\n\n return @rate_limiter if @rate_limiter.present?\n\n %w(like flag bookmark).each do |type|\n if public_send(\"is_#{type}?\")\n limit = SiteSetting.get(\"max_#{type}s_per_day\")\n\n if is_like? && user && user.trust_level >= 2\n multiplier = SiteSetting.get(\"tl#{user.trust_level}_additional_likes_per_day_multiplier\").to_f\n multiplier = 1.0 if multiplier < 1.0\n\n limit = (limit * multiplier).to_i\n end\n\n @rate_limiter = RateLimiter.new(user, \"create_#{type}\", limit, 1.day.to_i)\n return @rate_limiter\n end\n end\n end", "def rate_limit\n response = self.class.get('/rate_limit', options)\n\n return_value_for response\n end", "def throttled_responder; end", "def rate_limit!(namespace, limit: 5, minutes: 5)\n request_time = DateTime.now\n log_path = Rails.root.join(\"tmp/rate_limits/#{namespace}.log\")\n\n unless File.exist?(log_path)\n FileUtils.mkdir_p(File.dirname(log_path))\n FileUtils.touch(log_path)\n timestamp = request_time.strftime('%Y-%m-%dT%H:%M:%S%Z')\n count = 0\n File.write(log_path, \"#{timestamp} #{count}\")\n end\n\n # Check if log is in limit state\n log = File.open(log_path, 'r')\n timestamp, count = log.read.chomp.split\n time = DateTime.parse(timestamp, '%Y-%m-%dT%H:%M:%S%Z')\n count = count.to_i\n\n if time < (request_time - minutes.minutes)\n # Time window expired - reset\n timestamp = request_time.strftime('%Y-%m-%dT%H:%M:%S%Z')\n count = 1\n else\n # Current time window\n count += 1\n\n if count > limit\n flash[:alert] = 'Too many recent requests. Please try again later.'\n render(status: :too_many_requests)\n timestamp = DateTime.now.strftime('%Y-%m-%dT%H:%M:%S%Z') # Refresh timestamp\n File.write(log_path, \"#{timestamp} #{count}\")\n return false\n end\n end\n\n # Update log and allow request to proceed\n File.write(log_path, \"#{timestamp} #{count}\")\n end", "def rate_limit_check\n status = 200\n result = {}\n if rate_limit_on?\n if rate_limit_left > 0\n status = 429\n result[:error] = \"you need to wait #{rate_limit_left} ms before you can request anything again\"\n render status: status, json: result\n end\n end\n end", "def work()\n # FIXME : .rel[...].get doesn't update $client.rate_limit...\n\n rate_limit = $client.rate_limit\n dbgp \"#{rate_limit.remaining} API calls left.\"\n\n # A little buffer in case we use a feature from octokit\n # which doesn't update rate_limit on `$client`.\n if rate_limit.remaining < 5 then\n reset = rate_limit.resets_in + 10\n puts \"💤 zleepy timez (back in #{reset} seconds)\"\n sleep(reset)\n end\n\n begin\n yield\n rescue Octokit::BadGateway, Octokit::InternalServerError => e\n puts \"Uuuh... github is having a bad time :( #{e.response_status}\"\n pp \"=====\"\n pp \"=====\"\n pp e.response_body\n pp \"=====\"\n pp e.response_headers\n pp \"=====\"\n pp \"=====\"\n sleep 10\n retry\n end\nend", "def twitter_api_rate_limit\n # +++ move to app config\n @@_admin_account_access_rate_limit ||= 50 # times per hour\n end", "def rate_limit_calls\n calls = ENV['RATE_LIMIT_CALLS'].to_i\n calls > 0 ? calls : 5\n end", "def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end", "def get_limits\n # code\n end", "def rate_limit\n return nil unless @client\n\n t = Time.now\n limit = API.cache[\"rate_limits/users/#{@client.key}\"]\n if limit.nil? or limit[0] <= t.to_i\n # Reset limit\n limit = [t.to_i + INTERVAL, REMAINING]\n end\n\n # Update limit\n limit[1] = limit[1] - 1\n\n if limit[1] <= 0\n # Limit exceeded\n raise API::RateLimitError, \"rate limit exceeded (#{REMAINING}/#{INTERVAL} seconds)\"\n end\n\n # Store limit\n API.cache.store(\"rate_limits/users/#{@client.key}\", limit, :ttl => limit[0] - t.to_i)\n \n # Set rate limit headers\n response['X-RateLimit-Limit'] = REMAINING.to_s\n response['X-RateLimit-Remaining'] = limit[1].to_s\n response['X-RateLimit-Reset'] = Time.at(limit[0]).xmlschema\n\n true\n end", "def handle_rate_limit(&block)\n begin\n block.call\n rescue Twitter::Error::TooManyRequests => error\n wait_time = error.rate_limit.reset_in + 10\n if @verbose\n minutes = wait_time / 60\n puts\n puts \"RATE LIMIT HIT: Wait #{minutes} minutes.\"\n end\n countdown(wait_time)\n retry\n end\n end", "def throttle(request)\n time_left = $redis.ttl(cache_key(request))\n [429, {}, [\"Rate limit exceeded. Try again in #{time_left} seconds.\"]]\n end", "def calculate_rate_limit_reset(env); end", "def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end", "def limit_rate(opts = {})\n opts = opts.clone\n queue_name = Resque.queue_from_class(self).to_s\n\n if opts.include?(:api)\n queue_name += opts[:api].to_s\n opts.delete(:api)\n end\n if opts.include?(:reserved_rate)\n @reserved_rate = opts[:reserved_rate].to_i\n Resque::Job.reserved_rates[queue_name] = @reserved_rate\n opts.delete(:reserved_rate)\n end\n\n opts.each do |o|\n restriction = RateLimiter::RateRestriction.new(queue_name, o[0], o[1])\n self.restrictions << restriction\n Resque::Job.rate_limiter.add_restriction(restriction)\n end\n end", "def rate_limit_interval\n interval = ENV['RATE_LIMIT_INTERVAL'].to_i\n interval > 0 ? interval : 1\n end", "def on_rate_limit(*)\n disconnect(:rate_limited)\n fail SlackBotManager::ConnectionRateLimited\n end", "def rate_limit_limit(throttle_data)\n throttle_data[:limit]\n end", "def throttled_responder=(_arg0); end", "def throttle\n 5\n end", "def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend", "def rate_limit_status\n get('/account/rate_limit_status.json')\n end", "def throttle\n sleep @throttle if @@last_request + @throttle > Time.now\n @@last_request = Time.now\n end", "def rate_limit_by_ip(delay,*tags)\n key = \"limit:\"+tags.join(\".\")\n return true if $r.exists(key)\n $r.setex(key,delay,1)\n return false\nend", "def maximum_requests\n super\n end", "def rate_limit_status(params)\n get \"account/rate_limit_status\", params\n end", "def call(request)\n return bad_request unless request.instance_of? Request\n\n return ok if limiters_handler.whitelisted?(request)\n return not_allowed if limiters_handler.blacklisted?(request)\n \n # check through all the available throttlers, if throttling condition matched with the request,\n # it checks if limit has been exhausted or not.\n limiters_handler.throttlers.each do |name, throttler|\n if throttler.matched?(request)\n return throttler.call(request)\n end\n end\n ok\n end", "def waitTillLimitReset\n timeTillReset = CLIENT.rate_limit.resets_in + 5\n @logger.info(\"API limit reached while fetching... Sleeping for #{timeTillReset} seconds 😴 brb\")\n sleep(timeTillReset)\nend", "def set_rate_usage(resp)\n rate_limit = resp[\"x-ratelimit-limit\"]\n usage_limit = resp[\"x-ratelimit-usage\"]\n return if rate_limit.nil? or usage_limit.nil?\n short_limit = rate_limit.split(\",\")[0].to_i\n long_limit = rate_limit.split(\",\")[1].to_i\n short_usage = usage_limit.split(\",\")[0].to_i\n long_usage = usage_limit.split(\",\")[1].to_i\n quarter_hours_left = [(DateTime.now.utc.end_of_day.to_i - DateTime.now.utc.to_i) / 900, 1].max\n short_max = [ ( (long_limit - long_usage) / quarter_hours_left.to_f).to_i, short_limit].min\n $redis.set(\"strava_short_limit\", short_limit)\n $redis.set(\"strava_long_limit\", long_limit)\n $redis.set(\"strava_short_usage\", short_usage)\n $redis.set(\"strava_long_usage\", long_usage)\n $redis.set(\"strava_last_time\", DateTime.now.to_i)\n $redis.set(\"strava_short_max\", short_max)\n end", "def throttle(wait, onLast, onFirst, interval, timestamps)\n \nend", "def call(url, request, xml = '', *args)\n # Alma throttles for both overall\n # requests per day as well as per second\n #\n # These are PER INSTITUTION, not per conncoection / api key\n # so even if our throttling is working we might get warnings\n # about exceeding either threshold.\n #\n # If it's the daily , we'll want to do a warning\n # and sleep for the rest of the day...\n #\n # if it's the per_second threshold, we should\n # just wait a second (and issue a warning)\n\n \n throttled_result = true\n response = nil\n while throttled_result do\n \n #header neeeds to be Authorization: apikey {APIKEY}\n request['Authorization'] = 'apikey ' + @config['api_key']\n \n response = Net::HTTP.start(url.hostname,\n url.port,\n :use_ssl => true) { | http |\n http.request( request )\n }\n \n raw_xml = response.body\n \n xml = Nokogiri::XML( raw_xml ) \n\n # see daily_threshold.xml for an example of what is returend\n # when we hit the daily threshold (not clear what http code\n # this is relative to midnight GMT\n # see concurrent_threshold.xml (also called per_second_threshold in docs) for example of taht\n # this will be returned w/ a code of 429\n\n\n # will need to investigate to see if namespace is actually returned in errors unlike some of the other stuff...\n \n # daily_threshold_xpath = '\n daily_threshold_xpath = '//ae:web_service_result'\n\n\n # since results are normally not namespaced, we may be better off just doing xml.remove_namespaces!\n # rather than trusting the docs that these are actually namespaced\n \n # check for daily limit, sleep til midnight GMT if found\n if !xml.xpath( '/ae:web_service_result/ae:errorList/ae:error/ae:errorCode[contains(text(),\"DAILY_THRESHOLD\")]',\n { 'ae' => \"http://com/exlibris/urm/general/xmlbeans\"} ).empty?\n puts \"Warning - reached daily limit for API, going to sleep\"\n sleep_till_midnight()\n \n # check for second limit, sleep till next second if found. Don't need to check body, docs say this always returns 429 if it is triggered\n elsif response.code == '429'\n puts \"Warning - reached per-second threshold, going to sleep and try again\"\n sleep(1)\n \n else\n throttled_result = false\n end\n end\n \n # for now returning response, api only cares about throttle, not errors, etc atm\n # puts \"Ok, got a response that wasn't throttled, going to return that\"\n response\n end", "def pending_requests; end", "def pending_requests; end", "def pending_requests; end", "def throttle=(_arg0); end", "def snapshot_every_n_requests; end", "def rate_limited?\n tries = redis.get(key=\"tries:#{@env['REMOTE_ADDR']}\").to_i\n\n if tries > 10\n true\n else\n # give the key a new value and tell it to expire in 30 seconds\n redis.set(key, tries+1)\n redis.expire(key, 30)\n false\n end\n end", "def quotas()\n return get_request(address(\"/limits\"), @token)\n end", "def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend", "def rate_limit_remaining\n connection.rate_limit_remaining\n end", "def disable_rate_limits!\n @rate_limits_disabled = true\n end", "def rate_limits\n @rate_limits ||= RateLimit.create_or_update!(action: action, keys: keys, cost: cost, rate: rate, burst: burst)\n end", "def rate_limits\n @rate_limits ||= RateLimit.create_or_update!(action: action, keys: keys, cost: cost, rate: rate, burst: burst)\n end", "def throttle\n elapsed = Time.now - self.last_call\n if elapsed < 0.4\n puts 'throttling...'\n sleep(0.04 - elapsed)\n end\n self.last_call = Time.now\n end", "def call_api(object, method_name, *args, &block)\n now = ::Time.now\n\n @api_call_history.delete_if { |t| t < now - API_RATE_LIMIT_WINDOW }\n\n if @api_call_history.size >= API_RATE_LIMIT\n seconds_to_sleep = @api_call_history[0] + API_RATE_LIMIT_WINDOW - now\n\n if seconds_to_sleep > 0\n sleep(seconds_to_sleep)\n slept_now = ::Time.now\n @api_call_history.delete_if { |t| t < slept_now - API_RATE_LIMIT_WINDOW }\n end\n end\n\n @api_call_history << ::Time.now\n object.public_send(method_name, *args, &block)\n end", "def rate_limit_add(time)\n access_token = params[:access_token]\n key = \"limit-#{access_token}\"\n $redis.with do |conn|\n result = conn.set(key, duration)\n end\n end", "def call_api_response(response)\n rate_limit(headers: response.headers)\n end", "def rate_limit_from_stream(name, &blk)\n on_event(:incoming_stream) do\n instance_eval(&blk) if correct_stream?(name, :limit)\n end\n end", "def rate_limit_by_ip(delay,*tags)\n key = \"limit:\"+tags.join(\".\")\n return true if $r.exists(key)\n $r.setex(key,delay,1)\n return false\n end", "def request(method, path, params = {})\n rate_limit.after_limit do\n connection.send(method.to_sym, path, params)\n end\n end", "def timelimit\n 15.minutes\n end", "def pending_response_requests; end", "def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end", "def rate_limited?(thing, rate_limit_time = nil, increment: 1)\n key = resolve_key thing\n limit_hash = @bucket[key]\n\n # First case: limit_hash doesn't exist yet\n unless limit_hash\n @bucket[key] = {\n last_time: Time.now,\n set_time: Time.now,\n count: increment\n }\n\n return false\n end\n\n # Define the time at which we're being rate limited once so it doesn't get inaccurate\n rate_limit_time ||= Time.now\n\n if @limit && (limit_hash[:count] + increment) > @limit\n # Second case: Count is over the limit and the time has not run out yet\n return (limit_hash[:set_time] + @time_span) - rate_limit_time if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Third case: Count is over the limit but the time has run out\n # Don't return anything here because there may still be delay-based limiting\n limit_hash[:set_time] = rate_limit_time\n limit_hash[:count] = 0\n end\n\n if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n # Fourth case: we're being delayed\n (limit_hash[:last_time] + @delay) - rate_limit_time\n else\n # Fifth case: no rate limiting at all! Increment the count, set the last_time, and return false\n limit_hash[:last_time] = rate_limit_time\n limit_hash[:count] += increment\n false\n end\n end", "def snapshot_every_n_requests=(_arg0); end", "def over_limit?\n connect\n redis.incr rate_limiter_key\n redis.get(rate_limiter_key).to_i > limit\n end", "def rate_limit(id, seconds = 1)\n now_time = Time.now\n last_exec = @rate_limits[id] || (now_time - seconds.seconds - 1.second)\n\n if now_time > last_exec + seconds.seconds\n yield_result = yield\n @rate_limits[id] = now_time\n end\n\n yield_result\n end", "def conditional_requests; end", "def conditional_requests; end", "def instagram_rate_limit_warning(rate_limit_remaining, url)\n # Key-based expiration\n @rate_limit_remaining = rate_limit_remaining\n @url = url\n cache_key = [\"instagram_rate_limit_warning\", Time.now.hour]\n return nil if Rails.cache.fetch cache_key\n Rails.cache.write cache_key, true\n mail subject: \"[#{AppConfig.app_name}] WARNING: Instagram rate limit low\"\n end", "def rate_scale; end", "def resource_limits; end", "def resource_limits; end", "def enforce_rate_limit\n allowance = (session[:js_exception_notifier_allowance] || THROTTLE_MAX_RATE).to_f\n last_error_at = (session[:js_exception_notifier_last_error_at] || Time.now).to_i\n\n current_time = Time.now.to_i\n time_passed = current_time - last_error_at\n session[:js_exception_notifier_last_error_at] = current_time\n\n allowance += time_passed * (THROTTLE_MAX_RATE / THROTTLE_DURATION)\n allowance = THROTTLE_MAX_RATE if allowance > THROTTLE_MAX_RATE\n\n if allowance < 1.0\n session[:js_exception_notifier_allowance] = allowance\n if Rails.env.production?\n render json: {}, status: 200\n else\n render json: { text: \"You reached error limit!\" }, status: 422\n end\n else\n session[:js_exception_notifier_allowance] = allowance - 1.0\n end\n end", "def rate_limit_status\n\t\tresponse = access_token.get('/account/rate_limit_status.json')\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tstatus=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless status.is_a? Hash\n\t\t\tstatus\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in rate_limit_status: #{err}\"\n\t\traise err\n\tend", "def rate_limit_available?(env)\n env.key?(rack_attack_key) && (env[rack_attack_key].keys & throttle).any?\n end", "def limit; end", "def limit; end", "def limit; end", "def rate_limit_exceeded(request)\n options[:rate_limit_exceeded_callback].call(request) if options[:rate_limit_exceeded_callback]\n headers = respond_to?(:retry_after) ? {'Retry-After' => retry_after.to_f.ceil.to_s} : {}\n http_error(options[:code] || 403, options[:message] || 'Rate Limit Exceeded', headers)\n end", "def wait_time\n if rate_limit_remaining < 50\n [rate_limit_reset - Time.zone.now, 0.001].sort.last\n else\n 3600.0 / rate_limiting\n end\n end", "def api_request_raw(url, media_type = '')\n\n begin\n start_time = Time.now\n\n contents = do_request(url, media_type)\n total = Time.now.to_ms - start_time.to_ms\n info \"Successful request. URL: #{url}, Remaining: #{@remaining}, Total: #{total} ms\"\n\n contents\n rescue OpenURI::HTTPError => e\n @remaining = e.io.meta['x-ratelimit-remaining'].to_i\n @reset = e.io.meta['x-ratelimit-reset'].to_i\n\n case e.io.status[0].to_i\n # The following indicate valid Github return codes\n when 400, # Bad request\n 403, # Forbidden\n 404, # Not found\n 409, # Conflict -- returned on gets of empty repos\n 422 then # Unprocessable entity\n warn request_error_msg(url, e)\n return nil\n when 401 # Unauthorized\n warn request_error_msg(url, e)\n warn \"Unauthorised request with token: #{@token}\"\n raise e\n when 451 # DMCA takedown\n warn request_error_msg(url, e)\n warn \"Repo was taken down (DMCA)\"\n return nil\n else # Server error or HTTP conditions that Github does not report\n warn request_error_msg(url, e)\n raise e\n end\n rescue StandardError => e\n warn error_msg(url, e)\n raise e\n ensure\n # The exact limit is only enforced upon the first @reset\n # No idea how many requests are available on this key. Sleep if we have run out\n if @remaining < @req_limit\n to_sleep = @reset - Time.now.to_i + 2\n warn \"Request limit reached, reset in: #{to_sleep} secs\"\n t = Thread.new do\n slept = 0\n while true do\n debug \"Sleeping for #{to_sleep - slept} seconds\"\n sleep 1\n slept += 1\n end\n end\n sleep([0, to_sleep].max)\n t.exit\n end\n end\n end", "def over_rate_limit?\n window = 10.minutes.ago.to_i\n interval = 30.seconds.to_i\n \n return true if rate_limit.present? and rate_limit > Time.now.to_i\n if rate_limit.nil? or rate_limit < window\n self.rate_limit = window\n end\n self.rate_limit += interval\n self.save!\n false\n end", "def over_rate_limit?\n window = 10.minutes.ago.to_i\n interval = 30.seconds.to_i\n \n return true if rate_limit.present? and rate_limit > Time.now.to_i\n if rate_limit.nil? or rate_limit < window\n self.rate_limit = window\n end\n self.rate_limit += interval\n self.save!\n false\n end", "def rate; end", "def rate; end", "def max_fast_inline(num_of_requests); end", "def refresh_if_near_expiration; end", "def rate_limited_exceeded?\n limit = get_json( \"#{ GITHUB_API_URL }/rate_limit\" )[ 'rate' ][ 'remaining' ]\n limit == 0 ? true : false\nend", "def limit(limit); end", "def rate_limit_reset(throttle_data)\n now = Time.now.to_i\n throttle_period = throttle_data[:period]\n now + (throttle_period - now % throttle_period)\n end", "def doGetMaxCountPerRequest()\n end", "def rate_limit_exceeded\n headers = respond_to?(:retry_after) ? {'Retry-After' => retry_after.to_f.ceil.to_s} : {}\n http_error(options[:code] || 403, options[:message], headers)\n end", "def rate_limit_redis_key\n return @rate_limit_redis_key if @rate_limit_redis_key\n\n timestamp = Time.now\n timestamp = timestamp.to_i - timestamp.sec\n @rate_limit_redis_key =\n \"jira_handler_rate_limit::#{@event['check']['name']}::#{timestamp}\"\n end", "def rate=(_arg0); end", "def rate=(_arg0); end", "def miter_limit(limit)\n end", "def request_count; end", "def rate_scale=(_arg0); end", "def call_api(**rest_options)\n json = nil\n response = nil\n begin\n response = RestClient::Request.execute(**rest_options)\n json = JSON.parse(response.to_s) if response && !response.empty?\n headers = response.headers\n self.rate_limit = headers[:x_ratelimit_limit].to_i if headers.include?(:x_ratelimit_limit)\n self.rate_remaining = headers[:x_ratelimit_remaining].to_i if headers.include?(:x_ratelimit_remaining)\n self.rate_reset = Time.at(headers[:x_ratelimit_reset].to_i) if headers.include?(:x_ratelimit_reset)\n rescue RestClient::Exceptions::Timeout => e\n raise\n rescue RestClient::ExceptionWithResponse => e\n response = e.response\n #json = JSON.parse(response.to_s) if response && !response.empty?\n json = nil\n rescue => e\n raise\n end\n return response, json\n end" ]
[ "0.750423", "0.7502726", "0.73384", "0.7310064", "0.72990054", "0.72097987", "0.7160852", "0.71251214", "0.71103394", "0.71011657", "0.7098245", "0.70155466", "0.694872", "0.6900897", "0.6851895", "0.68482524", "0.68378204", "0.6829347", "0.676603", "0.675675", "0.674409", "0.6702924", "0.66709465", "0.6664637", "0.66394675", "0.6612071", "0.6570443", "0.65387666", "0.64842117", "0.6470845", "0.6466317", "0.64500237", "0.64493674", "0.6428301", "0.6411233", "0.63727206", "0.6364666", "0.62828195", "0.6250791", "0.6230526", "0.6229837", "0.62102133", "0.62102133", "0.62102133", "0.6204912", "0.61824834", "0.6172782", "0.6145944", "0.6145033", "0.61350137", "0.6104393", "0.6089442", "0.6089442", "0.60788286", "0.6076742", "0.60752547", "0.60734", "0.60696715", "0.60643166", "0.60604644", "0.6051294", "0.60354316", "0.6018864", "0.6011478", "0.59969723", "0.5996806", "0.5991353", "0.5984681", "0.5984681", "0.5976987", "0.5975153", "0.59718674", "0.59718674", "0.59569126", "0.592351", "0.59078854", "0.59001946", "0.59001946", "0.59001946", "0.58953637", "0.5893402", "0.58728105", "0.5868667", "0.5868667", "0.58520794", "0.58520794", "0.58247006", "0.582082", "0.5808784", "0.5786474", "0.578016", "0.5766096", "0.5754301", "0.5746525", "0.5720517", "0.5720517", "0.5706968", "0.5697383", "0.56966424", "0.5687395" ]
0.598942
67
sidekiq_options :retry => false
def perform(user_id,alert,id,nt,name,activity_id) user = User.find(user_id) user.devices.each do |device| @activity = Activity.find(activity_id) unless activity_id == 0 if @activity user.notifications.create(notification_type: @activity.activity_type, user_id: @activity.item_id, content: @activity.message ) end if @activity and (@activity.activity_type == "friend_request") nt = "friend_request" end p"=====user_id========#{user_id.inspect}=================" p"=========nt====#{nt.inspect}=================" p"=====activity_id========#{activity_id.inspect}=================" p "device_id: #{device.device_id}===========device_type: #{device.device_type}" if (device.device_type == 'iOS') p "device_id: #{device.device_id}===========device_type: #{device.device_type}" pusher = Grocer.pusher( certificate: Rails.root.join('MobiloitteDevelopment.pem'), passphrase: "Mobiloitte1", gateway: "gateway.sandbox.push.apple.com", #gateway: "gateway.push.apple.com", port: 2195, retries: 3 ) notification = Grocer::Notification.new( :device_token => device.device_id.to_s, :alert => alert, custom: {:Notification_id => id, :Notification_type => nt,name: name,activity_id: activity_id}, :badge => 1, :sound => "siren.aiff", :expiry => Time.now + 60*60, :identifier => 1234, :content_available => true ) push = pusher.push(notification) elsif (device.device_type == 'android') p "deviceandroid_id: #{device.device_id}===========device_type: #{device.device_type}" gcm = GCM.new("AIzaSyAigkMoPSiWg2vq-CQJZNYM5Hvh3-Qu9MQ") registration_ids= ["#{device.device_id}"] options = { 'data' => { 'message' =>['alert' => alert,'badge' => 1,'Notification_id' => id,'Notification_type' => nt,'name' => name, 'activity_id' => activity_id] }, "time_to_live" => 108, "delay_while_idle" => true, "collapse_key" => 'updated_state' } response = gcm.send_notification(registration_ids,options) logger.info"====================#{response}++++++++++++++++" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n Sidekiq::Worker.clear_all\n end", "def retry_options\n {tries: 15, sleep: 1}\n end", "def silence_single_worker_warning; end", "def disable_until_finished_or_interrupted; end", "def lock_timeout_retries; end", "def lock_timeout_retry_delay; end", "def clean_sidekiq\n Sidekiq::Worker.clear_all\n end", "def sidekiq?\n option?(\"sidekiq\")\n end", "def sidekiq_options(opts = T.unsafe(nil)); end", "def worker_timeout(timeout); end", "def retry\n self.solved(:retry)\n end", "def retry\n super\n end", "def retry!\n raise RetryMessage\n end", "def should_retry?(code)\n false\n end", "def retry!\n raise 'Not implemented!'\n end", "def requeue_perform_delay\n 1.0\n end", "def requeue_perform_delay\n 1.0\n end", "def trigger_requeue!\n false\n end", "def sleep_before_retry_on_limit_error\n sleep 15\n end", "def run_interrupted; end", "def process\n client.unreliable_activity_without_retry_options\n end", "def lock_timeout_retry_delay=(_arg0); end", "def perform\n # Sidekiq would not be able to get an instance as an argument\n\n\n # Do something later\n puts \"Starting to do something which takes time...\"\n sleep(5)\n puts \"Finished my time-consuming process!\"\n end", "def retry_reads?\n client.options[:retry_reads] != false\n end", "def retry_change_requests; end", "def retry_change_requests; end", "def without_reconnect(&block); end", "def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend", "def lock_timeout_retries=(_arg0); end", "def worker_timeout\n option :worker_timeout, DEFAULT_WORKER_TIMEOUT\n end", "def with_background_worker_disabled(&block)\n original_background_worker_threads = configuration.background_worker_threads\n configuration.background_worker_threads = 0\n\n block.call\n ensure\n configuration.background_worker_threads = original_background_worker_threads\n end", "def perform\n # Do nothing\n false\n end", "def workers!\n LambdaMail::Mailing::SendSpecialEmailMessageWorker.drain\nend", "def base_opts\r\n { attempt: 1, retry: false }\r\n end", "def poll_max_retries\n 3\n end", "def retry_delay\n 30\n end", "def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end", "def retry\n self.class.enqueue(\n object,\n method_name,\n *(args << {\n :job_options => {\n :parent_id => parent_id || id,\n :run_at => Time.now + times_failed ** 4,\n :priority => priority\n }\n })\n )\n end", "def retries(worker = nil, &block)\n filter_set(Sidekiq::RetrySet.new, worker, &block)\n end", "def fail_fast\n return nil unless published?\n\n @fail_fast ||= Integer(@redis.hget(key_queue_config, \"fail_fast\"))\n end", "def perform\n raise RuntimeError, \"Worker Implementations should override this\"\n end", "def reenable_on_interrupt; end", "def with_force_shutdown; end", "def retry_interval\n @options[:retry_interval]\n end", "def default_task_heartbeat_timeout; Float::INFINITY; end", "def default_fail_queue_target\n false\n end", "def set_keep_alive; end", "def recover_async\n return if !stuck?\n RecoverAudioFileWorker.perform_async(id) unless Rails.env.test?\n end", "def perform_with_tracking(*args)\n self.class.record_event(:dequeue)\n Rails.logger.debug \"Sidekiq perform: #{self} #{args} at #{Time.now}\"\n\n success = yield\n self.class.record_event(success ? :success : :failure)\n rescue\n self.class.record_event(:failure)\n raise\n end", "def worker_queue\n PingWorker.perform_async(self.id)\n end", "def max_retry\n 5\n end", "def default_fail_queue_target\n true\n end", "def worker_shutdown_timeout(timeout); end", "def worker_initial_config\n\n end", "def allow_retry\n @@retrySending = true\n @@retryQueue = Queue.new\n @@retryThread = Thread.new {\n while element = @@retryQueue.pop do\n success = false\n while !success do\n success = parentSend(element[:addr], element[:msg])\n if !success \n warn \"Failed to send message, retry in #{SEND_RETRY_INTERVAL}s \"+\n \"(msg: '#{message}')\"\n sleep(SEND_RETRY_INTERVAL)\n end\n end\n end\n } \n end", "def add_retry(worker = 'SimpleWorker', jid = 'bob', at = Time.now.to_f)\n payload = Sidekiq.dump_json('class' => worker,\n 'args' => [], 'queue' => 'default', 'jid' => jid,\n 'retry_count' => 2, 'failed_at' => Time.now.utc)\n\n Sidekiq.redis do |conn|\n conn.zadd('retry', at.to_s, payload)\n end\n end", "def queue_job; end", "def retry_jobs\n storage.jobs_for(name) do |job_to_retry|\n job_to_retry['args'].merge!(retrying: true)\n try_again(job_to_retry) if job_to_retry\n end\n end", "def allow_concurrency; end", "def allow_concurrency; end", "def update_slave\n return false unless master?\n Rollbar.warning \"Sidekiq not ready\" unless Report.sidekiq_ready?\n MultitenantProxyWorker.perform_async(Customer.tenant_name, self.id)\n end", "def default_fail_queue_target\n true\n end", "def lock_timeout; end", "def queue_lock_timeout\n 3600\n end", "def purge_interrupt_queue; end", "def purge_interrupt_queue; end", "def retryable(&block)\n RetryableRecord.retry(self, &block)\n end", "def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\n end", "def done_working\n super\n self.job = nil\n end", "def fail_fast\n @fail_fast\n end", "def simple_sidekiq_delay_for(interval, options = {})\n Proxy.new(simple_delayed_worker, self, options.merge('at' => Time.now.to_f + interval.to_f))\n end", "def sidekiq_task_options(opts = {})\n @sidekiq_task_options_hash = get_sidekiq_task_options.merge((opts).symbolize_keys!)\n end", "def nretries\n options[:nretries]\n end", "def failsafe_timeout\n super\n end", "def reply (workitem)\n\n unschedule_timeout(workitem)\n\n super\n end", "def before_starting_workers\n end", "def perform!\n end", "def ignore_disconnect; end", "def on_error_retry_delay(_exception)\n nil\n end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def worker_check_interval(interval); end", "def processing_running_task\n reset_undefined_retries!\n 'running'\n end", "def retryable?\n raise 'Not implemented!'\n end", "def perform(exception, route)\n Rails.configuration.failed_request_counter.observe(1, { route: route, exception: exception })\n sleep 5\n Rails.configuration.failed_request_counter.observe(1, { route: route, exception: exception })\n end", "def allowing_other_threads; end", "def retry_later(interval, opts = {})\n is_error = opts.to_h.fetch(:is_error, true)\n\n redis.write(\n gid,\n retries: is_error ? retries + 1 : retries,\n http_request: http_request,\n schedule_time: (Time.now + interval).to_i,\n queue: queue,\n dispatch_deadline: dispatch_deadline\n )\n redis.sadd(self.class.key, [id])\n end", "def setup_retry_queue(delay, index)\n channel.queue(\"#{queue_name}_delay_#{index}\",\n durable: !Proletariat.test_mode?,\n auto_delete: Proletariat.test_mode?,\n arguments: {\n 'x-dead-letter-exchange' => exchange_name,\n 'x-dead-letter-routing-key' => \"#{queue_name}_requeue\",\n 'x-message-ttl' => delay\n }\n ).bind(exchange, routing_key: \"#{queue_name}_delay_#{index}\")\n end", "def retry_change_requests\n @agent.retry_change_requests\n end", "def retry_later\n IngestWorkflowMonitorJob.set(wait: 15.minutes).perform_later(flow.id, @params)\n end", "def retry_block_until_true\n (0..RETRY_COUNT).each do\n return if yield\n sleep RETRY_STEP\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end", "def fire_and_forget(opts = {})\n interval = opts[:interval].is_a?(Fixnum) ? opts[:interval] : nil\n loop do\n begin\n self.work_once\n rescue @@EOQ => e\n break\n end\n sleep(interval) if interval\n end\n end", "def worker_pool; end", "def worker_pool; end", "def blocking?\n false\n end", "def blocking_thread\n worker_thread\n end", "def keep_alive; end", "def keep_alive; end", "def read_retry_interval\n options[:read_retry_interval] || Cluster::READ_RETRY_INTERVAL\n end", "def before_perform_lock(*args)\n if lock_workers(*args)\n nx = Resque.redis.setnx(lock_workers(*args).to_s, true)\n if nx == false\n sleep(requeue_perform_delay)\n Resque.redis.del(lock_enqueue(*args).to_s)\n Resque.enqueue(self, *args)\n raise Resque::Job::DontPerform\n end\n end\n end" ]
[ "0.6580955", "0.64084613", "0.6309883", "0.6303499", "0.59379095", "0.58770365", "0.57881063", "0.5756289", "0.5748831", "0.572569", "0.57132155", "0.5707041", "0.5687238", "0.5659512", "0.56595105", "0.5650672", "0.5650672", "0.5641426", "0.56057924", "0.559615", "0.5578624", "0.5545119", "0.5542926", "0.5495204", "0.5483455", "0.5483455", "0.5475682", "0.54676324", "0.54584736", "0.5451351", "0.5448858", "0.5446282", "0.5428962", "0.542852", "0.5425648", "0.5400576", "0.5399109", "0.53733367", "0.5346828", "0.5313982", "0.5309432", "0.5308355", "0.53077406", "0.5292384", "0.52904904", "0.5278424", "0.5276745", "0.5276367", "0.52638656", "0.525887", "0.52568185", "0.5246439", "0.5218679", "0.5217942", "0.52175164", "0.52011156", "0.5192825", "0.51912373", "0.51867515", "0.51867515", "0.5155978", "0.5145449", "0.5127085", "0.5123811", "0.5122817", "0.5122817", "0.51183623", "0.5117682", "0.511588", "0.51103634", "0.510949", "0.51092935", "0.5103115", "0.5101673", "0.5094581", "0.5091144", "0.5079224", "0.5073213", "0.50711775", "0.5070759", "0.5070759", "0.5070759", "0.5068808", "0.50650924", "0.5062207", "0.50620073", "0.5059165", "0.50527406", "0.5048441", "0.5047937", "0.5045759", "0.5045024", "0.50436133", "0.50379634", "0.50379634", "0.50330764", "0.5027736", "0.5027174", "0.5027174", "0.5026167", "0.50213486" ]
0.0
-1