Class: Boar::Handlers::Root

Inherits:
Generic
  • Object
show all
Defined in:
app/models/boar/handlers/root.rb

Instance Attribute Summary collapse

Attributes inherited from Generic

#configuration, #service

Instance Method Summary collapse

Methods included from Utils::Basic

#ensure_hash, #get_option, #interpolate

Constructor Details

#initialize(service, options) ⇒ Root

Returns a new instance of Root.



12
13
14
15
16
17
# File 'app/models/boar/handlers/root.rb', line 12

def initialize(service, options)
  super(service)

  # Get the template for building the root
  @template = self.get_option(options, :directory, @configuration.directory)
end

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



10
11
12
# File 'app/models/boar/handlers/root.rb', line 10

def template
  @template
end

Instance Method Details

#call(*_) ⇒ Object



19
20
21
22
# File 'app/models/boar/handlers/root.rb', line 19

def call(*_)
  # Interpolate to a directory
  Pathname.new(self.interpolate(@template, {root: Rails.root, request: @service.controller.request, controller: @service.controller}))
end