Class: Diamond::Pattern
- Inherits:
-
Object
- Object
- Diamond::Pattern
- Extended by:
- ClassMethods
- Defined in:
- lib/diamond/pattern.rb
Overview
Pattern that the sequence is derived from given the parameters and input
Defined Under Namespace
Modules: ClassMethods, Presets
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#compute(range, interval) ⇒ Array<Fixnum>
Compute scale degrees using the pattern with the given range and interval.
-
#initialize(name, &block) ⇒ Pattern
constructor
A new instance of Pattern.
Methods included from ClassMethods
<<, add, all, find, first, last
Constructor Details
#initialize(name, &block) ⇒ Pattern
Returns a new instance of Pattern.
55 56 57 58 |
# File 'lib/diamond/pattern.rb', line 55 def initialize(name, &block) @name = name @proc = block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
50 51 52 |
# File 'lib/diamond/pattern.rb', line 50 def name @name end |
Instance Method Details
#compute(range, interval) ⇒ Array<Fixnum>
Compute scale degrees using the pattern with the given range and interval
64 65 66 |
# File 'lib/diamond/pattern.rb', line 64 def compute(range, interval) @proc.call(range, interval) end |