Class: Mantra::Manifest::Scope::HashScope

Inherits:
Mantra::Manifest::Scope show all
Defined in:
lib/mantra/manifest/scope/hash_scope.rb

Constant Summary

Constants inherited from Mantra::Manifest::Scope

ARRAY_SELECTOR_REGEXP, HASH_SELECTOR_REGEXP

Instance Attribute Summary

Attributes inherited from Mantra::Manifest::Scope

#next, #scope

Instance Method Summary collapse

Methods inherited from Mantra::Manifest::Scope

#filter, #has_same_type?, #initialize, #last?, #match?, parse, parse_selector, raise_parse_error, split_selector, #to_a

Methods included from Helpers::RegexpHelper

#to_regexp

Methods included from Helpers::ObjectWithType

included

Constructor Details

This class inherits a constructor from Mantra::Manifest::Scope

Instance Method Details

#_filter(element) ⇒ Object

returns array of children that matches this scope



9
10
11
12
13
14
15
# File 'lib/mantra/manifest/scope/hash_scope.rb', line 9

def _filter(element)
  scope_regexp = to_regexp(scope)
  element.content.each_pair.map do |pair|
    key, value = *pair
    key.match(scope_regexp) ? value : nil
  end.compact
end