Class: Dasht::Board
- Inherits:
-
Object
- Object
- Dasht::Board
- Defined in:
- lib/dasht/board.rb
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#default_height ⇒ Object
Returns the value of attribute default_height.
-
#default_refresh ⇒ Object
Returns the value of attribute default_refresh.
-
#default_resolution ⇒ Object
Returns the value of attribute default_resolution.
-
#default_width ⇒ Object
Returns the value of attribute default_width.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#tiles ⇒ Object
Returns the value of attribute tiles.
Instance Method Summary collapse
- #emit_plugin_css ⇒ Object
- #emit_plugin_html ⇒ Object
- #emit_plugin_js ⇒ Object
-
#initialize(parent, name) ⇒ Board
constructor
A new instance of Board.
- #method_missing(method, *args, &block) ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(parent, name) ⇒ Board
Returns a new instance of Board.
12 13 14 15 16 |
# File 'lib/dasht/board.rb', line 12 def initialize(parent, name) @parent = parent @name = name @tiles = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dasht/board.rb', line 37 def method_missing(method, *args, &block) begin metric = args.shift = args.pop || {} @tiles << { :type => method, :metric => metric, :resolution => self.default_resolution || parent.default_resolution || 60, :refresh => self.default_refresh || parent.default_refresh || 5, :width => self.default_width || parent.default_width || 3, :height => self.default_height || parent.default_height || 3, :extra_args => args }.merge() rescue => e super(method, *args, &block) end end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
6 7 8 |
# File 'lib/dasht/board.rb', line 6 def background @background end |
#default_height ⇒ Object
Returns the value of attribute default_height.
10 11 12 |
# File 'lib/dasht/board.rb', line 10 def default_height @default_height end |
#default_refresh ⇒ Object
Returns the value of attribute default_refresh.
8 9 10 |
# File 'lib/dasht/board.rb', line 8 def default_refresh @default_refresh end |
#default_resolution ⇒ Object
Returns the value of attribute default_resolution.
7 8 9 |
# File 'lib/dasht/board.rb', line 7 def default_resolution @default_resolution end |
#default_width ⇒ Object
Returns the value of attribute default_width.
9 10 11 |
# File 'lib/dasht/board.rb', line 9 def default_width @default_width end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/dasht/board.rb', line 4 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/dasht/board.rb', line 3 def parent @parent end |
#tiles ⇒ Object
Returns the value of attribute tiles.
5 6 7 |
# File 'lib/dasht/board.rb', line 5 def tiles @tiles end |
Instance Method Details
#emit_plugin_css ⇒ Object
25 26 27 |
# File 'lib/dasht/board.rb', line 25 def emit_plugin_css _emit_css(parent.system_plugins_path) end |
#emit_plugin_html ⇒ Object
29 30 31 |
# File 'lib/dasht/board.rb', line 29 def emit_plugin_html _emit_html(parent.system_plugins_path) end |
#emit_plugin_js ⇒ Object
33 34 35 |
# File 'lib/dasht/board.rb', line 33 def emit_plugin_js _emit_js(parent.system_plugins_path) end |
#to_html ⇒ Object
18 19 20 21 22 23 |
# File 'lib/dasht/board.rb', line 18 def to_html # Load the erb. path = File.join(parent.views_path, "dashboard.erb") @erb = ERB.new(IO.read(path)) @erb.result(binding) end |