Class: PT::DataRow
- Inherits:
-
Object
- Object
- PT::DataRow
- Defined in:
- lib/pt/data_row.rb
Instance Attribute Summary collapse
-
#num ⇒ Object
Returns the value of attribute num.
-
#owners ⇒ Object
Returns the value of attribute owners.
-
#record ⇒ Object
Returns the value of attribute record.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #estimate ⇒ Object
-
#initialize(orig, dataset) ⇒ DataRow
constructor
A new instance of DataRow.
- #method_missing(method) ⇒ Object
- #name ⇒ Object
- #story_type ⇒ Object
- #to_s ⇒ Object
- #to_s_attribute ⇒ Object
Constructor Details
#initialize(orig, dataset) ⇒ DataRow
Returns a new instance of DataRow.
9 10 11 12 13 14 15 |
# File 'lib/pt/data_row.rb', line 9 def initialize(orig, dataset) @record = orig @num = dataset.index(orig) + 1 if defined? orig.current_state @state = orig.current_state end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
17 18 19 20 |
# File 'lib/pt/data_row.rb', line 17 def method_missing(method) str = @record.send(method).to_s str.respond_to?(:force_encoding) ? str.force_encoding('utf-8') : Iconv.iconv('UTF-8', 'UTF-8', str) end |
Instance Attribute Details
#num ⇒ Object
Returns the value of attribute num.
7 8 9 |
# File 'lib/pt/data_row.rb', line 7 def num @num end |
#owners ⇒ Object
Returns the value of attribute owners.
7 8 9 |
# File 'lib/pt/data_row.rb', line 7 def owners @owners end |
#record ⇒ Object
Returns the value of attribute record.
7 8 9 |
# File 'lib/pt/data_row.rb', line 7 def record @record end |
#state ⇒ Object
Returns the value of attribute state.
7 8 9 |
# File 'lib/pt/data_row.rb', line 7 def state @state end |
Instance Method Details
#estimate ⇒ Object
79 80 81 |
# File 'lib/pt/data_row.rb', line 79 def estimate @record.estimate.to_i if @record.estimate end |
#name ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/pt/data_row.rb', line 30 def name _name = @record.name if _name.size > 15 _name[0..15] + '...' else _name end end |
#story_type ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/pt/data_row.rb', line 63 def story_type t = @record.story_type case t when 'bug' '🐞' when 'feature' '⭐' when 'release' '🏁' when 'chore' '⚙️' else t end end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/pt/data_row.rb', line 22 def to_s @record.send(self.to_s_attribute) end |
#to_s_attribute ⇒ Object
26 27 28 |
# File 'lib/pt/data_row.rb', line 26 def to_s_attribute @n.to_s end |