class Whois::Scanners::WhoisNicIt

Private Instance Methods

parse_section_items() click to toggle source
# File lib/whois/scanners/whois.nic.it.rb, line 42
def parse_section_items
  if @input.match?(/(\s+)([^:]+?)\n/)
    items = []
    indentation = @input[1].length
    while item = parse_section_items_item(indentation)
      items << item
    end
    items
  end
end
parse_section_items_item(indentation) click to toggle source
# File lib/whois/scanners/whois.nic.it.rb, line 53
def parse_section_items_item(indentation)
  if @input.scan(/\s{#{indentation}}(.+)\n/)
    @input[1]
  end
end
parse_section_pair() click to toggle source
# File lib/whois/scanners/whois.nic.it.rb, line 71
def parse_section_pair
  if @input.scan(/(\s+)(.+?):(\s+)(.*?)\n/)
    key = @input[2].strip
    values = [@input[4].strip]
    indentation = @input[1].length + @input[2].length + 1 + @input[3].length
    while value = parse_section_pair_newlinevalue(indentation)
      values << value
    end
    { key => values.join("\n") }
  end
end
parse_section_pair_newlinevalue(indentation) click to toggle source
# File lib/whois/scanners/whois.nic.it.rb, line 83
def parse_section_pair_newlinevalue(indentation)
  if @input.scan(/\s{#{indentation}}(.+)\n/)
    @input[1]
  end
end
parse_section_pairs() click to toggle source
# File lib/whois/scanners/whois.nic.it.rb, line 59
def parse_section_pairs
  contents = {}
  while content = parse_section_pair
    contents.merge!(content)
  end
  if !contents.empty?
    contents
  else
    false
  end
end