yard-sequel 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 073ce59843dbdb8f357321e2deabfa0b201c064d
4
- data.tar.gz: 1797e658e7baa1ef8fa21aa58bac9f45c9ec2958
2
+ SHA256:
3
+ metadata.gz: 9284ee1351b6a7f96efc170c14aef164245d849790b08ace886b7e94a86c305f
4
+ data.tar.gz: 5c3d39bd376f18edf52a20b4d5e729a0c52ced190435161b5a6cf6fb37dce4ad
5
5
  SHA512:
6
- metadata.gz: a29270319e1ed42d99f0d90658a525b704568831f59d35ed70a10b551e45db5f497294b7e073b0c45c1dc3c360d4d9dd30e2da9529dd576c55ec151d5cd8b2ef
7
- data.tar.gz: 5543778bc9c3d94c1f1aace225bd0707cf40e6661a8b76ca209e7109e8c6620046b4ed4917c11abd345797d3ba3d9691607dcdbf6ec39dd89ea588171d7969f2
6
+ metadata.gz: 846c464a14c21f7f0c415961f6ced942deb2247143a20675a8b22dd7cde9becb2ed017e7d438f538ccb6a098139695cc1fadf96fae608084c0780a9d1bc3bcc8
7
+ data.tar.gz: 95a2d3e008efc2c0f6b4839465b70eaae1fc10de39cdefac228236ab3a62ebf61773314f381b3570d530a9830a45c773fc51b797cc0eb0ace075ef252ef91e58
@@ -1,20 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sequel'
2
4
  require 'yard'
3
5
 
4
6
  Sequel.extension :inflector
5
7
 
6
- # The YARD base module
7
- module YARD
8
- # The YARD handlers module
9
- module Handlers
10
- # The module for YARD ruby handlers
11
- module Ruby
12
- # Module for documenting Sequel code.
13
- # @author Kai Moschcau
14
- module Sequel
15
- end
16
- end
17
- end
18
- end
8
+ # Module for documenting Sequel code.
9
+ # @author Kai Moschcau
10
+ module YardSequel; end
19
11
 
20
12
  require_relative 'yard-sequel/associations'
13
+ require_relative 'yard-sequel/ast_node_hash'
@@ -1,18 +1,13 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- # Module for documention Sequel associations.
6
- # @author Kai Moschcau
7
- module Associations
8
- end
9
- end
10
- end
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ module YardSequel
4
+ # Module for documentation Sequel associations.
5
+ # @author Kai Moschcau
6
+ module Associations; end
12
7
  end
13
8
 
14
9
  require_relative 'associations/association_handler'
15
- require_relative 'associations/mixins'
10
+ require_relative 'associations/modules'
16
11
 
17
12
  require_relative 'associations/many_to_one_handler'
18
13
  require_relative 'associations/one_to_many_handler'
@@ -1,100 +1,87 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- module Associations
6
- # The basic method handler class for Sequel associations.
7
- # @author Kai Moschcau
8
- class AssociationHandler < YARD::Handlers::Ruby::MethodHandler
9
- protected
1
+ # frozen_string_literal: true
10
2
 
11
- # Adds a parameter tag to a method object.
12
- # @param [YARD::CodeObjects::MethodObject] method
13
- # The method to add the parameter tag to.
14
- # @param [String] name The name of the parameter.
15
- # @param [String] class_name The class name of the parameter.
16
- # @param [String] description The description of the parameter.
17
- # @return [void]
18
- def add_param_tag(method, name, class_name, description)
19
- method.parameters << [name, nil]
20
- method.docstring.add_tag(
21
- YARD::Tags::Tag.new(
22
- :param,
23
- description,
24
- class_name,
25
- name
26
- )
27
- )
28
- end
3
+ module YardSequel
4
+ module Associations
5
+ # The basic DSL handler class for Sequel associations.
6
+ # @author Kai Moschcau
7
+ class AssociationHandler < YARD::Handlers::Ruby::DSLHandler
8
+ def process
9
+ log.debug { "#{self.class.name}#process call" }
10
+ end
11
+
12
+ protected
13
+
14
+ # Adds a parameter tag to a method object.
15
+ # @param [YARD::CodeObjects::MethodObject] method
16
+ # The method to add the parameter tag to.
17
+ # @param [String] name The name of the parameter.
18
+ # @param [String] class_name The class name of the parameter.
19
+ # @param [String] description The description of the parameter.
20
+ # @return [void]
21
+ def add_param_tag(method, name, class_name, description)
22
+ method.parameters << [name, nil]
23
+ method.docstring.add_tag(
24
+ YARD::Tags::Tag.new(:param, description, class_name, name)
25
+ )
26
+ end
27
+
28
+ # @return [String] the name of the association
29
+ def association_name
30
+ @statement.parameters.first.jump(:ident).source
31
+ end
29
32
 
