Class: Immediate
- Inherits:
-
Object
- Object
- Immediate
- Defined in:
- lib/immediate.rb
Instance Method Summary collapse
- #clip_array ⇒ Object
- #create ⇒ Object
- #delete ⇒ Object
- #list ⇒ Object
-
#open(filename) ⇒ Object
Variables @data Clip_Array the clip array.
- #retrieve ⇒ Object
- #update ⇒ Object
Instance Method Details
#clip_array ⇒ Object
22 23 24 |
# File 'lib/immediate.rb', line 22 def clip_array return @data end |
#create ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/immediate.rb', line 26 def create new = STDIN.readlines.join($/) @data.new @data.current.text = new print_verbose "immediately creating clip '#{@data.current.title}'" @data.close end |
#delete ⇒ Object
47 48 49 50 51 |
# File 'lib/immediate.rb', line 47 def delete print_verbose "immediately deleting clip '#{@data.current.title}'" @data.delete @data.close end |
#list ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/immediate.rb', line 53 def list print_verbose "immediately listing #{@data.length} clips" @data.each_index do | i | c = @data[i] print "%d\t%s\t%s\n" % [i+1,c.type,c.title!] end @data.close end |
#open(filename) ⇒ Object
Variables @data Clip_Array the clip array
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/immediate.rb', line 10 def open(filename) begin new_data = ClipArray.open(filename) rescue AppError, SystemCallError => msg puts msg return nil end @data = new_data return @data end |
#retrieve ⇒ Object
34 35 36 37 38 |
# File 'lib/immediate.rb', line 34 def retrieve puts @data.current.text print_verbose "immediately retrieving clip '#{@data.current.title}'" @data.close end |
#update ⇒ Object
40 41 42 43 44 45 |
# File 'lib/immediate.rb', line 40 def update new = STDIN.readlines.join($/) @data.current.text = new print_verbose "immediately updating clip '#{@data.current.title}'" @data.close end |