Module: FAP::Mixins::Properties

Defined in:
lib/fap/mixins/properties.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/fap/mixins/properties.rb', line 8

def self.included base
  base.class_eval <<-EOS, __FILE__, __LINE__ + 1
    extlib_inheritable_accessor(:properties) unless self.respond_to?(:properties)
    self.properties ||= []
  EOS
  base.extend ClassMethods
end

Instance Method Details

#_search_property(name) ⇒ Object

Raises:

  • (StandardError)


16
17
18
19
20
21
# File 'lib/fap/mixins/properties.rb', line 16

def _search_property name
  property = properties.select { |prop| prop.name == name }.first
  node = @_node.at_xpath property.xpath
  raise StandardError, "Could not find #{self.class}.#{name} (#{property.xpath}) in stream." unless node
  property.cast node
end