Sha256: 16cc0f9f104e8c829012c83ba53ff5e12c83baf0618546832ff38460e8054af6

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

module Ray
  class Event
    if defined? Encoding
      alias text_without_encoding text

      # @return [String, nil] The entered text in internal encoding
      def text
        if content = text_without_encoding
          content.force_encoding(InternalEncoding)
        end
      end
    else
      # @param [String, Encoding] encoding The encoding to be used.
      # @return [String, nil] The entered text using the provided encoding.
      def text_as(encoding)
        if content = text
          Ray::TextHelper.convert(content, encoding)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ray-0.2.1 lib/ray/event.rb
ray-0.2.0 lib/ray/event.rb
ray-0.1.1 lib/ray/event.rb
ray-0.1.0 lib/ray/event.rb