Class: Rcurse::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/rcurse/context.rb

Overview

Template context

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Context) initialize(path = nil)

Create a new context

Parameters:

  • path (String) (defaults to: nil) —

    Template directory path



7
8
9
10
# File 'lib/rcurse/context.rb', line 7

def initialize path = nil
	@binding = binding
	@path = path
end

Instance Attribute Details

- (Object) path

Template directory path



27
28
29
# File 'lib/rcurse/context.rb', line 27

def path
  @path
end

Instance Method Details

- (Object) eval(code)

Evaluate Ruby code inside the context

Parameters:

  • code (String) —

    valid Ruby code

Returns:

  • result of the evaluation



22
23
24
# File 'lib/rcurse/context.rb', line 22

def eval code
	@binding.eval code
end

- (Binding) get_binding

Get Binding object for the context

Returns:

  • (Binding) —

    binding object



14
15
16
# File 'lib/rcurse/context.rb', line 14

def get_binding
	@binding
end