Class: AsciiChem::Layout::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/asciichem/layout.rb

Overview

Layout result: positioned atoms and bonds ready for rendering.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#atomsObject

Returns the value of attribute atoms

Returns:

  • (Object)

    the current value of atoms



33
34
35
# File 'lib/asciichem/layout.rb', line 33

def atoms
  @atoms
end

#bondsObject

Returns the value of attribute bonds

Returns:

  • (Object)

    the current value of bonds



33
34
35
# File 'lib/asciichem/layout.rb', line 33

def bonds
  @bonds
end

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



33
34
35
# File 'lib/asciichem/layout.rb', line 33

def height
  @height
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



33
34
35
# File 'lib/asciichem/layout.rb', line 33

def width
  @width
end

Instance Method Details

#atoms_by_idObject



34
35
36
# File 'lib/asciichem/layout.rb', line 34

def atoms_by_id
  @atoms_by_id ||= atoms.to_h { |a| [a.id, a] }
end

#empty?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/asciichem/layout.rb', line 38

def empty?
  atoms.empty?
end