Class: RecordLoader::RecordFile
- Inherits:
-
Object
- Object
- RecordLoader::RecordFile
- Defined in:
- lib/record_loader/record_file.rb
Overview
A RecordFile is a wrapper to handle categorization of the yaml files used by RecordLoader
Constant Summary collapse
- EXTENSION =
Returns Extension of the yaml files to load.
'.yml'
- DEV_IDENTIFIER =
Returns The tag immediately prior to the extension that flags a file as being development specific. For example a file names users.dev.yaml.
'.dev'
- WIP_IDENTIFIER =
Returns The tag immediately prior to the extension that flags a file as being work-in-progress. For example a file names new_feature.wip.yaml.
'.wip'
Instance Method Summary collapse
-
#basename ⇒ String
Returns the name of the file, minus the extension and dev/wip flags.
-
#dev? ⇒ Boolean
Returns true if the file is development environment specific ie.
-
#initialize(record_file) ⇒ RecordFile
constructor
Create a RecordFile wrapper for a given file.
-
#wip? ⇒ Boolean
Returns true if the file is flagged as WIP ie.
Constructor Details
#initialize(record_file) ⇒ RecordFile
Create a RecordFile wrapper for a given file
20 21 22 |
# File 'lib/record_loader/record_file.rb', line 20 def initialize(record_file) @record_file = record_file end |
Instance Method Details
#basename ⇒ String
Returns the name of the file, minus the extension and dev/wip flags
26 27 28 29 |
# File 'lib/record_loader/record_file.rb', line 26 def basename without_extension.delete_suffix(WIP_IDENTIFIER) .delete_suffix(DEV_IDENTIFIER) end |
#dev? ⇒ Boolean
Returns true if the file is development environment specific ie. ends in .dev.yml
34 35 36 |
# File 'lib/record_loader/record_file.rb', line 34 def dev? without_extension.end_with?(DEV_IDENTIFIER) end |
#wip? ⇒ Boolean
Returns true if the file is flagged as WIP ie. ends in .wip.yml
41 42 43 |
# File 'lib/record_loader/record_file.rb', line 41 def wip? without_extension.end_with?(WIP_IDENTIFIER) end |