demeler 1.0.1 → 1.0.2

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: c0c386f96ecc1bd387757913d8c06df79c31a705
4
- data.tar.gz: bed41140c85456d8d829e8b9919bbc70b9a7d838
3
+ metadata.gz: acfebb387fbe7468614262a490e3a139cc473a93
4
+ data.tar.gz: ffc63a2408ee1fa55953579cd7a3a7a0b88c4ea2
5
5
  SHA512:
6
- metadata.gz: 5a75c02f4294c9da6b8fe6159c274c05a793c2ce2a31c90815f677723082b12d1117c0366543cc0fb08878442510d1d348af1520d3a344ec8aed1b53941109aa
7
- data.tar.gz: c6eff11ee04f5a3b2f95f5938b5ed3f3ade2de6b158141bb3ce79f7683b2b38a738888fb7264f92ebdee7d0ac01713ac08f88645b81dddcddc7970cb696e23ed
6
+ metadata.gz: 3faea11d3c64618169f3fa6f99d7adb928a2c0b1c454f8d26150adbca80c81cedcc5de25f580361efdc9318b8de8ea003d1e724e592e7e3c37995b73b9e3dd81
7
+ data.tar.gz: e3912710539a702240427b371c896f3f88fc9f778fd64713301faf2fe2223dca3fcbb4196a239da42bb58e9342e7880f6ba81ad1f6144734896ef2262b744b1d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
+ # 1.0.2
2
+
3
+ * Renamed the 'session' variable to be 'usr'. It's become clear to me that the only way a script can access data passed from the controller to the script is through this variable: therefore, it ought to have a generic name. The variable usr will have whatever is passed in through `new` or `build`.
4
+
1
5
  # 1.0.1
6
+
2
7
  * Changed the `clear` method to return self so that clear can be chained.
3
8
  * Corrected some of the comments above individual methods.
4
9
  * Made some corrections and additions to the README.
@@ -6,7 +11,9 @@
6
11
  * Added an argument to `build` and `initialize` to allow a session variable to be passed through.
7
12
  * Corrected a problem with the `select` control in that the attributes were not being applied.
8
13
  * Added a variable to `build` and `initialize` to be able to pass through a user argument. I called it `session` because that's what it would commonly be used for, but you could pass anything and access it in your Demeler code. For example, if you needed session _and_ some other variables, you would just pass them all in a Hash, including session.
14
+ * Added a .gitignore file.
9
15
 
10
16
 
11
17
  # 1.0.0
18
+
12
19
  * Initial version.
data/README.md CHANGED
@@ -276,7 +276,7 @@ Opts represents a Hash with tag attributes.
276
276
 
277
277
  ## Reference Guide
278
278
 
279
- ### def self.build(obj=nil, gen_html=false, session={}, &block)
279
+ ### def self.build(obj=nil, gen_html=false, usr=nil, &block)
280
280
 
281
281
  This is the main Demeler call used to build your HTML. This call uses your code in the block, so it makes no sense to call `build` without a block.
282
282
 
@@ -284,17 +284,17 @@ Name | Type | Value
284
284
  ---- | ---- | -----
285
285
  obj | Hash+ | An object to use to get values and error messages.
286
286
  gen_html | Boolean | Create formatted HTML (true), or compact HTML (false: default).
287
- session | Hash | A variable meant to pass a session in a web server, but you can use it for passing any other value as well. _This value is for the caller's use and is not used by Demeler._
287
+ usr | * | A variable meant to pass a session in a web server, but you can use it for passing any other value as well. _This value is for the caller's use and is not used by Demeler._
288
288
  block | Proc | The block with your code.
289
289
 
290
- ### def initialize(obj=nil, session={}, &block)
290
+ ### def initialize(obj=nil, usr=nil, &block)
291
291
 
292
292
  Initialize sets up the initial conditions in Demeler, and is called by `new`.
293
293
 
294
294
  Name | Type | Value
295
295
  ---- | ---- | -----
296
296
  obj | Hash+ | An object to use to get values and error messages.
297
- session | Hash | A variable meant to pass a session in a web server, but you can use it for passing any other value as well. _This value is for the caller's use and is not used by Demeler._
297
+ usr | Hash | A variable meant to pass a session in a web server, but you can use it for passing any other value as well. _This value is for the caller's use and is not used by Demeler._
298
298
  block | Proc | The block with your code.
