Class: ActionView::Template::SimpleType

Inherits:
Object
  • Object
show all
Defined in:
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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol) ⇒ SimpleType

Returns a new instance of SimpleType.



29
30
31
# File 'lib/action_view/template/types.rb', line 29

def initialize(symbol)
  @symbol = symbol.to_sym
end

Class Attribute Details

.symbolsObject (readonly)

Returns the value of attribute symbols.



12
13
14
# File 'lib/action_view/template/types.rb', line 12

def symbols
  @symbols
end

Instance Attribute Details

#symbolObject (readonly)

Returns the value of attribute symbol.



27
28
29
# File '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 '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

Returns:

  • (Boolean)


22
23
24
# File '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 'lib/action_view/template/types.rb', line 43

def ==(type)
  @symbol == type.to_sym unless type.blank?
end

#refObject Also known as: to_sym



38
39
40
# File 'lib/action_view/template/types.rb', line 38

def ref
  @symbol
end

#to_sObject Also known as: to_str



33
34
35
# File 'lib/action_view/template/types.rb', line 33

def to_s
  @symbol.to_s
end