Class: ActionView::Template::Types::Type
- Inherits:
-
Object
- Object
- ActionView::Template::Types::Type
- Defined in:
- lib/action_view/template/types.rb
Constant Summary collapse
- SET =
Struct.new(:symbols).new([ :html, :text, :js, :css, :xml, :json ])
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 (also: #to_sym)
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(symbol) ⇒ Type
Returns a new instance of Type.
19 20 21 |
# File 'lib/action_view/template/types.rb', line 19 def initialize(symbol) @symbol = symbol.to_sym end |
Instance Attribute Details
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
17 18 19 |
# File 'lib/action_view/template/types.rb', line 17 def symbol @symbol end |
Class Method Details
.[](type) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/action_view/template/types.rb', line 9 def self.[](type) if type.is_a?(self) type else new(type) end end |
Instance Method Details
#==(type) ⇒ Object
33 34 35 |
# File 'lib/action_view/template/types.rb', line 33 def ==(type) @symbol == type.to_sym unless type.blank? end |
#ref ⇒ Object Also known as: to_sym
28 29 30 |
# File 'lib/action_view/template/types.rb', line 28 def ref @symbol end |
#to_s ⇒ Object Also known as: to_str
23 24 25 |
# File 'lib/action_view/template/types.rb', line 23 def to_s @symbol.to_s end |