Class: Togls::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/togls/rule.rb

Direct Known Subclasses

Togls::Rules::Boolean, Togls::Rules::Group

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/togls/rule.rb', line 3

def data
  @data
end

Instance Method Details

#idObject



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