Sha256: 096e453651aee057a48c97bc6e4bdeab63fdc319be220d3b4ee8e1ff153def8d

Contents?: true

Size: 1.61 KB

Versions: 6

Compression:

Stored size: 1.61 KB

Contents

Electricity=AMEE::DataAbstraction::PrototypeCalculation.new { # The application has support for an electricity calculation. :electricity is the internal label used to refer to it
  label :electricity
  name "Electricity Consumption"
  path '/business/energy/electricity/grid'
  
  drill {
    fixed 'argentina' #Not to be unset, value pre-given
    label :country  #Name will default to label.humanize if not given
    path 'country' #Some of the fields on the form are drill-downs, but the application doesn't need to display these differently
    #type :autocompleting_text_box #default for a drill with entries is probably a dropdown
  }

  profile {
    label :energy_used
    # Symbol provided here is used in generating html ids for elements etc
    path 'energyPerTime' #The amee profile item value corresponding to the field
    name "Energy Used" #The display name used on the form
    unit "kWh" #Default unit choice
    interface :text_box #Probably not needed, as likely to be the default for profile item value unsets
    validation lambda{|x|x.is_a? Float} #Probably not needed, as default can be deduced from PIV TYPE in API. Here as illustrative.
    alternative_units :MWh, :MBTU, :BTU # If these are explcitly specified then the alternatives are limited to only these units. Otherwise all dimensionally equivalent units are available as alternatives by default
  }
  
  # Alternatively, the drill might be fixed
  #permanent :country {
  #   drill_path 'country'
  #   value 'Argentina'

  output { #A marv output value
    label :co2
    path :default #It's not a marv, use the default output
    name "Carbon Dioxide"
  }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
amee-data-abstraction-2.1.1 spec/fixtures/electricity.rb
amee-data-abstraction-2.1.0 spec/fixtures/electricity.rb
amee-data-abstraction-1.2.0 spec/fixtures/electricity.rb
amee-data-abstraction-2.0.0 spec/fixtures/electricity.rb
amee-data-abstraction-1.1.0 spec/fixtures/electricity.rb
amee-data-abstraction-1.0.0 spec/fixtures/electricity.rb