Class: Tableficate::Filter::Choice
- Inherits:
-
Object
- Object
- Tableficate::Filter::Choice
- Defined in:
- lib/tableficate/filters/choice.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value, options = {}) ⇒ Choice
constructor
A new instance of Choice.
- #selected? ⇒ Boolean (also: #checked?)
Constructor Details
#initialize(name, value, options = {}) ⇒ Choice
Returns a new instance of Choice.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tableficate/filters/choice.rb', line 6 def initialize(name, value, = {}) @name = name @value = value @selected = !!(.has_key?(:selected) || .has_key?(:checked)) .delete(:selected) .delete(:checked) @attrs = end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
4 5 6 |
# File 'lib/tableficate/filters/choice.rb', line 4 def attrs @attrs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/tableficate/filters/choice.rb', line 4 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/tableficate/filters/choice.rb', line 4 def value @value end |
Instance Method Details
#selected? ⇒ Boolean Also known as: checked?
17 18 19 |
# File 'lib/tableficate/filters/choice.rb', line 17 def selected? @selected end |