Class: Bobkit::Scope
Instance Method Summary collapse
-
#initialize(scope) ⇒ Scope
constructor
A new instance of Scope.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #respond_to?(method_name, include_private = false) ⇒ Boolean
Methods included from SlimBridge
Methods included from SlimOptions
Methods included from FileHelpers
#copy_file, #create_file, #create_folder, #create_folder_for
Constructor Details
#initialize(scope) ⇒ Scope
Returns a new instance of Scope.
5 6 7 |
# File 'lib/bobkit/scope.rb', line 5 def initialize(scope) @scope = scope end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/bobkit/scope.rb', line 9 def method_missing(method_name, *arguments, &block) if @scope.respond_to?(:key?) and @scope.key?(method_name) @scope[method_name] elsif @scope.respond_to? method_name @scope.send method_name else super end end |
Instance Method Details
#respond_to?(method_name, include_private = false) ⇒ Boolean
19 20 21 22 23 24 25 26 27 |
# File 'lib/bobkit/scope.rb', line 19 def respond_to?(method_name, include_private = false) if @scope.respond_to?(:key?) and @scope.key?(method_name) true elsif @scope.respond_to? method_name true else super end end |