Sha256: eb98fb10ffd1a356d6987da2a371aba40a5f3aa1ed5490bb2d1e9fc697087fa0

Contents?: true

Size: 536 Bytes

Versions: 5

Compression:

Stored size: 536 Bytes

Contents

require 'psych'
require_relative 'yaml_ast_proxy'

class I18nFlow::Parser
  attr_reader :buffer
  attr_reader :file_path

  def initialize(buffer, file_path: nil)
    @buffer = buffer
    @file_path = file_path
  end

  def parse!
    parser.parse(buffer)
  end

  def root
    builder.root
  end

  def root_proxy
    @root_proxy ||= I18nFlow::YamlAstProxy.create(root, file_path: file_path)
  end

private

  def builder
    @builder ||= Psych::TreeBuilder.new
  end

  def parser
    @parser ||= Psych::Parser.new(builder)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
i18n_flow-0.2.3 lib/i18n_flow/parser.rb
i18n_flow-0.2.2 lib/i18n_flow/parser.rb
i18n_flow-0.2.1 lib/i18n_flow/parser.rb
i18n_flow-0.2.0 lib/i18n_flow/parser.rb
i18n_flow-0.1.0 lib/i18n_flow/parser.rb