Class: GoonModelGen::Golang::NamedSlice
- Defined in:
- lib/goon_model_gen/golang/named_slice.rb
Instance Attribute Summary collapse
-
#base_type ⇒ Object
readonly
Returns the value of attribute base_type.
-
#base_type_name ⇒ Object
readonly
Returns the value of attribute base_type_name.
-
#base_type_package_path ⇒ Object
readonly
Returns the value of attribute base_type_package_path.
Attributes inherited from Type
Instance Method Summary collapse
-
#initialize(name, base_type_name, base_type_package_path = nil) ⇒ NamedSlice
constructor
A new instance of NamedSlice.
- #ptr_slice? ⇒ Boolean
- #resolve(pkgs) ⇒ Object
Methods inherited from Type
Constructor Details
#initialize(name, base_type_name, base_type_package_path = nil) ⇒ NamedSlice
Returns a new instance of NamedSlice.
15 16 17 18 19 |
# File 'lib/goon_model_gen/golang/named_slice.rb', line 15 def initialize(name, base_type_name, base_type_package_path = nil) super(name) @base_type_name = base_type_name @base_type_package_path = base_type_package_path end |
Instance Attribute Details
#base_type ⇒ Object (readonly)
Returns the value of attribute base_type.
10 11 12 |
# File 'lib/goon_model_gen/golang/named_slice.rb', line 10 def base_type @base_type end |
#base_type_name ⇒ Object (readonly)
Returns the value of attribute base_type_name.
8 9 10 |
# File 'lib/goon_model_gen/golang/named_slice.rb', line 8 def base_type_name @base_type_name end |
#base_type_package_path ⇒ Object (readonly)
Returns the value of attribute base_type_package_path.
9 10 11 |
# File 'lib/goon_model_gen/golang/named_slice.rb', line 9 def base_type_package_path @base_type_package_path end |
Instance Method Details
#ptr_slice? ⇒ Boolean
29 30 31 |
# File 'lib/goon_model_gen/golang/named_slice.rb', line 29 def ptr_slice? base_type.is_a?(GoonModelGen::Golang::Modifier) && (base_type.prefix == '*') end |
#resolve(pkgs) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/goon_model_gen/golang/named_slice.rb', line 22 def resolve(pkgs) @base_type = base_type_package_path.present? ? pkgs.type_for(base_type_name, base_type_package_path) : pkgs.type_for(base_type_name) || raise("#{base_type_name.inspect} not found") end |