Class: MineSkin::SkinData

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

Overview

Skin Data class

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) ⇒ SkinData

rubocop:disable AbcSize Initializes new instance of SkinData

Parameters:

  • filename (String)

    Path to input file



28
29
30
31
32
33
34
35
36
# File 'lib/mineskin/skin_data.rb', line 28

def initialize(filename)
  @image = Magick::Image.read(filename).first
  @new_format = @image.columns == @image.rows
  @unit = image_unit size: @image.columns
  @head = extract_head
  @body = extract_body
  @left_leg, @right_leg = extract_legs
  @left_arm, @right_arm = extract_arms
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



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

def body
  @body
end

#headObject

Returns the value of attribute head.



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

def head
  @head
end

#left_armObject

Returns the value of attribute left_arm.



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

def left_arm
  @left_arm
end

#left_legObject

Returns the value of attribute left_leg.



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

def left_leg
  @left_leg
end

#right_armObject

Returns the value of attribute right_arm.



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

def right_arm
  @right_arm
end

#right_legObject

Returns the value of attribute right_leg.



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

def right_leg
  @right_leg
end

#unitObject (readonly)

Returns the value of attribute unit.



20
21
22
# File 'lib/mineskin/skin_data.rb', line 20

def unit
  @unit
end

Instance Method Details

#new_format?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/mineskin/skin_data.rb', line 21

def new_format?
  @new_format
end