Module: Fileable

Module | Fileable
In: | lib/more/facets/fileable.rb

# 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::DSL

### Public Class methods

included(base)

When included extend DSL too.

[Source]

    # File lib/more/facets/fileable.rb, line 50
      def self.included(base)
        base.extend DSL
      end

new(content)

New fileable object. By default this is called by read passing the file contents. Override it if need is differnt.

[Source]

    # File lib/more/facets/fileable.rb, line 62
      def initialize(content)
        @content = content
      end

### Public Instance methods

read(file)

Override this if reading is differnt.

[Source]

    # File lib/more/facets/fileable.rb, line 68
      def read(file)
        self.file = file if defined?(:file=)
        initialize(File.read(file))
      end

[Validate]