Class: Jewelry

Inherits:
Item show all
Defined in:
lib/Olib/objects/jewelry.rb

Constant Summary collapse

HEIRLOOM =
/are the initials ([A-Z]{2})./

Constants inherited from Exist

Exist::GETTER, Exist::PATTERN

Instance Attribute Summary collapse

Attributes inherited from Item

#container

Attributes inherited from Exist

#gameobj, #id

Instance Method Summary collapse

Methods inherited from Item

#appraise, fetch, #held?, #initialize, of, #sell, #stash, #take, #to_json, #transaction, #use, #worn?

Methods inherited from Exist

#==, #deconstruct_keys, #effects, #exists?, #fetch, fetch, #gone?, #initialize, #method_missing, normalize_type_data, #respond_to_missing?, scan, #tags, #to_h, #to_s

Constructor Details

This class inherits a constructor from Item

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Exist

Instance Attribute Details

#heirloomObject

Returns the value of attribute heirloom.



4
5
6
# File 'lib/Olib/objects/jewelry.rb', line 4

def heirloom
  @heirloom
end

Instance Method Details

#heirloom?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'lib/Olib/objects/jewelry.rb', line 5

def heirloom?
  result = Olib.do "look ##{@id}", /^You see nothing unusual/ | HEIRLOOM
  @heirloom = result =~ HEIRLOOM ? true : false
  @heirloom
end