Class: Twing::Modules::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/twing/modules/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
# File 'lib/twing/modules/base.rb', line 8

def initialize(app)
  @app = app
  @logger = CustomLogger.new(app.logger, self.class.to_s)
  @root_setting = app.setting
  @setting = app.setting.modules[self.class.to_s.downcase]
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



6
7
8
# File 'lib/twing/modules/base.rb', line 6

def app
  @app
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/twing/modules/base.rb', line 6

def logger
  @logger
end

#root_settingObject (readonly)

Returns the value of attribute root_setting.



6
7
8
# File 'lib/twing/modules/base.rb', line 6

def root_setting
  @root_setting
end

#settingObject (readonly)

Returns the value of attribute setting.



6
7
8
# File 'lib/twing/modules/base.rb', line 6

def setting
  @setting
end

Instance Method Details

#on_message(*args) ⇒ Object

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/twing/modules/base.rb', line 15

def on_message(*args)
  raise NotImplementedError.new("You must implement #{self.class}##{__method__}")
end