Class: JsonRuleObject

Inherits:
JsonRuleBase show all
Defined in:
lib/rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJsonRuleObject

Returns a new instance of JsonRuleObject.



9
10
11
12
13
# File 'lib/rules.rb', line 9

def initialize()
  @allow_other_keys = true
  @key_rules = []
  @keys = []
end

Instance Attribute Details

#allow_other_keysObject (readonly)

Returns the value of attribute allow_other_keys.



7
8
9
# File 'lib/rules.rb', line 7

def allow_other_keys
  @allow_other_keys
end

#key_rulesObject (readonly)

Returns the value of attribute key_rules.



7
8
9
# File 'lib/rules.rb', line 7

def key_rules
  @key_rules
end

#keysObject (readonly)

Returns the value of attribute keys.



7
8
9
# File 'lib/rules.rb', line 7

def keys
  @keys
end

Instance Method Details

#add_key_rule(rule) ⇒ Object



20
21
22
23
24
# File 'lib/rules.rb', line 20

def add_key_rule(rule)
  @key_rules.push(rule)
  @keys.push(rule.key)
  self
end

#disallow_other_keysObject



15
16
17
18
# File 'lib/rules.rb', line 15

def disallow_other_keys
  @allow_other_keys = false
  self
end