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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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