Class: PageObjectify::DOMToRuby
- Inherits:
-
Object
- Object
- PageObjectify::DOMToRuby
- Includes:
- ASTMaker
- Defined in:
- lib/page-objectify/dom_to_ruby.rb
Overview
Takes an Array of DOM elements and generates Ruby code (page class containing PageObject::Accessors)
Instance Method Summary collapse
-
#initialize(dom, config) ⇒ DOMToRuby
constructor
A new instance of DOMToRuby.
-
#unparse ⇒ Object
Generate Ruby source as a String.
Methods included from ASTMaker
Constructor Details
#initialize(dom, config) ⇒ DOMToRuby
Returns a new instance of DOMToRuby.
11 12 13 14 |
# File 'lib/page-objectify/dom_to_ruby.rb', line 11 def initialize(dom, config) @dom = dom @config = config end |
Instance Method Details
#unparse ⇒ Object
Generate Ruby source as a String
17 18 19 20 21 22 23 |
# File 'lib/page-objectify/dom_to_ruby.rb', line 17 def unparse tree = s(:class, *first_line, s(:begin, *accessors) ) Unparser.unparse(tree) end |