Sha256: 0743641f6aa573cf6eeffd7e2429f450632e5da74b75de24a75aa14c34987b0b

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

module Richard
  module Internal
    class TextLine
      attr_reader :text
      
      def initialize(text)
        @text = text || fail("You need to supply some text even if it's empty")
      end

      def matches?(text)
        @text.eql?(text)
      end
    end

    class PatternLine
      attr_reader :text
      
      def initialize(text)
        @text = text || fail("You need to supply some text even if it's empty")
      end

      # [!] expects lines to start and end with /
      def matches?(text)
        regex = Regexp.new(@text.slice(1,(@text.size-2)))
        false == regex.match(text).nil?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
richard_iii-0.1.1 lib/richard_iii/internal/text_line.rb
richard_iii-0.1.0 lib/richard_iii/internal/text_line.rb