Sha256: 3cf4a74e809377856376d8bed9a487569deaefc3b60da9e63e2b4fd811b5c3f6

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

module StatusTag
  class Choice

    attr_accessor :name,      # the method that will be called on the object to determine if this is the correct choice
                              #   when nil, indicates this choice is the catch-all, naked `else`
                  :css_class, # css_class is for the CSS class that will differentiate each specific label type (color, size, etc)
                  :text,      # text is the what the label says in the view port
                  :noop       # designates a `name` as taking up space, but not rendering a tag, in the ordered set to tumble the results.

    def initialize(name: nil, css_class: "", text: "", noop: false)
      @name = name
      @css_class = css_class
      @text = text
      @noop = !!noop
    end

    def catch_all?
      name.nil?
    end

    def noop?
      noop
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
status_tag-0.2.0 lib/status_tag/choice.rb
status_tag-0.1.3 lib/status_tag/choice.rb
status_tag-0.1.2 lib/status_tag/choice.rb