Class: Pod::Image
- Inherits:
-
Object
- Object
- Pod::Image
- Defined in:
- lib/cocoapods-dongjia/command/strip.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#fuzzy_name ⇒ Object
Returns the value of attribute fuzzy_name.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #fullpath ⇒ Object
- #hash ⇒ Object
-
#initialize(dir, name) ⇒ Image
constructor
A new instance of Image.
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
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/cocoapods-dongjia/command/strip.rb', line 7 def dir @dir end |
#fuzzy_name ⇒ Object
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 |
#name ⇒ Object
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
27 28 29 |
# File 'lib/cocoapods-dongjia/command/strip.rb', line 27 def eql?(other) @dir == other.dir && @name == other.name end |
#fullpath ⇒ Object
35 36 37 |
# File 'lib/cocoapods-dongjia/command/strip.rb', line 35 def fullpath File.join(@dir, @name) end |
#hash ⇒ Object
31 32 33 |
# File 'lib/cocoapods-dongjia/command/strip.rb', line 31 def hash [@dir, @name].hash end |