Class: Puppet::Pops::Types::RubyMethod Private

Inherits:
Annotation show all
Defined in:
lib/puppet/pops/types/ruby_method.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants inherited from Annotation

Annotation::CLEAR

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Annotation

_pcore_type, annotate, annotate_new, type_name

Methods included from PuppetObject

#_pcore_all_contents, #_pcore_contents, #_pcore_init_hash, #_pcore_type, #to_s

Methods inherited from Adaptable::Adapter

adapt, adapt_new, associate_adapter, clear, create_adapter, get, instance_var_name, self_attr_name, type_name

Constructor Details

#initialize(body, parameters = nil) ⇒ RubyMethod

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RubyMethod.



26
27
28
29
# File 'lib/puppet/pops/types/ruby_method.rb', line 26

def initialize(body, parameters = nil)
  @body = body
  @parameters = parameters
end

Instance Attribute Details

#bodyObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/puppet/pops/types/ruby_method.rb', line 24

def body
  @body
end

#parametersObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/puppet/pops/types/ruby_method.rb', line 24

def parameters
  @parameters
end

Class Method Details

.from_asserted_hash(init_hash) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/puppet/pops/types/ruby_method.rb', line 20

def self.from_asserted_hash(init_hash)
  new(init_hash['body'], init_hash['parameters'])
end

.from_hash(init_hash) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/puppet/pops/types/ruby_method.rb', line 16

def self.from_hash(init_hash)
  from_asserted_hash(Types::TypeAsserter.assert_instance_of('RubyMethod initializer', _pcore_type.init_hash_type, init_hash))
end

.register_ptype(loader, ir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Register the Annotation type. This is the type that all custom Annotations will inherit from.



7
8
9
10
11
12
13
14
# File 'lib/puppet/pops/types/ruby_method.rb', line 7

def self.register_ptype(loader, ir)
  @type = Pcore.create_object_type(loader, ir, self, 'RubyMethod', 'Annotation',
                                   'body' => PStringType::DEFAULT,
                                   'parameters' => {
                                     KEY_TYPE => POptionalType.new(PStringType::NON_EMPTY),
                                     KEY_VALUE => nil
                                   })
end