Created
June 27, 2013 14:25
-
-
Save raphink/5876847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
positionable do | |
def insync?(is) | |
# define sync | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ensurable do | |
desc "Ensure the presence, absence or position of the entry" | |
defaultvalues | |
newvalue(:positioned) do | |
current = self.retrieve | |
if current == :absent | |
provider.create | |
elsif !provider.in_position? | |
provider.destroy | |
provider.create | |
end | |
end | |
def insync?(is) | |
return true if should == :positioned and is == :present and provider.in_position? | |
super | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implies the code above (including ensurable) | |
positionable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment