Class: NETSNMP::MIB::Parser
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- NETSNMP::MIB::Parser
- Defined in:
- lib/netsnmp/mib/parser.rb
Instance Method Summary collapse
- #bracketed(atom) ⇒ Object
- #curly(atom) ⇒ Object
- #spaced(character = nil) ⇒ Object
- #square_bracketed(atom) ⇒ Object
- #with_separator(atom, separator = nil) ⇒ Object
Instance Method Details
#bracketed(atom) ⇒ Object
21 22 23 |
# File 'lib/netsnmp/mib/parser.rb', line 21 def bracketed(atom) str("(") >> space.repeat >> atom >> space.repeat >> str(")") end |
#curly(atom) ⇒ Object
17 18 19 |
# File 'lib/netsnmp/mib/parser.rb', line 17 def curly(atom) str("{") >> space.repeat >> atom >> space.repeat >> str("}") end |
#spaced(character = nil) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/netsnmp/mib/parser.rb', line 9 def spaced(character = nil) if character.nil? && block_given? yield >> space.repeat else str(character) >> space.repeat end end |
#square_bracketed(atom) ⇒ Object
25 26 27 |
# File 'lib/netsnmp/mib/parser.rb', line 25 def square_bracketed(atom) str("[") >> space.repeat >> atom >> space.repeat >> str("]") end |
#with_separator(atom, separator = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/netsnmp/mib/parser.rb', line 29 def with_separator(atom, separator = nil) if separator sep = if separator.is_a?(String) space.repeat >> str(separator) >> space.repeat else separator end atom >> (sep >> atom).repeat else atom >> (space.repeat >> atom).repeat end end |