Class: Mingle::CardType
- Inherits:
-
Object
- Object
- Mingle::CardType
- Defined in:
- lib/mingle_macro_models/card_type.rb
Overview
This is a lightweight representation of a card type in Mingle. From an instance of this class you can the name, color and position of the card type, in addition to Property Definitions that are associated with it.
Instance Attribute Summary collapse
-
#card_types_property_definitions_loader ⇒ Object
writeonly
Sets the attribute card_types_property_definitions_loader.
Instance Method Summary collapse
-
#color ⇒ Object
returns: The hex color code for this CardType.
-
#initialize(full_card_type) ⇒ CardType
constructor
A new instance of CardType.
-
#name ⇒ Object
returns: The name of this CardType.
-
#position ⇒ Object
returns: The position of this CardType among all the CardTypes on the project.
-
#property_definitions ⇒ Object
returns: The PropertyDefinitions associated with this CardType.
- #to_s ⇒ Object
Constructor Details
#initialize(full_card_type) ⇒ CardType
Returns a new instance of CardType.
9 10 11 |
# File 'lib/mingle_macro_models/card_type.rb', line 9 def initialize(full_card_type) @full_card_type = full_card_type end |
Instance Attribute Details
#card_types_property_definitions_loader=(value) ⇒ Object (writeonly)
Sets the attribute card_types_property_definitions_loader
38 39 40 |
# File 'lib/mingle_macro_models/card_type.rb', line 38 def card_types_property_definitions_loader=(value) @card_types_property_definitions_loader = value end |
Instance Method Details
#color ⇒ Object
returns: The hex color code for this CardType
19 20 21 |
# File 'lib/mingle_macro_models/card_type.rb', line 19 def color @full_card_type.color.gsub('#', '') end |
#name ⇒ Object
returns: The name of this CardType
14 15 16 |
# File 'lib/mingle_macro_models/card_type.rb', line 14 def name @full_card_type.name end |
#position ⇒ Object
returns: The position of this CardType among all the CardTypes on the project. The first card type has position 1
25 26 27 |
# File 'lib/mingle_macro_models/card_type.rb', line 25 def position @full_card_type.position end |
#property_definitions ⇒ Object
returns: The PropertyDefinitions associated with this CardType
30 31 32 |
# File 'lib/mingle_macro_models/card_type.rb', line 30 def property_definitions @card_types_property_definitions_loader.load.collect(&:property_definition) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/mingle_macro_models/card_type.rb', line 34 def to_s "CardType[name=#{name},color=#{color},position=#{position}]" end |