iq-html 0.1.0 → 0.1.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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/iq-html.gemspec +2 -2
  3. data/lib/iq/html.rb +16 -7
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/iq-html.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{iq-html}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jamie Hill"]
12
- s.date = %q{2010-01-13}
12
+ s.date = %q{2010-01-14}
13
13
  s.description = %q{Library containing a series of helper methods for creating html markup including the escaping of strings.}
14
14
  s.email = %q{jamie@soniciq.com}
15
15
  s.extra_rdoc_files = [
data/lib/iq/html.rb CHANGED
@@ -40,7 +40,6 @@ module IQ
40
40
  # @return [String] the escaped string (leaving existing entities intact)
41
41
  def self.sanitize_as_dom_id(string_to_sanitize)
42
42
  raise ArgumentError, 'Argument must be a string' unless string_to_sanitize.is_a?(String)
43
-
44
43
  # see http://www.w3.org/TR/html4/types.html#type-name
45
44
  string_to_sanitize.to_s.gsub(']','').gsub(/[^-a-zA-Z0-9:.]/, "-")
46
45
  end
@@ -57,17 +56,24 @@ module IQ
57
56
  # IQ::HTML.tag('strong', 'B&B', { :id => 'bb' }, false) #=> "<strong id="bb">Bill & Ben</strong>"
58
57
  # IQ::HTML.tag('input', :title => 'B&B') #=> '<input type="text" title="B&amp;B" />'
59
58
  # IQ::HTML.tag('strong', 'B&B', :title => 'Bill & Ben') #=> "<strong title="Bill &amp; Ben">B&amp;B</strong>"
60
- #
61
- # @param [String, Symbol] name
62
- # @param [String] content
63
- # @param [Hash] attributes
64
- # @param [true, false] escape
59
+ #
60
+ # @overload self.tag(name, attributes = {})
61
+ # @param [String, Symbol] name
62
+ # @param [Hash] attributes
63
+ # @overload self.tag(name, content, escape = true)
64
+ # @param [String, Symbol] name
65
+ # @param [String] content
66
+ # @param [true, false] escape
67
+ # @overload self.tag(name, content, attributes, escape = true)
68
+ # @param [String, Symbol] name
69
+ # @param [String] content
70
+ # @param [Hash] attributes
71
+ # @param [true, false] escape
65
72
  #
66
73
  # @return [String]
67
74
  def self.tag(name, *args)
68
75
  raise ArgumentError, 'Name must be a symbol or string' unless name.is_a?(Symbol) || name.is_a?(String)
69
76
 
70
- raise ArgumentError, 'Too many arguments' if args.size > 3
71
77
  case args.size
72
78
  when 3 then content, attributes, escape = *args
73
79
  when 2
@@ -84,6 +90,9 @@ module IQ
84
90
  else
85
91
  raise ArgumentError, 'Second argument must be a content string or an attributes hash'
86
92
  end
93
+ when 0
94
+ else
95
+ raise ArgumentError, "Too many arguments"
87
96
  end
88
97
 
89
98
  raise ArgumentError, 'Content must be in the form of a string' unless content.nil? || content.is_a?(String)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iq-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Hill
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-13 00:00:00 +00:00
12
+ date: 2010-01-14 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency