Class: AttributeStats::AttributeInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/entities/attribute_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject (readonly)

Returns the value of attribute count.



3
4
5
# File 'lib/entities/attribute_info.rb', line 3

def count
  @count
end

#emptyObject (readonly)

Returns the value of attribute empty.



3
4
5
# File 'lib/entities/attribute_info.rb', line 3

def empty
  @empty
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/entities/attribute_info.rb', line 3

def name
  @name
end

#usage_percentObject (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

Returns:

  • (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