Class: Variable

Inherits:
NesstarObject show all
Defined in:
lib/nesstar-api/variable.rb

Overview

Represents a variable in a Study.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, eager = false) ⇒ Variable

Returns a new instance of Variable.



9
10
11
12
13
14
15
16
# File 'lib/nesstar-api/variable.rb', line 9

def initialize(data, eager = false)
  @id = data['id']
  @name = data['name']
  @label = data['label']
  if eager
    
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/nesstar-api/variable.rb', line 7

def id
  @id
end

#labelObject (readonly)

Returns the value of attribute label.



7
8
9
# File 'lib/nesstar-api/variable.rb', line 7

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/nesstar-api/variable.rb', line 7

def name
  @name
end

Instance Method Details

#continuous?Boolean

Indicates whether the variable is continuous.

Returns:

  • (Boolean)


26
27
28
# File 'lib/nesstar-api/variable.rb', line 26

def continuous?
  ['intrvl'] == 'continuous'
end

#discrete?Boolean

Indicates whether the variable is discrete.

Returns:

  • (Boolean)


20
21
22
# File 'lib/nesstar-api/variable.rb', line 20

def discrete?
  ['intrvl'] == 'discrete'
end

#get_categoriesObject

Returns a list of categories in this variable



38
39
40
41
42
# File 'lib/nesstar-api/variable.rb', line 38

def get_categories
  ['catgry'].collect do | category |
    Category.new category
  end
end

#weighted?Boolean

Indicates whether this is a weight variable

Returns:

  • (Boolean)


32
33
34
# File 'lib/nesstar-api/variable.rb', line 32

def weighted?
  ['wgt']
end