Class: Plotrb::Mark::MarkProperty::ValueRef

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/plotrb/marks.rb

Overview

A value reference specifies the value for a given mark property

Constant Summary collapse

VALUE_REF_PROPERTIES =
[:value, :field, :scale, :mult, :offset, :band,
:group]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

#add_attributes, #attributes, #classify, #collect_attributes, #define_boolean_attribute, #define_boolean_attributes, #define_multi_val_attribute, #define_multi_val_attributes, #define_single_val_attribute, #define_single_val_attributes, #defined_attributes, included, #set_attributes

Constructor Details

#initialize(data, value = nil, &block) ⇒ ValueRef

Returns a new instance of ValueRef.


375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/plotrb/marks.rb', line 375

def initialize(data, value=nil, &block)
  @data = data
  define_single_val_attributes(:value, :mult, :offset, :group, :field,
                               :scale)
  define_boolean_attribute(:band)
  self.singleton_class.class_eval {
    alias_method :from, :field
    alias_method :use_band, :band
    alias_method :use_band?, :band?
    alias_method :times, :mult
  }
  if value
    @value = value
  end
  self.instance_eval(&block) if block
  self
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data


373
374
375
# File 'lib/plotrb/marks.rb', line 373

def data
  @data
end