campo 0.3.0 → 0.3.1

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.
data/CHANGES CHANGED
@@ -1,3 +1,5 @@
1
+ v0.3.1 Fixed possible bit of dodgy interpolation in Haml_Ruby_Insert
2
+
1
3
  v0.3.0 Improved passing of hash arguments for options to select tags. More specs.
2
4
 
3
5
  v0.2.0 All Base fields can now take a block and the convenience methodsl, allowing them to nest other elements regardless of whether the parent is a form or a select. This basically makes it a lot easier to use a literal as the root of the document.
data/README.markdown CHANGED
@@ -301,7 +301,7 @@ Output:
301
301
 
302
302
  ## Adding in helpers ##
303
303
 
304
- If you want to use helpers in the attributes, like sinatra's `uri` helper, then add a quote to the front:
304
+ If you want to use helpers in the attributes, like sinatra's `uri` helper, then add a double-quote to the front:
305
305
 
306
306
  form = Campo::Form.new "best_bands", action: %Q!"uri("/best/bands/")!
307
307
 
@@ -317,6 +317,8 @@ outputs:
317
317
 
318
318
  %form{ atts[:best_bands], method: "POST", action: uri("/best/bands/"), name: "best_bands", }
319
319
  = 5 + 1
320
+
321
+ Although, if you forget the "=" sign it will add it for you.
320
322
 
321
323
  ## And literals ##
322
324
 
data/lib/campo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Campo
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/campo.rb CHANGED
@@ -308,8 +308,9 @@ STR
308
308
 
309
309
  class Haml_Ruby_Insert < Base
310
310
  def initialize( s )
311
+ raise ArgumentError, "you may only pass a string to Haml_Ruby_Insert/bit_of_ruby" unless s.kind_of?( String )
311
312
  super( nil ) # no name needed
312
- @s = s.start_with?( '=' ) ? s : "= #{s}"
313
+ @s = s.start_with?( '=' ) ? s : "= " + s.to_s
313
314
 
314
315
  self.on_output do |n=0, tab=2|
315
316
  (" " * n * tab) + @s
data/spec/campo_spec.rb CHANGED
@@ -623,6 +623,16 @@ s.chomp
623
623
  it { should == expected }
624
624
  end
625
625
  end
626
+
627
+ context "When not given a string" do
628
+ it "should raise" do
629
+ expect {
630
+ form = Campo.form "a" do |form|
631
+ form.bit_of_ruby 2
632
+ end
633
+ }.to raise_error( ArgumentError )
634
+ end
635
+ end
626
636
  end
627
637
 
628
638
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -55,7 +55,7 @@ default_executable:
55
55
  dependencies:
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: haml
58
- requirement: &2164742080 !ruby/object:Gem::Requirement
58
+ requirement: &2153137700 !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements:
61
61
  - - ~>
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: 3.1.1
64
64
  type: :runtime
65
65
  prerelease: false
66
- version_requirements: *2164742080
66
+ version_requirements: *2153137700
67
67
  description: ! ' Form builder for Haml
68
68
 
69
69
  '
metadata.gz.sig CHANGED
Binary file