Class: ViewSpec::Type
- Inherits:
-
Object
- Object
- ViewSpec::Type
- Defined in:
- lib/view_spec/type.rb
Direct Known Subclasses
ViewSpec::Types::Boolean, ViewSpec::Types::Date, ViewSpec::Types::DateTime, ViewSpec::Types::Decimal, ViewSpec::Types::Float, ViewSpec::Types::Integer, ViewSpec::Types::String, ViewSpec::Types::Symbol, ViewSpec::Types::Time
Constant Summary collapse
- TYPES =
i[boolean date date_time decimal float integer string symbol time]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**options) ⇒ Type
constructor
A new instance of Type.
- #type ⇒ Object
Constructor Details
#initialize(**options) ⇒ Type
Returns a new instance of Type.
7 8 9 |
# File 'lib/view_spec/type.rb', line 7 def initialize(**) = end |
Class Method Details
.for(type) ⇒ Object
16 17 18 19 20 |
# File 'lib/view_spec/type.rb', line 16 def for(type, ...) return new(...) unless type.in?(TYPES) "ViewSpec::Types::#{type.to_s.camelize}".constantize.new(...) end |
Instance Method Details
#type ⇒ Object
11 12 13 |
# File 'lib/view_spec/type.rb', line 11 def type self.class.name.demodulize.to_sym end |