Class: Sfp::Visitor::SfpGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/sfp/visitors.rb

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ SfpGenerator

Returns a new instance of SfpGenerator.



75
76
77
# File 'lib/sfp/visitors.rb', line 75

def initialize(root)
	@root = root
end

Instance Method Details

#visit(name, value, parent) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/sfp/visitors.rb', line 79

def visit(name, value, parent)
	if value.is_a?(Hash)
		value['_parent'] = parent
		value['_self'] = name
		if not value.has_key?('_context')
			value['_context'] = 'object'
			if value.has_key?('_isa')
			else
				value['_isa'] = '$.Object'
			end
		end
		Sfp::Helper.expand_object(value, @root) if value.isobject
	end
	return true
end