class Fictive::Bundle

Attributes

documents[R]

Public Class Methods

import(path, options={}) click to toggle source
# File lib/fictive/bundle.rb, line 3
def self.import(path, options={})
  bundle_path = Pathname.new(path)

  if bundle_path.directory?
    files = bundle_path.children.select { |file| file.extname == '.txt' }
  elsif bundle_path.exist?
    files = [bundle_path] if bundle_path.extname == '.txt'
  else
    # File not found
  end

  self.new(files)
end
new(files) click to toggle source
# File lib/fictive/bundle.rb, line 19
def initialize(files)
  @documents = files.map { |file| file.read }.freeze
end