Class: Togls::Rule
- Inherits:
-
Object
- Object
- Togls::Rule
- Defined in:
- lib/togls/rule.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(data = nil) ⇒ Rule
constructor
A new instance of Rule.
- #run(key, target = nil) ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ Rule
Returns a new instance of Rule.
5 6 7 |
# File 'lib/togls/rule.rb', line 5 def initialize(data=nil) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/togls/rule.rb', line 3 def data @data end |
Instance Method Details
#id ⇒ Object
15 16 17 |
# File 'lib/togls/rule.rb', line 15 def id Togls::Helpers.sha1(self.class, @data) end |
#run(key, target = nil) ⇒ Object
9 10 11 12 13 |
# File 'lib/togls/rule.rb', line 9 def run(key, target = nil) raise Togls::NotImplemented.new( "Rule's #run method must be implemented" ) end |