Class: XCAssets::ImageSet

Inherits:
Object
  • Object
show all
Defined in:
lib/KCommercialPipeline/core/resource/xcassets/imageset.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ImageSet

Returns a new instance of ImageSet.



9
10
11
12
13
14
15
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 9

def initialize(name)
  @name = name
  @images = []
  scale1_image
  scale2_image
  scale3_image
end

Instance Attribute Details

#imagesObject (readonly)

Returns the value of attribute images.



7
8
9
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 7

def images
  @images
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 5

def name
  @name
end

Instance Method Details

#contentsObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 29

def contents
  {
    :info => {
      :author => :xcode,
      :version => 1
    },
    :images => @images.map do |image|
      image.contents
    end
  }
end

#scale1_imageObject



17
18
19
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 17

def scale1_image
  scale_image('1x')
end

#scale2_imageObject



21
22
23
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 21

def scale2_image
  scale_image('2x')
end

#scale3_imageObject



25
26
27
# File 'lib/KCommercialPipeline/core/resource/xcassets/imageset.rb', line 25

def scale3_image
  scale_image('3x')
end