hir 0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hir.rb +8 -12
- metadata +2 -2
data/lib/hir.rb
CHANGED
@@ -5,20 +5,20 @@ class Hash
|
|
5
5
|
end
|
6
6
|
|
7
7
|
class HIR
|
8
|
-
VERSION = "
|
8
|
+
VERSION = "1.0.0"
|
9
9
|
|
10
|
-
module
|
10
|
+
module Tags
|
11
11
|
|
12
|
-
def self.
|
12
|
+
def self.add_tag(tagname)
|
13
13
|
define_method(tagname, ->(*args, &block) { tag(tagname, *args, &block) })
|
14
14
|
define_method("#{tagname}!", ->(*args, &block) { tag_sc(tagname, *args) })
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.
|
18
|
-
tagnames.each { |tagname|
|
17
|
+
def self.add_tags(*tagnames)
|
18
|
+
tagnames.each { |tagname| add_tag(tagname) }
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
add_tags *%w[
|
22
22
|
a abbr acronym address applet area article aside audio b base basefont
|
23
23
|
bdi bdo big blockquote body br button canvas caption center cite code
|
24
24
|
col colgroup command datalist dd del details dfn dir div dl dt em embed
|
@@ -56,18 +56,14 @@ class HIR
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.to_html(&content)
|
59
|
-
HIR.new.instance_eval(&content)
|
59
|
+
HIR.new.instance_eval(&content)
|
60
60
|
end
|
61
61
|
|
62
|
-
include
|
62
|
+
include Tags
|
63
63
|
|
64
64
|
def initialize
|
65
65
|
@tags = []
|
66
66
|
end
|
67
|
-
|
68
|
-
def to_s
|
69
|
-
@tags.join
|
70
|
-
end
|
71
67
|
end
|
72
68
|
|
73
69
|
def hir(&content)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|