Class: Gelauto::GenericType
- Inherits:
-
Object
- Object
- Gelauto::GenericType
- Defined in:
- lib/gelauto/generic_type.rb
Instance Attribute Summary collapse
-
#generic_args ⇒ Object
readonly
Returns the value of attribute generic_args.
-
#ruby_type ⇒ Object
readonly
Returns the value of attribute ruby_type.
Instance Method Summary collapse
- #[](generic_arg_name) ⇒ Object
-
#initialize(ruby_type, generic_arg_names = []) ⇒ GenericType
constructor
A new instance of GenericType.
- #to_sig ⇒ Object
Constructor Details
#initialize(ruby_type, generic_arg_names = []) ⇒ GenericType
Returns a new instance of GenericType.
7 8 9 10 11 12 13 14 |
# File 'lib/gelauto/generic_type.rb', line 7 def initialize(ruby_type, generic_arg_names = []) @ruby_type = ruby_type @generic_args = {} generic_arg_names.each_with_object({}) do |generic_arg_name, ret| generic_args[generic_arg_name] = TypeSet.new end end |
Instance Attribute Details
#generic_args ⇒ Object (readonly)
Returns the value of attribute generic_args.
5 6 7 |
# File 'lib/gelauto/generic_type.rb', line 5 def generic_args @generic_args end |
#ruby_type ⇒ Object (readonly)
Returns the value of attribute ruby_type.
5 6 7 |
# File 'lib/gelauto/generic_type.rb', line 5 def ruby_type @ruby_type end |
Instance Method Details
#[](generic_arg_name) ⇒ Object
16 17 18 |
# File 'lib/gelauto/generic_type.rb', line 16 def [](generic_arg_name) generic_args[generic_arg_name] end |
#to_sig ⇒ Object
20 21 22 |
# File 'lib/gelauto/generic_type.rb', line 20 def to_sig raise NotImplementedError, "please define #{__method__} in derived classes" end |