Sha256: de89fc9eccb4f02b3b66b52ae80439f99bcf7b6f67191c05c5a9261deee3574c

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

class WIN32OLE_VARIABLE
  java_import org.racob.com.VarDesc
  
  attr_reader :name

  def initialize(type, var_desc, name)
    @type, @var_desc, @name = type, var_desc, name
  end

  def ole_type
    @type.ole_type # MRI gets from vardesc, but why shouldn't this work?
  end

  def ole_type_detail
    # TODO: Fill in other details when they actually exist
    [@type.ole_type]
  end

  def value
    RubyWIN32OLE.from_variant(JRuby.runtime, @var_desc.constant)
  end

  def variable_kind
    case varkind
    when VarDesc::VAR_PERINSTANCE then
      "PERINSTANCE"
    when VarDesc::VAR_STATIC then
      "STATIC"
    when VarDesc::VAR_CONST then
      "CONSTANT"
    when VarDesc::VAR_DISPATCH then
      "DISPATCH"
    else
      "UNKNOWN"
    end
  end

  def varkind
    @var_desc.varkind
  end

  def inspect
    "#<WIN32OLE_VARIABLE:#{to_s}=#{value.inspect}>"
  end

  alias :to_s :name

  def visible?
    flags = @var_desc.flags
    flags & (VarDesc::VARFLAG_FHIDDEN | VarDesc::VARFLAG_FRESTRICTED | VarDesc::VARFLAG_FNONBROWSABLE) == 0
  end

  include WIN32OLE::Utils
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jruby-win32ole-0.8.5 lib/win32ole/win32ole_variable.rb
jruby-win32ole-0.8.4 lib/win32ole/win32ole_variable.rb
jruby-win32ole-0.8.3 lib/win32ole/win32ole_variable.rb
jruby-win32ole-0.8.2 lib/win32ole/win32ole_variable.rb
jruby-win32ole-0.8.1 lib/win32ole/win32ole_variable.rb