Class: PGExaminer::Result::Function
- Inherits:
-
Item
- Object
- Base
- Item
- PGExaminer::Result::Function
show all
- Defined in:
- lib/pg_examiner/result/function.rb
Constant Summary
collapse
- EXCESS_WHITESPACE_REGEX =
/\s+/.freeze
Instance Attribute Summary
Attributes inherited from Item
#parent, #result, #row
Instance Method Summary
collapse
Methods inherited from Item
#initialize, #inspect, #name, #oid
Methods inherited from Base
#==, #diff, #diffable_lists
Instance Method Details
#argument_types ⇒ Object
30
31
32
33
34
|
# File 'lib/pg_examiner/result/function.rb', line 30
def argument_types
@argument_types ||= @row['proargtypes'].split.map do |oid|
result.pg_type.find{|t| t['oid'] == oid}['name']
end
end
|
#definition ⇒ Object
24
25
26
27
28
|
# File 'lib/pg_examiner/result/function.rb', line 24
def definition
s = @row['definition'].strip
s.gsub!(EXCESS_WHITESPACE_REGEX, ' ')
s
end
|
#diffable_attrs ⇒ Object
8
9
10
11
12
13
|
# File 'lib/pg_examiner/result/function.rb', line 8
def diffable_attrs
{
"name" => "name",
"proargmodes" => "argument modes",
}
end
|
#diffable_methods ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/pg_examiner/result/function.rb', line 15
def diffable_methods
{
"argument_types" => "argument types",
"return_type" => "return type",
"language" => "language",
"definition" => "function definition",
}
end
|
#language ⇒ Object
40
41
42
|
# File 'lib/pg_examiner/result/function.rb', line 40
def language
@language ||= result.pg_language.find{|l| l['oid'] == @row['prolang']}['name']
end
|
#return_type ⇒ Object
36
37
38
|
# File 'lib/pg_examiner/result/function.rb', line 36
def return_type
@return_type ||= result.pg_type.find{|t| t['oid'] == @row['prorettype']}['name']
end
|