Class: Steam::Id::Base
- Inherits:
-
Object
- Object
- Steam::Id::Base
- Extended by:
- Forwardable
- Defined in:
- lib/steam/id/base.rb
Overview
Represents a SteamID holds the various parts of the Steam Id an internal 64bit datastructure
Direct Known Subclasses
Instance Attribute Summary collapse
-
#struct ⇒ Object
readonly
Returns the value of attribute struct.
Instance Method Summary collapse
-
#initialize(struct = Struct.new) ⇒ Base
constructor
Create a new Steam ID.
-
#to_i ⇒ Integer
Return the Steam Id in int format.
-
#to_s(klass = Steam2Printer) ⇒ String
Return the Steam Id in string format.
-
#valid? ⇒ Bool
Returns true if the Steam id is valid.
Constructor Details
#initialize(struct = Struct.new) ⇒ Base
Create a new Steam ID
20 21 22 |
# File 'lib/steam/id/base.rb', line 20 def initialize(struct = Struct.new) @struct = struct end |
Instance Attribute Details
#struct ⇒ Object (readonly)
Returns the value of attribute struct.
17 18 19 |
# File 'lib/steam/id/base.rb', line 17 def struct @struct end |
Instance Method Details
#to_i ⇒ Integer
Return the Steam Id in int format.
37 38 39 |
# File 'lib/steam/id/base.rb', line 37 def to_i @struct.to_i end |
#to_s(klass = Steam2Printer) ⇒ String
Return the Steam Id in string format. By default the Steam2 format is returned
29 30 31 32 |
# File 'lib/steam/id/base.rb', line 29 def to_s(klass = Steam2Printer) printer ||= klass.new(self) printer.print end |
#valid? ⇒ Bool
Returns true if the Steam id is valid
44 45 46 |
# File 'lib/steam/id/base.rb', line 44 def valid? valid_universe? && valid_account? end |