Class: Trekky::Context

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_dir) ⇒ Context

Returns a new instance of Context.



10
11
12
13
14
# File 'lib/trekky/context.rb', line 10

def initialize(source_dir)
  @source_dir = source_dir
  @files = { layouts: [], partials: [], sources: [] }
  build
end

Instance Attribute Details

#source_dirObject (readonly)

Returns the value of attribute source_dir.



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

def source_dir
  @source_dir
end

Instance Method Details

#find_partial(name) ⇒ Object



28
29
30
# File 'lib/trekky/context.rb', line 28

def find_partial(name)
  partials.find {|p| p.path == File.join(source_dir, name)}
end

#layoutsObject



24
25
26
# File 'lib/trekky/context.rb', line 24

def layouts
  @files[:layouts]
end

#partialsObject



20
21
22
# File 'lib/trekky/context.rb', line 20

def partials
  @files[:partials]
end

#sourcesObject



16
17
18
# File 'lib/trekky/context.rb', line 16

def sources
  @files[:sources]
end