Class: Blacklight::Types::Selector

Inherits:
Array show all
Defined in:
app/values/blacklight/types.rb

Instance Method Summary collapse

Methods inherited from Value

coerce

Constructor Details

#initialize(by: nil, block: nil, **kwargs) ⇒ Selector

Returns a new instance of Selector.



98
99
100
101
102
# File 'app/values/blacklight/types.rb', line 98

def initialize(by: nil, block: nil, **kwargs)
  super(**kwargs)
  @by = by
  @block = block
end

Instance Method Details

#cast(input) ⇒ Object



104
105
106
107
108
# File 'app/values/blacklight/types.rb', line 104

def cast(input)
  return super.public_send(@by) unless @block

  super.public_send(@by, &@block)
end