Fileable
Make File-esque classes. Fileable makes it easy to create classes that can load from files.
Class level mixin for loading/opening file classes. You will generally want to use extend with this.
NOTE: This is an expiremental library, and is still
undergoing revision.
Methods
included
new
read
Classes and Modules
Module Fileable::DSLPublic Class methods
[ + ]
# File lib/more/facets/fileable.rb, line 50 def self.included(base) base.extend DSL end
New fileable object. By default this is called by read passing the file contents. Override it if need is differnt.
[ + ]
# File lib/more/facets/fileable.rb, line 62 def initialize(content) @content = content end
Public Instance methods
Override this if reading is differnt.
[ + ]
# File lib/more/facets/fileable.rb, line 68 def read(file) self.file = file if defined?(:file=) initialize(File.read(file)) end