Class: Waffle::Maker::Waf
- Inherits:
-
Object
- Object
- Waffle::Maker::Waf
- Defined in:
- lib/waffle/maker/waf.rb
Instance Attribute Summary collapse
-
#path_position ⇒ Object
Returns the value of attribute path_position.
Instance Method Summary collapse
-
#each(&_block) ⇒ Object
[ { raw: “2019/01/01 01:01:01t8.8.8.8t/homest攻撃t○”, path: “/hoems” }, { raw: “2019/01/01 01:01:01t8.8.8.8t/userst攻撃t○”, path: “/users” }, … ].
-
#initialize(path_position) ⇒ Waf
constructor
A new instance of Waf.
- #parse_symbol ⇒ Object
Constructor Details
#initialize(path_position) ⇒ Waf
Returns a new instance of Waf.
10 11 12 |
# File 'lib/waffle/maker/waf.rb', line 10 def initialize(path_position) self.path_position = path_position end |
Instance Attribute Details
#path_position ⇒ Object
Returns the value of attribute path_position.
8 9 10 |
# File 'lib/waffle/maker/waf.rb', line 8 def path_position @path_position end |
Instance Method Details
#each(&_block) ⇒ Object
[ { raw: “2019/01/01 01:01:01t8.8.8.8t/homest攻撃t○”, path: “/hoems” }, { raw: “2019/01/01 01:01:01t8.8.8.8t/userst攻撃t○”, path: “/users” }, … ]
19 20 21 22 23 24 25 26 27 |
# File 'lib/waffle/maker/waf.rb', line 19 def each(&_block) $stdin.each(chomp: true) do |line| o = { raw: line, path: line.split(/#{parse_symbol}/)[path_position] } yield o end end |
#parse_symbol ⇒ Object
30 31 32 |
# File 'lib/waffle/maker/waf.rb', line 30 def parse_symbol ENV.fetch("IFS", "\t") end |