Class: Vedeu::Interface

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/vedeu/models/interface.rb

Direct Known Subclasses

API::Interface

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Interface

Returns a new instance of Interface.



9
10
11
# File 'lib/vedeu/models/interface.rb', line 9

def initialize(attributes = {})
  @attributes = attributes
end

Instance Method Details

#attributesObject



13
14
15
# File 'lib/vedeu/models/interface.rb', line 13

def attributes
  @_attributes ||= defaults.merge!(@attributes)
end

#colourObject



29
30
31
# File 'lib/vedeu/models/interface.rb', line 29

def colour
  @colour ||= Colour.new(attributes[:colour])
end

#cursorObject



41
42
43
44
45
46
47
48
49
# File 'lib/vedeu/models/interface.rb', line 41

def cursor
  @cursor ||= if cursor?
    Esc.string('show_cursor')

  else
    Esc.string('hide_cursor')

  end
end

#delayObject



51
52
53
# File 'lib/vedeu/models/interface.rb', line 51

def delay
  @delay || attributes[:delay]
end

#geometryObject



37
38
39
# File 'lib/vedeu/models/interface.rb', line 37

def geometry
  @geometry ||= Geometry.new(attributes[:geometry])
end

#groupObject



21
22
23
# File 'lib/vedeu/models/interface.rb', line 21

def group
  @group ||= attributes[:group]
end

#linesObject



25
26
27
# File 'lib/vedeu/models/interface.rb', line 25

def lines
  @lines ||= Attributes.coercer(attributes[:lines], Line, :streams)
end

#nameObject



17
18
19
# File 'lib/vedeu/models/interface.rb', line 17

def name
  @name ||= attributes[:name]
end

#styleObject



33
34
35
# File 'lib/vedeu/models/interface.rb', line 33

def style
  @style ||= Attributes.coerce_styles(attributes[:style])
end

#to_sObject



55
56
57
# File 'lib/vedeu/models/interface.rb', line 55

def to_s
  Render.call(self)
end