class Geny::Context::Base

@api private

Attributes

command[R]
locals[R]

Public Class Methods

new(command:, locals: {}) click to toggle source
# File lib/geny/context/base.rb, line 7
def initialize(command:, locals: {})
  @locals = locals
  @command = command
  @command.helpers.each { |h| extend h }
end

Private Instance Methods

method_missing(meth, *args) click to toggle source
Calls superclass method
# File lib/geny/context/base.rb, line 19
def method_missing(meth, *args)
  return super unless locals.key?(meth)

  unless args.empty?
    raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 0)"
  end

  locals[meth]
end
respond_to_missing?(meth, *) click to toggle source
Calls superclass method
# File lib/geny/context/base.rb, line 15
def respond_to_missing?(meth, *)
  locals.key?(meth) || super
end