File: null.rb

package info (click to toggle)
libnora-ruby 1%3A0.0.20041021-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 408 kB
  • ctags: 726
  • sloc: ruby: 5,186; ansic: 669; makefile: 248; sql: 10
file content (29 lines) | stat: -rwxr-xr-x 538 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Web::Persistent::Lock::Null
# Copyright(c) 2002 MoonWolf <moonwolf@moonwolf.com>
module Web
  class Persistent
    module Lock
      class Null
        def initialize(persistent_id, options={})
          @persistent_id = persistent_id
        end

        def lock
          @locked =true
          if block_given?
            yield
            unlock
          end
        end

        def unlock
          @locked = false
        end

        def delete
          nil
        end
      end
    end # Lock
  end # Persistent
end # Web