Class: Calyx::Format::YAMLGrammar
- Inherits:
-
Object
- Object
- Calyx::Format::YAMLGrammar
- Defined in:
- lib/calyx/format.rb
Instance Method Summary collapse
- #each_rule(&block) ⇒ Object
-
#initialize(filename) ⇒ YAMLGrammar
constructor
A new instance of YAMLGrammar.
Constructor Details
#initialize(filename) ⇒ YAMLGrammar
Returns a new instance of YAMLGrammar.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/calyx/format.rb', line 47 def initialize(filename) warn [ "NOTE: Loading grammars defined in YAML is deprecated. ", "Use the JSON format instead: `Calyx::Format.load(\"hello.json\")`" ].join require 'yaml' @filename = filename @contents = File.read(@filename) @rules = YAML.load(@contents) end |