Class: Osm::Badge::Requirement

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::Requirement

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 433

Instance Attribute Details

#badgeOsm::Badge

Returns the badge the requirement belongs to.

Returns:

  • (Osm::Badge)

    the badge the requirement belongs to


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

attribute :badge, :type => Object

#descriptionString

Returns a description of the badge requirement.

Returns:

  • (String)

    a description of the badge requirement


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

attribute :badge, :type => Object

#editableBoolean

Returns:

  • (Boolean)

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

attribute :badge, :type => Object

#idFixnum

Returns the id for the requirement (passed to OSM).

Returns:

  • (Fixnum)

    the id for the requirement (passed to OSM)


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

attribute :badge, :type => Object

#modOsm::Badge::RequirementModule

Returns the module the requirement belongs to.

Returns:


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

attribute :badge, :type => Object

#nameString

Returns the name of the badge requirement.

Returns:

  • (String)

    the name of the badge requirement


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

attribute :badge, :type => Object

Instance Method Details

#<=>(another) ⇒ Object

Compare Badge::Requirement based on badge then requirement


438
439
440
441
442
# File 'lib/osm/badge.rb', line 438

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

#inspectObject


444
445
446
# File 'lib/osm/badge.rb', line 444

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