Class: Fixturizer::Getters::Template
- Inherits:
-
Object
- Object
- Fixturizer::Getters::Template
- Defined in:
- lib/fixturizer/getters/init.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
-
#initialize(filename:, options: nil) ⇒ Template
constructor
A new instance of Template.
- #read_file(file) ⇒ Object
- #retrieve ⇒ Object
Constructor Details
#initialize(filename:, options: nil) ⇒ Template
Returns a new instance of Template.
8 9 10 11 |
# File 'lib/fixturizer/getters/init.rb', line 8 def initialize(filename:, options: nil) @filename = filename @options = end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/fixturizer/getters/init.rb', line 6 def data @data end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/fixturizer/getters/init.rb', line 6 def filename @filename end |
Instance Method Details
#read_file(file) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/fixturizer/getters/init.rb', line 17 def read_file(file) return File.readlines(file).join rescue Errno::EACCES puts "Error: Permission denied to read the file #{file}." rescue StandardError => e puts "Error: #{e.}" end |
#retrieve ⇒ Object
13 14 15 |
# File 'lib/fixturizer/getters/init.rb', line 13 def retrieve raise "Abstract template, don't use" end |