class Eaco::DSL::Base

Base DSL class. Provides handy access to the target class being manipulated, DSL-specific options, and a {#target_eval} helper to do instance_eval on the target.

Nothing too fancy.

Attributes

options[R]

DSL-specific options

target[R]

The target class of the manipulation

Public Class Methods

eval(klass, options = {}, &block) click to toggle source

Executes a DSL block in the context of a DSL manipulator.

@see DSL::ACL @see DSL::Actor @see DSL::Resource

@return [Base]

# File lib/eaco/dsl/base.rb, line 22
def self.eval(klass, options = {}, &block)
  new(klass, options).tap do |dsl|
    dsl.instance_eval(&block) if block
  end
end
new(target, options) click to toggle source

Sets up the DSL instance target class and the options.

@param target [Class] @param options [Hash]

# File lib/eaco/dsl/base.rb, line 40
def initialize(target, options)
  @target, @options = target, options
end

Protected Instance Methods

target_eval(&block) click to toggle source

Evaluates the given block in the context of the target class

@param block [Proc] @return [void]

# File lib/eaco/dsl/base.rb, line 51
def target_eval(&block)
  target.instance_eval(&block)
end