class Khaleesi::Page
Public Class Methods
new(page_file, page_variables)
click to toggle source
# File lib/khaleesi/generator.rb, line 586 def initialize(page_file, page_variables) @page_file = File.expand_path(page_file) @page_variables = page_variables end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/khaleesi/generator.rb, line 591 def <=> (other) regexp = /^sequence(\p{Blank}?):(\p{Blank}?)(\d+)$/ self_sequence = @page_variables[regexp, 3] if @page_variables o_variables = other.instance_variable_get(:@page_variables) other_sequence = o_variables[regexp, 3] if o_variables # if which one specify sequence, we shall force comparing by sequence. if self_sequence || other_sequence self_sequence = self_sequence.to_i other_sequence = other_sequence.to_i return 1 if self_sequence < other_sequence return 0 if self_sequence == other_sequence return -1 if self_sequence > other_sequence end other_create_time = other.take_create_time self_create_time = take_create_time other_create_time <=> self_create_time end
take_create_time()
click to toggle source
# File lib/khaleesi/generator.rb, line 615 def take_create_time # cache the create time to improve performance while sorting by. return @create_time if @create_time @create_time = Generator.fetch_create_time(@page_file) end
to_s()
click to toggle source
# File lib/khaleesi/generator.rb, line 621 def to_s @page_file end