Class: MessagePack::IDL::Evaluator::Template
- Inherits:
-
Object
- Object
- MessagePack::IDL::Evaluator::Template
- Defined in:
- lib/msgpack/idl/evaluator.rb
Instance Attribute Summary collapse
-
#generic_type ⇒ Object
readonly
Returns the value of attribute generic_type.
-
#nullable ⇒ Object
readonly
Returns the value of attribute nullable.
Instance Method Summary collapse
-
#initialize(generic_type, nullable = false) ⇒ Template
constructor
A new instance of Template.
- #match_all(name, array) ⇒ Object
- #nullable? ⇒ Boolean
Constructor Details
#initialize(generic_type, nullable = false) ⇒ Template
Returns a new instance of Template.
26 27 28 29 30 31 |
# File 'lib/msgpack/idl/evaluator.rb', line 26 def initialize(generic_type, nullable=false) @name = generic_type.name @params = generic_type.type_params @generic_type = generic_type @nullable = nullable end |
Instance Attribute Details
#generic_type ⇒ Object (readonly)
Returns the value of attribute generic_type.
32 33 34 |
# File 'lib/msgpack/idl/evaluator.rb', line 32 def generic_type @generic_type end |
#nullable ⇒ Object (readonly)
Returns the value of attribute nullable.
32 33 34 |
# File 'lib/msgpack/idl/evaluator.rb', line 32 def nullable @nullable end |
Instance Method Details
#match_all(name, array) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/msgpack/idl/evaluator.rb', line 38 def match_all(name, array) if @name != name return nil end if array.size != @params.size return nil end resolved_params = @params.zip(array).map {|a,b| if b.class == IR::TypeParameterSymbol return nil end if a.class != IR::TypeParameterSymbol && a != b return nil end b } resolved_params end |
#nullable? ⇒ Boolean
34 35 36 |
# File 'lib/msgpack/idl/evaluator.rb', line 34 def nullable? @nullable end |