Class: Git::Approvals::JSONFormatter

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/git/approvals/json_formatter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/git/approvals/json_formatter.rb', line 7

def self.engine_initialized?
  defined?(::JSON)
end

Instance Method Details

#evaluate(context, locals, &block) ⇒ Object



18
19
20
21
# File 'lib/git/approvals/json_formatter.rb', line 18

def evaluate( context, locals, &block )
  # TODO use locals as options to the formatter
  ::JSON.pretty_generate( ::JSON.parse( context ) )
end

#initialize_engineObject



11
12
13
# File 'lib/git/approvals/json_formatter.rb', line 11

def initialize_engine
  require_template_library 'json'
end

#prepareObject



15
16
# File 'lib/git/approvals/json_formatter.rb', line 15

def prepare
end