archon 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/archon.rb +1 -0
- data/lib/archon/factory_methods.rb +42 -0
- data/lib/archon/nodes.rb +1 -1
- data/lib/archon/nodes/{values_list.rb → values.rb} +4 -9
- data/lib/archon/version.rb +1 -1
- data/lib/archon/visitors.rb +1 -1
- data/lib/archon/visitors/{values_list.rb → values.rb} +2 -2
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe149a2fb497abd9c63109ee86c5e4a3fde1e5e
|
4
|
+
data.tar.gz: e96ebf7e9ef6fd78a57a0c85963413020b002ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ef60be5d52af5a5721f340fa39d1ee34afc63e8fe221305013cdbf2ed6f16e515cd96d4fec3d755ea164a2a8394a8b227af2eed45c656d720d5440b43e43e49
|
7
|
+
data.tar.gz: 12475dc15e270bbe0660211403aaf22d59d364b2f843aacbfa54f2aab1b7f36cf691d2cd5466d846860ad0b0cd650654f7c4ca254ac263030a21e475de62d6fb
|
data/lib/archon.rb
CHANGED
@@ -11,6 +11,7 @@ module Archon
|
|
11
11
|
autoload :InsertIntoSelect
|
12
12
|
autoload :PowerOverwhelming
|
13
13
|
autoload :Visitors
|
14
|
+
autoload :FactoryMethods
|
14
15
|
|
15
16
|
def self.method_missing(called_method_name, *arguments, &block)
|
16
17
|
# Call super to raise a method missing error if no class was loaded:
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Archon
|
2
|
+
module FactoryMethods
|
3
|
+
def sql_coalesce(*coalescees)
|
4
|
+
return Nodes::Coalesce.new(*coalescees)
|
5
|
+
end
|
6
|
+
|
7
|
+
def sql_populated_recordset(base, rows = [])
|
8
|
+
return Nodes::PopulatedRecordset.new base, rows
|
9
|
+
end
|
10
|
+
|
11
|
+
def sql_values expressions
|
12
|
+
return Nodes::Values.new expressions
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns a node that represents a `CAST([castable] AS [new_type])` sql fragment
|
16
|
+
def sql_cast_as(new_type, castable)
|
17
|
+
casting = Arel::Nodes::As.new castable, Arel::Nodes::SqlLiteral.new(new_type.to_s.upcase)
|
18
|
+
Arel::Nodes::NamedFunction.new 'CAST', [casting]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns a Insert Manager primed to insert the given 'select-ish' into the given 'table-ish'
|
22
|
+
def sql_insert_into_select(insertion_table, selection, options = {})
|
23
|
+
InsertIntoSelect.new insertion_table, selection, options
|
24
|
+
end
|
25
|
+
|
26
|
+
def sql_table(name)
|
27
|
+
Arel::Table.new name
|
28
|
+
end
|
29
|
+
|
30
|
+
def sql_quoted(quotable)
|
31
|
+
Arel::Nodes::Quoted.new quotable
|
32
|
+
end
|
33
|
+
|
34
|
+
def sql_literal(literable)
|
35
|
+
Arel::Nodes::SqlLiteral.new literable
|
36
|
+
end
|
37
|
+
|
38
|
+
def sql_as(left, right)
|
39
|
+
Arel::Nodes::As.new left, right
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/archon/nodes.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
module Archon
|
2
|
-
# Factory method
|
3
|
-
def self.values_list expressions
|
4
|
-
return Nodes::ValuesList.new expressions
|
5
|
-
end
|
6
|
-
|
7
2
|
module Nodes
|
8
|
-
class
|
3
|
+
class Values < Arel::Nodes::Binary
|
9
4
|
alias :expressions :left
|
10
5
|
alias :expressions= :left=
|
11
6
|
alias :columns :right
|
@@ -19,14 +14,14 @@ module Archon
|
|
19
14
|
|
20
15
|
# Only include the visitor module on the SQL vendors that support it:
|
21
16
|
Arel::Visitors::PostgreSQL.class_eval do
|
22
|
-
include Archon::Visitors::
|
17
|
+
include Archon::Visitors::Values
|
23
18
|
end
|
24
19
|
|
25
20
|
Arel::Visitors::Oracle.class_eval do
|
26
|
-
include Archon::Visitors::
|
21
|
+
include Archon::Visitors::Values
|
27
22
|
end
|
28
23
|
|
29
24
|
Arel::Visitors::Oracle12.class_eval do
|
30
|
-
include Archon::Visitors::
|
25
|
+
include Archon::Visitors::Values
|
31
26
|
end
|
32
27
|
end
|
data/lib/archon/version.rb
CHANGED
data/lib/archon/visitors.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Quintanilla
|
@@ -14,56 +14,56 @@ dependencies:
|
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.5'
|
69
69
|
description: A collection of methods and classes that unleash the power of the database
|
@@ -74,11 +74,11 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- .codeclimate.yml
|
78
|
-
- .gitignore
|
79
|
-
- .rspec
|
80
|
-
- .rubocop.yml
|
81
|
-
- .travis.yml
|
77
|
+
- ".codeclimate.yml"
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".rubocop.yml"
|
81
|
+
- ".travis.yml"
|
82
82
|
- CODE_OF_CONDUCT.md
|
83
83
|
- Gemfile
|
84
84
|
- LICENSE
|
@@ -90,15 +90,16 @@ files:
|
|
90
90
|
- dev.Dockerfile
|
91
91
|
- docker-compose.yml
|
92
92
|
- lib/archon.rb
|
93
|
+
- lib/archon/factory_methods.rb
|
93
94
|
- lib/archon/insert_into_select.rb
|
94
95
|
- lib/archon/nodes.rb
|
95
96
|
- lib/archon/nodes/coalesce.rb
|
96
97
|
- lib/archon/nodes/populated_recordset.rb
|
97
|
-
- lib/archon/nodes/
|
98
|
+
- lib/archon/nodes/values.rb
|
98
99
|
- lib/archon/power_overwhelming.rb
|
99
100
|
- lib/archon/version.rb
|
100
101
|
- lib/archon/visitors.rb
|
101
|
-
- lib/archon/visitors/
|
102
|
+
- lib/archon/visitors/values.rb
|
102
103
|
homepage: https://github.com/IcaliaLabs/archon-gem
|
103
104
|
licenses:
|
104
105
|
- MIT
|
@@ -109,17 +110,17 @@ require_paths:
|
|
109
110
|
- lib
|
110
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
112
|
requirements:
|
112
|
-
- -
|
113
|
+
- - ">="
|
113
114
|
- !ruby/object:Gem::Version
|
114
115
|
version: '0'
|
115
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
117
|
requirements:
|
117
|
-
- -
|
118
|
+
- - ">="
|
118
119
|
- !ruby/object:Gem::Version
|
119
120
|
version: '0'
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.6.11
|
123
124
|
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: 'ARchon: Summoning the powers of ActiveRecord and ARel to wreak havoc'
|