Class: Yuriita::Selects::Single

Inherits:
Object
  • Object
show all
Defined in:
lib/yuriita/selects/single.rb

Instance Method Summary collapse

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 = options
  @query = query
end

Instance Method Details

#filterObject



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

Returns:

  • (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