Module: NsOptions::Proxy::ProxyMethods

Defined in:
lib/ns-options/proxy.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object

for everything else, send to the proxied NAMESPACE handler at this point it really just enables setting dynamic options



82
83
84
85
86
87
88
# File 'lib/ns-options/proxy.rb', line 82

def method_missing(meth, *args, &block)
  if (po = self.__proxy_options__) && po.respond_to?(meth.to_s)
    po.send(meth.to_s, *args, &block)
  else
    super
  end
end

Instance Method Details

#apply(*args, &block) ⇒ Object



55
56
57
# File 'lib/ns-options/proxy.rb', line 55

def apply(*args, &block)
  __proxy_options__.apply(*args, &block)
end

#define(*args, &block) ⇒ Object



67
68
69
# File 'lib/ns-options/proxy.rb', line 67

def define(*args, &block)
  __proxy_options__.define(*args, &block)
end

#each(*args, &block) ⇒ Object



63
64
65
# File 'lib/ns-options/proxy.rb', line 63

def each(*args, &block)
  __proxy_options__.each(*args, &block)
end

#namespace(*args, &block) ⇒ Object Also known as: ns



50
51
52
# File 'lib/ns-options/proxy.rb', line 50

def namespace(*args, &block)
  __proxy_options__.namespace(*args, &block)
end

#option(*args, &block) ⇒ Object Also known as: opt

pass thru namespace methods to the proxied NAMESPACE handler



45
46
47
# File 'lib/ns-options/proxy.rb', line 45

def option(*args, &block)
  __proxy_options__.option(*args, &block)
end

#required_set?(*args, &block) ⇒ Boolean

Returns:



71
72
73
# File 'lib/ns-options/proxy.rb', line 71

def required_set?(*args, &block)
  __proxy_options__.required_set?(*args, &block)
end

#respond_to?(*args) ⇒ Boolean

Returns:



90
91
92
93
94
95
96
# File 'lib/ns-options/proxy.rb', line 90

def respond_to?(*args)
  if (po = self.__proxy_options__) && po.respond_to?(args.first.to_s)
    true
  else
    super
  end
end

#to_hash(*args, &block) ⇒ Object



59
60
61
# File 'lib/ns-options/proxy.rb', line 59

def to_hash(*args, &block)
  __proxy_options__.to_hash(*args, &block)
end

#valid?(*args, &block) ⇒ Boolean

Returns:



75
76
77
# File 'lib/ns-options/proxy.rb', line 75

def valid?(*args, &block)
  __proxy_options__.valid?(*args, &block)
end