946: def initialize(arg = nil, &block)
947: case arg
948: when Text::Format
949: __create(arg.text) do
950: @columns = arg.columns
951: @tabstop = arg.tabstop
952: @first_indent = arg.first_indent
953: @body_indent = arg.body_indent
954: @format_style = arg.format_style
955: @left_margin = arg.left_margin
956: @right_margin = arg.right_margin
957: @extra_space = arg.extra_space
958: @tag_paragraph = arg.tag_paragraph
959: @tag_text = arg.tag_text
960: @abbreviations = arg.abbreviations
961: @nobreak = arg.nobreak
962: @nobreak_regex = arg.nobreak_regex
963: @text = arg.text
964: @hard_margins = arg.hard_margins
965: @split_words = arg.split_words
966: @split_rules = arg.split_rules
967: @hyphenator = arg.hyphenator
968: end
969: instance_eval(&block) unless block.nil?
970: when Hash
971: __create do
972: @columns = arg[:columns] || arg['columns'] || @columns
973: @tabstop = arg[:tabstop] || arg['tabstop'] || @tabstop
974: @first_indent = arg[:first_indent] || arg['first_indent'] || @first_indent
975: @body_indent = arg[:body_indent] || arg['body_indent'] || @body_indent
976: @format_style = arg[:format_style] || arg['format_style'] || @format_style
977: @left_margin = arg[:left_margin] || arg['left_margin'] || @left_margin
978: @right_margin = arg[:right_margin] || arg['right_margin'] || @right_margin
979: @extra_space = arg[:extra_space] || arg['extra_space'] || @extra_space
980: @text = arg[:text] || arg['text'] || @text
981: @tag_paragraph = arg[:tag_paragraph] || arg['tag_paragraph'] || @tag_paragraph
982: @tag_text = arg[:tag_text] || arg['tag_text'] || @tag_text
983: @abbreviations = arg[:abbreviations] || arg['abbreviations'] || @abbreviations
984: @nobreak = arg[:nobreak] || arg['nobreak'] || @nobreak
985: @nobreak_regex = arg[:nobreak_regex] || arg['nobreak_regex'] || @nobreak_regex
986: @hard_margins = arg[:hard_margins] || arg['hard_margins'] || @hard_margins
987: @split_rules = arg[:split_rules] || arg['split_rules'] || @split_rules
988: @hyphenator = arg[:hyphenator] || arg['hyphenator'] || @hyphenator
989: end
990: instance_eval(&block) unless block.nil?
991: when String
992: __create(arg, &block)
993: when NilClass
994: __create(&block)
995: else
996: raise TypeError
997: end
998: end