30
- # @return [String] the name of the association
31
- def association_name
32
- @statement.parameters.first.jump(:ident).source
33
- end
33
+ # @return [Array<YARD::Parser::Ruby::AstNode>] the association nodes
34
+ # of the options Hash.
35
+ def association_options
36
+ @statement.parameters[1].filter { |node| node.type == :assoc }
37
+ end
34
38
 
35
- # @param [String] name The name of the method object.
36
- # @return [YARD::CodeObjects::MethodObject] a method object.
37
- def create_method_object(name)
38
- method = YARD::CodeObjects::MethodObject.new(
39
- namespace,
40
- name
41
- )
42
- register_and_tag(method)
43
- method
44
- end
39
+ # @param [String] name The name of the method object.
40
+ # @return [YARD::CodeObjects::MethodObject] a method object.
41
+ def create_method_object(name)
42
+ method = YARD::CodeObjects::MethodObject.new(namespace, name)
43
+ register_and_tag method
44
+ method
45
+ end
45
46
 
46
- # Sets or replaces the return tag on a passed method object.
47
- # @param (see #void_return_tag)
48
- # @param [String] class_name The class name of the return value.
49
- # @param [String] description The description of the return value.
50
- # @return (see #void_return_tag)
51
- def return_tag(method, class_name, description)
52
- method.docstring.delete_tags(:return)
53
- method.docstring.add_tag(
54
- YARD::Tags::Tag.new(
55
- :return,
56
- description,
57
- class_name
58
- )
59
- )
60
- end
47
+ # Sets or replaces the return tag on a passed method object.
48
+ # @param (see #void_return_tag)
49
+ # @param [String] class_name The class name of the return value.
50
+ # @param [String] description The description of the return value.
51
+ # @return (see #void_return_tag)
52
+ def return_tag(method, class_name, description)
53
+ method.docstring.delete_tags(:return)
54
+ method.docstring.add_tag(
55
+ YARD::Tags::Tag.new(:return, description, class_name)
56
+ )
57
+ end
61
58
 
62
- # Sets or replaces the return tag on a passed method object with a
63
- # void return tag.
64
- # @param [YARD::CodeObjects::MethodObject] method
65
- # The method object to set the return tag on.
66
- # @return [void]
67
- def void_return_tag(method)
68
- method.docstring.delete_tags(:return)
69
- method.docstring.add_tag(
70
- YARD::Tags::Tag.new(
71
- :return,
72
- nil,
73
- 'void'
74
- )
75
- )
76
- end
59
+ # Sets or replaces the return tag on a passed method object with a
60
+ # void return tag.
61
+ # @param [YARD::CodeObjects::MethodObject] method
62
+ # The method object to set the return tag on.
63
+ # @return [void]
64
+ def void_return_tag(method)
65
+ method.docstring.delete_tags(:return)
66
+ method.docstring.add_tag(
67
+ YARD::Tags::Tag.new(:return, nil, 'void')
68
+ )
69
+ end
77
70
 
78
- private
71
+ private
79
72
 
80
- # Registers the source of a given method object and sets some tags.
81
- # @param [YARD::CodeObjects::MethodObject] method
82
- # The method object to register and tag.
83
- # @return [void]
84
- def register_and_tag(method)
85
- unless method.is_a? YARD::CodeObjects::MethodObject
86
- raise(
87
- ArgumentError,
88
- 'The given method has to be a '\
89
- "#{YARD::CodeObjects::MethodObject}"
90
- )
91
- end
92
- register(method)
93
- method.dynamic = true
94
- method[:sequel] = :association
95
- end
96
- end
73
+ # Registers the source of a given method object and sets some tags.
74
+ # @param [YARD::CodeObjects::MethodObject] method
75
+ # The method object to register and tag.
76
+ # @return [void]
77
+ def register_and_tag(method)
78
+ unless method.is_a? YARD::CodeObjects::MethodObject
79
+ raise(ArgumentError, 'The given method has to be a ' +
80
+ YARD::CodeObjects::MethodObject.to_s)
97
81
  end
