Class: JSONCop::Model::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/jsoncop/model/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Model

Returns a new instance of Model.



10
11
12
13
14
15
# File 'lib/jsoncop/model/model.rb', line 10

def initialize(name)
    @name = name.gsub(/\s+/, "")
    @attributes = []
    @transformers = []
    @attr_json_hash = {}
end

Instance Attribute Details

#attr_json_hashObject

Returns the value of attribute attr_json_hash.



8
9
10
# File 'lib/jsoncop/model/model.rb', line 8

def attr_json_hash
  @attr_json_hash
end

#attributesObject

Returns the value of attribute attributes.



6
7
8
# File 'lib/jsoncop/model/model.rb', line 6

def attributes
  @attributes
end

#is_structObject

Returns the value of attribute is_struct.



5
6
7
# File 'lib/jsoncop/model/model.rb', line 5

def is_struct
  @is_struct
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/jsoncop/model/model.rb', line 4

def name
  @name
end

#transformersObject

Returns the value of attribute transformers.



7
8
9
# File 'lib/jsoncop/model/model.rb', line 7

def transformers
  @transformers
end

Instance Method Details

#key_value_pairObject



17
18
19
# File 'lib/jsoncop/model/model.rb', line 17

def key_value_pair
  attributes.map { |attribute| "#{attribute.name}: #{attribute.name}" }.join(", ")
end