Class: SPSS::Dictionary::Element

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

Direct Known Subclasses

Dictionary, MissingValue, Variable

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Element

Returns a new instance of Element.



26
27
28
29
# File 'lib/spss.rb', line 26

def initialize(config = {})
  @config = config
  @elements = []
end

Instance Method Details

#add(a) ⇒ Object



12
13
14
# File 'lib/spss.rb', line 12

def add(a)
  @elements.push(a)
end

#init_with(config) ⇒ Object



20
21
22
23
24
# File 'lib/spss.rb', line 20

def init_with config
  config.each do |key, value|
      self.send(key.to_s + "=", value) if methods.include? key.to_s
  end
end

#parse_elements(func = :to_s) ⇒ Object



16
17
18
# File 'lib/spss.rb', line 16

def parse_elements(func = :to_s)
  @elements.collect{ |e| "   "+e.send(func) }.join("\n")
end