class Zapata::Diver
Attributes
access_level[RW]
current_klass[RW]
current_moduls[RW]
current_sklass[RW]
Public Class Methods
deeper_dives(code)
click to toggle source
# File lib/zapata/diver.rb, line 84 def deeper_dives(code) return unless DIVE_TYPES.include?(code.type) code.to_a.compact.each do |part| dive(part) end end
dive(code)
click to toggle source
# File lib/zapata/diver.rb, line 48 def dive(code) return Primitive::Nil.new unless code if HARD_TYPES.include?(code.type) return Primitive::Raw.new(:missing, :hard_type) end if (klass = primitive_klass(code)) result = klass.new(code) DB.create(result) if search_for_types.include?(code.type) end deeper_dives(code) result || Primitive::Raw.new(:super, nil) end
find_primitive_type(code)
click to toggle source
# File lib/zapata/diver.rb, line 71 def find_primitive_type(code) klass_pair = PRIMITIVE_TYPES.detect do |_, types| types.include?(code.type) end return unless klass_pair klass_pair.first end
primitive_klass(code)
click to toggle source
# File lib/zapata/diver.rb, line 64 def primitive_klass(code) primitive_type = find_primitive_type(code) return unless primitive_type "Zapata::Primitive::#{primitive_type}".constantize end
search_for(what)
click to toggle source
# File lib/zapata/diver.rb, line 43 def search_for(what) @search_for = what @current_moduls ||= [] end
search_for_types()
click to toggle source
# File lib/zapata/diver.rb, line 80 def search_for_types TYPES_BY_SEARCH_FOR[@search_for] end