Class: AboutPage::OpenStructWithHashAccess
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- AboutPage::OpenStructWithHashAccess
- Defined in:
- lib/about_page/configuration.rb
Instance Method Summary collapse
- #reject(&block) ⇒ Object
- #select(&block) ⇒ Object
- #to_h ⇒ Object
- #to_json(options = {}) ⇒ Object
- #to_xml(options = {}) ⇒ Object
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_h ⇒ Object
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( = {}) 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( = {}) @table end |