Skip to content

Commit

Permalink
🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
kn1kn1 committed Sep 11, 2017
1 parent 8fa79ec commit c3c2216
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions petal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def play_array(arry, dur, loop_index, cycle)
end

def calc_rand(r)
if r.is_a?(Rand)
if r.instance_of?(Rand)
rrand(r.min.to_f, r.max.to_f)
elsif r.is_a?(IRand)
elsif r.instance_of?(IRand)
rrand_i(r.min.to_i, r.max.to_i)
end
end
Expand Down
13 changes: 3 additions & 10 deletions petal_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,15 @@ def initialize(min, max)

def ==(other)
return false if other.nil?
return false unless other.is_a?(Rand)
return false unless other.instance_of?(Rand)
@min == other.min && @max == other.max
end
end

class IRand
attr_reader :min
attr_reader :max
def initialize(min, max)
@min = min
@max = max
end

class IRand < Rand
def ==(other)
return false if other.nil?
return false unless other.is_a?(IRand)
return false unless other.instance_of?(IRand)
@min == other.min && @max == other.max
end
end
Expand Down

0 comments on commit c3c2216

Please sign in to comment.