Class: Notes::Criteria

Inherits:
Object
  • Object
show all
Defined in:
lib/notes/model/criteria.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ Criteria

Returns a new instance of Criteria.



4
5
6
7
# File 'lib/notes/model/criteria.rb', line 4

def initialize(name, value)
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/notes/model/criteria.rb', line 3

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/notes/model/criteria.rb', line 3

def value
  @value
end

Instance Method Details

#to_hashObject



9
10
11
12
13
14
# File 'lib/notes/model/criteria.rb', line 9

def to_hash
  if @value.kind_of? Array
    return {@name => (Notes::ArrayUtil.array_to_string @value)}
  end
  {@name => @value}
end