Sha256: 4bed680bb7457f72adb4dfebfd5a6d8fcb6a752969ffb89d73eb06eb321bc549

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

module TodoNext
  class Line

    attr_accessor :text, :col_offset, :leaf

    def initialize(text, col_offset)
      @text, @col_offset = text, col_offset
    end

    def to_s
      "<Line# text:#{text}, leaf:#{leaf}, col_offset:#{col_offset}>"
    end

    def blank?
      text =~ /^\s*$/
    end
    def comment?
      text =~ /^#/
    end
    def passed?
      text =~ /^\s*√/
    end
    def example?
      text =~ /\s*(ex|example)\s*:/
    end

    def leaf?   ; leaf   end
    def branch? ; !leaf? end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
todo_next-0.0.2 lib/todo_next/line.rb