Class: Fanxobj
- Inherits:
-
Object
- Object
- Fanxobj
- Defined in:
- lib/melody_object/Level_three.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#hilimit ⇒ Object
Returns the value of attribute hilimit.
-
#lolimit ⇒ Object
Returns the value of attribute lolimit.
-
#secondvariable ⇒ Object
Returns the value of attribute secondvariable.
-
#variable ⇒ Object
Returns the value of attribute variable.
Instance Method Summary collapse
- #fanx ⇒ Object
-
#initialize(hsh = {}) ⇒ Fanxobj
constructor
A new instance of Fanxobj.
Constructor Details
#initialize(hsh = {}) ⇒ Fanxobj
Returns a new instance of Fanxobj.
78 79 80 81 82 83 84 |
# File 'lib/melody_object/Level_three.rb', line 78 def initialize(hsh={}) @variable=hsh[:var]||=60 @hilimit=hsh[:hi]||=72 @lolimit=hsh[:lo]||=48 @secondvariable=hsh[:secvar]||=5 @direction=hsh[:dir]||=:up end |
Instance Attribute Details
#direction ⇒ Object
Returns the value of attribute direction.
75 76 77 |
# File 'lib/melody_object/Level_three.rb', line 75 def direction @direction end |
#hilimit ⇒ Object
Returns the value of attribute hilimit.
72 73 74 |
# File 'lib/melody_object/Level_three.rb', line 72 def hilimit @hilimit end |
#lolimit ⇒ Object
Returns the value of attribute lolimit.
74 75 76 |
# File 'lib/melody_object/Level_three.rb', line 74 def lolimit @lolimit end |
#secondvariable ⇒ Object
Returns the value of attribute secondvariable.
73 74 75 |
# File 'lib/melody_object/Level_three.rb', line 73 def secondvariable @secondvariable end |
#variable ⇒ Object
Returns the value of attribute variable.
71 72 73 |
# File 'lib/melody_object/Level_three.rb', line 71 def variable @variable end |
Instance Method Details
#fanx ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/melody_object/Level_three.rb', line 86 def fanx if @variable>@hilimit then @direction=:down @variable-=@secondvariable elsif @variable<@lolimit then @direction=:up @variable+=@secondvariable else case @direction when :up @variable+=@secondvariable when :down @variable-=@secondvariable end end #~ @fyl.puts "#{self} #{@variable}" return @variable end |