Class: Filterparams::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/filterparams/obj/parameter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params = {}) ⇒ Parameter

Returns a new instance of Parameter.



5
6
7
8
9
10
# File 'lib/filterparams/obj/parameter.rb', line 5

def initialize(name, params = {})
  self.name = name
  self.filter = params[:filter] || nil
  self.value = params[:value] || nil
  self.alias = params[:alias] || nil
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



3
4
5
# File 'lib/filterparams/obj/parameter.rb', line 3

def alias
  @alias
end

#filterObject

Returns the value of attribute filter.



3
4
5
# File 'lib/filterparams/obj/parameter.rb', line 3

def filter
  @filter
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/filterparams/obj/parameter.rb', line 3

def name
  @name
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/filterparams/obj/parameter.rb', line 3

def value
  @value
end

Instance Method Details

#equal?(other) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
26
# File 'lib/filterparams/obj/parameter.rb', line 20

def equal?(other)
  if other.is_a? Parameter
    name == other.name && self.alias == other.alias
  else
    false
  end
end

#identificationObject



12
13
14
15
16
17
18
# File 'lib/filterparams/obj/parameter.rb', line 12

def identification
  if self.alias.nil?
    name
  else
    self.alias
  end
end