Sha256: dfb0fdc93f708bbb688090b0a4e6991770bda63476bcb718101aa9ab4d28a85f
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 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.exists?(@parser) @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-0.3.0 | lib/sexpr/grammar/options.rb |