Sha256: 83e51e32a6e28ff38f958c6e8654d92721ffcc8a1ecad0204d79ec3f8483f1cf

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 Bytes

Contents

require_relative 'base'
require_relative '../helpers/range'

module Estratto
  module Layout
    class LayoutNotFoundForPrefix < StandardError; end

    class MultiRegister < Base

      def prefix_range
        Estratto::Helpers::Range.for(layout['prefix'])
      end

      def register_fields_for(prefix)
        find_register(prefix)&.dig('fields')
      end

      private

      def find_register(prefix)
        registers.find { |register| register['register'] == prefix }
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
estratto-1.0.5 lib/estratto/layout/multi_register.rb
estratto-1.0.4 lib/estratto/layout/multi_register.rb
estratto-1.0.3 lib/estratto/layout/multi_register.rb
estratto-1.0.2 lib/estratto/layout/multi_register.rb
estratto-1.0.1 lib/estratto/layout/multi_register.rb
estratto-1.0.0 lib/estratto/layout/multi_register.rb