Class: Payload::AttrRoot

Inherits:
Object
  • Object
show all
Defined in:
lib/payload/arm/attr.rb

Overview

Root proxy for pl.attr so that pl.attr.name returns an Attr (not Class#name). Session#attr returns this instead of the Attr class to avoid Class/Module methods (e.g. .name) shadowing attribute names.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



70
71
72
73
74
75
76
77
# File 'lib/payload/arm/attr.rb', line 70

def method_missing(name, *args)
  if args.size == 1 && args[0].is_a?(Symbol)
    inner = Attr.new(name.to_s)
    Attr.new(args[0].to_s, inner).call
  else
    Attr.new(name.to_s)
  end
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/payload/arm/attr.rb', line 79

def respond_to_missing?(name, include_private = false)
  true
end