Class: Trekky::Context
- Inherits:
-
Object
- Object
- Trekky::Context
- Defined in:
- lib/trekky/context.rb
Instance Attribute Summary collapse
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
Instance Method Summary collapse
- #find_partial(name) ⇒ Object
-
#initialize(source_dir) ⇒ Context
constructor
A new instance of Context.
- #layouts ⇒ Object
- #partials ⇒ Object
- #sources ⇒ Object
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_dir ⇒ Object (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 |
#layouts ⇒ Object
24 25 26 |
# File 'lib/trekky/context.rb', line 24 def layouts @files[:layouts] end |
#partials ⇒ Object
20 21 22 |
# File 'lib/trekky/context.rb', line 20 def partials @files[:partials] end |
#sources ⇒ Object
16 17 18 |
# File 'lib/trekky/context.rb', line 16 def sources @files[:sources] end |