Class: Vizcore::DSL::LayerBuilder::ShapeReference

Inherits:
Object
  • Object
show all
Defined in:
lib/vizcore/dsl/layer_builder.rb

Overview

Reference to an already declared shape, used by ‘map … to: shape(:id).radius`.

Instance Method Summary collapse

Constructor Details

#initialize(prefix) ⇒ ShapeReference

Returns a new instance of ShapeReference.



36
37
38
# File 'lib/vizcore/dsl/layer_builder.rb', line 36

def initialize(prefix)
  @prefix = prefix
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



40
41
42
43
44
45
# File 'lib/vizcore/dsl/layer_builder.rb', line 40

def method_missing(method_name, *args, &block)
  return super unless args.empty? && block.nil?

  target = SHAPE_TARGET_ALIASES.fetch(method_name.to_s, method_name.to_s)
  :"#{@prefix}.#{target}"
end

Instance Method Details

#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/vizcore/dsl/layer_builder.rb', line 47

def respond_to_missing?(_method_name, _include_private = false)
  true
end