class DailyLog::Pathname

The pathname for an Entry file on a given Day

Constants

DEFAULT_DIRNAME

The default name for the dir where entries are stored.

FORMAT

The default format for entries

Attributes

dirname[W]

Set the dirname where entries are stored

date[R]

The Date we're caluclating the Pathname for

Public Class Methods

dirname() click to toggle source

The dirname where entries are stored

Returns String

# File lib/daily_log/pathname.rb, line 37
def dirname
  @dirname || DEFAULT_DIRNAME
end
new(date) click to toggle source

Create a new Pathname

date - The Date we're creating a Pathname for

# File lib/daily_log/pathname.rb, line 46
def initialize(date)
  @date = date
end

Public Instance Methods

dirname() click to toggle source

The name of the directory where the Entry will live

Returns String

# File lib/daily_log/pathname.rb, line 61
def dirname
  File.join self.class.dirname, year.zero_pad, month.zero_pad
end
to_path() click to toggle source

The Pathname as a path string Returns String

# File lib/daily_log/pathname.rb, line 52
def to_path
  File.join(dirname, "#{day.zero_pad}.#{FORMAT}")
end
Also aliased as: to_s
to_s()
Alias for: to_path