julia_builder 0.1.5 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 808abf3fd681906bfc3e92b9bd2e529ff48d10f9
4
- data.tar.gz: 1252a2784930125260636e9989b1f445567fd0ed
3
+ metadata.gz: 482da86a4a4e0cb9271af7fc984b12bb8435b3bb
4
+ data.tar.gz: 47c57742bbb02bb794a2d42da1028747ba6557d9
5
5
  SHA512:
6
- metadata.gz: 1b143da4a72d4a15a87a62d1ed40b1b5bf6a1bc71ccb43c390e3defa3053a1b71c5f23fa11644a389a29f985f8b485e174fc12c2b18441f2d0a0d39b75937898
7
- data.tar.gz: 1128c346625e9ba6da0e24e71aaeb46a024d2a29e6ae6fe91383030b9d4d256dbc816867af9289c004d39a4339e0654458f9ed9be3881961eeffe5c0e5de2bf5
6
+ metadata.gz: ad7ee4ca5bf85836258eefc0515ea5e94da6ac9d86a63f438f30986c4735c9b5b08fabb1b31dc83e7220dead7351fa4bf313b4ffafa8a6339b59d56663bdb46d
7
+ data.tar.gz: 489df6886bb07745c3926b1f075b3002220752f19dd74075ec63c08750d6f01d63b50e10b66589154ed22194bfb167127850dd44367a16ceabd4b1c4cbab1e64
@@ -1,5 +1,10 @@
1
1
  # Julia Builder changes
2
2
 
3
+ 0.2.0
4
+ -----
5
+
6
+ - Add the ability to include mixins. See https://github.com/stevenbarragan/julia_builder/issues/8
7
+
3
8
  0.1.5
4
9
  -----------
5
10
 
data/README.md CHANGED
@@ -52,6 +52,13 @@ require 'julia'
52
52
  column 'Type' do |user|
53
53
  user.class.name
54
54
  end
55
+
56
+ # include your own mixins
57
+ ActionView::Helpers::DateHelper
58
+
59
+ column 'age' do |c|
60
+ time_ago_in_words c.dob
61
+ end
55
62
  end
56
63
  ```
57
64
 
@@ -3,13 +3,13 @@ module Julia
3
3
  attr_reader :key, :action, :block
4
4
 
5
5
  def initialize(key, action = nil, &block)
6
- @key = key
7
6
  @action = action
8
7
  @block = block
8
+ @key = key
9
9
  end
10
10
 
11
- def get_value(record)
12
- return block.call(record) if block
11
+ def get_value(record, host)
12
+ return host.instance_exec(record, &block) if block
13
13
  return record.instance_exec(&action) if action.is_a? Proc
14
14
 
15
15
  record.send [action, key].compact.first
@@ -28,7 +28,7 @@ module Julia
28
28
 
29
29
  collection.each do |record|
30
30
  csv << columns_config.values.map do |action|
31
- action.get_value(record)
31
+ action.get_value(record, self)
32
32
  end
33
33
  end
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module Julia
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: julia_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Barragán
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-05 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler