Module: EasyApiDoc::Configurable::ClassMethods

Defined in:
lib/configurable.rb

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
# File 'lib/configurable.rb', line 12

def all
  root_node.map do |name, opts|
    new(name, opts)
  end
end

#configObject



23
24
25
# File 'lib/configurable.rb', line 23

def config
  Configuration.load
end

#config_pathObject

Override me



28
29
30
# File 'lib/configurable.rb', line 28

def config_path
  [self.to_s.split("::").last.downcase]
end

#find(name) ⇒ Object



18
19
20
21
# File 'lib/configurable.rb', line 18

def find(name)
  name, attrs = root_node.find {|key, attrs| key.to_s == name.to_s }
  new(name, attrs)
end

#root_nodeObject

protected



34
35
36
37
38
39
40
# File 'lib/configurable.rb', line 34

def root_node
  node = self.config
  config_path.each do |n|
    node = node[n]
  end
  node
end