bitswitch 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -1,9 +1,23 @@
1
1
  # BitSwitch
2
2
 
3
- Bit switch is a simple bitswitch class which allows you to switch on differnt values for different bits.
4
- Usage could be for security, or settings, or more.
3
+ BitSwitch is a class which allows you to store boolean values on different bits in an integer. Think of a really long row of lightswitches. I'll help you out a bit.
5
4
 
6
- ## Contributing to bitswitch
5
+ ![Bit Switch](http://upload.wikimedia.org/wikipedia/commons/0/0d/DIP_switch_01_Pengo.jpg "Bit Switch")
6
+
7
+ But the general idea in programming is instead of saving multiple boolean values in your database, you can rather store everything in a single integer. Usage could be for security, various settings, etc...
8
+
9
+ ## Installing BitSwitch
10
+
11
+ You can install BitSwitch with [RubyGems](https://rubygems.org/gems/bitswitch).
12
+
13
+ `gem install bitswitch` or `gem 'bitswitch'`
14
+
15
+ ## Documentation for BitSwitch
16
+
17
+ Documentation for BitSwitch is available on the wiki.
18
+ https://github.com/KellyLSB/Bitswitch/wiki/How-to-use
19
+
20
+ ## Contributing to BitSwitch
7
21
 
8
22
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
9
23
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Bitswitch::VERSION
9
9
  gem.authors = ["Kelly Becker"]
10
10
  gem.email = ["kellylsbkr@gmail.com"]
11
- gem.description = "Bitswitch is a gem designed to make storing multiple true false values easier"
12
- gem.summary = "Soon..."
11
+ gem.description = "Have you ever wanted to store multiple true/false values in your database, but annoyed with how many fields your tables have, then BitSwitcher is good for you. By assigning a bit for each true/false you can store all your fields in one integer."
12
+ gem.summary = "Bitswitch lets you store multiple true/false values in an integer using boolean math."
13
13
  gem.homepage = "http://kellybecker.me"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -61,13 +61,19 @@ class BitSwitch
61
61
  @val = n
62
62
  end
63
63
 
64
- def labels=(hash = {}, reset = false)
64
+ def labels(hash = {}, reset = false)
65
65
 
66
66
  # If reset is false then merge the labels
67
- return @labels.merge(hash) unless reset
67
+ unless reset
68
+ @labels.merge!(hash)
69
+ return self
70
+ end
68
71
 
69
72
  # Set a whole new label hash
70
73
  @labels = hash
74
+
75
+ # Return self
76
+ return self
71
77
  end
72
78
 
73
79
  # Convert to integer
@@ -95,7 +101,7 @@ class BitSwitch
95
101
  end
96
102
 
97
103
  class Fixnum
98
- def to_switch
99
- BitSwitch.new(self)
104
+ def to_switch(labels = {})
105
+ BitSwitch.new(self, labels)
100
106
  end
101
107
  end
@@ -1,3 +1,3 @@
1
1
  module Bitswitch
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitswitch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,8 +11,10 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-09-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: Bitswitch is a gem designed to make storing multiple true false values
15
- easier
14
+ description: Have you ever wanted to store multiple true/false values in your database,
15
+ but annoyed with how many fields your tables have, then BitSwitcher is good for
16
+ you. By assigning a bit for each true/false you can store all your fields in one
17
+ integer.
16
18
  email:
17
19
  - kellylsbkr@gmail.com
18
20
  executables: []
@@ -50,5 +52,6 @@ rubyforge_project:
50
52
  rubygems_version: 1.8.24
51
53
  signing_key:
52
54
  specification_version: 3
53
- summary: Soon...
55
+ summary: Bitswitch lets you store multiple true/false values in an integer using boolean
56
+ math.
54
57
  test_files: []