Class: Peictt::Builder::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/peictt/builder/template.rb

Constant Summary collapse

FORMAT =
[:json, :text].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, controller_name, action) ⇒ Template

Returns a new instance of Template.



7
8
9
10
11
12
# File 'lib/peictt/builder/template.rb', line 7

def initialize(args, controller_name, action)
  @arg = args
  @action = action
  @controller = controller_name
  process_args arg.dup
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



4
5
6
# File 'lib/peictt/builder/template.rb', line 4

def action
  @action
end

#argObject (readonly)

Returns the value of attribute arg.



4
5
6
# File 'lib/peictt/builder/template.rb', line 4

def arg
  @arg
end

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/peictt/builder/template.rb', line 4

def body
  @body
end

#formatObject (readonly)

Returns the value of attribute format.



4
5
6
# File 'lib/peictt/builder/template.rb', line 4

def format
  @format
end

#localsObject (readonly)

Returns the value of attribute locals.



4
5
6
# File 'lib/peictt/builder/template.rb', line 4

def locals
  @locals
end

Instance Method Details

#html?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/peictt/builder/template.rb', line 14

def html?
  @format == :html
end

#json?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/peictt/builder/template.rb', line 18

def json?
  @format == :json
end

#text?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/peictt/builder/template.rb', line 22

def text?
  @format == :text
end