archon 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de9e479ea8d74dee6b772bcb7a3a13a279cab668
4
- data.tar.gz: d6cf560e818c6d4bcb14ea0530043244db791db3
3
+ metadata.gz: 1fe149a2fb497abd9c63109ee86c5e4a3fde1e5e
4
+ data.tar.gz: e96ebf7e9ef6fd78a57a0c85963413020b002ae9
5
5
  SHA512:
6
- metadata.gz: 80dedf0d2c4ae62537a3ecc94bcc621e6bcd2a07a67ed7d86a112edbcaaf1c8a4d5b711d79adc75d2bb0252bde874be4836cde408fa2f13ca8782a8e169a39d6
7
- data.tar.gz: 3b8823e62118f6e2338ab19deec2d7690bdd9cf7447241cf25e165c3893404306077b4f923cb10387a499f38bd32867210df1f618d925ce0a14670eb0890bbb5
6
+ metadata.gz: 4ef60be5d52af5a5721f340fa39d1ee34afc63e8fe221305013cdbf2ed6f16e515cd96d4fec3d755ea164a2a8394a8b227af2eed45c656d720d5440b43e43e49
7
+ data.tar.gz: 12475dc15e270bbe0660211403aaf22d59d364b2f843aacbfa54f2aab1b7f36cf691d2cd5466d846860ad0b0cd650654f7c4ca254ac263030a21e475de62d6fb
@@ -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
@@ -6,6 +6,6 @@ module Archon
6
6
 
7
7
  autoload :Coalesce
8
8
  autoload :PopulatedRecordset
9
- autoload :ValuesList
9
+ autoload :Values
10
10
  end
11
11
  end
@@ -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 ValuesList < Arel::Nodes::Binary
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::ValuesList
17
+ include Archon::Visitors::Values
23
18
  end
24
19
 
25
20
  Arel::Visitors::Oracle.class_eval do
26
- include Archon::Visitors::ValuesList
21
+ include Archon::Visitors::Values
27
22
  end
28
23
 
29
24
  Arel::Visitors::Oracle12.class_eval do
30
- include Archon::Visitors::ValuesList
25
+ include Archon::Visitors::Values
31
26
  end
32
27
  end
@@ -1,3 +1,3 @@
1
1
  module Archon
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -3,6 +3,6 @@ module Archon
3
3
  # A collection of ARel visitors to emit SQL for various SQL vendors
4
4
  module Visitors
5
5
  extend ActiveSupport::Autoload
6
- autoload :ValuesList
6
+ autoload :Values
7
7
  end
8
8
  end
@@ -1,9 +1,9 @@
1
1
  module Archon
2
2
  module Visitors
3
- module ValuesList
3
+ module Values
4
4
  private
5
5
 
6
- def visit_Archon_Nodes_ValuesList o, collector
6
+ def visit_Archon_Nodes_Values o, collector
7
7
  collector << 'VALUES '
8
8
 
9
9
  len_a = o.expressions.length - 1
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
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/values_list.rb
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/values_list.rb
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.0.14.1
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'