Module: RVGP::Base::Grid::HasMultipleSheets::ClassMethods
- Defined in:
- lib/rvgp/base/grid.rb
Overview
This module contains the Class methods, that are automatically included, at the time RVGP::Base::Grid::HasMultipleSheets is included into a class.
Instance Method Summary collapse
-
#has_sheets(sheet_output_prefix) {|year| ... } ⇒ void
Define what additional sheets, this Grid will handle.
-
#sheet_output_prefix ⇒ String
Returns the sheet_output_prefix, that was set in #has_sheets.
-
#sheets(year) ⇒ Array<String>
Returns the sheets that are available for the given year.
-
#uptodate?(year) ⇒ TrueClass, FalseClass
Whether this grid’s outputs are fresh.
Instance Method Details
#has_sheets(sheet_output_prefix) {|year| ... } ⇒ void
This method returns an undefined value.
Define what additional sheets, this Grid will handle.
491 492 493 494 |
# File 'lib/rvgp/base/grid.rb', line 491 def has_sheets(sheet_output_prefix, &block) # rubocop:disable Naming/PredicateName @has_sheets = block @sheet_output_prefix = sheet_output_prefix end |
#sheet_output_prefix ⇒ String
Returns the sheet_output_prefix, that was set in #has_sheets
507 508 509 |
# File 'lib/rvgp/base/grid.rb', line 507 def sheet_output_prefix @sheet_output_prefix end |
#sheets(year) ⇒ Array<String>
Returns the sheets that are available for the given year. This is calculated using the block provided in #has_sheets
500 501 502 503 |
# File 'lib/rvgp/base/grid.rb', line 500 def sheets(year) @sheets ||= {} @sheets[year] ||= @has_sheets.call year end |
#uptodate?(year) ⇒ TrueClass, FalseClass
Whether this grid’s outputs are fresh. This is determined, by examing the mtime’s of our #dependency_paths.
522 523 524 525 526 |
# File 'lib/rvgp/base/grid.rb', line 522 def uptodate?(year) sheets(year).all? do |sheet| FileUtils.uptodate? output_path(year, sheet), dependency_paths end end |