Module: Ziya::YamlHelpers::Gauges

Includes:
Base
Included in:
Gauges::Base, Gauges::Support::Base, Maps::Support::Base
Defined in:
lib/ziya/yaml_helpers/gauges.rb

Instance Method Summary collapse

Methods included from Base

#clazz, #indent

Instance Method Details

#dial(comp_class, comp_name = nil) ⇒ Object

generates a gauge element declaration

Example

<%= dial :rect %>
=> --- !ruby/object:Ziya::Gauges::Support::Rect


20
21
22
23
# File 'lib/ziya/yaml_helpers/gauges.rb', line 20

def dial( comp_class, comp_name=nil )
  clazz = clazz( comp_class, "Gauges::Support" )
  comp_name ? "- :#{comp_name}: #{clazz}" : "- #{clazz}"
end

#dialsObject Also known as: components

generates a yaml hash of dials

Example

<%= dials %>
=> components: !omap


29
30
31
# File 'lib/ziya/yaml_helpers/gauges.rb', line 29

def dials
  "components: !omap"
end

#gauge(class_name) ⇒ Object

generates a gauge yaml class declaration

Example

<%= gauge :thermo %>

produces:

--- !ruby/object:Ziya::Gauges::Thermo
  components: !omap


12
13
14
# File 'lib/ziya/yaml_helpers/gauges.rb', line 12

def gauge( class_name )
  "--- #{clazz( class_name, 'Gauges' )}\n#{dials}" 
end