xquery 0.1.3-java → 0.2.0-java

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: 33e6fdb5a289ea9dd885be6ecb0abe3ce0db6829
4
- data.tar.gz: d7759edc915b5c87dfe1ddbe92699e4fa4ba7f0a
3
+ metadata.gz: 7805222ef90fd9a6a76f3c4cd21783e438a026d0
4
+ data.tar.gz: c2bcff3ecf1a549f62a32cdfa9270aac3f4f03f7
5
5
  SHA512:
6
- metadata.gz: b6e8ad5cba36841f9eab41f4c1c4f5d21481296958ed44a6f69adbe54f010e74ac22f9d6fef5d9f64ac3f8b25f876035f305cf379526fdac252cbf37b5906b17
7
- data.tar.gz: ad988f2174be9ad81271da984ab14591ba6ad542421324cfb1cab68f556dfcba3232130ce0e86c6df248b7a03fc9f5090bcc3e54f35013d960e34020c0e3f30a
6
+ metadata.gz: b7fc897c36eec97a269b8502a9664a776347c1cdea2c5a64b429683fd87e0f7725927e456ba3eca4d53aadb6ba6319ccbda523c3a14cbd154d25d5a98ca6ef86
7
+ data.tar.gz: bb8e5ef86fc5cd94ce53415fe3c8fbd86263bed4e2363a754491619860a261de9bd399e1779dd6e136244567d7ddd2dabdcb60c6d62ccfb0b95751c24c916d88
@@ -4,11 +4,11 @@ require 'xquery/query_proxy'
4
4
  require 'xquery/errors'
5
5
 
6
6
  module XQuery
7
- # abstract superclass, should be inherited, not used
7
+ # Abstract superclass, should be inherited, not used
8
8
  class Abstract
9
9
  class_attribute :query_superclass
10
10
 
11
- # yields instance inside block. I suggest to name it `q`
11
+ # Yields instance inside block. I suggest to name it `q`
12
12
  # @param args [Array(Object)] array of arguments would be passed to
13
13
  # @param block [#to_proc] block to witch instance would be yielded
14
14
  def self.with(*args, &block)
@@ -17,10 +17,6 @@ module XQuery
17
17
  instance.query
18
18
  end
19
19
 
20
- class << self
21
- alias_method :execute, :with
22
- end
23
-
24
20
  # Defines `method`, `__method` and `q.method`.
25
21
  # Both of wich changes query to query.method
26
22
  # @param name [#to_sym] name of method on query
@@ -30,13 +26,13 @@ module XQuery
30
26
  alias_on_q(as, true)
31
27
  end
32
28
 
33
- # same as wrap_method, but hanldes multiply methods
29
+ # Aame as wrap_method, but hanldes multiply methods
34
30
  # @param methods [Array(#to_sym)] names of methods defined
35
31
  def self.wrap_methods(*methods)
36
32
  methods.each(&method(:wrap_method))
37
33
  end
38
34
 
39
- # Aliases method to __method and q.method
35
+ # Aliases method to `#__method` and `q.method`
40
36
  # @param name [#to_sym] name of method
41
37
  # @param return_self [Boolean] should defined method return self or result
42
38
  def self.alias_on_q(name, return_self = false)
@@ -68,7 +64,27 @@ module XQuery
68
64
  @query_proxy = self.class.query_proxy.new(self)
69
65
  end
70
66
 
71
- # yields query inside block
67
+ # Yields iteself inside block. I suggest to name it `q`
68
+ # @param block [#to_proc] block to whitch instance would be yielded
69
+ # @return [Object] query
70
+ def with(&block)
71
+ block.call(self)
72
+ query
73
+ end
74
+
75
+ # Executes specified method, returns query.
76
+ # Feel free to redefine this method in case it's only public api method
77
+ # in your class
78
+ # @param method [#to_sym] any instance public method name
79
+ # @param args [Array(Object)] method call params
80
+ # @param block [#to_proc] block would be sent to method
81
+ # @return [Object] query
82
+ def execute(method, *args, &block)
83
+ public_send(method, *args, &block)
84
+ query
85
+ end
86
+
87
+ # Yields query inside block
72
88
  # @param block [#to_proc]
73
89
  # @return [XQuery::Abstract] self
74
90
  def apply(&block)
@@ -78,14 +94,14 @@ module XQuery
78
94
 
79
95
  private
80
96
 
81
- # @private_api
82
- # updates query by calling method on it and storing the result
97
+ # Private Api!
98
+ # Updates query by calling method on it and storing the result
83
99
  # @return [XQuery::Abstract] self
84
100
  def _update_query(method, *args, &block)
85
101
  apply { |x| x.public_send(method, *args, &block) }
86
102
  end
87
103
 
88
- # added constraints check
104
+ # Added constraints check
89
105
  # @raise XQuery::QuerySuperclassChanged
90
106
  def query=(x)
91
107
  unless x.is_a?(query_superclass)
@@ -1,4 +1,4 @@
1
1
  module XQuery
2
2
  # defines XQuery version
3
- VERSION = '0.1.3'
3
+ VERSION = '0.2.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - jelf