Class: Apkstats::Entity::Permission

Inherits:
Object
  • Object
show all
Defined in:
lib/apkstats/entity/permission.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, max_sdk: nil) ⇒ Permission

Returns a new instance of Permission.



11
12
13
14
# File 'lib/apkstats/entity/permission.rb', line 11

def initialize(name, max_sdk: nil)
  @name = name
  @max_sdk = max_sdk
end

Instance Attribute Details

#max_sdkObject (readonly)

String?



9
10
11
# File 'lib/apkstats/entity/permission.rb', line 9

def max_sdk
  @max_sdk
end

#nameObject (readonly)

String



6
7
8
# File 'lib/apkstats/entity/permission.rb', line 6

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
27
28
# File 'lib/apkstats/entity/permission.rb', line 24

def ==(other)
  return if !other || other.class != self.class

  to_s == other.to_s
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/apkstats/entity/permission.rb', line 30

def eql?(other)
  to_s.eql?(other.to_s)
end

#hashObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/apkstats/entity/permission.rb', line 34

def hash
  h = name.hash

  if max_sdk
    h *= 31
    h += max_sdk.hash
  end

  h
end

#to_sObject



16
17
18
19
20
21
22
# File 'lib/apkstats/entity/permission.rb', line 16

def to_s
  if max_sdk
    "#{name} maxSdkVersion=#{max_sdk}"
  else
    name
  end
end