Sha256: a31aef56a0ef8e256e23736a7379e5336890f211448f7e9d1596d45e85962ee4

Contents?: true

Size: 604 Bytes

Versions: 14

Compression:

Stored size: 604 Bytes

Contents

class PeakFlowUtils::HandlerHelper
  delegate :translations, to: :instance

  def self.find(id)
    PeakFlowUtils::HandlersFinderService.execute!.each do |handler|
      return handler if handler.id == id.to_s
    end

    raise ActiveRecord::RecordNotFound, "Handlers not found: '#{id}'."
  end

  def initialize(data)
    @data = data
  end

  def id
    @data.fetch(:id)
  end

  def to_param
    id
  end

  def name
    @data.fetch(:name)
  end

  def const
    PeakFlowUtils.const_get(@data.fetch(:const_name))
  end

  def instance
    const.new
  end

  def groups
    const.new.groups
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
peak_flow_utils-0.1.19 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.18 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.17 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.16 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.15 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.14 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.13 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.12 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.11 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.10 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.9 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.8 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.7 lib/peak_flow_utils/handler_helper.rb
peak_flow_utils-0.1.6 lib/peak_flow_utils/handler_helper.rb