module EPUB::Publication::FixedLayout::Rendition
Public Instance Methods
Source
# File lib/epub/publication/fixed_layout.rb, line 39 def def_rendition_layout_methods property = 'layout' RENDITION_PROPERTIES[property].each do |value| method_name_base = value.gsub('-', '_') writer_name = "#{method_name_base}=" define_method writer_name do |new_value| new_prop = new_value ? value : values.find {|l| l != value} __send__ "rendition_#{property}=", new_prop end maker_name = "make_#{method_name_base}" define_method maker_name do __send__ "rendition_#{property}=", value end destructive_method_name = "#{method_name_base}!" alias_method destructive_method_name, maker_name predicate_name = "#{method_name_base}?" define_method predicate_name do __send__("rendition_#{property}") == value end end end
Source
# File lib/epub/publication/fixed_layout.rb, line 31 def def_rendition_methods RENDITION_PROPERTIES.each_key do |property| alias_method property, "rendition_#{property}" alias_method "#{property}=", "rendition_#{property}=" end def_rendition_layout_methods end
@note Call after defining rendition_xxx and renditionn_xxx=