Class: Plotrb::Mark::MarkProperty

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

Defined Under Namespace

Classes: ValueRef

Constant Summary collapse

VISUAL_PROPERTIES =
[:x, :x2, :width, :y, :y2, :height, :opacity, :fill,
:fill_opacity, :stroke, :stroke_width,
:stroke_opacity, :stroke_dash, :stroke_dash_offset]

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, #defined_attributes, included, #set_attributes

Constructor Details

#initialize(type, data = nil, &block) ⇒ MarkProperty

Returns a new instance of MarkProperty.



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/plotrb/marks.rb', line 202

def initialize(type, data=nil, &block)
  define_single_val_attributes *VISUAL_PROPERTIES
  self.singleton_class.class_eval {
    alias_method :x_start, :x
    alias_method :left, :x
    alias_method :x_end, :x2
    alias_method :right, :x2
    alias_method :y_start, :y
    alias_method :top, :y
    alias_method :y_end, :y2
    alias_method :bottom, :y2
  }
  @data = data
  self.send(type)
  self.instance_eval(&block) if block_given?
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



200
201
202
# File 'lib/plotrb/marks.rb', line 200

def data
  @data
end