Class: X2CH::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/x2ch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Category

Returns a new instance of Category.



41
42
43
44
# File 'lib/x2ch.rb', line 41

def initialize(name)
  @name = name
  @boards = []
end

Instance Attribute Details

#boardsObject

Returns the value of attribute boards.



39
40
41
# File 'lib/x2ch.rb', line 39

def boards
  @boards
end

#nameObject

Returns the value of attribute name.



39
40
41
# File 'lib/x2ch.rb', line 39

def name
  @name
end

Instance Method Details

#[](bname) ⇒ Object



46
47
48
49
50
51
# File 'lib/x2ch.rb', line 46

def [](bname)
  @boards.each{|b|
    return b if b.name == bname
  }
  nil
end

#each(&blk) ⇒ Object



57
58
59
60
61
# File 'lib/x2ch.rb', line 57

def each(&blk)
  @boards.each{|b|
    yield b
  }
end

#push(board) ⇒ Object



53
54
55
# File 'lib/x2ch.rb', line 53

def push(board)
  @boards << board
end