Class: AroundTheWorld::ProxyModule

Inherits:
Module
  • Object
show all
Defined in:
lib/around_the_world/proxy_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(purpose: nil) ⇒ ProxyModule



9
10
11
# File 'lib/around_the_world/proxy_module.rb', line 9

def initialize(purpose: nil)
  @purpose = purpose unless purpose.blank?
end

Instance Attribute Details

#purposeObject (readonly)

Returns the value of attribute purpose.



5
6
7
# File 'lib/around_the_world/proxy_module.rb', line 5

def purpose
  @purpose
end

Instance Method Details

#defines_proxy_method?(method_name) ⇒ Boolean



22
23
24
# File 'lib/around_the_world/proxy_module.rb', line 22

def defines_proxy_method?(method_name)
  instance_methods(true).include?(method_name.to_sym) || private_method_defined?(method_name.to_sym)
end

#for?(purpose) ⇒ Boolean



13
14
15
# File 'lib/around_the_world/proxy_module.rb', line 13

def for?(purpose)
  self.purpose == purpose
end

#inspectObject



17
18
19
# File 'lib/around_the_world/proxy_module.rb', line 17

def inspect
  "#<#{self.class.name}#{":#{purpose}" if purpose}>"
end