Class: SPQR::ManageableMeta

Inherits:
Struct
  • Object
show all
Defined in:
lib/spqr/manageable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*a) ⇒ ManageableMeta

Returns a new instance of ManageableMeta.



27
28
29
30
31
32
33
# File 'lib/spqr/manageable.rb', line 27

def initialize(*a)
  super *a
  self.options = (({} unless self.options) or self.options.dup)
  self.statistics = [] unless self.statistics
  self.properties = [] unless self.properties
  self.mmethods ||= {}
end

Instance Attribute Details

#classnameObject

Returns the value of attribute classname

Returns:

  • (Object)

    the current value of classname



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def classname
  @classname
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def description
  @description
end

#mmethodsObject

Returns the value of attribute mmethods

Returns:

  • (Object)

    the current value of mmethods



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def mmethods
  @mmethods
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def options
  @options
end

#packageObject

Returns the value of attribute package

Returns:

  • (Object)

    the current value of package



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def package
  @package
end

#propertiesObject

Returns the value of attribute properties

Returns:

  • (Object)

    the current value of properties



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def properties
  @properties
end

#statisticsObject

Returns the value of attribute statistics

Returns:

  • (Object)

    the current value of statistics



26
27
28
# File 'lib/spqr/manageable.rb', line 26

def statistics
  @statistics
end

Instance Method Details

#declare_method(name, desc, options, blk = nil) ⇒ Object



35
36
37
38
39
# File 'lib/spqr/manageable.rb', line 35

def declare_method(name, desc, options, blk=nil)
  result = MethodMeta.new name, desc, options
  blk.call(result.args) if blk
  self.mmethods[name] = result
end

#declare_property(name, kind, options) ⇒ Object



49
50
51
# File 'lib/spqr/manageable.rb', line 49

def declare_property(name, kind, options)
  declare_basic(:property, name, kind, options)
end

#declare_statistic(name, kind, options) ⇒ Object



45
46
47
# File 'lib/spqr/manageable.rb', line 45

def declare_statistic(name, kind, options)
  declare_basic(:statistic, name, kind, options)
end

#manageable_methodsObject



41
42
43
# File 'lib/spqr/manageable.rb', line 41

def manageable_methods
  self.mmethods.values
end