class Schemacop::ScopedEnv

Public Class Methods

new(delegation_object, methods, backup_binding = nil, prefix = nil) click to toggle source
# File lib/schemacop/scoped_env.rb, line 3
def initialize(delegation_object, methods, backup_binding = nil, prefix = nil)
  @delegation_object = delegation_object
  @methods = methods
  @backup_binding = backup_binding
  @prefix = prefix
end

Public Instance Methods

method_missing(symbol, *args, &block) click to toggle source
Calls superclass method
# File lib/schemacop/scoped_env.rb, line 10
               def method_missing(symbol, *args, &block)
  symbol = :"#{@prefix}#{symbol}" if @prefix

  if @methods.include?(symbol)
    if @delegation_object.respond_to?(symbol)
      @delegation_object.send(symbol, *args, &block)
    elsif @backup_binding.respond_to?(symbol)
      @backup_binding.send(symbol, *args, &block)
    else
      super
    end
  else
    super
  end
end
respond_to_missing?(symbol, include_private = false) click to toggle source
Calls superclass method
# File lib/schemacop/scoped_env.rb, line 26
def respond_to_missing?(symbol, include_private = false)
  @methods.include?(symbol) || super
end