Of course enum's don't exist in Ruby, but based on this post I've used something like the following:
class PostType
Page = 1,
Post = 2
end
I want to pass the value to a method and use it for a comparison. So:
initialize(post_type)
if post_type = PostType::Page
# do something here
elsif post_type = PostType::Post
# do something else here
end
end
But this doesn't work, regardless of what I pass into the constructor of my class, it always yields the same result.
Any ideas as to why passing the "fake enum" into a method and trying to compare it won't work? Do I have to compare the value? i.e. post_type = 2
?