Module: EPUB::Publication::FixedLayout::ItemrefMixin
- Extended by:
- Rendition
- Defined in:
- lib/epub/publication/fixed_layout.rb
Constant Summary collapse
- PAGE_SPREAD_PROPERTY =
'center'
- PAGE_SPREAD_PREFIX =
'rendition:page-spread-'
Class Method Summary collapse
Methods included from Rendition
def_rendition_layout_methods, def_rendition_methods
Class Method Details
.included(base) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/epub/publication/fixed_layout.rb', line 118 def included(base) return if base.instance_methods.include? :page_spread_without_fixed_layout base.__send__ :alias_method, :page_spread_without_fixed_layout, :page_spread base.__send__ :alias_method, :page_spread_writer_without_fixed_layout, :page_spread= prefixed_page_spread_property = "#{PAGE_SPREAD_PREFIX}#{PAGE_SPREAD_PROPERTY}" base.__send__ :define_method, :page_spread do property = page_spread_without_fixed_layout return property if property properties.include?(prefixed_page_spread_property) ? PAGE_SPREAD_PROPERTY : nil end base.__send__ :define_method, :page_spread= do |new_value| if new_value == PAGE_SPREAD_PROPERTY page_spread_writer_without_fixed_layout nil properties << prefixed_page_spread_property else page_spread_writer_without_fixed_layout new_value end new_value end end |