Class: Archimate::DataModel::Layer
- Inherits:
-
Object
- Object
- Archimate::DataModel::Layer
- Includes:
- Comparable
- Defined in:
- lib/archimate/data_model/layer.rb
Instance Attribute Summary collapse
-
#background_class ⇒ Object
readonly
Returns the value of attribute background_class.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #===(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(layer = "None", background_class = "") ⇒ Layer
constructor
No user serviceable parts here.
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(layer = "None", background_class = "") ⇒ Layer
No user serviceable parts here. don’t use me.
14 15 16 17 18 |
# File 'lib/archimate/data_model/layer.rb', line 14 def initialize(layer = "None", background_class = "") @symbol = Layer.symbolize(layer) @name = layer @background_class = background_class end |
Instance Attribute Details
#background_class ⇒ Object (readonly)
Returns the value of attribute background_class.
11 12 13 |
# File 'lib/archimate/data_model/layer.rb', line 11 def background_class @background_class end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/archimate/data_model/layer.rb', line 10 def name @name end |
Class Method Details
.symbolize(str) ⇒ Object
54 55 56 57 |
# File 'lib/archimate/data_model/layer.rb', line 54 def self.symbolize(str) return str if str.is_a?(Symbol) str.downcase.tr(" ", "_").to_sym end |
Instance Method Details
#<=>(other) ⇒ Object
42 43 44 |
# File 'lib/archimate/data_model/layer.rb', line 42 def <=>(other) Layers.find_index(self) <=> Layers.find_index(other) end |
#==(other) ⇒ Object
38 39 40 |
# File 'lib/archimate/data_model/layer.rb', line 38 def ==(other) @symbol == other&.to_sym end |
#===(other) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/archimate/data_model/layer.rb', line 24 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 |
#hash ⇒ Object
20 21 22 |
# File 'lib/archimate/data_model/layer.rb', line 20 def hash self.class.hash ^ @symbol.hash end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/archimate/data_model/layer.rb', line 50 def to_s @name end |
#to_sym ⇒ Object
46 47 48 |
# File 'lib/archimate/data_model/layer.rb', line 46 def to_sym @symbol end |