Class: Archsight::Annotations::Computed

Inherits:
Object
  • Object
show all
Defined in:
lib/archsight/annotations/computed.rb

Overview

Computed represents a computed annotation definition. It stores the key, description, optional type, and the computation block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, description: nil, type: nil, &block) ⇒ Computed

Returns a new instance of Computed.



11
12
13
14
15
16
# File 'lib/archsight/annotations/computed.rb', line 11

def initialize(key, description: nil, type: nil, &block)
  @key = key
  @description = description
  @type = type
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



9
10
11
# File 'lib/archsight/annotations/computed.rb', line 9

def block
  @block
end

#descriptionObject (readonly)

Returns the value of attribute description.



9
10
11
# File 'lib/archsight/annotations/computed.rb', line 9

def description
  @description
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/archsight/annotations/computed.rb', line 9

def key
  @key
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/archsight/annotations/computed.rb', line 9

def type
  @type
end

Instance Method Details

#matches?(other_key) ⇒ Boolean

Check if this definition matches a given key

Returns:

  • (Boolean)


19
20
21
# File 'lib/archsight/annotations/computed.rb', line 19

def matches?(other_key)
  @key == other_key
end