Class: EurekaBot::Tg::Controller::RepliesConcern::Markup

Inherits:
Object
  • Object
show all
Defined in:
lib/eureka_bot/tg/controller/concerns/replies_concern.rb

Direct Known Subclasses

ClassicMarkup, InlineMarkup

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, options = {}) ⇒ Markup

Returns a new instance of Markup.



28
29
30
31
32
# File 'lib/eureka_bot/tg/controller/concerns/replies_concern.rb', line 28

def initialize(context, options={})
  @context = context
  @options = options
  @items   = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/eureka_bot/tg/controller/concerns/replies_concern.rb', line 38

def method_missing(symbol, *args)
  if context.respond_to?(symbol)
    context.send(symbol, *args)
  else
    super
  end
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



26
27
28
# File 'lib/eureka_bot/tg/controller/concerns/replies_concern.rb', line 26

def context
  @context
end

#itemsObject (readonly)

Returns the value of attribute items.



26
27
28
# File 'lib/eureka_bot/tg/controller/concerns/replies_concern.rb', line 26

def items
  @items
end

#optionsObject (readonly)

Returns the value of attribute options.



26
27
28
# File 'lib/eureka_bot/tg/controller/concerns/replies_concern.rb', line 26

def options
  @options
end

Instance Method Details

#run(&block) ⇒ Object



34
35
36
# File 'lib/eureka_bot/tg/controller/concerns/replies_concern.rb', line 34

def run(&block)
  @items = block.call(self)
end