Sha256: 4f1e1c0f87a14bc82f5c8b7a1d5f3fe3a46eb8ca3dda9139c2a181d726819b12

Contents?: true

Size: 812 Bytes

Versions: 9

Compression:

Stored size: 812 Bytes

Contents

module ::Rubiks

  class Measure < ::Rubiks::NamedObject
    def column(new_name=nil, options={})
      @column = new_name.to_s if new_name.present?
      @column ||= @options[:column] || name
    end

    def aggregator(new_name=nil, options={})
      @aggregator = new_name.to_s if new_name.present?
      @aggregator ||= @options[:aggregator] || 'count'
    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 = {:name => caption, :column => column, :aggregator => aggregator}
      xml_attrs[:formatString] = format_string if format_string.present?
      builder.measure(xml_attrs)
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

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