Class: Twitter::TwitterText::Validation::ParseResults

Inherits:
Hash
  • Object
show all
Defined in:
lib/twitter-text/validation.rb

Overview

:weighted_length the weighted length of tweet based on weights specified in the config :valid If tweet is valid :permillage permillage of the tweet over the max length specified in config :valid_range_start beginning of valid text :valid_range_end End index of valid part of the tweet text (inclusive) :display_range_start beginning index of display text :display_range_end end index of display text (inclusive)

Constant Summary collapse

RESULT_PARAMS =
[:weighted_length, :valid, :permillage, :valid_range_start, :valid_range_end, :display_range_start, :display_range_end]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ParseResults

Returns a new instance of ParseResults.



29
30
31
32
33
# File 'lib/twitter-text/validation.rb', line 29

def initialize(params = {})
  RESULT_PARAMS.each do |key|
    super[key] = params[key] if params.key?(key)
  end
end

Class Method Details

.emptyObject



25
26
27
# File 'lib/twitter-text/validation.rb', line 25

def self.empty
  return ParseResults.new(weighted_length: 0, permillage: 0, valid: true, display_range_start: 0, display_range_end: 0, valid_range_start: 0, valid_range_end: 0)
end