Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More Docstrings

  • Loading branch information...
commit d73ef16703c3be0bf97bfd0570702eeb91cffcdb 1 parent 8d88807
@bakkdoor authored
View
6 bin/fancy
@@ -4,6 +4,12 @@
base = File.dirname(__FILE__)
require File.expand_path("../boot/fancy_ext", base)
+class Object
+ define_method("__AFTER__BOOTSTRAP__:") do |block|
+ block.call
+ end
+end
+
# Use the bootstrapping code loader.
require File.expand_path("../boot/load", base)
View
4 boot/fancy_ext/object.rb
@@ -1,4 +1,8 @@
class Object
+ define_method("__AFTER__BOOTSTRAP__:") do |block|
+ nil
+ end
+
define_method("ruby:with_block:") do |method, block|
self.send(method, &block)
end
View
34 lib/html.fy
@@ -1,4 +1,36 @@
class HTML {
+ """
+ HTML generator class.
+
+ Example:
+ require: \"html\"
+ html = HTML new: @{
+ html: @{
+ head: @{ title: \"My Fancy Website\" }
+ body: @{
+ div: { id: \”main\” } with: \"Hello, Fancy World!\"
+ }
+ }
+ } . to_s
+
+ # html is now:
+ \"\"\"
+ <html>
+ <head>
+ <title>
+ My Fancy Website
+ </title>
+ </head>
+ <body>
+ <div id=\"main\">
+ Hello, Fancy World!
+ </div>
+ </body>
+ </html>
+ \"\"\"
+
+ """
+
def initialize {
@buf = ""
@indent = 0
@@ -18,7 +50,7 @@ class HTML {
unless: (attrs empty?) do: {
@buf << " "
attrs each: |k v| {
- @buf << k << "=" << (v inspect)
+ @buf << k << "=" << (v to_s inspect)
} in_between: {
@buf << " "
}
View
17 lib/vars.fy
@@ -1,3 +1,20 @@
*stdin* = STDIN
*stdout* = STDOUT
*stderr* = STDERR
+
+__AFTER__BOOTSTRAP__: {
+ *stdin* documentation: """
+ The Standard Input stream.
+ Can be rebound to any @IO@ stream via @Object#let:be:in:@.
+ """
+
+ *stdout* documentation: """
+ The Standard Output stream.
+ Can be rebound to any @IO@ stream via @Object#let:be:in:@.
+ """
+
+ *stderr* documentation: """
+ The Standard Error Output stream.
+ Can be rebound to any @IO@ stream via @Object#let:be:in:@.
+ """
+}
Please sign in to comment.
Something went wrong with that request. Please try again.