lib/characteristics.rb in characteristics-0.2.0 vs lib/characteristics.rb in characteristics-0.3.0
- old
+ new
@@ -12,11 +12,11 @@
:ascii
when "ASCII-8BIT"
:binary
when /^UTF-/
:unicode
- when /^ISO-8859-/, /^Windows-125/
+ when /^ISO-8859-/, /^Windows-125/, /^(IBM|CP85)/, /^mac/, 'TIS-620', 'Windows-874', /^KOI8-/
:byte
else
raise ArgumentError, "encoding <#{encoding_name}> not supported"
end
end
@@ -39,27 +39,31 @@
end
attr_reader :encoding
def initialize(char)
+ raise ArgumentError, "Do not use abstract Characteristics.new(char) directly, please use Characteristics.create(char)" if self.class == Characteristics
+
@is_valid = char.valid_encoding?
@encoding = char.encoding
@encoding_name = @encoding.name
end
def valid?
@is_valid
end
def unicode?
- false
end
def assigned?
end
def control?
end
def blank?
+ end
+
+ def format?
end
end