Class: TorigoyaKit::SourceData
- Inherits:
-
Object
- Object
- TorigoyaKit::SourceData
- Defined in:
- lib/torigoya_kit/ticket.rb
Overview
contains source codes / inputs data
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#is_compressed ⇒ Object
readonly
Returns the value of attribute is_compressed.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(rhs) ⇒ Object
-
#initialize(name, code, is_compressed = false) ⇒ SourceData
constructor
A new instance of SourceData.
- #to_hash ⇒ Object
- #to_msgpack(out = '') ⇒ Object
Constructor Details
#initialize(name, code, is_compressed = false) ⇒ SourceData
Returns a new instance of SourceData.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/torigoya_kit/ticket.rb', line 14 def initialize(name, code, is_compressed = false) @name = name @data = if is_compressed then # NOT: implemented else code end @is_compressed = is_compressed validate end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
25 26 27 |
# File 'lib/torigoya_kit/ticket.rb', line 25 def data @data end |
#is_compressed ⇒ Object (readonly)
Returns the value of attribute is_compressed.
25 26 27 |
# File 'lib/torigoya_kit/ticket.rb', line 25 def is_compressed @is_compressed end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/torigoya_kit/ticket.rb', line 25 def name @name end |
Class Method Details
.make_with_compress(name, code) ⇒ Object
10 11 12 |
# File 'lib/torigoya_kit/ticket.rb', line 10 def self.make_with_compress(name, code) return self.new(name, code, true) end |
Instance Method Details
#==(rhs) ⇒ Object
39 40 41 42 43 |
# File 'lib/torigoya_kit/ticket.rb', line 39 def ==(rhs) return @name == rhs.name && @data == rhs.data @is_compressed == rhs.is_compressed end |
#to_hash ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/torigoya_kit/ticket.rb', line 27 def to_hash return { name: @name, data: @data, is_compressed: @is_compressed, } end |
#to_msgpack(out = '') ⇒ Object
35 36 37 |
# File 'lib/torigoya_kit/ticket.rb', line 35 def to_msgpack(out = '') return to_hash.to_msgpack(out) end |