Class: Clef::Layout::SystemLayout::System

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_momentObject

Returns the value of attribute end_moment

Returns:

  • (Object)

    the current value of end_moment



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def end_moment
  @end_moment
end

#line_indexObject

Returns the value of attribute line_index

Returns:

  • (Object)

    the current value of line_index



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def line_index
  @line_index
end

#line_topObject

Returns the value of attribute line_top

Returns:

  • (Object)

    the current value of line_top



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def line_top
  @line_top
end

#page_indexObject

Returns the value of attribute page_index

Returns:

  • (Object)

    the current value of page_index



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def page_index
  @page_index
end

#position_offsetObject

Returns the value of attribute position_offset

Returns:

  • (Object)

    the current value of position_offset



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def position_offset
  @position_offset
end

#staff_offsetsObject

Returns the value of attribute staff_offsets

Returns:

  • (Object)

    the current value of staff_offsets



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def staff_offsets
  @staff_offsets
end

#start_momentObject

Returns the value of attribute start_moment

Returns:

  • (Object)

    the current value of start_moment



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def start_moment
  @start_moment
end

#x_originObject

Returns the value of attribute x_origin

Returns:

  • (Object)

    the current value of x_origin



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def x_origin
  @x_origin
end

#y_originObject

Returns the value of attribute y_origin

Returns:

  • (Object)

    the current value of y_origin



6
7
8
# File 'lib/clef/layout/system_layout.rb', line 6

def y_origin
  @y_origin
end

Instance Method Details

#include_moment?(moment) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/clef/layout/system_layout.rb', line 16

def include_moment?(moment)
  value = moment.is_a?(Clef::Ir::Moment) ? moment.value : Rational(moment)
  value.between?(start_moment.value, end_moment.value)
end

#staff_offset(staff_id) ⇒ Object



8
9
10
# File 'lib/clef/layout/system_layout.rb', line 8

def staff_offset(staff_id)
  staff_offsets.fetch(staff_id)
end

#staff_origin(staff_id) ⇒ Object



12
13
14
# File 'lib/clef/layout/system_layout.rb', line 12

def staff_origin(staff_id)
  [x_origin, y_origin + staff_offset(staff_id)]
end