Skip to content

crguezl/html-method_missing-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#Example of method_missing and Rake::TestTask ##SYNOPSIS

require "html"

q= HTML.new {  
  html {
    head { title "My wonderful home page" }
    body do
      h1 "Welcome to my home page!"
      b "My hobbies:"
      ul do
        li "Juggling"
        li "Knitting"
        li { i "Sleeping" } 
        li "Metaprogramming"
      end #ul
    end # body
  }
}

q.to_s produces:

    <html>
    <head>
    <title>
    My wonderful home page
    </title>
    </head><body>
    <h1>
    Welcome to my home page!
    </h1><b>
    My hobbies:
    </b><ul>
    <li>
    Juggling
    </li><li>
    Knitting
    </li><li>
    <i>
    Sleeping
    </i>
    </li><li>
    Metaprogramming
    </li>
    </ul>
    </body>
    </html>

About

Example of how to use method_missing in Ruby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages