Class: Toggle::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/toggle/compiler.rb

Defined Under Namespace

Classes: FileNotFound

Instance Method Summary collapse

Constructor Details

#initialize(file, parsers = nil) ⇒ Compiler

Returns a new instance of Compiler.



5
6
7
8
# File 'lib/toggle/compiler.rb', line 5

def initialize file, parsers = nil
  @file    = file
  @parsers = parsers ? [*parsers] : file_extensions
end

Instance Method Details

#parsed_contentObject



10
11
12
13
14
# File 'lib/toggle/compiler.rb', line 10

def parsed_content
  @parsers.reduce(raw_file_content) do |content, parser|
    Toggle::Parser.for(parser).parse content if content
  end
end