Class: StrapiRuby::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/strapi_ruby/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Formatter

Returns a new instance of Formatter.



3
4
5
# File 'lib/strapi_ruby/formatter.rb', line 3

def initialize(options = {})
  @keys_to_convert = options[:convert_to_html] || StrapiRuby.config.convert_to_html
end

Instance Method Details

#call(data) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/strapi_ruby/formatter.rb', line 7

def call(data)
  # Check data for emptiness
  check_emptiness(data)

  converted_data = data.clone
  convert_to_html!(converted_data)
  convert_to_datetime!(converted_data)
  converted_data
end