Class: Crusoe::Commands::Read
- Inherits:
-
Object
- Object
- Crusoe::Commands::Read
- Defined in:
- lib/crusoe/commands/read.rb
Constant Summary collapse
- DAY_SEPARATOR =
"\n\n".freeze
- JOURNAL_FILE_DATE_REGEX =
%r{/(?<date>\d{4}-\d{2}-\d{2})\.md$}
Instance Attribute Summary collapse
-
#date_range ⇒ Object
readonly
Returns the value of attribute date_range.
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
Instance Method Summary collapse
-
#initialize(directory:, date_range:) ⇒ Read
constructor
A new instance of Read.
- #to_s ⇒ Object
Constructor Details
#initialize(directory:, date_range:) ⇒ Read
Returns a new instance of Read.
14 15 16 17 |
# File 'lib/crusoe/commands/read.rb', line 14 def initialize(directory:, date_range:) @directory = directory @date_range = date_range end |
Instance Attribute Details
#date_range ⇒ Object (readonly)
Returns the value of attribute date_range.
8 9 10 |
# File 'lib/crusoe/commands/read.rb', line 8 def date_range @date_range end |
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
9 10 11 |
# File 'lib/crusoe/commands/read.rb', line 9 def directory @directory end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/crusoe/commands/read.rb', line 19 def to_s files.map { File.read(_1) }.join(DAY_SEPARATOR) end |