logstash-output-sumologic 1.1.9 → 1.3.1

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
  SHA256:
3
- metadata.gz: 38154784dc8755290fa30a990402a34ba11074c1a0718dbca8c77431f7f1d567
4
- data.tar.gz: 66ebfe180d5d6836da7a33d5b2310779d6c60a4aed44357fa72f7b9d13eb048a
3
+ metadata.gz: 596877e694163207291385444d3e10ced75cba12422d57b21503126395002f03
4
+ data.tar.gz: 157f6fc6262ef8990d44d597066bbbcde226e27dc3d48d332a29970d38bd962c
5
5
  SHA512:
6
- metadata.gz: 87778952988d6f3cf26bda8e8d889f8b06a378a063c96caa5ddcc9968c6bfd8d0315d0e7c0d65273b11acc5fed8111be2695bed0d168f8340df7e9ceccffc7ee
7
- data.tar.gz: badfe59cf7d84ce33602a35e16960a31e22c0e9af386b609c7d7e1d0d4aba3674181366545a92bf5f7065766f60b0045c374dcc2c66d97a66c2fe46c3e9ce25b
6
+ metadata.gz: 2da6958efa3878652965d1620206a3af61172e1f5ff3f369ed738a0346c0c14949cad1c5e36c4d889e8e3dd75373cf8a6f6f0d6be0c8800dfda14b6be855f74b
7
+ data.tar.gz: b6021badd961cbe617108676906a55e16beeaa169e9f1a3e8a0b1244508c8271e661f7df8c951b38b7132d61588631a00f9595573abf50de43d69ce4dbcb6693
@@ -1,5 +1,27 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.3.1 (2020-12-18)
4
+
5
+ - [#53](https://github.com/SumoLogic/logstash-output-sumologic/pull/53) Fix "undefined method `blank?'"
6
+ - [#52](https://github.com/SumoLogic/logstash-output-sumologic/pull/52) Fix logstash-plugin-http_client version conflict in Logstash 7
7
+
8
+ ## 1.3.0
9
+
10
+ - [#41](https://github.com/SumoLogic/logstash-output-sumologic/pull/41) Provide Docker image with Logstash 6.6 + output plugin on docker hub
11
+ - [#41](https://github.com/SumoLogic/logstash-output-sumologic/pull/41) Kubernetes support with Logstash beats to SumoLogic
12
+ - [#41](https://github.com/SumoLogic/logstash-output-sumologic/pull/41) CI improving
13
+ - [#36](https://github.com/SumoLogic/logstash-output-sumologic/pull/36) Update sender to send in batch.
14
+ - [#36](https://github.com/SumoLogic/logstash-output-sumologic/pull/36) Support %{} field evaluation in `source_category`, `source_name`, `source_host` parameters
15
+ - [#39](https://github.com/SumoLogic/logstash-output-sumologic/pull/39) Disable cookies by default
16
+
17
+ ## 1.2.2
18
+
19
+ - Bug fix: memory leak when using `%{@json}` in format
20
+
21
+ ## 1.2.1
22
+
23
+ - Bug fix on plug-in logging and samples
24
+
3
25
  ## 1.2.0
4
26
 
5
27
  - Support message piling with both `interval` and `pile_max`
@@ -13,4 +35,4 @@
13
35
 
14
36
  ## 1.0.0
15
37
 
16
- - Initial release
38
+ - Initial release
@@ -26,6 +26,15 @@ bin/logstash-plugin install <full path of .gem>
26
26
 
27
27
  ## How to run test with rspec
28
28
 
29
+ ### Running in Docker
30
+
31
+ ```bash
32
+ docker build -t logstash-output-plugin .
33
+ docker run --rm -it -e 'sumo_url=https://events.sumologic.net/receiver/v1/http/XXXXXXXXXX' logstash-output-plugin
34
+ ```
35
+
36
+ ### Running on bare metal
37
+
29
38
  The test requires JRuby to run. So you need to install [JRuby](http://jruby.org/), [bundle](https://bundler.io/bundle_install.html) and [RVM](https://rvm.io/) (for switching between JRuby and Ruby) first.
30
39
  And then run:
31
40
 
@@ -36,4 +45,5 @@ export sumo_url=https://events.sumologic.net/receiver/v1/http/XXXXXXXXXX
36
45
  rspec spec/
37
46
  ```
38
47
 
39
- The project is integrated to the Travis CI now. Make sure [all test passed](https://travis-ci.org/SumoLogic/logstash-output-sumologic) before creating PR
48
+ The project is integrated to Travis CI now.
49
+ Make sure [all test passed](https://travis-ci.com/SumoLogic/logstash-output-sumologic) before creating PR
data/LICENSE CHANGED
@@ -1,18 +1,196 @@
1
- Copyright (c) 2016 Sumo Logic <https://www.sumologic.com>
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
6
 
7
- http://www.apache.org/licenses/LICENSE-2.0
7
+ 1. Definitions.
8
8
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
14
11
 
15
- This product includes software developed by The Apache Software
16
- Foundation (http://www.apache.org/).
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
17
14
 
18
- This product includes software developed by Elasticsearch (http://www.elastic.co/).
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2018 Sumo Logic
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
191
+
192
+ This product includes software developed by The Apache Software
193
+ Foundation (http://www.apache.org/).
194
+
195
+ This product includes software developed by Elasticsearch
196
+ (http://www.elastic.co/).
data/README.md CHANGED
@@ -1,14 +1,10 @@
1
1
  # Logstash Sumo Logic Output Plugin
2
2
 
3
- [![Build Status](https://travis-ci.org/SumoLogic/logstash-output-sumologic.svg?branch=master)](https://travis-ci.org/SumoLogic/logstash-output-sumologic)
3
+ [![Build Status](https://travis-ci.org/SumoLogic/logstash-output-sumologic.svg?branch=master)](https://travis-ci.org/SumoLogic/logstash-output-sumologic) [![Gem Version](https://badge.fury.io/rb/logstash-output-sumologic.svg)](https://badge.fury.io/rb/logstash-output-sumologic) [![Docker Pulls](https://img.shields.io/docker/pulls/sumologic/logstash-output-sumologic.svg)](https://hub.docker.com/r/sumologic/logstash-output-sumologic)
4
4
 
5
5
  This is an output plugin for [Logstash](https://github.com/elastic/logstash).
6
6
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
7
7
 
8
- | TLS Deprecation Notice |
9
- | --- |
10
- | In keeping with industry standard security best practices, as of May 31, 2018, the Sumo Logic service will only support TLS version 1.2 going forward. Verify that all connections to Sumo Logic endpoints are made from software that supports TLS 1.2. |
11
-
12
8
  ## Getting Started
13
9
 
14
10
  This guide is for the users just want to download the binary and make the plugin work. For the developer, please refer to the [Developer Guide](DEVELOPER.md)
@@ -140,7 +136,7 @@ On the other side, this version is marked as thread safe so if necessary, multip
140
136
 
141
137
  ### Monitor throughput in metrics
142
138
 
143
- If your Sumo Logic account supporting metrics feature, you can enable the stats monitor of plugin with configuring `stats_enabled` to `true`. For every `stats_interval` seconds, a batch of metrics data points will be sent to Sumo Logic with source category `XXX.stats` (`XXX` is the source category of main output). Include:
139
+ If your Sumo Logic account supports metrics feature, you can enable the stats monitor of this plugin with configuring `stats_enabled` to `true`. For every `stats_interval` seconds, a batch of metrics data points will be sent to Sumo Logic with source category `XXX.stats` (`XXX` is the source category of main output):
144
140
 
145
141
  | Metric | Description |
146
142
  | ------------------------------- | ----------------------------------------------------------- |
@@ -153,3 +149,10 @@ If your Sumo Logic account supporting metrics feature, you can enable the stats
153
149
  | `total_output_bytes_compressed` | Total bytes of payloads sent to Sumo Logic server (after compressing)
154
150
  | `total_response_times` | Total number of responses acknowledged by Sumo Logic server
155
151
  | `total_response_success` | Total number of accepted(200) acknowledged by Sumo Logic server
152
+
153
+ **NOTE:** The data points will consume DPM quota
154
+
155
+
156
+ ### TLS 1.2 Requirement
157
+
158
+ Sumo Logic only accepts connections from clients using TLS version 1.2 or greater. To utilize the content of this repo, ensure that it's running in an execution environment that is configured to use TLS 1.2 or greater.
@@ -14,6 +14,7 @@ require "logstash/plugin_mixins/http_client"
14
14
  class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
15
15
  declare_threadsafe!
16
16
 
17
+ require "logstash/outputs/sumologic/batch"
17
18
  require "logstash/outputs/sumologic/common"
18
19
  require "logstash/outputs/sumologic/compressor"
19
20
  require "logstash/outputs/sumologic/header_builder"
@@ -110,13 +111,15 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
110
111
  # Sending throughput data points every (x) seconds
111
112
  config :stats_interval, :validate => :number, :default => 60
112
113
 
114
+ # Disable cookies by default (used in HTTP mixin)
115
+ config :cookies, :validate => :boolean, :default => false
116
+
113
117
  attr_reader :stats
114
118
 
115
119
  def register
116
120
  set_logger(@logger)
117
- @stats = Statistics.new()
121
+ @stats = Statistics.new
118
122
  @queue = MessageQueue.new(@stats, config)
119
- @builder = PayloadBuilder.new(@stats, config)
120
123
  @piler = Piler.new(@queue, @stats, config)
121
124
  @monitor = Monitor.new(@queue, @stats, config)
122
125
  @sender = Sender.new(client, @queue, @stats, config)
@@ -130,34 +133,18 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
130
133
  end # def register
131
134
 
132
135
  def multi_receive(events)
133
- # events.map { |e| receive(e) }
134
- begin
135
- content = Array(events).map { |event| @builder.build(event) }.join($/)
136
- @queue.enq(content)
137
- @stats.record_multi_input(events.size, content.bytesize)
138
- rescue Exception => exception
139
- log_err(
140
- "Error when processing events",
141
- :events => events,
142
- :message => exception.message,
143
- :class => exception.class.name,
144
- :backtrace => exception.backtrace
145
- )
146
- end
136
+ Array(events).map { |event| receive(event) }
147
137
  end # def multi_receive
148
138
 
149
139
  def receive(event)
150
140
  begin
151
- content = @builder.build(event)
152
- @piler.input(content)
141
+ @piler.input(event)
153
142
  rescue Exception => exception
154
- log_err(
155
- "Error when processing event",
143
+ log_err("error when processing event",
156
144
  :event => event,
157
145
  :message => exception.message,
158
146
  :class => exception.class.name,
159
- :backtrace => exception.backtrace
160
- )
147
+ :backtrace => exception.backtrace)
161
148
  end
162
149
  end # def receive
163
150
 
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ module LogStash; module Outputs; class SumoLogic;
4
+ class Batch
5
+
6
+ attr_accessor :headers, :payload
7
+
8
+ def initialize(headers, payload)
9
+ @headers, @payload = headers, payload
10
+ end
11
+
12
+ end
13
+ end; end; end;
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
- require "date"
3
-
4
2
  module LogStash; module Outputs; class SumoLogic;
5
3
  module Common
6
4
 
5
+ require "date"
6
+
7
7
  # global constants
8
8
  DEFAULT_LOG_FORMAT = "%{@timestamp} %{host} %{message}"
9
9
  METRICS_NAME_PLACEHOLDER = "*"
@@ -12,6 +12,22 @@ module LogStash; module Outputs; class SumoLogic;
12
12
  DEFLATE = "deflate"
13
13
  GZIP = "gzip"
14
14
  STATS_TAG = "STATS_TAG"
15
+ STOP_TAG = "PLUGIN STOPPED"
16
+
17
+ CONTENT_TYPE = "Content-Type"
18
+ CONTENT_TYPE_LOG = "text/plain"
19
+ CONTENT_TYPE_GRAPHITE = "application/vnd.sumologic.graphite"
20
+ CONTENT_TYPE_CARBON2 = "application/vnd.sumologic.carbon2"
21
+ CONTENT_ENCODING = "Content-Encoding"
22
+
23
+ CATEGORY_HEADER = "X-Sumo-Category"
24
+ CATEGORY_HEADER_DEFAULT = "Logstash"
25
+ HOST_HEADER = "X-Sumo-Host"
26
+ NAME_HEADER = "X-Sumo-Name"
27
+ NAME_HEADER_DEFAULT = "logstash-output-sumologic"
28
+
29
+ CLIENT_HEADER = "X-Sumo-Client"
30
+ CLIENT_HEADER_VALUE = "logstash-output-sumologic"
15
31
 
16
32
  # for debugging test
17
33
  LOG_TO_CONSOLE = false
@@ -25,7 +41,7 @@ module LogStash; module Outputs; class SumoLogic;
25
41
  if LOG_TO_CONSOLE
26
42
  puts "[INFO:#{DateTime::now}]#{message} #{opts.to_s}"
27
43
  else
28
- @@logger && @@logger.info(message, opts)
44
+ @@logger && @@logger.info(message, *opts)
29
45
  end
30
46
  end # def log_info
31
47
 
@@ -33,7 +49,7 @@ module LogStash; module Outputs; class SumoLogic;
33
49
  if LOG_TO_CONSOLE
34
50
  puts "\e[33m[WARN:#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
35
51
  else
36
- @@logger && @@logger.warn(message, opts)
52
+ @@logger && @@logger.warn(message, *opts)
37
53
  end
38
54
  end # def log_warn
39
55
 
@@ -41,7 +57,7 @@ module LogStash; module Outputs; class SumoLogic;
41
57
  if LOG_TO_CONSOLE
42
58
  puts "\e[31m[ERR :#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
43
59
  else
44
- @@logger && @@logger.error(message, opts)
60
+ @@logger && @@logger.error(message, *opts)
45
61
  end
46
62
  end # def log_err
47
63
 
@@ -49,9 +65,19 @@ module LogStash; module Outputs; class SumoLogic;
49
65
  if LOG_TO_CONSOLE
50
66
  puts "\e[36m[DBG :#{DateTime::now}]#{message} #{opts.to_s}\e[0m"
51
67
  else
52
- @@logger && @@logger.debug(message, opts)
68
+ @@logger && @@logger.debug(message, *opts)
53
69
  end
54
70
  end # def log_dbg
55
71
 
72
+ def blank?(value)
73
+ if value.kind_of?(NilClass)
74
+ true
75
+ elsif value.kind_of?(String)
76
+ value !~ /\S/
77
+ else
78
+ value.respond_to?(:empty?) ? value.empty? : !value
79
+ end
80
+ end
81
+
56
82
  end
57
- end; end; end
83
+ end; end; end