Class: Doodle

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
Core, JSON
Defined in:
lib/doodle/app.rb,
lib/doodle/xml.rb,
lib/doodle/base.rb,
lib/doodle/core.rb,
lib/doodle/info.rb,
lib/doodle/json.rb,
lib/doodle/debug.rb,
lib/doodle/utils.rb,
lib/doodle/factory.rb,
lib/doodle/inherit.rb,
lib/doodle/marshal.rb,
lib/doodle/to_hash.rb,
lib/doodle/version.rb,
lib/doodle/deferred.rb,
lib/doodle/equality.rb,
lib/doodle/attribute.rb,
lib/doodle/collector.rb,
lib/doodle/collector.rb,
lib/doodle/datatypes.rb,
lib/doodle/singleton.rb,
lib/doodle/comparable.rb,
lib/doodle/conversion.rb,
lib/doodle/exceptions.rb,
lib/doodle/validation.rb,
lib/molic_orderedhash.rb,
lib/doodle/ordered-hash.rb,
lib/doodle/collector-1.9.rb,
lib/doodle/getter-setter.rb,
lib/doodle/datatype-holder.rb,
lib/doodle/smoke-and-mirrors.rb

Overview

1.8.7+ versions

Direct Known Subclasses

App, DoodleAttribute, XML::Document

Defined Under Namespace

Modules: BaseMethods, BuiltIns, ClassMethods, Comparable, ConversionHelper, Core, DataTypes, Debug, Equality, EscapeXML, Factory, GetterSetter, Inherited, JSON, ModMarshal, Singleton, SmokeAndMirrors, ToHash, Utils, VERSION, ValidationHelper, XML Classes: App, AppendableAttribute, AttributeCollector, ConversionError, DataTypeHolder, DeferredBlock, DoodleAttribute, DoodleInfo, InvalidOrderError, KeyedAttribute, NoDefaultError, OrderedHash, ReadOnlyError, UnknownAttributeError, Validation, ValidationError

Constant Summary collapse

@@raise_exception_on_error =

error handling

true

Class Method Summary collapse

Methods included from ClassMethods

context, parent

Methods included from JSON

included

Methods included from Core::ModuleMethods

#included

Class Method Details

.raise_exception_on_errorObject



4
5
6
# File 'lib/doodle/exceptions.rb', line 4

def self.raise_exception_on_error
  @@raise_exception_on_error
end

.raise_exception_on_error=(tf) ⇒ Object



7
8
9
# File 'lib/doodle/exceptions.rb', line 7

def self.raise_exception_on_error=(tf)
  @@raise_exception_on_error = tf
end

.TypedArray(*klasses) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/doodle/collector.rb', line 3

def self.TypedArray(*klasses)
  typed_class = Class.new(NormalizedArray) do
    define_method :normalize_value do |v|
      if !klasses.any?{ |klass| v.kind_of?(klass) }
        raise TypeError, "#{self.class}: #{v.class}(#{v.inspect}) is not a kind of #{klasses.map{ |c| c.to_s }.join(', ')}", [caller[-1]]
      end
      v
    end
  end
  #p [:creating_class, typed_class]
  typed_class
end