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