Sha256: 9e142eb410673b512a650ae82ef373c315db13d9f6f78fc39e1cbc350a2b5d74

Contents?: true

Size: 829 Bytes

Versions: 3

Compression:

Stored size: 829 Bytes

Contents

require "yaml"
module WLang
  class EncoderSet
    module YAML
  
      # Default encoders  
      DEFAULT_ENCODERS = {}
  
    end # module YAML
  end
  class RuleSet
    module YAML
    
        # Default mapping between tag symbols and methods
        DEFAULT_RULESET = {'+' => :inclusion}
    
        # Rule implementation of <tt>+{wlang/ruby}</tt>.
        def self.inclusion(parser, offset)
          expression, reached = parser.parse(offset, "wlang/hosted")
          value = parser.evaluate(expression)
          col = parser.buffer.__wlang_column_of(parser.buffer.length)
          result = value.to_yaml.
                         gsub(/^\s*---\s*|\n$/,"").
                         __wlang_realign(col-1, true)
          [result, reached]
        end
  
    end # module YAML
  end # class RuleSet
end # module WLang

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wlang-0.10.2 lib/wlang/dialects/yaml_dialect.rb
wlang-0.10.1 ./lib/wlang/dialects/yaml_dialect.rb
wlang-0.10.0 lib/wlang/dialects/yaml_dialect.rb