Sha256: eb28e4fd1824a2d921ff47322f67c576b781cfc4301001e8bf8478689deed68e
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Sexpr module Grammar module Options attr_reader :options attr_reader :path attr_reader :rules attr_reader :root attr_reader :parser def install_options(options) @options = options install_path install_rules install_root install_parser yield self if block_given? end def option(key) @options[key.to_sym] || @options[key.to_s] end def install_path @path = option(:path) end def install_rules @rules = option(:rules) || {} @rules = compile_rules(@rules) end def install_root @root = option(:root) @root = rules.keys.first unless @root @root = root.to_sym if @root end def install_parser @parser = option(:parser) if @parser.is_a?(String) && !File.exist?(@parser) unless path raise Errno::ENOENT, "#{@parser} (no main path)" end @parser = File.join(File.dirname(path), @parser) end @parser = Parser.factor(@parser) if @parser end def compile_rules(rules) @rules = rules end end # module Options end # module Grammar end # module Sexpr
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sexpr-1.1.0 | lib/sexpr/grammar/options.rb |