lib/tramway/config.rb in tramway-0.3.2 vs lib/tramway/config.rb in tramway-0.4
- old
+ new
@@ -1,26 +1,26 @@
# frozen_string_literal: true
+require 'anyway'
require 'singleton'
require 'tramway/configs/entity'
module Tramway
# Basic configuration of Tramway
#
- class Config
+ class Config < Anyway::Config
include Singleton
- def initialize
- @entities = []
- end
+ attr_config(
+ pagination: { enabled: false },
+ entities: []
+ )
def entities=(collection)
- @entities = collection.map do |entity|
+ super(collection.map do |entity|
entity_options = entity.is_a?(Hash) ? entity : { name: entity }
Tramway::Configs::Entity.new(**entity_options)
- end
+ end)
end
-
- attr_reader :entities
end
end