82
+ register method
83
+ method.dynamic = true
84
+ method[:sequel] = :association
98
85
  end
99
86
  end
100
87
  end
@@ -1,25 +1,19 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- module Associations
6
- # The handler class for Sequel many_to_one associations.
7
- # @author Kai Moschcau
8
- class ManyToOneHandler < AssociationHandler
9
- include YARD::Handlers::Ruby::Sequel::Associations::DatasetMethod
10
- include YARD::Handlers::Ruby::Sequel::Associations::ToOneMethods
1
+ # frozen_string_literal: true
11
2
 
12
- handles method_call(:many_to_one)
13
- namespace_only
14
-
15
- process do
16
- create_to_one_getter
17
- create_to_one_setter
18
-
19
- create_dataset_method
20
- end
21
- end
22
- end
3
+ module YardSequel
4
+ module Associations
5
+ # The handler class for Sequel many_to_one associations.
6
+ # @author Kai Moschcau
7
+ class ManyToOneHandler < YardSequel::Associations::AssociationHandler
8
+ include YardSequel::Associations::DatasetMethod
9
+ include YardSequel::Associations::ToOneMethods
10
+ handles method_call(:many_to_one)
11
+ namespace_only
12
+ def process
13
+ super
14
+ create_to_one_getter
15
+ create_to_one_setter
16
+ create_dataset_method
23
17
  end
24
18
  end
25
19
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'modules/dataset_method'
4
+ require_relative 'modules/to_many_methods'
5
+ require_relative 'modules/to_one_methods'
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YardSequel
4
+ module Associations
5
+ # Provides methods for creating the dataset method object.
6
+ # @author Kai Moschcau
7
+ module DatasetMethod
8
+ # @return [YARD::CodeObjects::MethodObject] the dataset method
9
+ # object.
10
+ def create_dataset_method
11
+ method = create_method_object("#{association_name}_dataset")
12
+ return_tag(method, 'Sequel::Dataset', 'the association\'s'\
13
+ 'dataset.')
14
+ method
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YardSequel
4
+ module Associations
5
+ # Provides methods for creating the to_many method objects.
6
+ # @author Kai Moschcau
7
+ module ToManyMethods
8
+ # @return [YARD::CodeObjects::MethodObject] the to_many adder method
9
+ # object.
10
+ def create_to_many_adder
11
+ name = association_name
12
+ method = create_method_object "add_#{name.singularize}"
13
+ method.docstring += "Associates the passed #{name.classify} "\
14
+ 'with `self`.'
15
+ add_param_tag(method, name.singularize, name.classify,
16
+ "The #{name.classify} to associate with `self`.")
17
+ return_tag(method, name.classify,
18
+ "the associated #{name.classify}.")
19
+ method
20
+ end
21
+
22
+ # @return [YARD::CodeObjects::MethodObject] the to_many clearer
23
+ # method object.
24
+ def create_to_many_clearer
25
+ name = association_name
26
+ method = create_method_object "remove_all_#{name}"
27
+ method.docstring += 'Removes the association of all '\
28
+ "#{name.classify.pluralize} with `self`."
29
+ void_return_tag method
30
+ method
31
+ end
32
+
33
+ # @return [YARD::CodeObjects::MethodObject] the to_many getter
34
+ # method object.
35
+ def create_to_many_getter
36
+ name = association_name
37
+ method = create_method_object name
38
+ return_tag(method, "Array<#{name.classify}>",
39
+ "the associated #{name.classify.pluralize}.")
40
+ method
41
+ end
42
+
43
+ # @return [YARD::CodeObjects::MethodObject] the to_many remover
44
+ # method object.
45
+ def create_to_many_remover
46
+ name = association_name
47
+ method = create_method_object "remove_#{name.singularize}"
48
+ method.docstring += 'Removes the association of the passed '\
49
+ "#{name.classify} with `self`."
50
+ add_param_tag(method, name.singularize, name.classify,
51
+ "The #{name.classify} to remove the association "\
52
+ 'with `self` from.')
53
+ void_return_tag method
54
+ method
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YardSequel
4
+ module Associations
5
+ # Provides methods for creating the to_one method objects.
6
+ # @author Kai Moschcau
7
+ module ToOneMethods
8
+ # @return [YARD::CodeObjects::MethodObject] the to_one getter method
9
+ # object.
10
+ def create_to_one_getter
11
+ name = association_name
12
+ method = create_method_object name
13
+ return_tag(method, name.classify,
14
+ "the associated #{name.classify}.")
15
+ method
16
+ end
17
+
18
+ # @return [YARD::CodeObjects::MethodObject] the to_one setter method
19
+ # object.
20
+ def create_to_one_setter
21
+ name = association_name
22
+ method = create_method_object "#{name}="
23
+ method.docstring += "Associates the passed #{name.classify} "\
24
+ 'with `self`.'
25
+ add_param_tag(method, name, name.classify,
26
+ "The #{name.classify} to associate with `self`.")
27
+ return_tag(method, name.classify,
28
+ "the associated #{name.classify}.")
29
+ method
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,27 +1,21 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- module Associations
6
- # The handler class for Sequel one_to_many associations.
7
- # @author Kai Moschcau
8
- class OneToManyHandler < AssociationHandler
9
- include YARD::Handlers::Ruby::Sequel::Associations::DatasetMethod
10
- include YARD::Handlers::Ruby::Sequel::Associations::ToManyMethods
1
+ # frozen_string_literal: true
11
2
 
