Class: Yuriita::Selects::Single
- Inherits:
-
Object
- Object
- Yuriita::Selects::Single
- Defined in:
- lib/yuriita/selects/single.rb
Instance Method Summary collapse
- #filter ⇒ Object
-
#initialize(options:, query:) ⇒ Single
constructor
A new instance of Single.
- #selected?(option) ⇒ Boolean
Constructor Details
#initialize(options:, query:) ⇒ Single
Returns a new instance of Single.
4 5 6 7 |
# File 'lib/yuriita/selects/single.rb', line 4 def initialize(options:, query:) @options = @query = query end |
Instance Method Details
#filter ⇒ Object
9 10 11 12 13 |
# File 'lib/yuriita/selects/single.rb', line 9 def filter if active_option.present? active_option.filter end end |
#selected?(option) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/yuriita/selects/single.rb', line 15 def selected?(option) if active_option.present? active_option == option else false end end |