Class: SolidusFriendlyPromotions::NestedClassSet
- Inherits:
-
Object
- Object
- SolidusFriendlyPromotions::NestedClassSet
- Defined in:
- lib/solidus_friendly_promotions/nested_class_set.rb
Instance Attribute Summary collapse
-
#klass_sets ⇒ Object
readonly
Returns the value of attribute klass_sets.
Instance Method Summary collapse
- #[](klass) ⇒ Object
-
#initialize(hash = {}) ⇒ NestedClassSet
constructor
A new instance of NestedClassSet.
Constructor Details
#initialize(hash = {}) ⇒ NestedClassSet
Returns a new instance of NestedClassSet.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/solidus_friendly_promotions/nested_class_set.rb', line 9 def initialize(hash = {}) @klass_sets = hash.map do |key, value| [ key, Spree::Core::ClassConstantizer::Set.new.tap do |set| value.each { |klass_name| set << klass_name } end ] end.to_h end |
Instance Attribute Details
#klass_sets ⇒ Object (readonly)
Returns the value of attribute klass_sets.
7 8 9 |
# File 'lib/solidus_friendly_promotions/nested_class_set.rb', line 7 def klass_sets @klass_sets end |
Instance Method Details
#[](klass) ⇒ Object
20 21 22 |
# File 'lib/solidus_friendly_promotions/nested_class_set.rb', line 20 def [](klass) klass_sets[klass.name] end |