Class: Raspar::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/raspar/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attrs, domain = nil) ⇒ Result

Returns a new instance of Result.


5
6
7
8
9
# File 'lib/raspar/result.rb', line 5

def initialize(name, attrs, domain = nil)
  @name = name
  @attrs = attrs
  @domain = domain if domain
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object


15
16
17
# File 'lib/raspar/result.rb', line 15

def method_missing(name, *args, &block)
  @attrs[name]
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.


3
4
5
# File 'lib/raspar/result.rb', line 3

def attrs
  @attrs
end

#domainObject (readonly)

Returns the value of attribute domain.


3
4
5
# File 'lib/raspar/result.rb', line 3

def domain
  @domain
end

#nameObject (readonly)

Returns the value of attribute name.


3
4
5
# File 'lib/raspar/result.rb', line 3

def name
  @name
end

Instance Method Details

#[](f) ⇒ Object


11
12
13
# File 'lib/raspar/result.rb', line 11

def [](f)
  @attrs[f]
end