Class: RogerThemes::Asset
- Inherits:
-
Object
- Object
- RogerThemes::Asset
- Defined in:
- lib/roger_themes/asset.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
Instance Method Summary collapse
- #attributes ⇒ Object
- #full_path ⇒ Object
-
#initialize(data, theme) ⇒ Asset
constructor
A new instance of Asset.
- #initialize_copy(source) ⇒ Object
- #location ⇒ Object
-
#path ⇒ Object
Relative path within theme.
- #type ⇒ Object
- #update(data) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(data, theme) ⇒ Asset
Returns a new instance of Asset.
5 6 7 8 9 |
# File 'lib/roger_themes/asset.rb', line 5 def initialize(data, theme) @data = {} update(data) @theme = theme end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/roger_themes/asset.rb', line 3 def data @data end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
3 4 5 |
# File 'lib/roger_themes/asset.rb', line 3 def theme @theme end |
Instance Method Details
#attributes ⇒ Object
40 41 42 |
# File 'lib/roger_themes/asset.rb', line 40 def attributes @data["attributes"] || {} end |
#full_path ⇒ Object
24 25 26 |
# File 'lib/roger_themes/asset.rb', line 24 def full_path theme.path + path end |
#initialize_copy(source) ⇒ Object
15 16 17 |
# File 'lib/roger_themes/asset.rb', line 15 def initialize_copy(source) @data = @data.dup end |
#location ⇒ Object
32 33 34 |
# File 'lib/roger_themes/asset.rb', line 32 def location @data["location"].to_s end |
#path ⇒ Object
Relative path within theme
20 21 22 |
# File 'lib/roger_themes/asset.rb', line 20 def path @data["path"].to_s end |
#type ⇒ Object
36 37 38 |
# File 'lib/roger_themes/asset.rb', line 36 def type @data["type"].to_s end |
#update(data) ⇒ Object
11 12 13 |
# File 'lib/roger_themes/asset.rb', line 11 def update(data) @data.update(data) end |
#url ⇒ Object
28 29 30 |
# File 'lib/roger_themes/asset.rb', line 28 def url [theme.url.sub(/\/\Z/, ''), path.sub(/\A\//, '')].join("/") end |