Class: DiningTable::Presenters::HTMLPresenterConfiguration::TagsConfiguration
- Inherits:
-
Object
- Object
- DiningTable::Presenters::HTMLPresenterConfiguration::TagsConfiguration
- Defined in:
- lib/dining-table/presenters/html_presenter_configuration.rb
Constant Summary collapse
- TAGS =
[ :table, :thead, :tbody, :tfoot, :tr, :th, :td ]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ TagsConfiguration
constructor
A new instance of TagsConfiguration.
-
#initialize_copy(source) ⇒ Object
for deep dup.
- #merge_hash(hash) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ TagsConfiguration
Returns a new instance of TagsConfiguration.
64 65 66 67 68 |
# File 'lib/dining-table/presenters/html_presenter_configuration.rb', line 64 def initialize TAGS.each do |tag| self.send("#{ tag }=", TagConfiguration.new) end end |
Class Method Details
.from_hash(hash) ⇒ Object
86 87 88 |
# File 'lib/dining-table/presenters/html_presenter_configuration.rb', line 86 def self.from_hash( hash ) new.merge_hash( hash ) end |
Instance Method Details
#initialize_copy(source) ⇒ Object
for deep dup
91 92 93 94 95 |
# File 'lib/dining-table/presenters/html_presenter_configuration.rb', line 91 def initialize_copy( source ) TAGS.each do |tag| self.send("#{ tag }=", source.send( tag ).dup) end end |
#merge_hash(hash) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/dining-table/presenters/html_presenter_configuration.rb', line 77 def merge_hash( hash ) return self if !hash = hash[ :tags ] TAGS.each do |tag| self.send("#{ tag }").merge_hash( [ tag ] ) end if self end |