12
- handles method_call(:one_to_many)
13
- namespace_only
14
-
15
- process do
16
- create_to_many_adder
17
- create_to_many_clearer
18
- create_to_many_getter
19
- create_to_many_remover
20
-
21
- create_dataset_method
22
- end
23
- end
24
- end
3
+ module YardSequel
4
+ module Associations
5
+ # The handler class for Sequel one_to_many associations.
6
+ # @author Kai Moschcau
7
+ class OneToManyHandler < YardSequel::Associations::AssociationHandler
8
+ include YardSequel::Associations::DatasetMethod
9
+ include YardSequel::Associations::ToManyMethods
10
+ handles method_call(:one_to_many)
11
+ namespace_only
12
+ def process
13
+ super
14
+ create_to_many_adder
15
+ create_to_many_clearer
16
+ create_to_many_getter
17
+ create_to_many_remover
18
+ create_dataset_method
25
19
  end
26
20
  end
27
21
  end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YardSequel
4
+ # Offers methods to convert an Abstract Syntax Tree to a Hash consisting
5
+ # of `YARD::Parser::Ruby::AstNode`s.
6
+ # @author Kai Moschcau
7
+ module AstNodeHash
8
+ class << self
9
+ def from_ast(ast)
10
+ check_ast ast
11
+ node_hash_from_node ast
12
+ end
13
+
14
+ def check_ast(ast)
15
+ check_is_ast_node ast
16
+ check_is_hash_or_list ast
17
+ case ast.type
18
+ when :hash then check_hash_children ast
19
+ when :list then check_list_children ast
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def check_assoc_child_has_two_children(child_ast)
26
+ return if child_ast.children.size == 2
27
+
28
+ raise(ArgumentError, 'each `:assoc` child must have two children')
29
+ end
30
+
31
+ def check_children(ast)
32
+ check_has_only_assoc_children ast
33
+ ast.children.each do |child_ast|
34
+ check_assoc_child_has_two_children child_ast
35
+ end
36
+ end
37
+
38
+ def check_has_only_assoc_children(ast)
39
+ return unless ast.children.any? { |child| child.type != :assoc }
40
+
41
+ raise(ArgumentError,
42
+ 'all children of the passed `ast` have to have the type `:assoc`')
43
+ end
44
+
45
+ def check_hash_children(ast)
46
+ return if ast.children.empty?
47
+
48
+ check_children ast
49
+ end
50
+
51
+ def check_is_ast_node(ast)
52
+ return if ast.is_a? YARD::Parser::Ruby::AstNode
53
+
54
+ raise(TypeError,
55
+ 'the passed `ast` has to be a `YARD::Parser::Ruby::AstNode`')
56
+ end
57
+
58
+ def check_is_hash_or_list(ast)
59
+ return if %i[hash list].include? ast.type
60
+
61
+ raise(ArgumentError,
62
+ "the passed `ast`'s type has to be `:hash` or `:list`")
63
+ end
64
+
65
+ def check_list_children(ast)
66
+ if ast.children.empty?
67
+ raise(ArgumentError,
68
+ 'a passed `ast` of type `:list` has to have children')
69
+ end
70
+ check_children ast
71
+ end
72
+
73
+ def node_hash_from_node(ast)
74
+ hash = {}
75
+ ast.children.each { |cn| hash[cn.children[0]] = cn.children[1] }
76
+ hash
77
+ end
78
+ end
79
+ end
80
+ end
@@ -1,22 +1,18 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- # The major version number.
6
- # Used for changes that are not backwards compatible.
7
- V_MAJOR = 0
1
+ # frozen_string_literal: true
8
2
 
