class ToFactory::Parsing::File

Constants

EmptyFileException

Attributes

contents[R]

Public Class Methods

from_file(filename) click to toggle source
# File lib/to_factory/parsing/file.rb, line 18
def self.from_file(filename)
  contents = ::File.read filename rescue nil
  raise EmptyFileException.new "Invalid file #{filename}"  if contents.to_s.strip.length == 0

  new(contents)
end
new(contents) click to toggle source
# File lib/to_factory/parsing/file.rb, line 25
def initialize(contents)
  @contents = contents
end
parse(filename) click to toggle source
# File lib/to_factory/parsing/file.rb, line 14
def self.parse(filename)
  from_file(filename).parse
end

Public Instance Methods

parser() click to toggle source
# File lib/to_factory/parsing/file.rb, line 29
def parser
  @parser ||= Syntax.new(@contents)
end