Class: Docks::Containers::Function

Inherits:
Symbol show all
Defined in:
lib/docks/containers/function_container.rb

Overview

Public: a container for Function symbols.

Instance Attribute Summary

Attributes inherited from Symbol

#belongs_to, #methods, #properties

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Symbol

#add_member, #add_members, #find, from_symbol, #has_members?, #initialize, #member?, #members, #private?, #public?

Methods inherited from Base

#==, #[], #[]=, #delete, #fetch, #find, #initialize, #method_missing, #respond_to?, #summarized?, #tags, #to_h, #update

Constructor Details

This class inherits a constructor from Docks::Containers::Symbol

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Docks::Containers::Base

Class Method Details

.typeObject



8
# File 'lib/docks/containers/function_container.rb', line 8

def self.type; Docks::Types::Symbol::FUNCTION end

Instance Method Details

#instance?Boolean

Returns:

  • (Boolean)


11
# File 'lib/docks/containers/function_container.rb', line 11

def instance?; !static? end

#method?Boolean

Returns:

  • (Boolean)


12
# File 'lib/docks/containers/function_container.rb', line 12

def method?; fetch(:method, false) end

#static?Boolean

Returns:

  • (Boolean)


10
# File 'lib/docks/containers/function_container.rb', line 10

def static?; fetch(:static, false) end

#summaryObject



24
25
26
27
28
29
30
# File 'lib/docks/containers/function_container.rb', line 24

def summary
  summary = super
  summary.static = static?
  summary.method = method?
  summary.for = fetch(:for, nil)
  summary
end

#symbol_idObject



14
15
16
17
# File 'lib/docks/containers/function_container.rb', line 14

def symbol_id
  return super unless method?
  "method-#{"static-" if static?}#{self[:for]}-#{self[:name]}"
end

#to_descriptorObject



19
20
21
22
# File 'lib/docks/containers/function_container.rb', line 19

def to_descriptor
  return super unless method?
  "#{belongs_to.to_descriptor}#{static? ? "." : "#"}#{fetch(:name)}"
end