Class: WorkingSet

Inherits:
Object show all
Defined in:
lib/working_set.rb

Constant Summary collapse

VERSION =
"1.0.2"

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = nil, items = [])
  self.search  = search
  self.options = options
  self.items   = []
  items.each { |i| self.add i }
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



4
5
6
# File 'lib/working_set.rb', line 4

def items
  @items
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/working_set.rb', line 4

def name
  @name
end

#noteObject

Returns the value of attribute note.



4
5
6
# File 'lib/working_set.rb', line 4

def note
  @note
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/working_set.rb', line 4

def options
  @options
end

#savedObject

Returns the value of attribute saved.



4
5
6
# File 'lib/working_set.rb', line 4

def saved
  @saved
end

#searchObject

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

#inspectObject



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: #{options}
Items:

#{items.map(&:inspect).join("\n")}
EOS
end