Class: TableSaw::Manifest
- Inherits:
-
Object
- Object
- TableSaw::Manifest
- Defined in:
- lib/table_saw/manifest.rb
Defined Under Namespace
Classes: Table
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config) ⇒ Manifest
constructor
A new instance of Manifest.
- #tables ⇒ Object
- #variables ⇒ Object
Constructor Details
#initialize(config) ⇒ Manifest
Returns a new instance of Manifest.
44 45 46 |
# File 'lib/table_saw/manifest.rb', line 44 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
42 43 44 |
# File 'lib/table_saw/manifest.rb', line 42 def config @config end |
Class Method Details
.instance ⇒ Object
36 37 38 39 40 |
# File 'lib/table_saw/manifest.rb', line 36 def self.instance raise ArgumentError, 'Could not find manifest file' unless File.exist?(TableSaw.configuration.manifest) new(YAML.safe_load(File.read(TableSaw.configuration.manifest))) end |
Instance Method Details
#tables ⇒ Object
52 53 54 55 56 |
# File 'lib/table_saw/manifest.rb', line 52 def tables @tables ||= config['tables'].map { |entry| Table.new(variables, entry) }.each_with_object({}) do |t, memo| memo[t.name] = t end end |
#variables ⇒ Object
48 49 50 |
# File 'lib/table_saw/manifest.rb', line 48 def variables config['variables'] end |