Class: Blacklight::Types::Value

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

Direct Known Subclasses

Array, Boolean, Date, JsonValue, String, Time

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Value

Returns a new instance of Value.



19
20
21
# File 'app/values/blacklight/types.rb', line 19

def initialize(**kwargs)
  @kwargs = kwargs
end

Class Method Details

.coerce(input) ⇒ Object



15
16
17
# File 'app/values/blacklight/types.rb', line 15

def self.coerce(input)
  new.cast(input)
end

Instance Method Details

#cast(input) ⇒ Object



23
24
25
26
27
28
29
# File 'app/values/blacklight/types.rb', line 23

def cast(input)
  if input.is_a?(::Array)
    input.first
  else
    input
  end
end