Class: Interfacets::Server::Assets::Classifier

Inherits:
Object
  • Object
show all
Defined in:
lib/interfacets/server/assets.rb

Defined Under Namespace

Classes: Visitor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Classifier

Returns a new instance of Classifier.



58
59
60
# File 'lib/interfacets/server/assets.rb', line 58

def initialize(code)
  @code = code
end

Instance Attribute Details

#code ⇒ Object (readonly)

Returns the value of attribute code.



57
58
59
# File 'lib/interfacets/server/assets.rb', line 57

def code
  @code
end

Instance Method Details

#consts ⇒ Object



62
63
64
65
66
67
# File 'lib/interfacets/server/assets.rb', line 62

def consts
  @consts ||= (
    Prism.parse(code).value.accept(visitor)
    visitor.mods.map(&:last)
  )
end

#visitor ⇒ Object



69
70
71
# File 'lib/interfacets/server/assets.rb', line 69

def visitor
  @visitor ||= Visitor.new
end