Module: HtmlBlocksHelper

Defined in:
lib/yard-restful/html_blocks_helper.rb

Instance Method Summary collapse

Instance Method Details

#rotate(name = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/yard-restful/html_blocks_helper.rb', line 3

def rotate(name = nil)
  @counter ||= {}
  name ||= 'odd_even'
  name = name.to_s

  @counter[name] ||= 0
  @counter[name] += 1

  elements = name.split(/[^\w]|\_/)
  @counter[name].even? ? elements[0] : elements[1]
end

#type_as_string(type) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/yard-restful/html_blocks_helper.rb', line 15

def type_as_string(type)
  if type.resource? and type.tag(:restful_api).text
    "#{type.name.to_s.gsub(/Controller/, '')} [#{type.tag(:restful_api).text}]"
  else
    type.name.to_s
  end
end