Class: Puppet::Pops::Types::PStructElement
- Inherits:
-
TypedModelObject
- Object
- TypedModelObject
- Puppet::Pops::Types::PStructElement
- Defined in:
- lib/puppet/pops/types/types.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #<=>(o) ⇒ Object
- #==(o) ⇒ Object
- #generalize ⇒ Object
- #hash ⇒ Object
-
#initialize(key_type, value_type) ⇒ PStructElement
constructor
A new instance of PStructElement.
- #name ⇒ Object
Methods included from Visitable
Constructor Details
#initialize(key_type, value_type) ⇒ PStructElement
Returns a new instance of PStructElement.
807 808 809 810 |
# File 'lib/puppet/pops/types/types.rb', line 807 def initialize(key_type, value_type) @key_type = key_type @value_type = value_type end |
Instance Attribute Details
#key_type ⇒ Object
795 796 797 |
# File 'lib/puppet/pops/types/types.rb', line 795 def key_type @key_type end |
#value_type ⇒ Object
795 796 797 |
# File 'lib/puppet/pops/types/types.rb', line 795 def value_type @value_type end |
Instance Method Details
#<=>(o) ⇒ Object
816 817 818 |
# File 'lib/puppet/pops/types/types.rb', line 816 def <=>(o) self.name <=> o.name end |
#==(o) ⇒ Object
820 821 822 |
# File 'lib/puppet/pops/types/types.rb', line 820 def ==(o) self.class == o.class && value_type == o.value_type && key_type == o.key_type end |
#generalize ⇒ Object
812 813 814 |
# File 'lib/puppet/pops/types/types.rb', line 812 def generalize PStructElement.new(@key_type, @value_type.generalize) end |
#hash ⇒ Object
797 798 799 |
# File 'lib/puppet/pops/types/types.rb', line 797 def hash value_type.hash * 31 + key_type.hash end |
#name ⇒ Object
801 802 803 804 805 |
# File 'lib/puppet/pops/types/types.rb', line 801 def name k = key_type k = k.optional_type if k.is_a?(POptionalType) k.values[0] end |