Sha256: 0c30e922dc98ddff49a51043617476f46967bb8cb4d24d488f5478ac179b8d70
Contents?: true
Size: 1.21 KB
Versions: 457
Compression:
Stored size: 1.21 KB
Contents
module Puppet::Pops module Types # Interface implemented by a type that has InvocableMembers module TypeWithMembers # @return [InvocableMember,nil] An invocable member if it exists, or `nil` def [](member_name) raise NotImplementedError, "'#{self.class.name}' should implement #[]" end end # Interface implemented by attribute and function members module InvocableMember # Performs type checking of arguments and invokes the method that corresponds to this # method. The result of the invocation is returned # # @param receiver [Object] The receiver of the call # @param scope [Puppet::Parser::Scope] The caller scope # @param args [Array] Array of arguments. # @return [Object] The result returned by the member function or attribute # # @api private def invoke(receiver, scope, args, &block) raise NotImplementedError, "'#{self.class.name}' should implement #invoke" end end # Plays the same role as an PAttribute in the PObjectType. Provides # access to known attr_readers and plain reader methods. class AttrReader include InvocableMember def initialize(message) @message = message.to_sym end def invoke(receiver, scope, args, &block) receiver.send(@message) end end end end
Version data entries
457 entries across 457 versions & 2 rubygems