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
#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
.symbols ⇒ Object (readonly)
Returns the value of attribute symbols.
12 13 14 |
# File 'actionview/lib/action_view/template/types.rb', line 12 def symbols @symbols end |
Instance Attribute Details
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
27 28 29 |
# File 'actionview/lib/action_view/template/types.rb', line 27 def symbol @symbol end |
Class Method Details
.[](type) ⇒ Object
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 |
.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
#==(type) ⇒ Object
43 44 45 |
# File 'actionview/lib/action_view/template/types.rb', line 43 def ==(type) @symbol == type.to_sym unless type.blank? end |
#ref ⇒ Object Also known as: to_sym
38 39 40 |
# File 'actionview/lib/action_view/template/types.rb', line 38 def ref @symbol end |
#to_s ⇒ Object Also known as: to_str
33 34 35 |
# File 'actionview/lib/action_view/template/types.rb', line 33 def to_s @symbol.to_s end |