Class: Awestruct::Context

Inherits:
AStruct
  • Object
show all
Defined in:
lib/awestruct/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AStructMixin

#[], #cascade_for_nils!, extended, #key?, #method_missing, #transform_entry

Constructor Details

#initialize(hash) ⇒ Context

Returns a new instance of Context.



10
11
12
13
14
15
# File 'lib/awestruct/context.rb', line 10

def initialize(hash)
  super 
  @page = hash[:page]
  @site = hash[:site]
 
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Awestruct::AStructMixin

Instance Attribute Details

#pageObject

Returns the value of attribute page.



8
9
10
# File 'lib/awestruct/context.rb', line 8

def page
  @page
end

#siteObject

Returns the value of attribute site.



7
8
9
# File 'lib/awestruct/context.rb', line 7

def site
  @site
end

Instance Method Details

#inspectObject



17
18
19
# File 'lib/awestruct/context.rb', line 17

def inspect
  "Awestruct::Context{:page=>#{self.page.inspect}}" 
end