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.



45
46
47
# File 'lib/vizcore/dsl/layer_builder.rb', line 45

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



49
50
51
52
53
54
# File 'lib/vizcore/dsl/layer_builder.rb', line 49

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)


56
57
58
# File 'lib/vizcore/dsl/layer_builder.rb', line 56

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