Class: DataFormatter::HashCollection

Inherits:
Collection show all
Defined in:
lib/data_formatter/hash_collection.rb

Instance Attribute Summary

Attributes inherited from Collection

#indentation, #items, #lang

Instance Method Summary collapse

Methods inherited from Collection

#initialize, #to_s

Constructor Details

This class inherits a constructor from DataFormatter::Collection

Instance Method Details

#closeObject



8
9
10
# File 'lib/data_formatter/hash_collection.rb', line 8

def close
  @close ||= Tag.new(css_class: "curly-bracket", content: "}")
end

#openObject



4
5
6
# File 'lib/data_formatter/hash_collection.rb', line 4

def open
  @open ||= Tag.new(css_class: "curly-bracket", content: "{")
end

#prepare(data) ⇒ Object



12
13
14
# File 'lib/data_formatter/hash_collection.rb', line 12

def prepare(data)
  data.map { |k, v| ValuePair.new(key: Value.new(data: k, indentation: indentation, is_key: true), value: Value.new(data: v, indentation: indentation, lang: lang), lang: lang) }
end