Class: Rtlog::Entry

Inherits:
Object
  • Object
show all
Includes:
DirUtils
Defined in:
lib/rtlog/archives.rb

Direct Known Subclasses

DayEntry, MonthEntry, YearEntry

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DirUtils

#entries

Constructor Details

#initialize(config, path) ⇒ Entry

Returns a new instance of Entry.



127
128
129
130
131
# File 'lib/rtlog/archives.rb', line 127

def initialize config, path
  @config = config
  @path   = path
  @date   = nil
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



123
124
125
# File 'lib/rtlog/archives.rb', line 123

def config
  @config
end

#loggerObject



145
146
147
# File 'lib/rtlog/archives.rb', line 145

def logger
  defined?(@logger) ? @logger : Rtlog.logger
end

#pathObject (readonly)

Returns the value of attribute path.



124
125
126
# File 'lib/rtlog/archives.rb', line 124

def path
  @path
end

Instance Method Details

#==(v) ⇒ Object



140
141
142
143
# File 'lib/rtlog/archives.rb', line 140

def ==(v)
  return false if v.respond_to?(:path)
  self.path == v.path
end

#dateObject



133
134
135
136
137
138
# File 'lib/rtlog/archives.rb', line 133

def date
  unless @date
    @date = Time.zone.local( *path.split('/').last(date_split_size).collect{|v| v.to_i } )
  end
  @date
end