Class: AboutPage::OpenStructWithHashAccess

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/about_page/configuration.rb

Instance Method Summary collapse

Instance Method Details

#reject(&block) ⇒ Object



11
12
13
# File 'lib/about_page/configuration.rb', line 11

def reject &block
  self.class.new to_h.reject(&block)
end

#select(&block) ⇒ Object



15
16
17
# File 'lib/about_page/configuration.rb', line 15

def select &block
  self.class.new to_h.select(&block)
end

#to_hObject



23
24
25
# File 'lib/about_page/configuration.rb', line 23

def to_h
  @table
end

#to_json(options = {}) ⇒ Object



7
8
9
# File 'lib/about_page/configuration.rb', line 7

def to_json(options = {})
  Hash[*@table.map { |k, v| [k, (v.to_h if v.respond_to? :to_h || v) ] }.flatten ]
end

#to_xml(options = {}) ⇒ Object



19
20
21
# File 'lib/about_page/configuration.rb', line 19

def to_xml(options = {})
  @table
end