Class: Twirly::Compiler
- Inherits:
-
Object
- Object
- Twirly::Compiler
- Defined in:
- lib/twirly/compiler.rb
Instance Method Summary collapse
Instance Method Details
#fetch_user(user) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/twirly/compiler.rb', line 19 def fetch_user(user) output_path = File.join Twirly.source_dir, 'users', "#{user.username}.html.md.erb" puts "Creating #{output_path}" File.open(output_path, 'w') { |out| out << user.to_md } end |
#pick(post) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/twirly/compiler.rb', line 12 def pick(post) output_path = File.join Twirly.source_dir, "#{post.slug}.html.md.erb" puts "Creating #{output_path}" File.open(output_path, 'w') { |out| out << post.to_md } end |
#pull ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/twirly/compiler.rb', line 3 def pull Twirly::Post.published.each do |post| output_path = File.join Twirly.source_dir, "#{post.slug}.html.md.erb" puts "Creating #{output_path}" File.open(output_path, 'w') { |out| out << post.to_md } end end |