Class: Oinky::Model::DerivedType
- Inherits:
-
Object
- Object
- Oinky::Model::DerivedType
- Defined in:
- lib/oinky/compiler.rb
Instance Method Summary collapse
-
#initialize(basetype, instancetype) ⇒ DerivedType
constructor
A new instance of DerivedType.
- #instance_type(lang) ⇒ Object
- #oinky_type ⇒ Object
-
#value_from_variant(src_exp, emitter) ⇒ Object
This can be overriden by any derived type.
Constructor Details
#initialize(basetype, instancetype) ⇒ DerivedType
Returns a new instance of DerivedType.
47 48 49 50 |
# File 'lib/oinky/compiler.rb', line 47 def initialize(basetype, instancetype) @basetype = basetype @instancetype = instancetype end |
Instance Method Details
#instance_type(lang) ⇒ Object
51 52 53 54 |
# File 'lib/oinky/compiler.rb', line 51 def instance_type(lang) return @instancetype if @instancetype.is_a? String return @instancetype[lang] end |
#oinky_type ⇒ Object
55 56 57 58 |
# File 'lib/oinky/compiler.rb', line 55 def oinky_type return @basetype if @basetype.is_a? Symbol return @basetype.oinky_type end |
#value_from_variant(src_exp, emitter) ⇒ Object
This can be overriden by any derived type. By default we just build from the base type.
61 62 63 |
# File 'lib/oinky/compiler.rb', line 61 def value_from_variant(src_exp, emitter) emitter.value_from_variant(src_exp, oinky_type) end |