Sha256: 191ec76cc706031ce8d2b8b9e56ff69e895c73c033be5e85688d3304390c46b5

Contents?: true

Size: 464 Bytes

Versions: 3

Compression:

Stored size: 464 Bytes

Contents

module ToFactory
  module Parsing
    class NewSyntax < Syntax
      def header?
        sexp[1][1][1] == :FactoryGirl rescue false
      end

      def parent_from(x)
        # e.g.
        #s(:call, nil, :factory, s(:lit, :admin), s(:hash, s(:lit, :parent), s(:lit, :"to_factory/user")))
        x[1][4][2][1]
      rescue  NoMethodError
        # e.g.
        #s(:call, nil, :factory, s(:lit, :"to_factory/user"))
        x[1][3][1]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
to_factory-0.2.1 lib/to_factory/parsing/new_syntax.rb
to_factory-0.2.0 lib/to_factory/parsing/new_syntax.rb
to_factory-0.1.1 lib/to_factory/parsing/new_syntax.rb