Class: Sidenotes::Formatter

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

Constant Summary collapse

HEADER_COMMENT =
"# Generated by Sidenotes v%<version>s on %<timestamp>s\n" \
"# Do not edit manually — regenerate with `rake sidenotes:generate`\n"

Instance Method Summary collapse

Constructor Details

#initialize(model_name, data) ⇒ Formatter

Returns a new instance of Formatter.



11
12
13
14
# File 'lib/sidenotes/formatter.rb', line 11

def initialize(model_name, data)
  @model_name = model_name
  @data = data
end

Instance Method Details

#renderObject



16
17
18
19
20
21
# File 'lib/sidenotes/formatter.rb', line 16

def render
  case Sidenotes.configuration.format
  when :yaml then render_yaml
  when :json then render_json
  end
end