Sha256: 303f8f841dea18575e46dd524b2286edc59c8310310ffe0447b4f37f8fde7377
Contents?: true
Size: 852 Bytes
Versions: 3
Compression:
Stored size: 852 Bytes
Contents
require_relative 'world_object' module Woyo class Way < WorldObject attributes :description, name: lambda { |this| this.id.to_s.capitalize } def from @from ||= context end def world from ? from.world : nil end def to= arg if arg.instance_of? Symbol case when from && arg == from.id @to = from # way loops back to the same location when world && world.locations[arg] @to = world.locations[arg] # destination location already exists in world when world @to = world.location arg # create destination location in world else @to = Location.new arg # create free-standing destination location end end end def to arg=nil if arg.nil? @to else self.to = arg end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
woyo-world-0.0.5 | lib/woyo/world/way.rb |
woyo-world-0.0.4 | lib/woyo/world/way.rb |
woyo-world-0.0.3 | lib/woyo/world/way.rb |