Class: Gamefic::Direction
- Inherits:
-
Object
- Object
- Gamefic::Direction
- Defined in:
- lib/gamefic/direction.rb
Instance Attribute Summary collapse
-
#adjective ⇒ Object
Returns the value of attribute adjective.
-
#adverb ⇒ Object
Returns the value of attribute adverb.
-
#name ⇒ Object
Returns the value of attribute name.
-
#reverse ⇒ Object
Returns the value of attribute reverse.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Direction
constructor
A new instance of Direction.
- #synonyms ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Direction
Returns a new instance of Direction.
5 6 7 8 9 10 11 12 13 |
# File 'lib/gamefic/direction.rb', line 5 def initialize args = {} args.each { |key, value| send "#{key}=", value } if !reverse.nil? reverse.reverse = self end proper_named = true end |
Instance Attribute Details
#adjective ⇒ Object
Returns the value of attribute adjective.
4 5 6 |
# File 'lib/gamefic/direction.rb', line 4 def adjective @adjective end |
#adverb ⇒ Object
Returns the value of attribute adverb.
4 5 6 |
# File 'lib/gamefic/direction.rb', line 4 def adverb @adverb end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/gamefic/direction.rb', line 4 def name @name end |
#reverse ⇒ Object
Returns the value of attribute reverse.
4 5 6 |
# File 'lib/gamefic/direction.rb', line 4 def reverse @reverse end |
Class Method Details
.find(str) ⇒ Object
29 30 31 32 |
# File 'lib/gamefic/direction.rb', line 29 def self.find(str) x = { "north" => NORTH, "south" => SOUTH, "west" => WEST, "east" => EAST, "up" => UP, "down" => DOWN, "northwest" => NORTHWEST, "northeast" => NORTHEAST, "southwest" => SOUTHWEST, "southeast" => SOUTHEAST } x[str] end |
Instance Method Details
#synonyms ⇒ Object
23 24 25 |
# File 'lib/gamefic/direction.rb', line 23 def synonyms "#{adjective} #{adverb}" end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/gamefic/direction.rb', line 26 def to_s @name end |