Class: Litter::Parsing::LitterFile
- Inherits:
-
Object
- Object
- Litter::Parsing::LitterFile
- Defined in:
- lib/litter/parsing/litter_file.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(path = nil, file: nil, config: {}) ⇒ LitterFile
constructor
A new instance of LitterFile.
-
#parse ⇒ Hash
Parses the file.
Constructor Details
#initialize(path = nil, file: nil, config: {}) ⇒ LitterFile
Returns a new instance of LitterFile.
12 13 14 15 16 17 |
# File 'lib/litter/parsing/litter_file.rb', line 12 def initialize(path = nil, file: nil, config: {}) validate_path_or_file(path, file) @string = path ? File.read(path) : file.read @config = Config.new(config || {}).hash end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/litter/parsing/litter_file.rb', line 7 def config @config end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
7 8 9 |
# File 'lib/litter/parsing/litter_file.rb', line 7 def string @string end |