Class: AssetHost::AssetSize

Inherits:
Object
  • Object
show all
Defined in:
lib/asset_host/asset_size.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset, output) ⇒ AssetSize

Returns a new instance of AssetSize.



5
6
7
8
9
10
11
12
13
# File 'lib/asset_host/asset_size.rb', line 5

def initialize(asset, output)
  @asset  = asset
  @output = output

  self.width  = @asset.json['sizes'][ output['code'] ]['width']
  self.height = @asset.json['sizes'][ output['code'] ]['height']
  self.tag    = @asset.json['tags'][ output['code'] ]
  self.url    = @asset.json['urls'][ output['code'] ]
end

Instance Attribute Details

#assetObject

Returns the value of attribute asset.



3
4
5
# File 'lib/asset_host/asset_size.rb', line 3

def asset
  @asset
end

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/asset_host/asset_size.rb', line 3

def height
  @height
end

#outputObject

Returns the value of attribute output.



3
4
5
# File 'lib/asset_host/asset_size.rb', line 3

def output
  @output
end

#tagObject

Returns the value of attribute tag.



3
4
5
# File 'lib/asset_host/asset_size.rb', line 3

def tag
  @tag
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/asset_host/asset_size.rb', line 3

def url
  @url
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/asset_host/asset_size.rb', line 3

def width
  @width
end