class LessonsIndexer::Models::Base

Constants

VERSION_PATTERN

Attributes

file_name[R]
major[R]
minor[R]
path[R]

Public Class Methods

new(file_name) click to toggle source
# File lib/lessons_indexer/models/base.rb, line 9
def initialize(file_name)
  @file_name = file_name
  @path = File.expand_path(file_name)
  @major = file_name.match(VERSION_PATTERN)[:major].to_i
  @minor = file_name.match(VERSION_PATTERN)[:minor].to_i
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/lessons_indexer/models/base.rb, line 16
def <=>(other)
  if self.major == other.major
    self.minor <=> other.minor
  else
    self.major <=> other.major
  end
end