Sha256: 3b6a16eaaae2a468f10d3d71d79edc3762928461b3108e99f59f474ab0e2a1fe

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 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`
                  :klass, # klass 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, klass: "", text: "", noop: false)
      @name = name
      @klass = klass
      @text = text
      @noop = !!noop
    end

    def catch_all?
      name.nil?
    end

    def noop?
      noop
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
status_tag-0.1.1 lib/status_tag/choice.rb
status_tag-0.1.0 lib/status_tag/choice.rb