Class: Appwrite::Operator

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

Defined Under Namespace

Classes: Operator

Instance Method Summary collapse

Constructor Details

#initialize(method, values = nil) ⇒ Operator

Returns a new instance of Operator.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/appwrite/operator.rb', line 17

def initialize(method, values = nil)
    @method = method

    if values != nil
        if values.is_a?(Array)
            @values = values
        else
            @values = [values]
        end
    end
end

Instance Method Details

#to_json(*args) ⇒ Object



29
30
31
32
33
# File 'lib/appwrite/operator.rb', line 29

def to_json(*args)
    result = { method: @method }
    result[:values] = @values unless @values.nil?
    result.to_json(*args)
end

#to_sObject



35
36
37
# File 'lib/appwrite/operator.rb', line 35

def to_s
    return self.to_json
end