Class: XCAssets::XCAssets

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ XCAssets

Returns a new instance of XCAssets.



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

def initialize(name)
  @name = name
  @imagesets = []
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#add_imageset(imageset) ⇒ Object



15
16
17
# File 'lib/KCommercialPipeline/core/resource/xcassets/xcassets.rb', line 15

def add_imageset(imageset)
  @imagesets << imageset
end

#save(directory) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/KCommercialPipeline/core/resource/xcassets/xcassets.rb', line 19

def save(directory)
  root = directory.join("#{name}.xcassets")
  root.rmtree if root.exist?
  root.mkpath
  write_imagesets(root)
  write_contents_json(root)
end