Class: ProxyTo::Target

Inherits:
Module
  • Object
show all
Defined in:
lib/proxy_to/target.rb

Constant Summary collapse

VALID =
/@?\S+/i

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, pretend: false, methods: false) ⇒ Target

Returns a new instance of Target.

Parameters:

  • target (String, Symbol)


16
17
18
19
20
21
22
23
24
# File 'lib/proxy_to/target.rb', line 16

def initialize(target, pretend: false, methods: false)
  @target   = target.to_sym
  @pretend  = pretend
  @methods  = methods

  proxy_methods!
  pretend_methods! if pretend?
  methods_method! if methods?
end

Instance Attribute Details

#methodsObject (readonly) Also known as: methods?

Returns the value of attribute methods.



12
13
14
# File 'lib/proxy_to/target.rb', line 12

def methods
  @methods
end

#pretendObject (readonly) Also known as: pretend?

Returns the value of attribute pretend.



9
10
11
# File 'lib/proxy_to/target.rb', line 9

def pretend
  @pretend
end

#targetSymbol (readonly)

Returns:

  • (Symbol)


7
8
9
# File 'lib/proxy_to/target.rb', line 7

def target
  @target
end

Instance Method Details

#inspectObject



26
27
28
# File 'lib/proxy_to/target.rb', line 26

def inspect
  "ProxyTo::Target(:to => :#{target}, :pretend => #{pretend})"
end