Class: MineSkin::CapeData

Inherits:
Object
  • Object
show all
Includes:
Extractor, Unit
Defined in:
lib/mineskin/cape_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Extractor

#crop, #extract, #part

Methods included from Unit

#image_unit

Constructor Details

#initialize(filename) ⇒ CapeData

Returns a new instance of CapeData.



14
15
16
17
18
19
20
21
22
23
# File 'lib/mineskin/cape_data.rb', line 14

def initialize(filename)
  @image = Magick::Image.read(filename).first
  # rubocop:disable ConditionalAssignment
  if (@image.columns.to_f / @image.rows.to_f) == (22.0 / 17.0)
    @unit = (@image.columns / 22.0).ceil
  else
    @unit = (@image.columns / 64.0).ceil
  end
  extract_cape!
end

Instance Attribute Details

#capeObject

Returns the value of attribute cape.



11
12
13
# File 'lib/mineskin/cape_data.rb', line 11

def cape
  @cape
end

#unitObject (readonly)

Returns the value of attribute unit.



12
13
14
# File 'lib/mineskin/cape_data.rb', line 12

def unit
  @unit
end