Class: Golden_Sections
- Inherits:
-
Object
- Object
- Golden_Sections
- Defined in:
- lib/project/handler.rb,
lib/project/constants.rb,
lib/project/goldensections.rb
Overview
Golden_Sections handler for common methods
Constant Summary collapse
- CGPoint_proc =
CGPoint initializer
lambda {|| CGPoint.new([:x], [:y])}
- CGSize_proc =
CGSize initializer
lambda {|| CGSize.new([:width], [:height])}
- CGRect_proc =
CGRect initializer
lambda {|| CGRect.new([[:x], [:y]], [[:width], [:height]])}
- Version =
The version of golden-sections
'0.0.2'
- Golden_Mean =
The all-important golden mean
1.6180339
- CGPoint_relations =
Relations of CGPoint attributes
{:x => :y}
- CGSize_relations =
Relations of CGSize attributes
{:width => :height}
- CGRect_relations =
Relations of CGRect attributes
{:x => :y, :width => :height}
Class Method Summary collapse
-
.handler(relations, options, &init) ⇒ Object
A common handler for golden_section methods.
Class Method Details
.handler(relations, options, &init) ⇒ Object
A common handler for golden_section methods
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/project/handler.rb', line 9 def self.handler(relations, , &init) [:exponent]||=1 relations.each do |relation1, relation2| if [relation1]&&![relation2] [relation2]=[relation1].golden_section([:exponent]) elsif [relation2]&&![relation1] [relation1]=[relation2].golden_section([:exponent]) end end init.call() end |