Class: Shigeki

Inherits:
Object
  • Object
show all
Defined in:
lib/shigeki.rb

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller_name, view_context: nil) ⇒ Shigeki

Returns a new instance of Shigeki.



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

def initialize(controller_name, view_context: nil)
  @controller_name = controller_name
  @view_context = view_context
end

Instance Attribute Details

#controller_nameObject

Returns the value of attribute controller_name.



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

def controller_name
  @controller_name
end

#view_contextObject

Returns the value of attribute view_context.



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

def view_context
  @view_context
end

Instance Method Details

#dataObject



9
10
11
12
13
14
15
# File 'lib/shigeki.rb', line 9

def data(&)
  builder = Builder.new(controller_name, view_context: view_context)

  builder.instance_eval(&)

  builder.to_h
end