Class: Android::Manifest::Component
- Inherits:
-
Object
- Object
- Android::Manifest::Component
- Defined in:
- lib/android/manifest.rb
Overview
<activity>, <service>, <receiver> or <provider> element in <application> element of the manifest file.
Direct Known Subclasses
Constant Summary collapse
- TYPES =
component types
['activity', 'activity-alias', 'service', 'receiver', 'provider', 'application', 'queries']
Instance Attribute Summary collapse
- #elem ⇒ REXML::Element readonly
-
#icon_id ⇒ String
readonly
Icon id - use apk.icon_by_id(icon_id) to retrieve it’s corresponding data.
- #intent_filters ⇒ Array<Manifest::IntentFilters<Manifest::IntentFilter>> readonly
- #metas ⇒ Array<Manifest::Meta> readonly
-
#name ⇒ String
readonly
Component name.
-
#type ⇒ String
readonly
Type string in TYPES.
Class Method Summary collapse
-
.valid?(elem) ⇒ Boolean
the element is valid Component element or not.
Instance Method Summary collapse
-
#initialize(elem) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(elem) ⇒ Component
Returns a new instance of Component.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/android/manifest.rb', line 39 def initialize(elem) raise ArgumentError unless Component.valid?(elem) @elem = elem @type = elem.name @name = elem.attributes['name'] @icon_id = elem.attributes['icon'] @intent_filters = parse_intent_filters @metas = end |
Instance Attribute Details
#elem ⇒ REXML::Element (readonly)
35 36 37 |
# File 'lib/android/manifest.rb', line 35 def elem @elem end |
#icon_id ⇒ String (readonly)
Returns icon id - use apk.icon_by_id(icon_id) to retrieve it’s corresponding data.
29 30 31 |
# File 'lib/android/manifest.rb', line 29 def icon_id @icon_id end |
#intent_filters ⇒ Array<Manifest::IntentFilters<Manifest::IntentFilter>> (readonly)
31 32 33 |
# File 'lib/android/manifest.rb', line 31 def intent_filters @intent_filters end |
#metas ⇒ Array<Manifest::Meta> (readonly)
33 34 35 |
# File 'lib/android/manifest.rb', line 33 def @metas end |
#name ⇒ String (readonly)
Returns component name.
27 28 29 |
# File 'lib/android/manifest.rb', line 27 def name @name end |
#type ⇒ String (readonly)
Returns type string in TYPES.
25 26 27 |
# File 'lib/android/manifest.rb', line 25 def type @type end |
Class Method Details
.valid?(elem) ⇒ Boolean
the element is valid Component element or not
18 19 20 21 22 |
# File 'lib/android/manifest.rb', line 18 def self.valid?(elem) TYPES.include?(elem.name.downcase) rescue false end |