Sha256: 1f8e51f3bdef82a925f0b0323e634e9b5527b70ffda039e83528cfc0e6023c4f

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

require 'administrate/field/string'
require 'administrate/field/hyperlink/version'
require 'rails/engine'

module Administrate
  module Field
    class Hyperlink < Administrate::Field::String
      include HyperlinkVersion
      class Engine < ::Rails::Engine
      end

      def to_s
        data
      end

      def href
        return data if data.include?('://') || data.start_with?('//')

        "#{options.fetch(:scheme) { 'https://' }}#{data}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-hyperlink-0.2.0 lib/administrate/field/hyperlink.rb