Module: HashInitialized
- Included in:
- DisjunctionPattern, ObjectMembersValidation, ObjectMembersValidationResult, UniformArrayPattern, Validation, ValidationFailure
- Defined in:
- lib/json_patterns.rb
Instance Method Summary collapse
Instance Method Details
#initialize(opts = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/json_patterns.rb', line 8 def initialize(opts={}) opts.each { |k, v| # TODO: No guarantee that the method is really a reader for that attribute - this would be # better handled with a specialized attribute maker. raise "class #{self.class} has no attribute #{k.inspect}" unless self.respond_to?(k) self.instance_variable_set("@#{k}", v) } end |