Class: ActionView::Template::Types::Type
- Defined in:
- actionview/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.
21 22 23 |
# File 'actionview/lib/action_view/template/types.rb', line 21 def initialize(symbol) @symbol = symbol.to_sym end |
Instance Attribute Details
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol
19 20 21 |
# File 'actionview/lib/action_view/template/types.rb', line 19 def symbol @symbol end |
Class Method Details
.[](type) ⇒ Object
11 12 13 14 15 16 17 |
# File 'actionview/lib/action_view/template/types.rb', line 11 def self.[](type) if type.is_a?(self) type else new(type) end end |
Instance Method Details
#==(type) ⇒ Object
35 36 37 |
# File 'actionview/lib/action_view/template/types.rb', line 35 def ==(type) @symbol == type.to_sym unless type.blank? end |
#ref ⇒ Object Also known as: to_sym
30 31 32 |
# File 'actionview/lib/action_view/template/types.rb', line 30 def ref @symbol end |
#to_s ⇒ Object Also known as: to_str
25 26 27 |
# File 'actionview/lib/action_view/template/types.rb', line 25 def to_s @symbol.to_s end |