Class: RedSnow::KeyValueCollection Abstract
- Inherits:
-
BlueprintNode
- Object
- BlueprintNode
- RedSnow::KeyValueCollection
- Defined in:
- lib/redsnow/blueprint.rb
Overview
This class is abstract.
Blueprint AST node for key-value collections
Instance Attribute Summary collapse
-
#collection ⇒ Array<Hash>
array of key value hashes.
Instance Method Summary collapse
-
#[](key) ⇒ NilClass, String
Retrieves the value of the collection item by its key.
-
#filter_collection(ignore_keys) ⇒ Array<Hash>
Filter collection keys.
Instance Attribute Details
#collection ⇒ Array<Hash>
array of key value hashes
55 56 57 |
# File 'lib/redsnow/blueprint.rb', line 55 def collection @collection end |
Instance Method Details
#[](key) ⇒ NilClass, String
Retrieves the value of the collection item by its key
63 64 65 66 |
# File 'lib/redsnow/blueprint.rb', line 63 def [](key) return nil if @collection.nil? return_item_value key end |
#filter_collection(ignore_keys) ⇒ Array<Hash>
Filter collection keys
70 71 72 73 |
# File 'lib/redsnow/blueprint.rb', line 70 def filter_collection(ignore_keys) return @collection if ignore_keys.blank? @collection.select { |kv_item| !ignore_keys.include?(kv_item.keys.first) } end |