Sha256: 0b4b790a51290c206c475089f4c3ea866d0918d13ead93c37c6ceba74c42a47f

Contents?: true

Size: 712 Bytes

Versions: 9

Compression:

Stored size: 712 Bytes

Contents

module ::Rubiks

  class CalculatedMeasure < NamedObject
    def formula(new_value=nil, options={})
      @formula = new_value.to_s if new_value.present?
      @formula ||= @options[:formula]
    end

    def format_string(new_value=nil, options={})
      @format_string = new_value.to_s if new_value.present?
      @format_string ||= @options[:format_string]
    end

    def to_xml(builder = nil)
      builder = builder || new_builder

      xml_attrs = default_xml_attributes
      xml_attrs[:dimension] = 'Measures'
      xml_attrs[:formula] = formula if formula.present?
      xml_attrs[:formatString] = format_string if format_string.present?

      builder.calculatedMember(xml_attrs)
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubiks-0.1.8 lib/rubiks/calculated_measure.rb
rubiks-0.1.7 lib/rubiks/calculated_measure.rb
rubiks-0.1.6 lib/rubiks/calculated_measure.rb
rubiks-0.1.5 lib/rubiks/calculated_measure.rb
rubiks-0.1.4 lib/rubiks/calculated_measure.rb
rubiks-0.1.3 lib/rubiks/calculated_measure.rb
rubiks-0.1.2 lib/rubiks/calculated_measure.rb
rubiks-0.1.1 lib/rubiks/calculated_measure.rb
rubiks-0.1.0 lib/rubiks/calculated_measure.rb