Class: ActionView::Template::SimpleType
- Defined in:
- actionview/lib/action_view/template/types.rb
Overview
SimpleType is mostly just a stub implementation for when Action View is used without Action Dispatch.
Class Attribute Summary collapse
-
.symbols ⇒ Object
readonly
Returns the value of attribute symbols.
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) ⇒ SimpleType
constructor
A new instance of SimpleType.
- #ref ⇒ Object (also: #to_sym)
- #to_s ⇒ Object (also: #to_str)
Constructor Details
permalink #initialize(symbol) ⇒ SimpleType
Returns a new instance of SimpleType.
29 30 31 |
# File 'actionview/lib/action_view/template/types.rb', line 29 def initialize(symbol) @symbol = symbol.to_sym end |
Class Attribute Details
Instance Attribute Details
Class Method Details
permalink .[](type) ⇒ Object
[View source]
14 15 16 17 18 19 20 |
# File 'actionview/lib/action_view/template/types.rb', line 14 def [](type) if type.is_a?(self) type else new(type) end end |
permalink .valid_symbols?(symbols) ⇒ Boolean
:nodoc
22 23 24 |
# File 'actionview/lib/action_view/template/types.rb', line 22 def valid_symbols?(symbols) # :nodoc symbols.all? { |s| @symbols.include?(s) } end |
Instance Method Details
permalink #==(type) ⇒ Object
[View source]
43 44 45 |
# File 'actionview/lib/action_view/template/types.rb', line 43 def ==(type) @symbol == type.to_sym unless type.blank? end |
permalink #ref ⇒ Object Also known as: to_sym
[View source]
38 39 40 |
# File 'actionview/lib/action_view/template/types.rb', line 38 def ref @symbol end |
permalink #to_s ⇒ Object Also known as: to_str
[View source]
33 34 35 |
# File 'actionview/lib/action_view/template/types.rb', line 33 def to_s @symbol.to_s end |