freeskimer 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,17 +2,18 @@ module Freeskimer
2
2
  module ModelAdditions
3
3
  def freeskim(att, options)
4
4
 
5
- # Validates arguments
6
- raise "'to' attribitute is missing" unless options[:to]
5
+ # Validates arguments
6
+ raise "'to' attribitute is missing" unless options[:to]
7
7
 
8
- # Define get method
9
- send :define_method, att do
10
- tmp = JSON.parse(send(options[:to]).to_s) if send(options[:to])
11
- tmp[att.to_s] if tmp and tmp[att.to_s]
12
- end
8
+ # Define get method
9
+ send :define_method, att do
10
+ tmp = JSON.parse(send(options[:to]).to_s) if send(options[:to])
11
+ tmp[att.to_s] if tmp and tmp[att.to_s]
12
+ end
13
13
 
14
- # Define set method
14
+ # Define set method
15
15
  send :define_method, "#{att}=" do |value|
16
+ value = yield(value) if block_given?
16
17
  tmp = {}
17
18
  tmp = JSON.parse send options[:to] if send options[:to]
18
19
  tmp[att] = value
@@ -1,3 +1,3 @@
1
1
  module Freeskimer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freeskimer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-07 00:00:00.000000000 Z
12
+ date: 2013-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec