Sha256: 1da6a5c5b07fa71adbb8195393d43323e8ecb1be7820a9a4d7b5e1f4d4c42734

Contents?: true

Size: 727 Bytes

Versions: 12

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

require "forwardable"

require "pakyow/support/safe_string"

require "pakyow/presenter/attributes/attribute"

module Pakyow
  module Presenter
    class Attributes
      # Wraps the value for a string-type view attribute (e.g. href).
      #
      # Behaves just like a normal +String+.
      #
      class String < Attribute
        extend Forwardable
        def_delegators :@value, :empty?, :include?

        def to_s
          @value
        end

        def to_str
          to_s
        end

        class << self
          include Support::SafeStringHelpers

          def parse(value)
            new(ensure_html_safety(value.to_s))
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pakyow-presenter-1.0.6 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.5 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.4 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.3 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.2 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.1 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.0 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.0.rc5 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.0.rc4 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.0.rc3 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.0.rc2 lib/pakyow/presenter/attributes/string.rb
pakyow-presenter-1.0.0.rc1 lib/pakyow/presenter/attributes/string.rb