Sha256: 10c24f40875ec7b6f71a7a07641186d6585a81b8a2557396c66c9142c2c92636
Contents?: true
Size: 560 Bytes
Versions: 3
Compression:
Stored size: 560 Bytes
Contents
module Suricate class WidgetRepository class WidgetNotFound < StandardError; end attr_reader :configurations def initialize(configurations) @configurations = configurations end def instantiate(id, context) if configuration = find_configuration_with_id(id.to_sym) configuration.instantiate(context) else raise WidgetNotFound.new("widget with id=#{id} not found") end end private def find_configuration_with_id(id) @configurations.find { |conf| conf.id == id } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
suricate-0.0.4 | lib/suricate/widget_repository.rb |
suricate-0.0.3 | lib/suricate/widget_repository.rb |
suricate-0.0.2 | lib/suricate/widget_repository.rb |