Sha256: 1d67f36375ca0815b7a1154dd08a13d617196e613a6761242870a58bd0450696

Contents?: true

Size: 586 Bytes

Versions: 15

Compression:

Stored size: 586 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Coercers

    # Provides the mechanism to convert a value into a
    # {Vedeu::Editor::Line}.
    #
    # @api private
    #
    class EditorLine < Vedeu::Coercers::Coercer

      # @return [Vedeu::Editor::Line]
      def coerce
        if coerced?
          value

        elsif string?(value)
          klass.new(value.chomp)

        else
          klass.new

        end
      end

      private

      # @return [Class]
      def klass
        Vedeu::Editor::Line
      end

    end # EditorLine

  end # Coercers

end # Vedeu

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vedeu-0.8.32 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.31 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.30 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.29 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.28 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.27 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.26 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.25 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.24 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.23 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.22 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.21 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.20 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.19 lib/vedeu/coercers/editor_line.rb
vedeu-0.8.18 lib/vedeu/coercers/editor_line.rb