Class: Axis::Document::Base

Inherits:
Object
  • Object
show all
Extended by:
FinderMethods
Defined in:
lib/axis/document.rb

Direct Known Subclasses

Invoice

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FinderMethods

find, find_by_date

Constructor Details

#initialize(path) ⇒ Base

Returns a new instance of Base.



51
52
53
54
55
# File 'lib/axis/document.rb', line 51

def initialize(path)
  @path = Pathname.new(path)
  @filename_split = @path.basename.to_s.split("_")
  @dirname_split = @path.dirname.split
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



49
50
51
# File 'lib/axis/document.rb', line 49

def path
  @path
end

Instance Method Details

#created_onObject



65
66
67
# File 'lib/axis/document.rb', line 65

def created_on
  Date.parse(@filename_split[2])
end

#idObject



57
58
59
# File 'lib/axis/document.rb', line 57

def id
  @filename_split.first
end

#typeObject



61
62
63
# File 'lib/axis/document.rb', line 61

def type
  Axis::Document::TYPES.key(@dirname_split.last.to_s)
end