Class: ActionView::Template::Types::Type
- Defined in:
- actionview/lib/action_view/template/types.rb
Instance Attribute Summary collapse
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Class Method Summary collapse
Instance Method Summary collapse
- #==(type) ⇒ Object
-
#initialize(symbol) ⇒ Type
constructor
A new instance of Type.
- #ref ⇒ Object
Constructor Details
#initialize(symbol) ⇒ Type
Returns a new instance of Type.
27 28 29 |
# File 'actionview/lib/action_view/template/types.rb', line 27 def initialize(symbol) @symbol = symbol.to_sym end |
Instance Attribute Details
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol
25 26 27 |
# File 'actionview/lib/action_view/template/types.rb', line 25 def symbol @symbol end |
Class Method Details
.[](type) ⇒ Object
17 18 19 20 21 22 23 |
# File 'actionview/lib/action_view/template/types.rb', line 17 def self.[](type) return type if type.is_a?(self) if type.is_a?(Symbol) || types.member?(type.to_s) new(type) end end |
.register(*t) ⇒ Object
11 12 13 |
# File 'actionview/lib/action_view/template/types.rb', line 11 def self.register(*t) types.merge(t.map { |type| type.to_s }) end |
Instance Method Details
#==(type) ⇒ Object
38 39 40 41 |
# File 'actionview/lib/action_view/template/types.rb', line 38 def ==(type) return false if type.blank? symbol.to_sym == type.to_sym end |
#ref ⇒ Object
34 35 36 |
# File 'actionview/lib/action_view/template/types.rb', line 34 def ref to_sym || to_s end |