summaryrefslogtreecommitdiffstats
path: root/lib/efl/elm/elm_store.rb
blob: 625232a3c27e29fffd855aed5acbc131594caf90 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl'
require 'efl/native/elm/elm_store'
#
module Efl
    #
    module Elm
        #
        class ElmStore
            #
            include Efl::ClassHelper
            search_prefixes 'elm_store_'
            #
            def initialize o=nil, &block
                @ptr = (
                    case o
                    when NilClass
                        FFI::AutoPointer.new Native.elm_store_filesystem_new, ElmStore.method(:release)
                    when FFI::Pointer
                        o
                    else
                        raise ArgumentError.new "wrong argument #{o.class.name}"
                    end
                )
                instance_eval &block if block
            end
            def self.release p
                Native.elm_store_free p
            end
            def free
                @ptr.autorelease=false if @ptr.is_a? FFI::AutoPointer
                ElmStore.release @ptr
                @ptr=nil
            end
            #
        end
        #
    end
end
#
# EOF