Class: Jets::Cfn::Params::Api::Base

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/jets/cfn/params/api/base.rb

Direct Known Subclasses

Cors, Methods, Resources

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
# File 'lib/jets/cfn/params/api/base.rb', line 13

def initialize(options={})
  @options = options
  @template = load_template # current paged template_path
  @params = ActiveSupport::HashWithIndifferentAccess.new
end

Instance Method Details

#buildObject

noop by default



37
# File 'lib/jets/cfn/params/api/base.rb', line 37

def build; end

#load_templateObject

Nice to be able to use template or template_path so the common Template.load_file is centralized.



27
28
29
30
31
32
33
34
35
# File 'lib/jets/cfn/params/api/base.rb', line 27

def load_template
  if @options[:template]
    # At Cfn::Builders::Api::Methods build time, template is in memory
    @options[:template]
  else
    # At Resource::Nested::Api::Methods build time, template is on disk
    Jets::Cfn::Template.load_file(@options[:template_path])
  end
end

#paramsObject



19
20
21
22
# File 'lib/jets/cfn/params/api/base.rb', line 19

def params
  build # interface method
  @params
end