Class: Metro::AssetPath
- Inherits:
-
Object
- Object
- Metro::AssetPath
- Defined in:
- lib/metro/asset_path.rb
Overview
An AssetPath searches through the various paths based on the path provided.
First it assumes the path is absolute, second it assuemts that path is within the game, and third it assumes it is within metro itself.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #absolute_asset?(path) ⇒ Boolean
- #filepath ⇒ Object (also: #to_s)
- #game_asset?(path) ⇒ Boolean
-
#initialize(path) ⇒ AssetPath
constructor
A new instance of AssetPath.
- #metro_asset?(path) ⇒ Boolean
Constructor Details
#initialize(path) ⇒ AssetPath
Returns a new instance of AssetPath.
65 66 67 |
# File 'lib/metro/asset_path.rb', line 65 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
69 70 71 |
# File 'lib/metro/asset_path.rb', line 69 def path @path end |
Class Method Details
.with(path) ⇒ Object
61 62 63 |
# File 'lib/metro/asset_path.rb', line 61 def self.with(path) path.is_a?(AssetPath) ? path : new(path.to_s) end |
Instance Method Details
#absolute_asset?(path) ⇒ Boolean
77 78 79 |
# File 'lib/metro/asset_path.rb', line 77 def absolute_asset?(path) asset_at_path? path end |
#filepath ⇒ Object Also known as: to_s
71 72 73 74 75 |
# File 'lib/metro/asset_path.rb', line 71 def filepath @filepath ||= begin absolute_asset?(path) or game_asset?(path) or metro_asset?(path) end end |
#game_asset?(path) ⇒ Boolean
81 82 83 |
# File 'lib/metro/asset_path.rb', line 81 def game_asset?(path) asset_at_path? asset_path(path) end |
#metro_asset?(path) ⇒ Boolean
85 86 87 |
# File 'lib/metro/asset_path.rb', line 85 def metro_asset?(path) asset_at_path? metro_asset_path(path) end |