Class: Mingle::PropertyValue

Inherits:
Object
  • Object
show all
Defined in:
lib/mingle_macro_models/property_value.rb

Overview

Copyright 2009 ThoughtWorks, Inc. All rights reserved.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(property_value) ⇒ PropertyValue

Returns a new instance of PropertyValue.



6
7
8
# File 'lib/mingle_macro_models/property_value.rb', line 6

def initialize(property_value)
  @property_value = property_value
end

Instance Attribute Details

#property_definition_loader=(value) ⇒ Object (writeonly)

Sets the attribute property_definition_loader

Parameters:

  • value

    the value to set the attribute property_definition_loader to.



63
64
65
# File 'lib/mingle_macro_models/property_value.rb', line 63

def property_definition_loader=(value)
  @property_definition_loader = value
end

Instance Method Details

#colorObject

returns: The hex color code for this PropertyValue



50
51
52
# File 'lib/mingle_macro_models/property_value.rb', line 50

def color
  @property_value.color.gsub('#', '')
end

#db_identifierObject

returns: The identifier that is used to represent this value in the database You will most likely not have to use this value in your macros For the various property types, the following are the values you can expect to see

  • Managed/Unmanaged text : The string value of the value

  • Managed/Unmanaged numeric : The numeric string representation of the value

  • Date : The canonical date format, as stored in the database

  • User : The id of the user in the database

  • Formula : Either the date or the numeric value, formatted as above

  • Card : The id of the card in the database



32
33
34
# File 'lib/mingle_macro_models/property_value.rb', line 32

def db_identifier
  @property_value.db_identifier
end

#display_valueObject

returns: The display value of this value Use the result of this method to display this value on the UI For the various property types, the following are the values you can expect to see

  • Managed/Unmanaged text : The string value of the value

  • Managed/Unmanaged numeric : The numeric string representation of the value

  • Date : The list of values this property has on all cards on the project, formatted using the project date format

  • User : The name of the user

  • Formula : Either the date or the numeric value, formatted as above

  • Card : The number of the card, followed by the name of the card



19
20
21
# File 'lib/mingle_macro_models/property_value.rb', line 19

def display_value
  @property_value.display_value
end

#property_definitionObject

returns: The PropertyDefinition that this value belongs to



55
56
57
# File 'lib/mingle_macro_models/property_value.rb', line 55

def property_definition
  @property_definition_loader.load
end

#to_sObject



59
60
61
# File 'lib/mingle_macro_models/property_value.rb', line 59

def to_s
  "PropertyValue[display_value=#{display_value},db_identifier=#{db_identifier},url_identifier=#{url_identifier}]"
end

#url_identifierObject

returns: A representation of this value that is unique and representable in a URL Use the result of this method if in any links that you want to build to point back into Mingle For the various property types, the following are the values you can expect to see

  • Managed/Unmanaged text : The string value of the value

  • Managed/Unmanaged numeric : The numeric string representation of the value

  • Date : The list of values this property has on all cards on the project, formatted using the project date format

  • User : The login of the user

  • Formula : Either the date or the numeric value, formatted as above

  • Card : The number of the card, followed by the name of the card



45
46
47
# File 'lib/mingle_macro_models/property_value.rb', line 45

def url_identifier
  @property_value.url_identifier
end