Class: Stencil::Template::State

Inherits:
Object
  • Object
show all
Defined in:
lib/stencil/template.rb,
lib/stencil/directives/term-style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, &file_opener) ⇒ State

Returns a new instance of State.



126
127
128
129
# File 'lib/stencil/template.rb', line 126

def initialize(data, &file_opener)
  @data = data
  @file_opener = file_opener
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



135
136
137
# File 'lib/stencil/template.rb', line 135

def data
  @data
end

Instance Method Details

#get_template(path) ⇒ Object



131
132
133
# File 'lib/stencil/template.rb', line 131

def get_template(path)
  Template::file(path, &@file_opener)
end

#terminal_styleObject



44
45
46
47
48
49
# File 'lib/stencil/directives/term-style.rb', line 44

def terminal_style
  @style ||= Styles.keys.inject({}){|style, key|
    style.merge({key => 'default'})
  }
  return @style
end

#terminal_style=(style) ⇒ Object



51
52
53
# File 'lib/stencil/directives/term-style.rb', line 51

def terminal_style=(style)
  @style = style
end