Class: Archimate::DataModel::Layer

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/data_model/layer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(layer = "None", element_names = []) ⇒ Layer

No user serviceable parts here. don’t use me.



11
12
13
14
15
# File 'lib/archimate/data_model/layer.rb', line 11

def initialize(layer = "None", element_names = [])
  @symbol = Layer.symbolize(layer)
  @name = layer
  @elements = element_names
end

Instance Attribute Details

#elementsObject (readonly)

Returns the value of attribute elements.



7
8
9
# File 'lib/archimate/data_model/layer.rb', line 7

def elements
  @elements
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/archimate/data_model/layer.rb', line 8

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



35
36
37
# File 'lib/archimate/data_model/layer.rb', line 35

def ==(other)
  @symbol == other&.to_sym
end

#===(other) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/archimate/data_model/layer.rb', line 21

def ===(other)
  return true if equal?(other)
  case other
  when String
    @symbol == Layer.symbolize(other)
  when Symbol
    @symbol == other
  when Layer
    self == other
  else
    false
  end
end

#hashObject



17
18
19
# File 'lib/archimate/data_model/layer.rb', line 17

def hash
  self.class.hash ^ @symbol.hash
end

#to_sObject



43
44
45
# File 'lib/archimate/data_model/layer.rb', line 43

def to_s
  @name
end

#to_symObject



39
40
41
# File 'lib/archimate/data_model/layer.rb', line 39

def to_sym
  @symbol
end