Sha256: fd28898a0bffa142119a7a2f9173f0390996f874d0d84184e9da6c71cc756120

Contents?: true

Size: 500 Bytes

Versions: 54

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

require "forwardable"

module Pennyworth
  module Presenters
    # Renders text into a compatible format for use in Alfred script filters.
    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

54 entries across 54 versions & 1 rubygems

Version Path
pennyworth-17.3.0 lib/pennyworth/presenters/text.rb
pennyworth-17.2.0 lib/pennyworth/presenters/text.rb
pennyworth-17.1.0 lib/pennyworth/presenters/text.rb
pennyworth-17.0.0 lib/pennyworth/presenters/text.rb
pennyworth-16.7.0 lib/pennyworth/presenters/text.rb
pennyworth-16.5.0 lib/pennyworth/presenters/text.rb
pennyworth-16.4.0 lib/pennyworth/presenters/text.rb
pennyworth-16.3.0 lib/pennyworth/presenters/text.rb
pennyworth-16.2.0 lib/pennyworth/presenters/text.rb
pennyworth-16.1.0 lib/pennyworth/presenters/text.rb
pennyworth-16.0.0 lib/pennyworth/presenters/text.rb
pennyworth-15.4.1 lib/pennyworth/presenters/text.rb
pennyworth-15.4.0 lib/pennyworth/presenters/text.rb
pennyworth-15.3.0 lib/pennyworth/presenters/text.rb
pennyworth-15.2.0 lib/pennyworth/presenters/text.rb
pennyworth-15.1.1 lib/pennyworth/presenters/text.rb
pennyworth-15.1.0 lib/pennyworth/presenters/text.rb
pennyworth-15.0.3 lib/pennyworth/presenters/text.rb
pennyworth-15.0.2 lib/pennyworth/presenters/text.rb
pennyworth-15.0.1 lib/pennyworth/presenters/text.rb