Class: Demos::Clock

Inherits:
Hokusai::Block show all
Defined in:
ui/examples/clock.rb

Instance Attribute Summary collapse

Attributes inherited from Hokusai::Block

#node, #provides, #publisher

Instance Method Summary collapse

Methods inherited from Hokusai::Block

#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, #initialize, inject, inject!, #method_missing, mount, #on_resize, provide, provides, #render, style, styles_get, template, template_from_file, template_get, #update, use, uses

Constructor Details

This class inherits a constructor from Hokusai::Block

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hokusai::Block

Instance Attribute Details

#widthObject

Returns the value of attribute width.



29
30
31
# File 'ui/examples/clock.rb', line 29

def width
  @width
end

Instance Method Details

#fullscreenObject



42
43
44
# File 'ui/examples/clock.rb', line 42

def fullscreen
  (width || 0) > 500
end

#set_width(width) ⇒ Object



38
39
40
# File 'ui/examples/clock.rb', line 38

def set_width(width)
  @width = width
end

#timeObject



33
34
35
36
# File 'ui/examples/clock.rb', line 33

def time
  time = DateTime.now
  "#{time.hour}:#{time.minute} #{time.second}"
end