9
- # The minor version number.
10
- # Used for changes that are backwards compatible.
11
- V_MINOR = 1
3
+ module YardSequel
4
+ # The major version number.
5
+ # Used for changes that are not backwards compatible.
6
+ V_MAJOR = 0
12
7
 
13
- # The build version number.
14
- # Used for internal changes.
15
- V_BUILD = 0
8
+ # The minor version number.
9
+ # Used for changes that are backwards compatible.
10
+ V_MINOR = 1
16
11
 
17
- # The version of the Sequel models.
18
- VERSION = Gem::Version.new("#{V_MAJOR}.#{V_MINOR}.#{V_BUILD}")
19
- end
20
- end
21
- end
12
+ # The build version number.
13
+ # Used for internal changes.
14
+ V_BUILD = 1
15
+
16
+ # The version of the Sequel models.
17
+ VERSION = Gem::Version.new("#{V_MAJOR}.#{V_MINOR}.#{V_BUILD}")
22
18
  end
metadata CHANGED
@@ -1,85 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kai Moschcau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-29 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: awesome_print
14
+ name: coveralls
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: guard-ctags-bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.13'
33
+ version: '0'
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
- version: '1.13'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: byebug
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '9.0'
47
+ version: '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
- version: '9.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '11.3'
61
+ version: '0'
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
- version: '11.3'
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: sequel
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ - - "<"
74
91
  - !ruby/object:Gem::Version
75
- version: '4.41'
92
+ version: '6'
76
93
  type: :runtime
77
94
  prerelease: false
78
95
  version_requirements: !ruby/object:Gem::Requirement
79
96
  requirements:
80
- - - "~>"
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '4.0'
100
+ - - "<"
81
101
  - !ruby/object:Gem::Version
82
- version: '4.41'
102
+ version: '6'
83
103
  - !ruby/object:Gem::Dependency
84
104
  name: yard
85
105
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +114,7 @@ dependencies:
94
114
  - - "~>"
95
115
  - !ruby/object:Gem::Version
96
116
  version: '0.9'
97
- description: This gem provides automatic YARD documentation for theSequel Gem.
117
+ description: This gem provides automatic YARD documentation for the Sequel Gem.
98
118
  email: kai.moschcau@gmail.com
99
119
  executables: []
100
120
  extensions: []
@@ -105,13 +125,14 @@ files:
105
125
  - lib/yard-sequel/associations.rb
106
126
  - lib/yard-sequel/associations/association_handler.rb
107
127
  - lib/yard-sequel/associations/many_to_one_handler.rb
108
- - lib/yard-sequel/associations/mixins.rb
109
- - lib/yard-sequel/associations/mixins/dataset_method.rb
110
- - lib/yard-sequel/associations/mixins/to_many_methods.rb
111
- - lib/yard-sequel/associations/mixins/to_one_methods.rb
128
+ - lib/yard-sequel/associations/modules.rb
129
+ - lib/yard-sequel/associations/modules/dataset_method.rb
130
+ - lib/yard-sequel/associations/modules/to_many_methods.rb
131
+ - lib/yard-sequel/associations/modules/to_one_methods.rb
112
132
  - lib/yard-sequel/associations/one_to_many_handler.rb
133
+ - lib/yard-sequel/ast_node_hash.rb
113
134
  - lib/yard-sequel/version.rb
114
- homepage:
135
+ homepage: https://github.com/kmoschcau/yard-sequel
115
136
  licenses:
116
137
  - MIT
117
138
  metadata: {}
@@ -121,17 +142,17 @@ require_paths:
121
142
  - lib
122
143
  required_ruby_version: !ruby/object:Gem::Requirement
123
144
  requirements:
124
- - - "~>"
145
+ - - ">="
125
146
  - !ruby/object:Gem::Version
126
- version: '2.3'
147
+ version: '0'
127
148
  required_rubygems_version: !ruby/object:Gem::Requirement
128
149
  requirements:
129
- - - "~>"
150
+ - - ">="
130
151
  - !ruby/object:Gem::Version
