Class: Dokkit::Resource::Data
- Inherits:
-
Object
- Object
- Dokkit::Resource::Data
- Includes:
- FilenameHelper
- Defined in:
- lib/dokkit/resource/data.rb
Overview
Data are immutable resources. Data files are copied from source directory (usually doc/data) to output directory. No rendering process occurs during copying.
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#source_fn ⇒ Object
readonly
Returns the value of attribute source_fn.
Instance Method Summary collapse
-
#initialize(source_fn, configuration = { :data_dir => 'doc/data', :output_dir => 'output' }) ⇒ Data
constructor
A Data instance is initialized with the source filename and a configuration hash containing data and output directory.
-
#target_fn ⇒ Object
Return the filename of the target data file.
Methods included from FilenameHelper
Constructor Details
#initialize(source_fn, configuration = { :data_dir => 'doc/data', :output_dir => 'output' }) ⇒ Data
A Data instance is initialized with the source filename and a configuration hash containing data and output directory.
21 22 23 24 |
# File 'lib/dokkit/resource/data.rb', line 21 def initialize(source_fn, configuration = { :data_dir => 'doc/data', :output_dir => 'output' } ) @source_fn = source_fn @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
18 19 20 |
# File 'lib/dokkit/resource/data.rb', line 18 def configuration @configuration end |
#source_fn ⇒ Object (readonly)
Returns the value of attribute source_fn.
18 19 20 |
# File 'lib/dokkit/resource/data.rb', line 18 def source_fn @source_fn end |
Instance Method Details
#target_fn ⇒ Object
Return the filename of the target data file.
Example:
target_fn = Data.new(‘doc/data/data_1’).target_fn #=> ‘output/data_1’
31 32 33 |
# File 'lib/dokkit/resource/data.rb', line 31 def target_fn filename_helper(source_fn, @configuration[:data_dir], @configuration[:output_dir], '') end |