Class: SiteWatcher::DSL::Top

Inherits:
Object
  • Object
show all
Defined in:
lib/site_watcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTop

Returns a new instance of Top.



87
88
89
90
91
# File 'lib/site_watcher.rb', line 87

def initialize
  @__sw_pages = []
  @__sw_before_hooks = []
  @__sw_after_hooks = []
end

Instance Attribute Details

#__sw_after_hooksObject (readonly)

Returns the value of attribute __sw_after_hooks.



85
86
87
# File 'lib/site_watcher.rb', line 85

def __sw_after_hooks
  @__sw_after_hooks
end

#__sw_before_hooksObject (readonly)

Returns the value of attribute __sw_before_hooks.



85
86
87
# File 'lib/site_watcher.rb', line 85

def __sw_before_hooks
  @__sw_before_hooks
end

#__sw_pagesObject (readonly)

Returns the value of attribute __sw_pages.



85
86
87
# File 'lib/site_watcher.rb', line 85

def __sw_pages
  @__sw_pages
end

Instance Method Details

#after(&block) ⇒ Object



97
98
99
# File 'lib/site_watcher.rb', line 97

def after(&block)
  @__sw_after_hooks << block
end

#before(&block) ⇒ Object



93
94
95
# File 'lib/site_watcher.rb', line 93

def before(&block)
  @__sw_before_hooks << block
end

#page(url, **opts, &block) ⇒ Object



101
102
103
104
105
# File 'lib/site_watcher.rb', line 101

def page(url, **opts, &block)
  page = Page.new(url, **opts)
  page.instance_eval(&block)
  @__sw_pages << page
end