Class: Pod::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-dongjia/command/strip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, name) ⇒ Image

Returns a new instance of Image.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cocoapods-dongjia/command/strip.rb', line 10

def initialize(dir, name)
  @dir = dir
  if name.end_with?('@2x') || name.end_with?('@3x')
    name = name[0, name.length-3]
  end
  @name = name

  # 只处理最后一段为数字,或分了三段及以上的命名形式
  comps = name.split('_')
  last = comps.last
  if last.to_i > 0 || last.start_with?('0') || comps.count >= 3
    @fuzzy_name = name[0, name.length - last.length]
  else
    @fuzzy_name = ''
  end
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



7
8
9
# File 'lib/cocoapods-dongjia/command/strip.rb', line 7

def dir
  @dir
end

#fuzzy_nameObject

Returns the value of attribute fuzzy_name.



9
10
11
# File 'lib/cocoapods-dongjia/command/strip.rb', line 9

def fuzzy_name
  @fuzzy_name
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/cocoapods-dongjia/command/strip.rb', line 8

def name
  @name
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/cocoapods-dongjia/command/strip.rb', line 27

def eql?(other)
  @dir == other.dir && @name == other.name
end

#fullpathObject



35
36
37
# File 'lib/cocoapods-dongjia/command/strip.rb', line 35

def fullpath
  File.join(@dir, @name)
end

#hashObject



31
32
33
# File 'lib/cocoapods-dongjia/command/strip.rb', line 31

def hash
  [@dir, @name].hash
end