Class: Mud::Utils::LocalsBinding

Inherits:
BasicObject
Defined in:
lib/mud/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(locals, &block) ⇒ LocalsBinding

Returns a new instance of LocalsBinding.



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/mud/utils.rb', line 107

def initialize(locals, &block)
  @_locals = locals

  locals.each_pair do |name, value|
    instance_eval %{
      def #{name}
        _get(:#{name})
      end
    }
  end

  instance_eval(&block) if block
end

Instance Method Details

#bindingObject



129
130
131
# File 'lib/mud/utils.rb', line 129

def binding
  ::Proc.new {}.binding
end

#js_directory(*paths) ⇒ Object



121
122
123
# File 'lib/mud/utils.rb', line 121

def js_directory(*paths)
  ::Mud.js_directory(*paths)
end

#render(opts) ⇒ Object



125
126
127
# File 'lib/mud/utils.rb', line 125

def render(opts)
  ::Mud.render(opts.update :basepath => js_directory)
end