Class: Osm::Badge::RequirementModule

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Model, ActiveModel::MassAssignmentSecurity
Defined in:
lib/osm/badge.rb,
lib/osm/badge.rb

Overview

Ensure the constant exists for the validators

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject

Initialize a new Badge::RequirementModule

Parameters:

  • attributes (Hash)

    The hash of attributes (see attributes for descriptions, use Symbol of attribute name as the key)



# File 'lib/osm/badge.rb', line 494

Instance Attribute Details

#add_column_id_to_numericFixnum?

Returns ?.

Returns:

  • (Fixnum, nil)

    ?



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#badgeOsm::Badge

Returns the badge the requirement module belongs to.

Returns:

  • (Osm::Badge)

    the badge the requirement module belongs to



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#completed_into_columnFixnum?

Returns ?.

Returns:

  • (Fixnum, nil)

    ?



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#custom_columnsFixnum?

Returns ?.

Returns:

  • (Fixnum, nil)

    ?



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#idFixnum

Returns the id for the module.

Returns:

  • (Fixnum)

    the id for the module



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#letterString

Returns the letter of the module.

Returns:

  • (String)

    the letter of the module



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#min_requiredFixnum

Returns the minimum number of requirements which must be met to achieve this module.

Returns:

  • (Fixnum)

    the minimum number of requirements which must be met to achieve this module



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

#numeric_into_columnFixnum?

Returns ?.

Returns:

  • (Fixnum, nil)

    ?



472
# File 'lib/osm/badge.rb', line 472

attribute :badge, :type => Object

Instance Method Details

#<=>(another) ⇒ Object

Compare Badge::RequirementModule based on badge then letter



499
500
501
502
503
504
# File 'lib/osm/badge.rb', line 499

def <=>(another)
  result = self.badge <=> another.try(:badge)
  result = self.letter <=> another.try(:letter) if result == 0
  result = self.id <=> another.try(:id) if result == 0
  return result
end

#inspectObject



506
507
508
# File 'lib/osm/badge.rb', line 506

def inspect
  Osm.inspect_instance(self, {:replace_with => {'badge' => :identifier}})
end