striptease 0.0.0
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 +7 -0
- data/lib/striptease.rb +30 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 27f0dc02915ee8c199dfd272525ad0b664fd5481
|
4
|
+
data.tar.gz: 2a542c131922c4e67bec086c3111f67f158a9e11
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee91169cd33174a63471fa6933e48ec255dc4ec53b138691da3424e229c1df76148d5ad0624cf88ce02de6b32300e40827ccf39e394f63993863a6a5921dfa39
|
7
|
+
data.tar.gz: 8afd0cd8f7eeac6921867add705d2c81733f40ab6b84c7d7da8dfb8b860cf981cdf78e147b44c91b58a74ce1bd4f1dee3ddb7c7a46006047e3731be696a7e392
|
data/lib/striptease.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Striptease
|
2
|
+
def self.extended(base)
|
3
|
+
base.class_eval do
|
4
|
+
class << self
|
5
|
+
attr_accessor :strippable_attributes
|
6
|
+
end
|
7
|
+
|
8
|
+
include InstanceMethods
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def strip_whitespace(*attributes)
|
13
|
+
self.strippable_attributes = attributes
|
14
|
+
before_validation :_strip_whitespace
|
15
|
+
end
|
16
|
+
|
17
|
+
module InstanceMethods
|
18
|
+
private
|
19
|
+
|
20
|
+
def _strip_whitespace
|
21
|
+
Array(self.class.strippable_attributes).each do |attribute|
|
22
|
+
public_send "#{attribute}=", public_send(attribute).try(:strip)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if defined?(ActiveRecord::Base)
|
29
|
+
ActiveRecord::Base.extend Striptease
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: striptease
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Uncommon Branch
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple library for stripping whitespace from model attributes
|
14
|
+
email: nick@uncommonbranch.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/striptease.rb
|
20
|
+
homepage: http://rubygems.org/gems/striptease
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.6.6
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Whitespace stripper dance party!
|
44
|
+
test_files: []
|