Module: UnderOs::UI::Commons

Included in:
View
Defined in:
lib/under_os/ui/utils/commons.rb

Instance Method Summary collapse

Instance Method Details

#data(key = nil) ⇒ Object



28
29
30
# File 'lib/under_os/ui/utils/commons.rb', line 28

def data(key=nil)
  key && @_data ? @_data[key.to_sym] : @_data
end

#data=(hash) ⇒ Object



32
33
34
# File 'lib/under_os/ui/utils/commons.rb', line 32

def data=(hash)
  @_data = hash
end

#hiddenObject Also known as: hidden?



60
61
62
# File 'lib/under_os/ui/utils/commons.rb', line 60

def hidden
  @_.isHidden
end

#hideObject



48
49
50
# File 'lib/under_os/ui/utils/commons.rb', line 48

def hide
  style.display = :none
end

#idObject



2
3
4
# File 'lib/under_os/ui/utils/commons.rb', line 2

def id
  @_id
end

#id=(id) ⇒ Object



6
7
8
# File 'lib/under_os/ui/utils/commons.rb', line 6

def id=(id)
  @_id = id
end

#pageObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/under_os/ui/utils/commons.rb', line 36

def page
  resp = @_

  while resp = resp.nextResponder
    if resp.is_a?(UIViewController)
      return resp.wrapper
    end
  end

  nil
end

#showObject



52
53
54
# File 'lib/under_os/ui/utils/commons.rb', line 52

def show
  style.display = :block
end

#tagNameObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/under_os/ui/utils/commons.rb', line 10

def tagName
  @_tag_name ||= begin
    wraps = UnderOs::UI::Wrap::WRAPS_TAGS_MAP
    klass = self.class; tag = 'VIEW'

    while klass
      if wrap = wraps.detect{|t,k| k == klass}
        tag = wrap[0].upcase
        break
      else
        klass = klass.superclass
      end
    end

    tag
  end
end

#toggleObject



56
57
58
# File 'lib/under_os/ui/utils/commons.rb', line 56

def toggle
  hidden ? show : hide
end

#visibleObject Also known as: visible?



64
65
66
# File 'lib/under_os/ui/utils/commons.rb', line 64

def visible
  !hidden
end