Sha256: 45cd6d7ae22744f22b41cc0e319b92d1eaac75c54919f91a89a2bff7c40ebd31

Contents?: true

Size: 279 Bytes

Versions: 4

Compression:

Stored size: 279 Bytes

Contents

class I18nFlow::Formatter
  attr_reader :ast

  def initialize(ast)
    @ast = ast
  end

  def format!
    sort_keys(ast)
  end

private

  def sort_keys(node)
    node.sort_keys! if node.mapping?
    node.each do |_, val|
      sort_keys(val) if val.mapping?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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