Class: WebShield::Shield
- Inherits:
-
Object
- Object
- WebShield::Shield
- Defined in:
- lib/web_shield/shield.rb
Direct Known Subclasses
Constant Summary collapse
- OPTION_KEYS =
[:period, :limit, :method, :path_sensitive, :dictatorial]
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path_matcher ⇒ Object
readonly
Returns the value of attribute path_matcher.
-
#shield_path ⇒ Object
readonly
Returns the value of attribute shield_path.
Instance Method Summary collapse
- #dictatorial? ⇒ Boolean
-
#filter(request) ⇒ Object
Returns: :pass, :block, [:response, rack_response], nil.
-
#initialize(id, shield_path, options, config) ⇒ Shield
constructor
Params: path: options: period: required limit: required method: optional path_sensitive: optional, defualt false.
Constructor Details
#initialize(id, shield_path, options, config) ⇒ Shield
Params:
path:
options:
period: required
limit: required
method: optional
path_sensitive: optional, defualt false
15 16 17 18 19 20 21 |
# File 'lib/web_shield/shield.rb', line 15 def initialize(id, shield_path, , config) @id = id @shield_path = shield_path @path_matcher = build_path_matcher(shield_path) = hash_to_symbol_keys() @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/web_shield/shield.rb', line 5 def config @config end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/web_shield/shield.rb', line 5 def id @id end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/web_shield/shield.rb', line 5 def end |
#path_matcher ⇒ Object (readonly)
Returns the value of attribute path_matcher.
5 6 7 |
# File 'lib/web_shield/shield.rb', line 5 def path_matcher @path_matcher end |
#shield_path ⇒ Object (readonly)
Returns the value of attribute shield_path.
5 6 7 |
# File 'lib/web_shield/shield.rb', line 5 def shield_path @shield_path end |
Instance Method Details
#dictatorial? ⇒ Boolean
28 29 30 |
# File 'lib/web_shield/shield.rb', line 28 def dictatorial? [:dictatorial] end |
#filter(request) ⇒ Object
Returns: :pass, :block, [:response, rack_response], nil
24 25 26 |
# File 'lib/web_shield/shield.rb', line 24 def filter(request) raise Error, "implement me" end |