Class: Docks::Containers::Variable
- Inherits:
-
Symbol
show all
- Defined in:
- lib/docks/containers/variable_container.rb
Overview
Public: a container for Variable 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
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Docks::Containers::Base
Class Method Details
.type ⇒ Object
9
|
# File 'lib/docks/containers/variable_container.rb', line 9
def self.type; Docks::Types::Symbol::VARIABLE end
|
Instance Method Details
#instance? ⇒ Boolean
12
|
# File 'lib/docks/containers/variable_container.rb', line 12
def instance?; !static? end
|
#property? ⇒ Boolean
13
|
# File 'lib/docks/containers/variable_container.rb', line 13
def property?; fetch(:property, false) end
|
#static? ⇒ Boolean
11
|
# File 'lib/docks/containers/variable_container.rb', line 11
def static?; fetch(:static, false) end
|
#summary ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/docks/containers/variable_container.rb', line 25
def summary
summary = super
summary.static = static?
summary.property = property?
summary.for = fetch(:for, nil)
summary
end
|
#symbol_id ⇒ Object
15
16
17
18
|
# File 'lib/docks/containers/variable_container.rb', line 15
def symbol_id
return super unless property?
"property-#{"static-" if static?}#{fetch(:for)}-#{fetch(:name)}"
end
|
#to_descriptor ⇒ Object
20
21
22
23
|
# File 'lib/docks/containers/variable_container.rb', line 20
def to_descriptor
return super unless property?
"#{belongs_to.to_descriptor}#{static? ? "." : "#"}#{fetch(:name)}"
end
|