Class: Reflect::Parameter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, op, value = nil) ⇒ Parameter



7
8
9
10
11
# File 'lib/reflect/parameter.rb', line 7

def initialize(field, op, value=nil)
  @field = field
  @op = op
  @value = value
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



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

def field
  @field
end

#opObject (readonly)

Returns the value of attribute op.



4
5
6
# File 'lib/reflect/parameter.rb', line 4

def op
  @op
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/reflect/parameter.rb', line 5

def value
  @value
end

Instance Method Details

#to_json(*a) ⇒ Object



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

def to_json(*a)
  h = { field: field, op: op }
  h[value.is_a?(Array) ? 'any' : 'value'] = value

  h.to_json(*a)
end