131
- version: '2.0'
152
+ version: '0'
132
153
  requirements: []
133
154
  rubyforge_project:
134
- rubygems_version: 2.5.1
155
+ rubygems_version: 2.7.6
135
156
  signing_key:
136
157
  specification_version: 4
137
158
  summary: Provides automatic YARD documentation for Sequel Gem
@@ -1,3 +0,0 @@
1
- require_relative 'mixins/dataset_method'
2
- require_relative 'mixins/to_many_methods'
3
- require_relative 'mixins/to_one_methods'
@@ -1,25 +0,0 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- module Associations
6
- # Provides methods for creating the dataset method object.
7
- # @author Kai Moschcau
8
- module DatasetMethod
9
- # @return [YARD::CodeObjects::MethodObject] the dataset method
10
- # object.
11
- def create_dataset_method
12
- method = create_method_object("#{association_name}_dataset")
13
- return_tag(
14
- method,
15
- 'Sequel::Dataset',
16
- 'the association\'s dataset.'
17
- )
18
- method
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,78 +0,0 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- module Associations
6
- # Provides methods for creating the to_many method objects.
7
- # @author Kai Moschcau
8
- module ToManyMethods
9
- # @return [YARD::CodeObjects::MethodObject] the to_many adder method
10
- # object.
11
- def create_to_many_adder
12
- name = association_name
13
- method = create_method_object("add_#{name.singularize}")
14
- method.docstring += "Associates the passed #{name.classify} "\
15
- 'with `self`.'
16
- add_param_tag(
17
- method,
18
- name.singularize,
19
- name.classify,
20
- "The #{name.classify} to associate with `self`."
21
- )
22
- return_tag(
23
- method,
24
- name.classify,
25
- "the associated #{name.classify}."
26
- )
27
- method
28
- end
29
-
30
- # @return [YARD::CodeObjects::MethodObject] the to_many clearer
31
- # method object.
32
- def create_to_many_clearer
33
- name = association_name
34
- method = create_method_object("remove_all_#{name}")
35
- method.docstring += 'Removes the association of all '\
36
- "#{name.classify.pluralize} with `self`."
37
- void_return_tag(method)
38
- method
39
- end
40
-
41
- # @return [YARD::CodeObjects::MethodObject] the to_many getter
42
- # method object.
43
- def create_to_many_getter
44
- name = association_name
45
- method = create_method_object(name)
46
- return_tag(
47
- method,
48
- "Array<#{name.classify}>",
49
- "the associated #{name.classify.pluralize}."
50
- )
51
- method
52
- end
53
-
54
- # @return [YARD::CodeObjects::MethodObject] the to_many remover
55
- # method object.
56
- def create_to_many_remover
57
- name = association_name
58
- method = create_method_object(
59
- "remove_#{name.singularize}"
60
- )
61
- method.docstring += 'Removes the association of the passed '\
62
- "#{name.classify} with `self`."
63
- add_param_tag(
64
- method,
65
- name.singularize,
66
- name.classify,
67
- "The #{name.classify} to remove the association with `self` "\
68
- 'from.'
69
- )
70
- void_return_tag(method)
71
- method
72
- end
73
- end
74
- end
75
- end
76
- end
77
- end
78
- end
@@ -1,47 +0,0 @@
1
- module YARD
2
- module Handlers
3
- module Ruby
4
- module Sequel
5
- module Associations
6
- # Provides methods for creating the to_one method objects.
7
- # @author Kai Moschcau
8
- module ToOneMethods
9
- # @return [YARD::CodeObjects::MethodObject] the to_one getter method
10
- # object.
11
- def create_to_one_getter
12
- name = association_name
13
- method = create_method_object(name)
14
- return_tag(
15
- method,
16
- name.classify,
17
- "the associated #{name.classify}."
18
- )
19
- method
20
- end
21
-
22
- # @return [YARD::CodeObjects::MethodObject] the to_one setter method
23
- # object.
24
- def create_to_one_setter
25
- name = association_name
26
- method = create_method_object("#{name}=")
27
- method.docstring += "Associates the passed #{name.classify} "\
28
- 'with `self`.'
29
- add_param_tag(
30
- method,
31
- name,
32
- name.classify,
33
- "The #{name.classify} to associate with `self`."
34
- )
35
- return_tag(
36
- method,
37
- name.classify,
38
- "the associated #{name.classify}."
39
- )
40
- method
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end