Module: LoraRb

Extended by:
LoraRb
Included in:
LoraRb
Defined in:
lib/lora-rb/help.rb,
lib/lora-rb.rb,
lib/version.rb,
lib/core/protocol.rb,
lib/lora-rb/utility.rb,
lib/core/configuration.rb,
lib/lora-rb/a2a/mqtt/call.rb,
lib/lora-rb/loriot/tls/call.rb,
lib/lora-rb/resiot/http/call.rb,
lib/core/configuration_dynamic.rb,
lib/generators/install_generator.rb,
lib/lora-rb/fractalgarden/mqtt/call.rb,
lib/lora-rb/fractalgarden/rabbitmq/call.rb

Overview

LoraRb calling methods

Defined Under Namespace

Modules: Base, Call, Generators, Settings Classes: Configuration, EuiNotFound, Protocol

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationObject



25
26
27
# File 'lib/core/configuration.rb', line 25

def self.configuration
  @configuration ||= Configuration.new
end

.configuration=(config) ⇒ Object



29
30
31
# File 'lib/core/configuration.rb', line 29

def self.configuration=(config)
  @configuration = config
end

.configure {|configuration| ... } ⇒ Object

Yields:



33
34
35
# File 'lib/core/configuration.rb', line 33

def self.configure
  yield configuration
end

.rootObject



19
20
21
# File 'lib/lora-rb.rb', line 19

def self.root
  File.expand_path('../..', __FILE__)
end

.updated_atObject



5
6
7
# File 'lib/version.rb', line 5

def self.updated_at
  "2017-11-21"
end

.versionObject



2
3
4
# File 'lib/version.rb', line 2

def self.version
  "0.16.0"
end

Instance Method Details

#configure_on_the_fly(&block) ⇒ Object

And we define a wrapper for the configuration block, that we’ll use to set up our set of options



29
30
31
# File 'lib/core/configuration_dynamic.rb', line 29

def configure_on_the_fly(&block)
  instance_eval &block
end

#parameter(*names) ⇒ Object

Appdata provides a basic single-method DSL with .parameter method being used to define a set of available settings. This method takes one or more symbols, with each one being a name of the configuration option.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/core/configuration_dynamic.rb', line 13

def parameter(*names)
  names.each do |name|
    attr_accessor name

    # For each given symbol we generate accessor method that sets option's
    # value being called with an argument, or returns option's current value
    # when called without arguments
    define_method name do |*values|
      value = values.first
      value ? self.send("#{name}=", value) : instance_variable_get("@#{name}")
    end
  end
end