Module: Consumer::Controls::PositionStore

Defined in:
lib/consumer/controls/position_store.rb,
lib/consumer/controls/position_store/file.rb

Defined Under Namespace

Modules: Location Classes: File

Constant Summary collapse

Example =
example_class do
  attr_accessor :telemetry_sink

  def configure
    self.telemetry_sink = ::Consumer::PositionStore::Telemetry::Sink.new

    telemetry.register(telemetry_sink)
  end

  def get
    Position::Global.example
  end

  def put(_)
  end
end

Class Method Summary collapse

Class Method Details

.example(&block) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/consumer/controls/position_store.rb', line 4

def self.example(&block)
  if block.nil?
    cls = Example
  else
    cls = example_class(&block)
  end

  cls.build
end

.example_class(&block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/consumer/controls/position_store.rb', line 14

def self.example_class(&block)
  Class.new do
    include ::Consumer::PositionStore

    def self.build
      instance = new
      instance.configure
      instance
    end

    def configure
    end

    class_exec(&block) unless block.nil?
  end
end