Class: Apkstats::Entity::Permissions
- Inherits:
-
Object
- Object
- Apkstats::Entity::Permissions
- Defined in:
- lib/apkstats/entity/permission.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Class Method Summary collapse
Instance Method Summary collapse
- #-(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(permission_arr) ⇒ Permissions
constructor
Array<Permission>.
- #to_a ⇒ Object
Constructor Details
#initialize(permission_arr) ⇒ Permissions
Array<Permission>
50 51 52 |
# File 'lib/apkstats/entity/permission.rb', line 50 def initialize() @values = end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
47 48 49 |
# File 'lib/apkstats/entity/permission.rb', line 47 def values @values end |
Class Method Details
.hashnize(permissions) ⇒ Object
80 81 82 83 84 |
# File 'lib/apkstats/entity/permission.rb', line 80 def self.hashnize() .values.each_with_object({}) do |, acc| acc[[.name, .max_sdk]] = end end |
Instance Method Details
#-(other) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/apkstats/entity/permission.rb', line 54 def -(other) raise "#{self.class} cannot handle #{other.class} with the minus operator" unless other.class == Permissions self_hash = Permissions.hashnize(self) other_hash = Permissions.hashnize(other) = (self_hash.keys - other_hash.keys).map do |key| self_hash[key] end Permissions.new() end |
#eql?(other) ⇒ Boolean
71 72 73 74 |
# File 'lib/apkstats/entity/permission.rb', line 71 def eql?(other) return if !other || other.class == Permissions other.values == values end |
#hash ⇒ Object
76 77 78 |
# File 'lib/apkstats/entity/permission.rb', line 76 def hash values.hash end |
#to_a ⇒ Object
67 68 69 |
# File 'lib/apkstats/entity/permission.rb', line 67 def to_a values.map(&:to_s) end |