Module: HTTPong::Rails::Helper

Defined in:
lib/httpong/rails/helper.rb

Instance Method Summary collapse

Instance Method Details

#httpong_collection(name, path, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/httpong/rails/helper.rb', line 16

def httpong_collection(name, path, options = {})
  if options[:scheme].class == HTTPong::Scheme
    scheme = options[:scheme]
  elsif options[:scheme]
    scheme = HTTPong.get_scheme(options[:scheme])
  else
    scheme = HTTPong.default_scheme
  end
  (:meta, nil, name: 'httpong-collection', content: raw(render(template: path)), scheme: scheme.name, collection: name)
end

#httpong_scheme(name_or_scheme = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/httpong/rails/helper.rb', line 4

def httpong_scheme(name_or_scheme = nil)
  if name_or_scheme.class == HTTPong::Scheme
    scheme = name_or_scheme
  elsif name_or_scheme
    scheme = HTTPong.get_scheme(name_or_scheme)
  else
    scheme = HTTPong.default_scheme
  end
  (:meta, nil, name: 'httpong-scheme', content: scheme.to_json, scheme: scheme.name)
  # "<meta name='httpong-scheme' content='#{scheme.to_json}' scheme='#{scheme.name}'/>"
end