Class: Ashikawa::Core::Figure

Inherits:
Object
  • Object
show all
Defined in:
lib/ashikawa-core/figure.rb

Overview

Wrapper around figures of a collection

Instance Method Summary collapse

Constructor Details

#initialize(raw_figure) ⇒ Figure

Create a wrapper around given figures

Examples:

Create a new figure from a raw figure

figure = Ashikawa::Core::Figure.new(raw_figure)

Parameters:

  • raw_figure (Hash)


12
13
14
15
16
17
18
19
# File 'lib/ashikawa-core/figure.rb', line 12

def initialize(raw_figure)
  @datafiles  = raw_figure['datafiles']
  @alive      = raw_figure['alive']
  @dead       = raw_figure['dead']
  @shapes     = raw_figure['shapes']
  @journals   = raw_figure['journals']
  @attributes = raw_figure['attributes']
end

Instance Method Details

#alive_countObject

The number of living documents

Examples:

Get the number of living documents

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.alive_count #=> 1337

Returns:

  • Fixnum



61
62
63
# File 'lib/ashikawa-core/figure.rb', line 61

def alive_count
  @alive['count']
end

#alive_sizeObject

The total size in bytes used by all living documents

Examples:

Get the size of all living documents in bytes

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.alive_size #=> 1337

Returns:

  • Fixnum



50
51
52
# File 'lib/ashikawa-core/figure.rb', line 50

def alive_size
  @alive['size']
end

#attributes_countObject

Number of different attributes that are or have been used in the collection

Examples:

Get the number of attributes

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.attributes_count #=> 12

Returns:

  • Fixnum



138
139
140
# File 'lib/ashikawa-core/figure.rb', line 138

def attributes_count
  @attributes['count']
end

#datafiles_countObject

The number of active datafiles

Examples:

Get the number of datafiles

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.datafiles_count #=> 1337

Returns:

  • Fixnum



28
29
30
# File 'lib/ashikawa-core/figure.rb', line 28

def datafiles_count
  @datafiles['count']
end

#datafiles_file_sizeObject

The file size of datafiles

Examples:

Get the file size of datafiles

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.datafile_size #=> 1337

Returns:

  • Fixnum



39
40
41
# File 'lib/ashikawa-core/figure.rb', line 39

def datafiles_file_size
  @datafiles['fileSize']
end

#dead_countObject

The number of dead documents

Examples:

Get the number of dead documents

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.dead_count #=> 1337

Returns:

  • Fixnum



83
84
85
# File 'lib/ashikawa-core/figure.rb', line 83

def dead_count
  @dead['count']
end

#dead_deletionObject

The number of deletion markers

Examples:

Get the number of deletion markers

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.dead_deletion #=> 1337

Returns:

  • Fixnum



105
106
107
# File 'lib/ashikawa-core/figure.rb', line 105

def dead_deletion
  @dead['deletion']
end

#dead_sizeObject

The total size in bytes used by all dead documents

Examples:

Get the size of all dead documents in bytes

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.dead_size #=> 1337

Returns:

  • Fixnum



72
73
74
# File 'lib/ashikawa-core/figure.rb', line 72

def dead_size
  @dead['size']
end

#journals_countObject

The number of journals

Examples:

Get the number of journals

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.journal_count #=> 1337

Returns:

  • Fixnum



116
117
118
# File 'lib/ashikawa-core/figure.rb', line 116

def journals_count
  @journals['count']
end

#journals_file_sizeObject

The file size of journals

Examples:

Get the file size of journals

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.journal_size #=> 1337

Returns:

  • Fixnum



127
128
129
# File 'lib/ashikawa-core/figure.rb', line 127

def journals_file_size
  @journals['fileSize']
end

#shapes_countObject

The total number of shapes used in the collection

Examples:

Get the number of shapes

figure = Ashikawa::Core::Figure.new(raw_figure)
figure.shapes_count #=> 1337

Returns:

  • Fixnum



94
95
96
# File 'lib/ashikawa-core/figure.rb', line 94

def shapes_count
  @shapes['count']
end