vendor/bundle/ruby/1.8/gems/gherkin-2.9.0/lib/gherkin/json_parser.rb
# Parse a gherkin object +o+, which can either be a JSON String,
# or a Hash (from a parsed JSON String).
Parse a gherkin object +o+, which can either be a JSON String,
or a Hash (from a parsed JSON String).
Parse a gherkin object + o + which can either be a JSON String or a Hash ( from a parsed JSON String ) .
def parse(o)
      o = JSON.parse(o) if String === o
      o.each do |f|
        @formatter.uri(f['uri'])
        Formatter::Model::Feature.new(comments(f), tags(f), keyword(f), name(f), description(f), line(f), id(f)).replay(@formatter)
        (f["elements"] || []).each do |feature_element|
          feature_element(feature_element).replay(@formatter)
          (feature_element["steps"] || []).each do |step|
            step(step).replay(@formatter)
            match(step)
            result(step)
            embeddings(step)
          end
          (feature_element["examples"] || []).each do |eo|
            Formatter::Model::Examples.new(comments(eo), tags(eo), keyword(eo), name(eo), description(eo), line(eo), id(eo), examples_rows(eo['rows'])).replay(@formatter)
          end
        end
      end
      @formatter.eof
    end
def parse ( o ) o = JSON . parse ( o ) if String === o o . each do | f | @formatter . uri ( f [ 'uri' ] ) Formatter :: Model :: Feature . new ( comments ( f ) , tags ( f ) , keyword ( f ) , name ( f ) , description ( f ) , line ( f ) , id ( f ) ) . replay ( @formatter ) ( f [ "elements" ] || [ ] ) . each do | feature_element | feature_element ( feature_element ) . replay ( @formatter ) ( feature_element [ "steps" ] || [ ] ) . each do | step | step ( step ) . replay ( @formatter ) match ( step ) result ( step ) embeddings ( step ) end ( feature_element [ "examples" ] || [ ] ) . each do | eo | Formatter :: Model :: Examples . new ( comments ( eo ) , tags ( eo ) , keyword ( eo ) , name ( eo ) , description ( eo ) , line ( eo ) , id ( eo ) , examples_rows ( eo [ 'rows' ] ) ) . replay ( @formatter ) end end end @formatter . eof end
Parse a gherkin object +o+, which can either be a JSON String,
or a Hash (from a parsed JSON String).
Parse a gherkin object + o + which can either be a JSON String or a Hash ( from a parsed JSON String ) .
o