class Android::Manifest::Component
<activity>, <service>, <receiver> or <provider> element in <application> element of the manifest file.
Constants
- TYPES
component types
Attributes
elem[R]
@return [REXML::Element]
intent_filters[R]
@return [Array<Manifest::IntentFilter>]
metas[R]
@return [Array<Manifest::Meta>]
name[R]
@return [String] component name
type[R]
@return [String] type string in TYPES
Public Class Methods
new(elem)
click to toggle source
@param [REXML::Element] elem target element @raise [ArgumentError] when elem is invalid.
# File lib/android/manifest.rb, line 37 def initialize(elem) raise ArgumentError unless Component.valid?(elem) @elem = elem @type = elem.name @name = elem.attributes['name'] @intent_filters = [] unless elem.elements['intent-filter'].nil? elem.elements['intent-filter'].each do |e| next unless e.instance_of? REXML::Element @intent_filters << IntentFilter.parse(e) end end @metas = [] elem.each_element('meta-data') do |e| @metas << Meta.new(e) end end
valid?(elem)
click to toggle source
the element is valid Component
element or not @param [REXML::Element] elem xml element @return [Boolean]
# File lib/android/manifest.rb, line 17 def self.valid?(elem) TYPES.include?(elem.name.downcase) rescue => e false end