Sha256: 5afe4190b496bfb8097866c904518b6457c2912af93929cad6d982b0f64d910b

Contents?: true

Size: 373 Bytes

Versions: 6

Compression:

Stored size: 373 Bytes

Contents

module CabbageDoc
  class Example
    include Parser

    attr_reader :label, :params

    def initialize
      @params = {}
    end

    def parse(text)
      m = text.match(/^(.*?)\s+-\s+(\(.*?\))$/)
      return false unless m

      @label = m[1].strip
      @params = parse_option(m[2].strip)

      valid?
    end

    def valid?
      !@label.nil?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cabbage_doc-0.0.6 lib/cabbage_doc/example.rb
cabbage_doc-0.0.5 lib/cabbage_doc/example.rb
cabbage_doc-0.0.4 lib/cabbage_doc/example.rb
cabbage_doc-0.0.3 lib/cabbage_doc/example.rb
cabbage_doc-0.0.2 lib/cabbage_doc/example.rb
cabbage_doc-0.0.1 lib/cabbage_doc/example.rb