Class: Kozeki::CollectionList

Inherits:
Object
  • Object
show all
Defined in:
lib/kozeki/collection_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#namesObject (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_jsonObject



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_pathObject



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

def item_path
  ['collections.json']
end