jreport 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4477c77b82b085035148ada4786c0940e0f3dd57
4
- data.tar.gz: 5676630c7eeb0faafd5ea398dd7b189ba3a0eafa
3
+ metadata.gz: e293697755777e04f70ac01bd27348ff8b092f7a
4
+ data.tar.gz: 09f4025c4c023553c432cec19ab806d4744ad2ca
5
5
  SHA512:
6
- metadata.gz: 7ef6b600e35520f66781c720afe3ada873d2763eea951ecf90ff30f8514d31356e997dbd51162d55dd95d8d86f76a202191ce4810496922bf726b3e8da553869
7
- data.tar.gz: 2710d3b107057a326f8265c7ca07d9011bc1e87ae7256e5eb209e8dbfe6ce9849791e3e48e90df7705f89915f99ee092fb3ffd2f7e3243281b78e76eea4b69d9
6
+ metadata.gz: 89af7c17a2cd543575794380bd60dfe8c17d53a9aff5d09d4ac060fb1603c57d2360aec1bb0deeb99295536ab175a0cbf6986474d32c44650982e39b09b83b0c
7
+ data.tar.gz: 009c76248309b3b0ee9341652b934f54479c88746d21fe6f1af7f2d10ca3683e1f315fb43b720204a03fd9b29da6137f69a0697bc01d08ef29968a13a1576a20
data/README.md CHANGED
@@ -102,6 +102,20 @@ This is a simple weekly report template:
102
102
  <%= data %>
103
103
 
104
104
  Note: in the template you can use helper method that is defined in helpers folder. You can access the active record classes, too.
105
+
106
+ For example. If you have a file `number_helper.rb` in helper folder:
107
+
108
+ module NumberHelper
109
+ def pretty_number(num)
110
+ num,result=num.to_s,''
111
+ num.reverse.split('').each_with_index{|v,i| result<<v;result<<',' if (i+1)%3==0}
112
+ result=result[0..-2] if result[-1]==','
113
+ result.reverse
114
+ end
115
+ end
116
+
117
+ Then you can use the helper method `pretty_number` directory in views as: `<%= pretty_number 1234345 %>`
118
+
105
119
  ### Gnerate report
106
120
 
107
121
  jreport make weather
@@ -124,6 +138,11 @@ P.S. See all available rake command:
124
138
 
125
139
  rake -T
126
140
 
141
+ Besides, you can access database directly in `irb`:
142
+
143
+ require './boot.rb'
144
+
145
+
127
146
  ### Mail configuration example(from [mail](https://github.com/mikel/mail))
128
147
 
129
148
  1. Change default delivery method
@@ -33,7 +33,11 @@ module Jreport
33
33
  html=render_html(dir,m.to_s,:data=>ctrl.data)
34
34
  File.open(ctrl.save_to,'w'){|fi| fi.write(html) } if ctrl.save_to
35
35
  # send out report
36
- mail.body=html
36
+ if mail.html_part
37
+ mail.html_part.body=html
38
+ else
39
+ mail.body=html
40
+ end
37
41
  send_mail(mail)
38
42
  rescue=>e
39
43
  puts e
@@ -1,3 +1,3 @@
1
1
  module Jreport
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jreport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - qjpcpu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-07 00:00:00.000000000 Z
11
+ date: 2014-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler