Module: JekyllRecker::Generators::Base
- Included in:
- Git, Graphs, ImageResize, Stats
- Defined in:
- lib/jekyll_recker/generators.rb
Overview
Base Generator
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
Methods included from Math
Methods included from Logging
Methods included from Date
#calculate_streaks, #slice_by_consecutive, #time_to_date
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
12 13 14 |
# File 'lib/jekyll_recker/generators.rb', line 12 def site @site end |
Instance Method Details
#data_file_target ⇒ Object
29 30 31 |
# File 'lib/jekyll_recker/generators.rb', line 29 def data_file_target File.join site.data_dir, "#{name}.json" end |
#generate(site) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll_recker/generators.rb', line 18 def generate(site) @site = Site.new(site) if @site.production? info "skipping #{name} generator" else info "running #{name} generator" data = crunch File.open(data_file_target, 'w') { |f| f.write(JSON.pretty_generate(data)) } unless data.nil? end end |
#name ⇒ Object
14 15 16 |
# File 'lib/jekyll_recker/generators.rb', line 14 def name self.class.name.split('::').last.downcase end |