class Miyano::Site
Public Class Methods
new()
click to toggle source
# File lib/miyano/site.rb, line 4 def initialize @posts = [] @tags = {} end
Public Instance Methods
add_post(post)
click to toggle source
# File lib/miyano/site.rb, line 13 def add_post(post) @posts << post @posts.sort_by! {|p| [p.mod_date, p.cre_date]} @posts.reverse! post.tags.each do |tag| if @tags.include? tag @tags[tag] += 1 else @tags[tag] = 1 end end @tags = @tags.sort_by {|key, value| [-value, key.length]} .to_h end
current_tag()
click to toggle source
# File lib/miyano/site.rb, line 57 def current_tag @current_tag end
current_tag=(tag)
click to toggle source
# File lib/miyano/site.rb, line 61 def current_tag=(tag) @current_tag = tag end
posts()
click to toggle source
# File lib/miyano/site.rb, line 9 def posts @posts end