Class: Diva::Type::MetaType
- Inherits:
-
Object
- Object
- Diva::Type::MetaType
show all
- Defined in:
- lib/diva/type.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, &cast) ⇒ MetaType
Returns a new instance of MetaType.
56
57
58
59
60
61
|
# File 'lib/diva/type.rb', line 56
def initialize(name, *, &cast)
@name = name.to_sym
if cast
define_singleton_method :cast, &cast
end
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
54
55
56
|
# File 'lib/diva/type.rb', line 54
def name
@name
end
|
Instance Method Details
#cast(value) ⇒ Object
63
64
65
|
# File 'lib/diva/type.rb', line 63
def cast(value)
value
end
|
#dump_for_json(value) ⇒ Object
71
72
73
|
# File 'lib/diva/type.rb', line 71
def dump_for_json(value)
value
end
|
#inspect ⇒ Object
75
76
77
|
# File 'lib/diva/type.rb', line 75
def inspect
"Diva::Type(#{self})"
end
|
#to_s ⇒ Object
67
68
69
|
# File 'lib/diva/type.rb', line 67
def to_s
name.to_s
end
|