class Docks::Containers::Variable

Public: a container for Variable symbols.

Public Class Methods

type() click to toggle source
# File lib/docks/containers/variable_container.rb, line 9
def self.type; Docks::Types::Symbol::VARIABLE end

Public Instance Methods

instance?() click to toggle source
# File lib/docks/containers/variable_container.rb, line 12
def instance?; !static? end
property?() click to toggle source
# File lib/docks/containers/variable_container.rb, line 13
def property?; fetch(:property, false) end
static?() click to toggle source
# File lib/docks/containers/variable_container.rb, line 11
def static?; fetch(:static, false) end
summary() click to toggle source
Calls superclass method Docks::Containers::Symbol#summary
# 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() click to toggle source
Calls superclass method Docks::Containers::Symbol#symbol_id
# 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() click to toggle source
Calls superclass method Docks::Containers::Symbol#to_descriptor
# File lib/docks/containers/variable_container.rb, line 20
def to_descriptor
  return super unless property?
  "#{belongs_to.to_descriptor}#{static? ? "." : "#"}#{fetch(:name)}"
end

Protected Instance Methods

matches_exactly?(descriptor) click to toggle source
# File lib/docks/containers/variable_container.rb, line 35
def matches_exactly?(descriptor)
  name = fetch(:name, nil)

  return super unless property?

  matches = (instance? && descriptor.instance_member == name) ||
    (static? && descriptor.static_member == name)

  matches && self
end