123456789_123456789_123456789_123456789_123456789_

Class: ActionView::Template::Types::Type

Relationships & Source Files
Inherits: Object
Defined in: actionview/lib/action_view/template/types.rb

Class Attribute Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(symbol) ⇒ Type

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 27

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

Class Attribute Details

.types (rw) Also known as: #types

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 8

cattr_accessor :types

Class Method Details

.[](type)

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 17

def self.[](type)
  return type if type.is_a?(self)

  if type.is_a?(Symbol) || types.member?(type.to_s)
    new(type)
  end
end

.register(*t)

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 11

def self.register(*t)
  types.merge(t.map { |type| type.to_s })
end

Instance Attribute Details

#symbol (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 25

attr_reader :symbol

#types (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 8

cattr_accessor :types

Instance Method Details

#==(type)

[ GitHub ]

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

def ==(type)
  return false if type.blank?
  symbol.to_sym == type.to_sym
end

#ref

[ GitHub ]

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

def ref
  to_sym || to_s
end

#to_s Also known as: #to_str

[ GitHub ]

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

delegate :to_s, :to_sym, :to => :symbol

#to_str

Alias for #to_s.

[ GitHub ]

  
# File 'actionview/lib/action_view/template/types.rb', line 32

alias to_str to_s

#to_sym

[ GitHub ]

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

delegate :to_s, :to_sym, :to => :symbol