Class: TextRecord::FileAttribute

Inherits:
Attribute show all
Defined in:
lib/text_record/attribute.rb

Instance Attribute Summary

Attributes inherited from Attribute

#name, #options

Instance Method Summary collapse

Methods inherited from Attribute

for_options, #initialize

Constructor Details

This class inherits a constructor from TextRecord::Attribute

Instance Method Details

#parse(obj) ⇒ Object



22
23
24
25
# File 'lib/text_record/attribute.rb', line 22

def parse(obj)
  file_contents = IO.read("#{obj.directory}/#{options[:from]}")
  obj.instance_variable_set("@#{name.to_s.underscore}".to_sym, file_contents)
end