Class: Toolsmith::Views::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/toolsmith/views/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, &block) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
# File 'lib/toolsmith/views/base.rb', line 6

def initialize(context, &block)
  @context = context

  if block_given?
    block.arity > 0 ? block.call(self) : yield
  end
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/toolsmith/views/base.rb', line 4

def context
  @context
end

Instance Method Details

#content_tag(*args, &block) ⇒ Object



14
15
16
# File 'lib/toolsmith/views/base.rb', line 14

def (*args, &block)
  context.(*args, &block)
end