Class: OrangeData::Document
- Inherits:
-
Object
- Object
- OrangeData::Document
- Defined in:
- lib/orange_data/receipt.rb
Overview
main class for receipt/correction
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#group ⇒ Object
Returns the value of attribute group.
-
#id ⇒ Object
Returns the value of attribute id.
-
#inn ⇒ Object
Returns the value of attribute inn.
-
#key_name ⇒ Object
Returns the value of attribute key_name.
Instance Method Summary collapse
-
#initialize(id: SecureRandom.uuid, inn:, group: nil, key_name: nil, content: nil) {|@content| ... } ⇒ Document
constructor
A new instance of Document.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(id: SecureRandom.uuid, inn:, group: nil, key_name: nil, content: nil) {|@content| ... } ⇒ Document
Returns a new instance of Document.
29 30 31 32 33 34 35 36 |
# File 'lib/orange_data/receipt.rb', line 29 def initialize(id:SecureRandom.uuid, inn:, group:nil, key_name:nil, content:nil) @id = id @inn = inn @group = group @key_name = key_name || inn @content = content if content yield @content if block_given? end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
27 28 29 |
# File 'lib/orange_data/receipt.rb', line 27 def content @content end |
#group ⇒ Object
Returns the value of attribute group.
27 28 29 |
# File 'lib/orange_data/receipt.rb', line 27 def group @group end |
#id ⇒ Object
Returns the value of attribute id.
27 28 29 |
# File 'lib/orange_data/receipt.rb', line 27 def id @id end |
#inn ⇒ Object
Returns the value of attribute inn.
27 28 29 |
# File 'lib/orange_data/receipt.rb', line 27 def inn @inn end |
#key_name ⇒ Object
Returns the value of attribute key_name.
27 28 29 |
# File 'lib/orange_data/receipt.rb', line 27 def key_name @key_name end |
Instance Method Details
#to_json(*args) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/orange_data/receipt.rb', line 38 def to_json(*args) { id: id, inn: inn, group: group || 'Main', content: content, key: key_name }.to_json(*args) end |