Class: Complex
Class Method Summary (collapse)
Instance Method Summary (collapse)
Class Method Details
+ (Boolean) generic?(other)
12 13 14 15 16 |
# File 'lib/complex.rb', line 12 def Complex.generic? (other) other.kind_of?(Integer) || other.kind_of?(Float) || other.kind_of?(Rational) end |
+ (Object) yaml_new(val)
234 235 236 237 238 239 240 |
# File 'lib/yaml/rubytypes.rb', line 234 def Complex.yaml_new(val) if val.is_a? String Complex(val) else Complex(val['real'], val['image']) end end |
Instance Method Details
- (Object) to_yaml(output = nil)
241 242 243 244 245 246 247 248 |
# File 'lib/yaml/rubytypes.rb', line 241 def to_yaml(output = nil) YAML::quick_emit(output) do |out| out.map(taguri, nil ) do |map| map.add('image', imaginary) map.add('real', real) end end end |