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

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



19
20
21
22
23
24
25
# File 'app/values/blacklight/types.rb', line 19

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