Class: AssetsMapper::IgnoreFolderXcassets

Inherits:
Xcassets
  • Object
show all
Defined in:
lib/classes/Xcassets.rb

Instance Method Summary collapse

Methods inherited from Xcassets

write

Constructor Details

#initialize(filepath, allow_modification) ⇒ IgnoreFolderXcassets

Returns a new instance of IgnoreFolderXcassets.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/classes/Xcassets.rb', line 21

def initialize(filepath, allow_modification)
  super(filepath, false, allow_modification)
  imagesets = Dir.glob("#{@filepath}/**/*.imageset")
    .map{|s| s.split('/')}
    .flat_map{|x| x}
    .select {|x|x.include?'.imageset'}
    .sort

  @xcassets_name = @filepath.match('[\.\/.]*(.*).xcassets').captures
  @enum = Enum.new(@xcassets_name)
  imagesets.each do |i|
    asset_name = i.match('(.*).imageset').captures[0]
    image_name = AssetsMapper.check_string(
      asset_name,
      allow_modification
    )

    string = Enum.static_let(image_name, asset_name)
    @enum.add_children(string)
  end
end

Instance Method Details

#enumObject



43
44
45
# File 'lib/classes/Xcassets.rb', line 43

def enum
  @enum
end