Class: Kozeki::CollectionList
- Inherits:
-
Object
- Object
- Kozeki::CollectionList
- Defined in:
- lib/kozeki/collection_list.rb
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(names) ⇒ CollectionList
constructor
A new instance of CollectionList.
- #item_path ⇒ Object
Constructor Details
#initialize(names) ⇒ CollectionList
Returns a new instance of CollectionList.
5 6 7 |
# File 'lib/kozeki/collection_list.rb', line 5 def initialize(names) @names = names end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names.
9 10 11 |
# File 'lib/kozeki/collection_list.rb', line 9 def names @names end |
Instance Method Details
#as_json ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kozeki/collection_list.rb', line 11 def as_json { kind: 'collection_list', collections: names.sort.map do |name| { name:, path: ['collections', "#{name}.json"].join('/'), } end, } end |
#item_path ⇒ Object
23 24 25 |
# File 'lib/kozeki/collection_list.rb', line 23 def item_path ['collections.json'] end |