Class: ViewSpec::Param
- Inherits:
-
Object
- Object
- ViewSpec::Param
- Includes:
- ActionView::Helpers::SanitizeHelper
- Defined in:
- lib/view_spec/param.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(name, cast_type = nil, value: nil, default: nil, **type_options) ⇒ Param
constructor
A new instance of Param.
- #to_pair ⇒ Object
- #type ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(name, cast_type = nil, value: nil, default: nil, **type_options) ⇒ Param
Returns a new instance of Param.
8 9 10 11 12 13 14 |
# File 'lib/view_spec/param.rb', line 8 def initialize(name, cast_type = nil, value: nil, default: nil, **) @name = name.to_sym @cast_type = cast_type @value = value @default = default = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/view_spec/param.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/view_spec/param.rb', line 6 def end |
Instance Method Details
#to_pair ⇒ Object
24 25 26 |
# File 'lib/view_spec/param.rb', line 24 def to_pair [name, value] end |
#type ⇒ Object
20 21 22 |
# File 'lib/view_spec/param.rb', line 20 def type @type ||= Type.for(@cast_type, **) end |
#value ⇒ Object
16 17 18 |
# File 'lib/view_spec/param.rb', line 16 def value type.cast(raw_value) end |