Sha256: 33623cd0b3d457b9f953973adb3d488c7f560555399e2daa498bcdd9ca9fb4b6

Contents?: true

Size: 796 Bytes

Versions: 11

Compression:

Stored size: 796 Bytes

Contents

module Ziya::YamlHelpers::Gauges
  include Ziya::YamlHelpers::Base

  # generates a gauge yaml class declaration
  # ==== Example
  #  <%= gauge :thermo %>
  #
  #  produces:
  #
  #  --- !ruby/object:Ziya::Gauges::Thermo
  #    components: !omap
  def gauge( class_name )
    "--- #{clazz( class_name, 'Gauges' )}\n#{dials}" 
  end
  
  # generates a gauge element declaration
  # ==== Example
  #  <%= dial :rect %>
  #  => --- !ruby/object:Ziya::Gauges::Support::Rect
  def dial( comp_class, comp_name=nil )
    clazz = clazz( comp_class, "Gauges::Support" )
    comp_name ? "- :#{comp_name}: #{clazz}" : "- #{clazz}"
  end

  # generates a yaml hash of dials
  # ==== Example
  #  <%= dials %>
  #  => components: !omap
  def dials
    "components: !omap"
  end
  alias :components :dials
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
derailed-ziya-2.1.0 lib/ziya/yaml_helpers/gauges.rb
derailed-ziya-2.1.1 lib/ziya/yaml_helpers/gauges.rb
derailed-ziya-2.1.2 lib/ziya/yaml_helpers/gauges.rb
derailed-ziya-2.1.3 lib/ziya/yaml_helpers/gauges.rb
derailed-ziya-2.1.4 lib/ziya/yaml_helpers/gauges.rb
derailed-ziya-2.1.5 lib/ziya/yaml_helpers/gauges.rb
ziya-2.3.0 lib/ziya/yaml_helpers/gauges.rb
ziya-2.1.9 lib/ziya/yaml_helpers/gauges.rb
ziya-2.1.8 lib/ziya/yaml_helpers/gauges.rb
ziya-2.1.7 lib/ziya/yaml_helpers/gauges.rb
ziya-2.1.6 lib/ziya/yaml_helpers/gauges.rb