Sha256: d947975da38a2bd2be889eb76fe8da7ba060404253905be990bd4c167ff37990

Contents?: true

Size: 468 Bytes

Versions: 6

Compression:

Stored size: 468 Bytes

Contents

# frozen_string_literal: true

require "forwardable"

module Pennyworth
  module Presenters
    # Shapes a text record for serialization.
    class Text
      extend Forwardable

      delegate %i[id content] => :record

      def initialize record, inflector: Inflector.new
        @record = record
        @inflector = inflector
      end

      def label = inflector.call(record.content.to_s)

      private

      attr_reader :record, :inflector
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pennyworth-17.8.0 lib/pennyworth/presenters/text.rb
pennyworth-17.7.0 lib/pennyworth/presenters/text.rb
pennyworth-17.6.0 lib/pennyworth/presenters/text.rb
pennyworth-17.5.0 lib/pennyworth/presenters/text.rb
pennyworth-17.4.1 lib/pennyworth/presenters/text.rb
pennyworth-17.4.0 lib/pennyworth/presenters/text.rb