Class: Docs::ERBEnvironment

Inherits:
Object
  • Object
show all
Includes:
ExampleHelper
Defined in:
lib/docs/erb_environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExampleHelper

#example, #examples

Instance Attribute Details

#configObject

<%= config.api_endpoint %>


10
11
12
# File 'lib/docs/erb_environment.rb', line 10

def config
  @config
end

#contentObject

Returns the value of attribute content


9
10
11
# File 'lib/docs/erb_environment.rb', line 9

def content
  @content
end

#examples=(value) ⇒ Object (writeonly)

Sets the attribute examples

Parameters:

  • value

    the value to set the attribute examples to.


8
9
10
# File 'lib/docs/erb_environment.rb', line 8

def examples=(value)
  @examples = value
end

Instance Method Details

#get_bindingObject


26
27
28
# File 'lib/docs/erb_environment.rb', line 26

def get_binding
  binding
end

#pretty_print_json(json) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/docs/erb_environment.rb', line 14

def pretty_print_json(json)
  begin
    JSON.pretty_generate(JSON.parse(json))
  rescue JSON::ParserError => e
    e.inspect
  end
end

#syntax_highlight(str, language) ⇒ Object


22
23
24
# File 'lib/docs/erb_environment.rb', line 22

def syntax_highlight(str, language)
  CodeRay.scan(str, language).div
end