Class: Module

Inherits:
Object
  • Object
show all
Includes:
Myco::MemeBindable
Defined in:
lib/myco/bootstrap/component.rb

Overview

TODO: use a better approach than this monkey-patch

Instance Method Summary collapse

Methods included from Myco::MemeBindable

#declare_meme, #memes

Instance Method Details

#component_eval(&block) ⇒ Object

Like module_eval, but it also shifts the ConstantScope of the block



194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/myco/bootstrap/component.rb', line 194

def component_eval &block
  block_env = block.block
  cscope = Rubinius::ConstantScope.new(self, block_env.constant_scope)
  if defined? ::Myco::FileToplevel && self < ::Myco::FileToplevel
    cscope.set_myco_file
  elsif defined? ::Myco::Category && self < ::Myco::Category
    cscope.set_myco_category
  else
    cscope.set_myco_component
  end
  result = block_env.call_under(self, cscope, true, self)
  result
end