Class: AttributeStats::AttributeInfo
- Inherits:
-
Object
- Object
- AttributeStats::AttributeInfo
- Defined in:
- lib/entities/attribute_info.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#empty ⇒ Object
readonly
Returns the value of attribute empty.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#usage_percent ⇒ Object
readonly
Returns the value of attribute usage_percent.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(attribute_name) ⇒ AttributeInfo
constructor
A new instance of AttributeInfo.
- #set_emptyness(is_empty) ⇒ Object
- #set_usage(record_count, table_total_record_count) ⇒ Object
Constructor Details
#initialize(attribute_name) ⇒ AttributeInfo
Returns a new instance of AttributeInfo.
5 6 7 |
# File 'lib/entities/attribute_info.rb', line 5 def initialize(attribute_name) @name = attribute_name end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
3 4 5 |
# File 'lib/entities/attribute_info.rb', line 3 def count @count end |
#empty ⇒ Object (readonly)
Returns the value of attribute empty.
3 4 5 |
# File 'lib/entities/attribute_info.rb', line 3 def empty @empty end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/entities/attribute_info.rb', line 3 def name @name end |
#usage_percent ⇒ Object (readonly)
Returns the value of attribute usage_percent.
3 4 5 |
# File 'lib/entities/attribute_info.rb', line 3 def usage_percent @usage_percent end |
Instance Method Details
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/entities/attribute_info.rb', line 19 def empty? @empty end |
#set_emptyness(is_empty) ⇒ Object
15 16 17 |
# File 'lib/entities/attribute_info.rb', line 15 def set_emptyness(is_empty) @empty = is_empty end |
#set_usage(record_count, table_total_record_count) ⇒ Object
9 10 11 12 13 |
# File 'lib/entities/attribute_info.rb', line 9 def set_usage(record_count, table_total_record_count) @count = record_count @usage_percent = (record_count / table_total_record_count.to_f).round(5) @empty = record_count == 0 end |