Class: Diva::Type::MetaType
- Inherits:
-
Object
- Object
- Diva::Type::MetaType
- Defined in:
- lib/diva/type.rb
Overview
全てのType共通のスーパークラス
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #cast(value) ⇒ Object
-
#initialize(name, *rest, &cast) ⇒ MetaType
constructor
A new instance of MetaType.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, *rest, &cast) ⇒ MetaType
Returns a new instance of MetaType.
49 50 51 52 53 54 |
# File 'lib/diva/type.rb', line 49 def initialize(name, *rest, &cast) @name = name.to_sym if cast define_singleton_method :cast, &cast end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
47 48 49 |
# File 'lib/diva/type.rb', line 47 def name @name end |
Instance Method Details
#cast(value) ⇒ Object
56 57 58 |
# File 'lib/diva/type.rb', line 56 def cast(value) value end |
#inspect ⇒ Object
64 65 66 |
# File 'lib/diva/type.rb', line 64 def inspect "Diva::Type(#{to_s})" end |
#to_s ⇒ Object
60 61 62 |
# File 'lib/diva/type.rb', line 60 def to_s name.to_s end |