Class: Cliptic::Menus::Select_Date

Inherits:
Interface::Menu_With_Stats show all
Defined in:
lib/cliptic/menus.rb

Constant Summary

Constants included from Chars

Chars::Block, Chars::HL, Chars::LL, Chars::LS, Chars::LU, Chars::MS, Chars::Nums, Chars::RL, Chars::RS, Chars::RU, Chars::TD, Chars::TL, Chars::TR, Chars::TU, Chars::Tick, Chars::VL, Chars::XX

Instance Attribute Summary collapse

Attributes inherited from Interface::Menu_With_Stats

#stat_win

Attributes inherited from Interface::Menu

#height, #selector

Attributes inherited from Interface::Menu_Box

#bot_b, #draw_bars, #logo, #top_b

Attributes inherited from Windows::Window

#centered_x, #centered_y, #col, #line, #x, #y

Instance Method Summary collapse

Methods inherited from Interface::Menu_With_Stats

#enter, #hide, #reset_pos, #update_stats

Methods inherited from Interface::Menu

#back, #choose_opt, #enter, #hide, #redraw, #reset_pos, #show

Methods inherited from Interface::Menu_Box

#add_title, #draw, #line, #reset_pos

Methods inherited from Windows::Window

#add_str, #bold, #clear, #color, #draw, #move, #refresh, #reset_attrs, #reset_pos, #setpos, #standend, #standout, #time_str, #wrap_str

Methods included from Chars

small_num

Constructor Details

#initializeSelect_Date

Returns a new instance of Select_Date.



20
21
22
23
24
# File 'lib/cliptic/menus.rb', line 20

def initialize
  @earliest_date = (Date.today << 9) + 1
  set_date(date:Date.today)
  super(height:7, sel:Interface::Date_Selector)
end

Instance Attribute Details

#earliest_dateObject (readonly)

Returns the value of attribute earliest_date.



19
20
21
# File 'lib/cliptic/menus.rb', line 19

def earliest_date
  @earliest_date
end

#optsObject (readonly)

Returns the value of attribute opts.



19
20
21
# File 'lib/cliptic/menus.rb', line 19

def opts
  @opts
end

Instance Method Details

#ctrlsObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cliptic/menus.rb', line 28

def ctrls
  super.merge({
    ?h  => ->{selector.cursor -= 1},
    ?l  => ->{selector.cursor += 1},
    ?j  => ->{inc_date(1)},
    ?k  => ->{inc_date(-1)},
    258 => ->{inc_date(1)},
    259 => ->{inc_date(-1)},
    260 => ->{selector.cursor -= 1},
    261 => ->{selector.cursor += 1}
  })
end

#stat_dateObject



40
41
42
# File 'lib/cliptic/menus.rb', line 40

def stat_date
  Date.new(*@opts.reverse)
end

#titleObject



25
26
27
# File 'lib/cliptic/menus.rb', line 25

def title
  "Select Date"
end