Class: GHI::Web
- Inherits:
-
Object
- Object
- GHI::Web
- Defined in:
- lib/ghi/web.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
- #curl(path = '', params = {}) ⇒ Object
-
#initialize(base) ⇒ Web
constructor
A new instance of Web.
- #open(path = '', params = {}) ⇒ Object
Constructor Details
#initialize(base) ⇒ Web
Returns a new instance of Web.
10 11 12 |
# File 'lib/ghi/web.rb', line 10 def initialize base @base = base end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9 10 11 |
# File 'lib/ghi/web.rb', line 9 def base @base end |
Instance Method Details
#curl(path = '', params = {}) ⇒ Object
23 24 25 |
# File 'lib/ghi/web.rb', line 23 def curl path = '', params = {} uri_for(path, params).open.read end |
#open(path = '', params = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/ghi/web.rb', line 14 def open path = '', params = {} path = uri_for path, params $stdout.puts path return unless $stdout.tty? launcher = 'open' launcher = 'xdg-open' if /linux/ =~ RUBY_PLATFORM system "#{launcher} '#{path}'" end |