Develop and Download Open Source Software

Browse Subversion Repository

Contents of /buffer_manager.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations) (download)
Fri Apr 6 11:20:39 2007 UTC (16 years, 11 months ago) by bluedwarf
File size: 1692 byte(s)
Changes the head description of each file.
1 # buffer.rb: the class definition of Edmaru::BufferManager
2 #
3 # Copyright (C) 2007 Takashi Nakamoto
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 # 02110-1301 USA.
18 #
19
20 require "buffer.rb"
21
22 module Edmaru
23
24 #The controller to manage multiple buffers.
25 class BufferManager
26
27 #Create the buffer manager.
28 #
29 #=== Return
30 #An initialized manager.
31 def initialize
32 @buffers = Hash.new
33 end
34
35 #Create a new buffer by specified name.
36 #
37 #=== Argument
38 #_name_ :: the buffer name
39 #
40 #=== Return
41 #_true_ if a new buffer is created successfully.
42 #
43 #=== Note
44 #This method returns if the specified _name_ is already used.
45 def create(name)
46 if @buffers.include?(name)
47 return false
48 end
49
50 @buffers[name] = Buffer.new(name)
51 end
52
53 #Return the specified buffer.
54 #
55 #=== Return
56 #The buffer instance whose name is the specified _name_ or _nil_
57 #if the specified _name_ is not used.
58 def get(name)
59 if @buffers.include?(name)
60 return @buffers[name]
61 else
62 return nil
63 end
64 end
65
66 end
67 end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26