Class: Archdown::Library
- Inherits:
-
Object
- Object
- Archdown::Library
- Defined in:
- lib/archdown/library.rb
Overview
The Library knows about its locations for books (e.g. file directory)
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #first(identifier) ⇒ Object
-
#initialize(path) ⇒ Library
constructor
A new instance of Library.
- #last(identifier) ⇒ Object
- #path_for_identifier(identifier, *parts) ⇒ Object
Constructor Details
#initialize(path) ⇒ Library
Returns a new instance of Library.
6 7 8 |
# File 'lib/archdown/library.rb', line 6 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/archdown/library.rb', line 4 def path @path end |
Instance Method Details
#first(identifier) ⇒ Object
10 11 12 |
# File 'lib/archdown/library.rb', line 10 def first(identifier) identifier[0..1].downcase end |
#last(identifier) ⇒ Object
14 15 16 |
# File 'lib/archdown/library.rb', line 14 def last(identifier) identifier[-2..-1].downcase end |
#path_for_identifier(identifier, *parts) ⇒ Object
18 19 20 |
# File 'lib/archdown/library.rb', line 18 def path_for_identifier(identifier, *parts) File.join(path, first(identifier), last(identifier), identifier, *parts) end |