textwrap 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/textwrap.rb +18 -13
  2. metadata +1 -1
@@ -120,20 +120,23 @@ module Textwrap
120
120
  end
121
121
 
122
122
  class TextWrapper
123
- @@kwargs = {
124
- :width => 70,
125
- :expand_tabs => true,
126
- :replace_whitespace => true,
127
- :initial_indent => '',
128
- :subsequent_indent => '',
129
- :break_long_words => true
130
- }
131
-
132
- attr_accessor *@@kwargs.keys
123
+ @@kwargs = [
124
+ :width,
125
+ :expand_tabs,
126
+ :replace_whitespace,
127
+ :initial_indent,
128
+ :subsequent_indent,
129
+ :break_long_words,
130
+ :consider_linebreak_whitespace,
131
+ :code
132
+ ]
133
+
134
+ attr_accessor *@@kwargs
133
135
 
134
136
  def initialize(options = {})
135
- @@kwargs.each do |kw, defval|
136
- self.instance_variable_set("@#{kw}", options.fetch(kw, defval))
137
+ @@kwargs.each do |kw|
138
+ next unless options.has_key?(kw)
139
+ self.instance_variable_set("@#{kw}", options[kw])
137
140
  end
138
141
  end
139
142
 
@@ -157,7 +160,9 @@ class TextWrapper
157
160
 
158
161
  instance_options = {}
159
162
 
160
- @@kwargs.each do |kw, defval|
163
+ @@kwargs.each do |kw|
164
+ val = self.instance_variable_get("@#{kw}")
165
+ next if val.nil?
161
166
  instance_options[kw] = self.instance_variable_get("@#{kw}")
162
167
  end
163
168
 
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: textwrap
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
6
+ version: 0.1.2
7
7
  date: 2007-10-28 00:00:00 +09:00
8
8
  summary: Text wrapping and filling library like Python textwrap module.
9
9
  require_paths: