Module: Sandboxy::Sandboxed::SandboxyInstanceMethods
- Defined in:
- lib/sandboxy/sandboxed.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
56
57
58
59
60
61
62
63
64
|
# File 'lib/sandboxy/sandboxed.rb', line 56
def method_missing(method, *args)
if method.to_s[/move_environment_(.+)/]
move_environment($1)
elsif method.to_s[/(.+)_environment?/]
environment?($1)
else
super
end
end
|
Instance Method Details
#environment ⇒ Object
85
86
87
88
89
|
# File 'lib/sandboxy/sandboxed.rb', line 85
def environment
return Sandboxy.configuration.default if sandbox.nil?
sandbox.environment
end
|
#environment?(value) ⇒ Boolean
81
82
83
|
# File 'lib/sandboxy/sandboxed.rb', line 81
def environment?(value)
environment == value
end
|
#move_environment(environment) ⇒ Object
72
73
74
75
76
77
78
79
|
# File 'lib/sandboxy/sandboxed.rb', line 72
def move_environment(environment)
case environment
when Sandboxy.configuration.default
move_to_default_environment
else
move_to_custom_environment(environment)
end
end
|
#respond_to_missing?(method, include_private = false) ⇒ Boolean
66
67
68
69
70
|
# File 'lib/sandboxy/sandboxed.rb', line 66
def respond_to_missing?(method, include_private = false)
super ||
method.to_s[/move_environment_(.+)/] ||
method.to_s[/(.+)_environment?/]
end
|