Class: Classlist::Add

Inherits:
Operation show all
Defined in:
lib/classlist/add.rb

Overview

Classlist::Add is an operation that adds tokens to the original classlist when added to it.

Constant Summary

Constants inherited from Classlist

VERSION

Instance Attribute Summary

Attributes inherited from Classlist

#entries, #operations

Instance Method Summary collapse

Methods inherited from Classlist

#+, #==, #add, #add_operation, #include?, #initialize, #item, #length, #remove, #replace, #resolve_operations, #to_a, #to_s, #toggle

Constructor Details

This class inherits a constructor from Classlist

Instance Method Details

#merge(original) ⇒ Object



8
9
10
# File 'lib/classlist/add.rb', line 8

def merge(original)
  original.entries + entries
end

#resolve(original) ⇒ Object

resolve changes the original classlist



13
14
15
16
17
18
19
# File 'lib/classlist/add.rb', line 13

def resolve(original)
  entries.each do |entry|
    original.add(entry)
  end

  super
end