Class: CfSim::PointList
- Inherits:
-
Object
- Object
- CfSim::PointList
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/cf_sim/point_list.rb
Instance Attribute Summary collapse
-
#points ⇒ Object
readonly
Returns the value of attribute points.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #creatable_field_count ⇒ Object
- #creatable_fields ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(*points) ⇒ PointList
constructor
A new instance of PointList.
- #max_field_count ⇒ Object
Constructor Details
#initialize(*points) ⇒ PointList
Returns a new instance of PointList.
13 14 15 |
# File 'lib/cf_sim/point_list.rb', line 13 def initialize(*points) @points = points.flatten.freeze end |
Instance Attribute Details
#points ⇒ Object (readonly)
Returns the value of attribute points.
10 11 12 |
# File 'lib/cf_sim/point_list.rb', line 10 def points @points end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 |
# File 'lib/cf_sim/point_list.rb', line 33 def ==(other) eql?(other) end |
#creatable_field_count ⇒ Object
21 22 23 |
# File 'lib/cf_sim/point_list.rb', line 21 def creatable_field_count @creatable_field_count ||= points.combination(3).size end |
#creatable_fields ⇒ Object
25 26 27 |
# File 'lib/cf_sim/point_list.rb', line 25 def creatable_fields @creatable_fields ||= CfSim::ControlFieldSet.new(points.combination(3).map { |a, b, c| CfSim::ControlField.new(a, b, c) }) end |
#eql?(other) ⇒ Boolean
29 30 31 |
# File 'lib/cf_sim/point_list.rb', line 29 def eql?(other) other.class == CfSim::PointList && @points == other.points end |
#max_field_count ⇒ Object
17 18 19 |
# File 'lib/cf_sim/point_list.rb', line 17 def max_field_count @max_field_count ||= 3 * (points.length - 3) + 1 end |