Class: Apidoco::ResourceDocumentation

Inherits:
Object
  • Object
show all
Defined in:
lib/apidoco/resource_documentation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory) ⇒ ResourceDocumentation

Returns a new instance of ResourceDocumentation.



5
6
7
# File 'lib/apidoco/resource_documentation.rb', line 5

def initialize(directory)
  self.directory = directory
end

Instance Attribute Details

#directoryObject

Returns the value of attribute directory.



3
4
5
# File 'lib/apidoco/resource_documentation.rb', line 3

def directory
  @directory
end

Instance Method Details

#as_jsonObject



9
10
11
# File 'lib/apidoco/resource_documentation.rb', line 9

def as_json
  children.map { |c| JSON.parse(File.read(c)) }
end

#childrenObject



13
14
15
16
17
# File 'lib/apidoco/resource_documentation.rb', line 13

def children
  directory.children.select do |child|
    child.extname.eql?('.json')
  end
end