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.



23
24
25
26
# File 'lib/spss.rb', line 23

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



18
19
20
21
22
# File 'lib/spss.rb', line 18

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

#parse_elements(func = :to_s) ⇒ Object



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

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