Module: Hoshi

Defined in:
lib/hoshi.rb,
lib/hoshi/tag.rb,
lib/hoshi/view.rb,
lib/html2hoshi.rb

Overview

This is the namespace for all of Hoshi, which currently only includes Hoshi::View and Hoshi::Tag . For an overview, see the README. For specifics, check out Hoshi::View .

Defined Under Namespace

Classes: Tag, View

Class Method Summary collapse

Class Method Details

.from_html(html, indent = "\t") ⇒ Object

A semi-hacky method for converting HTML text to a Hoshi method. It takes an HTML document as a string, and optionally the string to use for each level of indentation.



7
8
9
10
# File 'lib/html2hoshi.rb', line 7

def self.from_html(html, indent = "\t")
	"#{indent}def page" << tree_to_hoshi(parse(html), indent, 2) <<
		"\n#{indent * 2}render\n#{indent}end"
end

.View(*a, &b) ⇒ Object

This is a cosmetic method; you may do Hoshi::View, Hoshi::View(:type), or Hoshi::View :type



12
13
14
15
16
17
18
19
# File 'lib/hoshi.rb', line 12

def self.View(*a, &b)
	klass = View[*a]
	if b
		klass.build &b
	else
		klass
	end
end