Module: Restapi::Helpers

Included in:
Restapi
Defined in:
lib/restapi/helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#url_prefixObject

Returns the value of attribute url_prefix.



7
8
9
# File 'lib/restapi/helpers.rb', line 7

def url_prefix
  @url_prefix
end

Instance Method Details

#full_url(path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/restapi/helpers.rb', line 9

def full_url(path)
  unless @url_prefix
    @url_prefix = ""
    if rails_prefix = ENV["RAILS_RELATIVE_URL_ROOT"]
      @url_prefix << rails_prefix
    end
    @url_prefix << Restapi.configuration.doc_base_url
  end
  path = path.sub(/^\//,"")
  ret = "#{@url_prefix}/#{path}"
  ret.insert(0,"/") unless ret =~ /\A[.\/]/
  ret.sub!(/\/*\Z/,"")
  ret
end

#markup_to_html(text) ⇒ Object



3
4
5
# File 'lib/restapi/helpers.rb', line 3

def markup_to_html(text)
  Restapi.configuration.markup.to_html(text.strip_heredoc)
end