Class: Yuzu::Generators::GeneratedIndex
- Defined in:
- lib/yuzu/generators/index.rb
Instance Method Summary collapse
- #created_at ⇒ Object
- #default_index_filename ⇒ Object
- #generated? ⇒ Boolean
- #get_raw_contents ⇒ Object
-
#initialize(parent_folder, raw_contents = nil) ⇒ GeneratedIndex
constructor
A new instance of GeneratedIndex.
- #load_file_info! ⇒ Object
- #modified_at ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(parent_folder, raw_contents = nil) ⇒ GeneratedIndex
Returns a new instance of GeneratedIndex.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/yuzu/generators/index.rb', line 49 def initialize(parent_folder, raw_contents=nil) @raw_contents = raw_contents index_path = parent_folder.path + default_index_filename @path = index_path @path.make_file! raise "@path is nil for #{self}" if @path.nil? @parent = parent_folder @page = 1 @kind = :file end |
Instance Method Details
#created_at ⇒ Object
79 80 81 |
# File 'lib/yuzu/generators/index.rb', line 79 def created_at @created_at ||= Time.now end |
#default_index_filename ⇒ Object
66 67 68 |
# File 'lib/yuzu/generators/index.rb', line 66 def default_index_filename "index.md" end |
#generated? ⇒ Boolean
90 91 92 |
# File 'lib/yuzu/generators/index.rb', line 90 def generated? true end |
#get_raw_contents ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/yuzu/generators/index.rb', line 70 def get_raw_contents # Only becomes @raw_contents if it is still nil when raw_contents is first called. if @parent.is_blog? Yuzu::Generators.default_blog_index_template(@parent.path.relative) else Yuzu::Generators.default_index_template(@parent.path.relative) end end |
#load_file_info! ⇒ Object
87 88 |
# File 'lib/yuzu/generators/index.rb', line 87 def load_file_info! end |
#modified_at ⇒ Object
83 84 85 |
# File 'lib/yuzu/generators/index.rb', line 83 def modified_at @modified_at ||= Time.now end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/yuzu/generators/index.rb', line 62 def to_s "GeneratedIndex(#{@path.relative})" end |