Sha256: fc4212e39785fd0561d742e6f15c602dbb1f4052930372cd41c87e59be563643

Contents?: true

Size: 467 Bytes

Versions: 3

Compression:

Stored size: 467 Bytes

Contents

require_relative 'base'

module AdminCore
  module ResourceField
    # @!attribute [r] data
    #   @return [String]
    class Text < Base
      private

      # @note Implementation for {QiitaAdmin::ResourceField::Base#field_value}
      def field_value
        data.to_s[0...truncate_length]
      end

      # @return [Integer]
      def truncate_length
        options.fetch(:truncate, 50)
      end
    end

    AdminCore.register_resource_field(Text)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
admin_core-0.0.3 lib/admin_core/resource_field/text.rb
admin_core-0.0.2 lib/admin_core/resource_field/text.rb
admin_core-0.0.1 lib/admin_core/resource_field/text.rb