299
299
 
300
300
  ### def clear
@@ -1,4 +1,4 @@
1
1
  module Version
2
- VERSION = "1.0.1"
3
- MODIFIED = "2017-06-10"
2
+ VERSION = "1.0.2"
3
+ MODIFIED = "2017-06-12"
4
4
  end
data/lib/demeler.rb CHANGED
@@ -21,7 +21,7 @@
21
21
  # Ruby Sequel.
22
22
 
23
23
  class Demeler
24
- attr_reader :out, :obj, :session
24
+ attr_reader :out, :obj, :usr
25
25
 
26
26
  # These calls are effectively generated in the same way as 'text' input
27
27
  # tags. Method_missing just does a substitution to implement them.
@@ -35,11 +35,11 @@ class Demeler
35
35
  #
36
36
  # @param [object] obj a Sequel::Model object, or Hash object with an added 'errors' field.
37
37
  # @param [boolean] gen_html A flag to control final output: true=>formatted, false=>compressed.
38
- # @param [Hash] session The session variable from the caller, although it can be anything because Demeler doesn't use it.
38
+ # @param [*] usr The usr variable from the caller, although it can be anything because Demeler doesn't use it.
39
39
  # @param [Proc] block
40
40
  #
41
- def self.build(obj=nil, gen_html=false, session={}, &block)
42
- demeler = self.new(obj, session, &block)
41
+ def self.build(obj=nil, gen_html=false, usr=nil, &block)
42
+ demeler = self.new(obj, usr, &block)
43
43
  if gen_html then demeler.to_html else demeler.to_s end
44
44
  end
45
45
 
@@ -51,7 +51,7 @@ class Demeler
51
51
  # A note of warning: you'll get extra spaces in textareas if you use .to_html.
52
52
  #
53
53
  # @param [object] obj--a Sequel::Model object, or Hash object with an added 'errors' field.
54
- # @param [Hash] session The session variable from the caller, although it can be anything because Demeler doesn't use it.
54
+ # @param [*] usr The usr variable from the caller; it can be anything because Demeler doesn't use it.
55
55
  # @param [Proc] block
56
56
  #
57
57
  # To use this without Sequel, you can use an object like this:
@@ -62,10 +62,10 @@ class Demeler
62
62
  # end
63
63
  # end
64
64
  #
65
- def initialize(obj=nil, session={}, &block)
65
+ def initialize(obj=nil, usr=nil, &block)
66
66
  raise ArgumentError.new("The object passed to Demeler must have an errors field containing a Hash") if obj && !defined?(obj.errors)
67
67
  @obj = obj
68
- @session = session
68
+ @usr = usr
69
69
  clear
70
70
  instance_eval(&block) if block_given?
71
71
  end
data/notes CHANGED
@@ -24,12 +24,20 @@ git config --list
24
24
 
25
25
  # To push up to GitHub
26
26
  git remote add origin https://github.com/mjwelchphd/demeler.git
27
+
28
+ # UPDATE THE DEMELER GEM SRC
29
+ # CHANGE VERSION AND DATE
30
+ # UPDATE CHANGELOG
31
+ # UPDATE README
32
+ # BUILD THE GEM
33
+ # UPDATE 1.x to 1.y BELOW
34
+ # COMMIT CHANGES IN GIT BEFORE PUSHING!
27
35
  git push -u origin master
28
36
 
29
37
  #----------------------------------------
30
38
 
31
39
  # To upload the gem to rubygems.org
32
- gem push demeler-1.0.1.gem
40
+ gem push demeler-1.0.2.gem
33
41
 
34
42
  #----------------------------------------
35
43
 
data/spec/demeler.rb CHANGED
@@ -84,7 +84,7 @@ describe "Simple Demeler with Session" do
84
84
 
85
85
  it "should pass through the session variable" do
86
86
  @d.clear
87
- @d.out << session.inspect
87
+ @d.out << @d.usr.inspect
88
88
  @d.to_s.should.equal "{:id=>1}"
89
89
  end
90
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael J. Welch, Ph.D.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-10 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem takes your ruby input, plus an object such as a Sequel::Model
14
14
  object, and generates HTML code. If the object has values, they're inserted into