hoshi 0.0.186 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -20,8 +20,8 @@ spec = Gem::Specification.new { |s|
20
20
  s.rubyforge_project = 'hoshi-view'
21
21
  s.summary = "Nice, object-oriented, first-class views."
22
22
  s.homepage = "http://debu.gs/#{s.name}"
23
- %w(metaid hpricot).each &s.method(:add_dependency)
24
- s.version = '0.0.186'
23
+ %w(facets metaid hpricot).each &s.method(:add_dependency)
24
+ s.version = '0.1.3'
25
25
  }
26
26
 
27
27
  Rake::GemPackageTask.new(spec) { |pkg|
@@ -29,6 +29,6 @@ Rake::GemPackageTask.new(spec) { |pkg|
29
29
  }
30
30
 
31
31
  task(:install => :package) {
32
- g = "pkg/#{spec.name}-#{spec.version}.gem"
32
+ g = Dir['pkg/*.gem'].sort.last
33
33
  system "gem install -l #{g}"
34
34
  }
data/doc/TODO CHANGED
@@ -1,7 +1,6 @@
1
1
  TODO for 1.0:
2
2
  * Separate the tags by close type in the various View sub-classes. (The most
3
3
  tedious thing on the list, but required for compliance.)
4
- * Still not too happy about the way RSS feeds are done, going to rework.
5
4
 
6
5
  TODO for later:
7
6
  * Have html2hoshi do a smarter job of deciding doctypes, not using permissive!
@@ -1,3 +1,4 @@
1
+
1
2
  require 'hoshi'
2
3
  require 'cgi'
3
4
 
data/lib/hoshi/view.rb CHANGED
@@ -23,15 +23,13 @@ module Hoshi
23
23
  # h1 "I have been shown"
24
24
  # end
25
25
  def self.tag(name, close_type = nil)
26
- class_eval <<-EOHACK
27
- def #{name}(*opts, &b)
28
- if b
29
- tag #{name.inspect}, #{close_type.inspect}, *opts, &b
30
- else
31
- tag #{name.inspect}, #{close_type.inspect}, *opts, &b
32
- end
26
+ define_method(name) { |*opts,&b|
27
+ if b
28
+ tag name, close_type, *opts, &b
29
+ else
30
+ tag name, close_type, *opts
33
31
  end
34
- EOHACK
32
+ }
35
33
  end
36
34
 
37
35
  # A short-hand for creating multiple tags via View.tag. For tags that
@@ -54,8 +52,7 @@ module Hoshi
54
52
  doctype = doctype.to_s.downcase.gsub('_', '')
55
53
  const_get(constants.find { |c|
56
54
  cl = const_get c
57
- (cl.ancestors.include?(self) &&
58
- c.to_s.downcase == doctype) rescue false
55
+ cl.ancestors.include?(self) && c.downcase == doctype
59
56
  }) rescue nil
60
57
  end
61
58
 
@@ -133,7 +130,7 @@ module Hoshi
133
130
  if b
134
131
  old, self.current = current, []
135
132
  b.call
136
- inside, self.current = current.map { |i| i.to_s }.join, old
133
+ inside, self.current = current.map(&:to_s).join, old
137
134
  else
138
135
  inside = opts.shift if opts.first.kind_of?(String)
139
136
  end
@@ -157,7 +154,7 @@ module Hoshi
157
154
  # Turns things in to strings, properly escapes them, and appends them
158
155
  # to the document.
159
156
  def safe *things
160
- append! CGI.escapeHTML(things.map { |i| i.to_s }.join("\n"))
157
+ append! CGI.escapeHTML(things.map(&:to_s).join("\n"))
161
158
  end
162
159
 
163
160
  # Appends one or more non-escaped strings to the document.
@@ -168,7 +165,7 @@ module Hoshi
168
165
  # Returns the string representation of the document. This is what you
169
166
  # want to eventually call.
170
167
  def render
171
- tree.flatten.map { |i| i.to_s }.join
168
+ tree.flatten.map(&:to_s).join
172
169
  end
173
170
 
174
171
  # Prints the string representation of the docutment, with HTTP headers.
data/lib/hoshi.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'facets/symbol'
1
2
  require 'hoshi/monkey_patches'
2
3
 
3
4
  require 'hoshi/tag'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.186
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Elmore
@@ -9,9 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-10 00:00:00 -08:00
12
+ date: 2008-11-11 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: facets
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: metaid
17
27
  type: :runtime