lib/hyperdrive/docs.rb in hyperdrive-0.0.5 vs lib/hyperdrive/docs.rb in hyperdrive-0.0.6
- old
+ new
@@ -10,17 +10,17 @@
def output
out = ""
resources.each_value do |resource|
out += header(resource.name)
- out += paragraph(resource.desc)
+ out += paragraph(resource.description)
out += header("Endpoint URL", 2)
out += paragraph(bullet(code(resource.endpoint), 1))
out += header("Params", 2)
- out += list(resource.allowed_params)
+ out += list(resource.params.map { |_,param| param.to_hash })
out += header("Filters", 2)
- out += list(resource.filters)
+ out += list(resource.filters.map { |_,filter| filter.to_hash })
end
out
end
def header(string, level = 1)
@@ -51,19 +51,18 @@
"#{nest}- #{string}\n"
end
def list(items)
list = ""
- items.each do |key, value|
- list += bullet(bold(key), 1)
+ items.each do |item|
+ list += bullet(bold(item[:name]), 1)
+ item.each do |key, value|
+ list += bullet(italics(key), 2)
- value.each do |subkey, subvalue|
- list += bullet(italics(subkey), 2)
-
- if subvalue.kind_of? Array
- list += bullet(code_options(subvalue), 3)
+ if value.kind_of? Array
+ list += bullet(code_options(value), 3)
else
- list += bullet(subvalue, 3)
+ list += bullet(value, 3)
end
end
end
list
end