jaysus 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG +1 -0
  2. data/VERSION +1 -1
  3. data/jaysus.gemspec +1 -1
  4. data/lib/jaysus/base.rb +12 -0
  5. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
1
  Tues, Jan 25, 2011
2
2
  - - - - - - - - -
3
+ - Only include methods in to_json if they're set
3
4
  - Add support for modules within modules
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jaysus}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Campbell"]
@@ -170,6 +170,18 @@ module Jaysus
170
170
  "#{send(self.class.model_base.primary_key)}"
171
171
  end
172
172
 
173
+ def to_json
174
+ {}.tap do |outer_hash|
175
+ outer_hash[self.class.store_file_dir_name.singularize] = {}.tap do |inner_hash|
176
+ self.class.model_base.attributes.each do |attribute|
177
+ if self.send(attribute).present?
178
+ inner_hash[attribute] = self.send(attribute)
179
+ end
180
+ end
181
+ end
182
+ end.to_json
183
+ end
184
+
173
185
  def persisted?
174
186
  store_file.exist?
175
187
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jaysus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Campbell