Class: Crabfarm::BaseStruct
- Inherits:
-
Object
- Object
- Crabfarm::BaseStruct
- Includes:
- Assertion::Fields, Base
- Defined in:
- lib/crabfarm/base_struct.rb
Instance Method Summary collapse
- #as_json(_options = nil) ⇒ Object
-
#initialize(_values = {}) ⇒ BaseStruct
constructor
A new instance of BaseStruct.
- #to_json(_options = {}) ⇒ Object
Methods included from Assertion::Fields
#field_hash, included, #reset_fields
Methods included from Assertion::Context
Methods included from Base
Constructor Details
#initialize(_values = {}) ⇒ BaseStruct
Returns a new instance of BaseStruct.
9 10 11 12 |
# File 'lib/crabfarm/base_struct.rb', line 9 def initialize(_values={}) reset_fields _values.each { |k,v| send("#{k}=", v) } end |
Instance Method Details
#as_json(_options = nil) ⇒ Object
14 15 16 |
# File 'lib/crabfarm/base_struct.rb', line 14 def as_json(=nil) field_hash end |
#to_json(_options = {}) ⇒ Object
18 19 20 |
# File 'lib/crabfarm/base_struct.rb', line 18 def to_json(={}) field_hash.to_json() end |