Method: Glyph::Interpreter#initialize

Defined in:
lib/glyph/interpreter.rb

#initialize(text, context = {}) ⇒ Interpreter

Creates a new Glyph::Interpreter object.

Parameters:

  • text (String)

    the string to interpret

  • context (Hash) (defaults to: {})

    the context to pass along when expanding macros


14
15
16
17
18
19
# File 'lib/glyph/interpreter.rb', line 14

def initialize(text, context={})
	@context = context
	@context[:source] ||= {:name => "--", :file => nil, :topic => nil}
	@text = text
	@parser = Glyph::Parser.new text, @context[:source][:name]
end