Class: Togls::Rule
- Inherits:
-
Object
- Object
- Togls::Rule
- Defined in:
- lib/togls/rule.rb
Overview
Rule
The Rule is an abstract base class that is intended to act as an interface for other rules to be implemented against.
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.
9 10 11 |
# File 'lib/togls/rule.rb', line 9 def initialize(data = nil) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/togls/rule.rb', line 7 def data @data end |
Instance Method Details
#id ⇒ Object
17 18 19 |
# File 'lib/togls/rule.rb', line 17 def id Togls::Helpers.sha1(self.class, @data) end |
#run(key, target = nil) ⇒ Object
13 14 15 |
# File 'lib/togls/rule.rb', line 13 def run(key, target = nil) raise Togls::NotImplemented, "Rule's #run method must be implemented" end |