Class: Variable

Inherits:
NodeEntityAbstract show all
Defined in:
app/models/variable.rb

Instance Method Summary collapse

Methods inherited from NodeEntityAbstract

_find, #attributes=, find, #initialize, #node

Constructor Details

This class inherits a constructor from NodeEntityAbstract

Instance Method Details

#downloadable?Boolean

Returns:

  • (Boolean)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/variable.rb', line 44

def downloadable?
  if parent
    return parent.entity.downloadable?
  else
    da = true
    references_tmp.each{|v|
      unless v.downloadable?
        da = false
        break
      end
    }
    return da
  end
end

#fnameObject



23
24
25
26
27
28
29
30
31
# File 'app/models/variable.rb', line 23

def fname
  if node.file
    node.add_prefix(node.file)
  elsif (acs = actual_files).length > 0
    acs.collect{|ac| node.add_prefix(ac.path) }
  else
    raise "[BUG]"
  end
end

#gphysObject



33
34
35
# File 'app/models/variable.rb', line 33

def gphys
  NumRu::GPhys::IO.open(fname, vname)
end

#references_tmpObject



37
38
39
40
41
42
# File 'app/models/variable.rb', line 37

def references_tmp
  unless @new_record
    raise "Cannot #call references_tmp for saved data. Use references instead"
  end
  @references_tmp ||= Array.new
end

#vnameObject



15
16
17
18
19
20
21
# File 'app/models/variable.rb', line 15

def vname
  if vn = node.file
    return node.path.sub(/#{vn}\//,"")
  else
    return name
  end
end