Class: Blockhead::Schema
- Inherits:
-
Object
- Object
- Blockhead::Schema
- Defined in:
- lib/blockhead/schema.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
Instance Method Summary collapse
- #define(&block) ⇒ Object
-
#initialize(object) ⇒ Schema
constructor
A new instance of Schema.
Constructor Details
#initialize(object) ⇒ Schema
Returns a new instance of Schema.
9 10 11 |
# File 'lib/blockhead/schema.rb', line 9 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
3 4 5 |
# File 'lib/blockhead/schema.rb', line 3 def object @object end |
Class Method Details
.define(object, &block) ⇒ Object
5 6 7 |
# File 'lib/blockhead/schema.rb', line 5 def self.define(object, &block) new(object).define(&block) end |
Instance Method Details
#define(&block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/blockhead/schema.rb', line 13 def define(&block) fail 'No schema definition' unless block schema = Marshaller.new(object) schema.instance_eval(&block) schema end |