Class: WorkingSet
Constant Summary collapse
- VERSION =
"1.0.2"
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#name ⇒ Object
Returns the value of attribute name.
-
#note ⇒ Object
Returns the value of attribute note.
-
#options ⇒ Object
Returns the value of attribute options.
-
#saved ⇒ Object
Returns the value of attribute saved.
-
#search ⇒ Object
Returns the value of attribute search.
Instance Method Summary collapse
- #add(item) ⇒ Object
-
#initialize(search = nil, options = nil, items = []) ⇒ WorkingSet
constructor
A new instance of WorkingSet.
- #inspect ⇒ Object
Constructor Details
#initialize(search = nil, options = nil, items = []) ⇒ WorkingSet
Returns a new instance of WorkingSet.
8 9 10 11 12 13 |
# File 'lib/working_set.rb', line 8 def initialize(search = nil, = nil, items = []) self.search = search self. = self.items = [] items.each { |i| self.add i } end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
4 5 6 |
# File 'lib/working_set.rb', line 4 def items @items end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/working_set.rb', line 4 def name @name end |
#note ⇒ Object
Returns the value of attribute note.
4 5 6 |
# File 'lib/working_set.rb', line 4 def note @note end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/working_set.rb', line 4 def @options end |
#saved ⇒ Object
Returns the value of attribute saved.
4 5 6 |
# File 'lib/working_set.rb', line 4 def saved @saved end |
#search ⇒ Object
Returns the value of attribute search.
4 5 6 |
# File 'lib/working_set.rb', line 4 def search @search end |
Instance Method Details
#add(item) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/working_set.rb', line 15 def add(item) if item.kind_of? WorkingSetItem items.push item else items.push WorkingSetItem.new(item) end end |
#inspect ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/working_set.rb', line 23 def inspect str = <<EOS WorkingSet #{object_id} Search: #{search} Options: #{} Items: #{items.map(&:inspect).join("\n")} EOS end |