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

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

Overview

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.

API:

  • private

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.

API:

  • private



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.

API:

  • private



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.

API:

  • private



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.

API:

  • private



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.

API:

  • private



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.

API:

  • private



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

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