Module: Alephant::Renderer::Views::Base::InstanceMethods

Defined in:
lib/alephant/renderer/views/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



15
16
17
# File 'lib/alephant/renderer/views/base.rb', line 15

def base_path
  @base_path
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



15
16
17
# File 'lib/alephant/renderer/views/base.rb', line 15

def content_type
  @content_type
end

#dataObject (readonly)

Returns the value of attribute data.



15
16
17
# File 'lib/alephant/renderer/views/base.rb', line 15

def data
  @data
end

Instance Method Details

#initialize(data = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/alephant/renderer/views/base.rb', line 17

def initialize(data = {})
  @data = Hashie::Mash.new data
  @base_path = self.class.base_path

  setup
end

#setupObject



30
# File 'lib/alephant/renderer/views/base.rb', line 30

def setup; end

#to_hObject



24
25
26
27
28
# File 'lib/alephant/renderer/views/base.rb', line 24

def to_h
  whitelist.reduce({}) do |accum, method_key|
    accum.tap { |a| a[method_key] = send(method_key) }
  end
end

#whitelistObject



32
33
34
# File 'lib/alephant/renderer/views/base.rb', line 32

def whitelist
  []
end